Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152956947
D15174.id41777.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D15174.id41777.diff
View Options
Index: sys/powerpc/pseries/platform_chrp.c
===================================================================
--- sys/powerpc/pseries/platform_chrp.c
+++ sys/powerpc/pseries/platform_chrp.c
@@ -355,7 +355,8 @@
{
phandle_t cpu, dev;
char buf[32];
- int a, res;
+ int a, res, res2;
+ uint32_t reg, addr_cells, size_cells;
cell_t interrupt_servers[32];
uint64_t bsp;
@@ -371,20 +372,34 @@
dev = OF_peer(dev);
}
+ res = OF_getproplen(dev, "#address-cells");
+ res2 = OF_getproplen(dev, "#size-cells");
+ if (res != res2 || res != sizeof(uint32_t))
+ panic("CPU properties #address-cells and #size-cells not found on Open Firmware\n");
+ OF_getencprop(dev, "#address-cells", &addr_cells, sizeof(addr_cells));
+ OF_getencprop(dev, "#size-cells", &size_cells, sizeof(size_cells));
+ if (addr_cells != 1 || size_cells != 0)
+ panic("Unexpected values for CPU properties #address-cells and #size-cells on Open Firmware\n");
+
bsp = 0;
for (cpu = OF_child(dev); cpu != 0; cpu = OF_peer(cpu)) {
res = OF_getprop(cpu, "device_type", buf, sizeof(buf));
if (res > 0 && strcmp(buf, "cpu") == 0) {
res = OF_getproplen(cpu, "ibm,ppc-interrupt-server#s");
if (res > 0) {
-
-
OF_getencprop(cpu, "ibm,ppc-interrupt-server#s",
interrupt_servers, res);
+ res2 = OF_getproplen(cpu, "reg");
+ if (res2 != sizeof(uint32_t))
+ panic("Unexpected length for CPU property reg on Open Firmware\n");
+ OF_getencprop(cpu, "reg", ®, res2);
+ if (reg + res/sizeof(cell_t) > MAXCPU)
+ panic("Invalid CPU ID found on Open Firmware\n");
+
for (a = 0; a < res/sizeof(cell_t); a++) {
- platform_cpuref[platform_cpuref_cnt].cr_hwref = interrupt_servers[a];
- platform_cpuref[platform_cpuref_cnt].cr_cpuid = platform_cpuref_cnt;
+ platform_cpuref[reg + a].cr_hwref = interrupt_servers[a];
+ platform_cpuref[reg + a].cr_cpuid = reg + a;
platform_cpuref_cnt++;
}
@@ -392,6 +407,10 @@
}
}
+ for (a = 0; a < platform_cpuref_cnt; a++)
+ if (platform_cpuref[a].cr_cpuid != a)
+ panic("Invalid CPU ID found on Open Firmware\n");
+
platform_cpuref_valid = 1;
return (0);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 19, 7:53 AM (3 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31754718
Default Alt Text
D15174.id41777.diff (2 KB)
Attached To
Mode
D15174: Fix wrong cpu0 identification
Attached
Detach File
Event Timeline
Log In to Comment