Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147980252
D3216.id7370.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D3216.id7370.diff
View Options
Index: sys/dev/ofw/ofw_cpu.c
===================================================================
--- sys/dev/ofw/ofw_cpu.c
+++ sys/dev/ofw/ofw_cpu.c
@@ -281,6 +281,7 @@
phandle_t node, child;
pcell_t addr_cells, reg[2];
char status[16];
+ char device_type[16];
u_int id;
int count, rv;
@@ -296,7 +297,17 @@
sizeof(addr_cells)) < 0)
return (-1);
- for (child = OF_child(node); child != 0; child = OF_peer(child), id++) {
+ for (child = OF_child(node); child != 0; child = OF_peer(child)) {
+
+ /* Check if child is a CPU */
+ memset(device_type, 0, sizeof(device_type));
+ rv = OF_getprop(child, "device_type", device_type,
+ sizeof(device_type) - 1);
+ if (rv < 0)
+ continue;
+ if (strcmp(device_type, "cpu") != 0)
+ continue;
+
/*
* If we are filtering by runnable then limit to only
* those that have been enabled.
@@ -304,8 +315,9 @@
if (only_runnable) {
status[0] = '\0';
OF_getprop(child, "status", status, sizeof(status));
- if (status[0] != '\0' && strcmp(status, "okay") != 0)
- continue;
+ if (status[0] != '\0' && strcmp(status, "okay") != 0) {
+ goto next;
+ }
}
/*
@@ -314,10 +326,13 @@
rv = OF_getencprop(child, "reg", reg,
addr_cells * sizeof(cell_t));
if (rv != addr_cells * sizeof(cell_t))
- continue;
+ goto next;
if (callback == NULL || callback(id, child, addr_cells, reg))
count++;
+next:
+ /* We processed CPU entry, so increase CPU id number */
+ id++;
}
return (only_runnable ? count : id);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 15, 11:59 PM (13 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29742595
Default Alt Text
D3216.id7370.diff (1 KB)
Attached To
Mode
D3216: Limit ofw_cpu_early_foreach to CPUs only
Attached
Detach File
Event Timeline
Log In to Comment