Lines 285-296
chrp_real_maxaddr(platform_t plat)
Link Here
|
285 |
static u_long |
285 |
static u_long |
286 |
chrp_timebase_freq(platform_t plat, struct cpuref *cpuref) |
286 |
chrp_timebase_freq(platform_t plat, struct cpuref *cpuref) |
287 |
{ |
287 |
{ |
288 |
phandle_t phandle; |
288 |
char buf[8]; |
|
|
289 |
phandle_t cpu, dev, root; |
290 |
int res; |
289 |
int32_t ticks = -1; |
291 |
int32_t ticks = -1; |
290 |
|
292 |
|
291 |
phandle = cpuref->cr_hwref; |
293 |
root = OF_peer(0); |
|
|
294 |
dev = OF_child(root); |
295 |
while (dev != 0) { |
296 |
res = OF_getprop(dev, "name", buf, sizeof(buf)); |
297 |
if (res > 0 && strcmp(buf, "cpus") == 0) |
298 |
break; |
299 |
dev = OF_peer(dev); |
300 |
} |
301 |
|
302 |
for (cpu = OF_child(dev); cpu != 0; cpu = OF_peer(cpu)) { |
303 |
res = OF_getprop(cpu, "device_type", buf, sizeof(buf)); |
304 |
if (res > 0 && strcmp(buf, "cpu") == 0) |
305 |
break; |
306 |
} |
307 |
if (cpu == 0) |
308 |
return (512000000); |
292 |
|
309 |
|
293 |
OF_getencprop(phandle, "timebase-frequency", &ticks, sizeof(ticks)); |
310 |
OF_getencprop(cpu, "timebase-frequency", &ticks, sizeof(ticks)); |
294 |
|
311 |
|
295 |
if (ticks <= 0) |
312 |
if (ticks <= 0) |
296 |
panic("Unable to determine timebase frequency!"); |
313 |
panic("Unable to determine timebase frequency!"); |
297 |
- |
|
|