|
22 | 22 | #include <linux/irq_work.h>
|
23 | 23 | #include <linux/memblock.h>
|
24 | 24 | #include <linux/of_fdt.h>
|
| 25 | +#include <linux/libfdt.h> |
25 | 26 | #include <linux/smp.h>
|
26 | 27 | #include <linux/serial_core.h>
|
27 | 28 | #include <linux/pgtable.h>
|
@@ -62,29 +63,22 @@ static int __init parse_acpi(char *arg)
|
62 | 63 | }
|
63 | 64 | early_param("acpi", parse_acpi);
|
64 | 65 |
|
65 |
| -static int __init dt_scan_depth1_nodes(unsigned long node, |
66 |
| - const char *uname, int depth, |
67 |
| - void *data) |
| 66 | +static bool __init dt_is_stub(void) |
68 | 67 | {
|
69 |
| - /* |
70 |
| - * Ignore anything not directly under the root node; we'll |
71 |
| - * catch its parent instead. |
72 |
| - */ |
73 |
| - if (depth != 1) |
74 |
| - return 0; |
| 68 | + int node; |
75 | 69 |
|
76 |
| - if (strcmp(uname, "chosen") == 0) |
77 |
| - return 0; |
| 70 | + fdt_for_each_subnode(node, initial_boot_params, 0) { |
| 71 | + const char *name = fdt_get_name(initial_boot_params, node, NULL); |
| 72 | + if (strcmp(name, "chosen") == 0) |
| 73 | + continue; |
| 74 | + if (strcmp(name, "hypervisor") == 0 && |
| 75 | + of_flat_dt_is_compatible(node, "xen,xen")) |
| 76 | + continue; |
78 | 77 |
|
79 |
| - if (strcmp(uname, "hypervisor") == 0 && |
80 |
| - of_flat_dt_is_compatible(node, "xen,xen")) |
81 |
| - return 0; |
| 78 | + return false; |
| 79 | + } |
82 | 80 |
|
83 |
| - /* |
84 |
| - * This node at depth 1 is neither a chosen node nor a xen node, |
85 |
| - * which we do not expect. |
86 |
| - */ |
87 |
| - return 1; |
| 81 | + return true; |
88 | 82 | }
|
89 | 83 |
|
90 | 84 | /*
|
@@ -205,8 +199,7 @@ void __init acpi_boot_table_init(void)
|
205 | 199 | * and ACPI has not been [force] enabled (acpi=on|force)
|
206 | 200 | */
|
207 | 201 | if (param_acpi_off ||
|
208 |
| - (!param_acpi_on && !param_acpi_force && |
209 |
| - of_scan_flat_dt(dt_scan_depth1_nodes, NULL))) |
| 202 | + (!param_acpi_on && !param_acpi_force && !dt_is_stub())) |
210 | 203 | goto done;
|
211 | 204 |
|
212 | 205 | /*
|
|
0 commit comments