@@ -20,41 +20,12 @@ int main(int argc, const char *argv[])
20
20
21
21
mem_fd = open (" /sys/mem" , O_RDWR);
22
22
23
- uacpi_phys_addr rsdp_phys_addr = MOS_FOURCC (' R' , ' S' , ' D' , ' P' );
24
-
25
- /*
26
- * Set up the initialization parameters structure that configures uACPI
27
- * behavior both at bring up and during runtime.
28
- */
29
- uacpi_init_params init_params = {
30
- /*
31
- * Physical address of the RSDP structure that we have either found
32
- * ourselves manually by scanning memory or (ideally) provided to us by
33
- * the bootloader.
34
- */
35
- .rsdp = rsdp_phys_addr,
36
-
37
- /*
38
- * Set the log level to TRACE, this is a bit verbose but perhaps
39
- * okay for now since we're just getting started. We can change this
40
- * to INFO later on, which is the recommended level for release
41
- * builds. There's also the loudest UACPI_LOG_DEBUG log level, which
42
- * is recommended to pin down lockups or hangs.
43
- */
44
- .log_level = UACPI_LOG_TRACE,
45
-
46
- /*
47
- * Don't set any behavior flags, the defaults should work on most
48
- * hardware.
49
- */
50
- .flags = 0 ,
51
- };
52
-
53
23
/*
54
- * Proceed to the first step of the initialization. This loads all tables,
55
- * brings the event subsystem online, and enters ACPI mode.
24
+ * Start with this as the first step of the initialization. This loads all
25
+ * tables, brings the event subsystem online, and enters ACPI mode. We pass
26
+ * in 0 as the flags as we don't want to override any default behavior for now.
56
27
*/
57
- uacpi_status ret = uacpi_initialize (&init_params );
28
+ uacpi_status ret = uacpi_initialize (0 );
58
29
if (uacpi_unlikely_error (ret))
59
30
{
60
31
std::cerr << " uacpi_initialize error: " << uacpi_status_to_string (ret) << std::endl;
@@ -97,13 +68,7 @@ int main(int argc, const char *argv[])
97
68
return -ENODEV;
98
69
}
99
70
100
- /*
101
- * That's it, uACPI is now fully initialized and working! You can proceed to
102
- * using any public API at your discretion. The next recommended step is namespace
103
- * enumeration and device discovery so you can bind drivers to ACPI objects.
104
- */
105
-
106
- const auto acpi_init_one_device = [](void *user, uacpi_namespace_node *node) -> uacpi_ns_iteration_decision
71
+ const auto acpi_init_one_device = [](void *user, uacpi_namespace_node *node, uacpi_u32 node_depth) -> uacpi_iteration_decision
107
72
{
108
73
uacpi_namespace_node_info *info;
109
74
@@ -114,14 +79,14 @@ int main(int argc, const char *argv[])
114
79
const char *path = uacpi_namespace_node_generate_absolute_path (node);
115
80
std::cerr << " unable to retrieve node " << path << " , " << uacpi_status_to_string (ret) << std::endl;
116
81
uacpi_free_absolute_path (path);
117
- return UACPI_NS_ITERATION_DECISION_CONTINUE ;
82
+ return UACPI_ITERATION_DECISION_CONTINUE ;
118
83
}
119
84
120
85
if (info->type != UACPI_OBJECT_DEVICE)
121
86
{
122
87
// We probably don't care about anything but devices at this point
123
88
uacpi_free_namespace_node_info (info);
124
- return UACPI_NS_ITERATION_DECISION_CONTINUE ;
89
+ return UACPI_ITERATION_DECISION_CONTINUE ;
125
90
}
126
91
127
92
if (info->flags & UACPI_NS_NODE_INFO_HAS_HID)
@@ -141,10 +106,10 @@ int main(int argc, const char *argv[])
141
106
142
107
uacpi_free_namespace_node_info (info);
143
108
144
- return UACPI_NS_ITERATION_DECISION_CONTINUE ;
109
+ return UACPI_ITERATION_DECISION_CONTINUE ;
145
110
};
146
111
147
- uacpi_namespace_for_each_node_depth_first (uacpi_namespace_root (), acpi_init_one_device, UACPI_NULL);
112
+ uacpi_namespace_for_each_child (uacpi_namespace_root (), acpi_init_one_device, UACPI_NULL, UACPI_OBJECT_DEVICE_BIT, UACPI_MAX_DEPTH_ANY , UACPI_NULL);
148
113
149
114
while (true )
150
115
;
0 commit comments