Skip to content

Commit 7891438

Browse files
committed
update uACPI submodule
1 parent 57eacc5 commit 7891438

File tree

3 files changed

+14
-49
lines changed

3 files changed

+14
-49
lines changed

userspace/drivers/acpi-daemon/main.cpp

Lines changed: 9 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -20,41 +20,12 @@ int main(int argc, const char *argv[])
2020

2121
mem_fd = open("/sys/mem", O_RDWR);
2222

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-
5323
/*
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.
5627
*/
57-
uacpi_status ret = uacpi_initialize(&init_params);
28+
uacpi_status ret = uacpi_initialize(0);
5829
if (uacpi_unlikely_error(ret))
5930
{
6031
std::cerr << "uacpi_initialize error: " << uacpi_status_to_string(ret) << std::endl;
@@ -97,13 +68,7 @@ int main(int argc, const char *argv[])
9768
return -ENODEV;
9869
}
9970

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
10772
{
10873
uacpi_namespace_node_info *info;
10974

@@ -114,14 +79,14 @@ int main(int argc, const char *argv[])
11479
const char *path = uacpi_namespace_node_generate_absolute_path(node);
11580
std::cerr << "unable to retrieve node " << path << ", " << uacpi_status_to_string(ret) << std::endl;
11681
uacpi_free_absolute_path(path);
117-
return UACPI_NS_ITERATION_DECISION_CONTINUE;
82+
return UACPI_ITERATION_DECISION_CONTINUE;
11883
}
11984

12085
if (info->type != UACPI_OBJECT_DEVICE)
12186
{
12287
// We probably don't care about anything but devices at this point
12388
uacpi_free_namespace_node_info(info);
124-
return UACPI_NS_ITERATION_DECISION_CONTINUE;
89+
return UACPI_ITERATION_DECISION_CONTINUE;
12590
}
12691

12792
if (info->flags & UACPI_NS_NODE_INFO_HAS_HID)
@@ -141,10 +106,10 @@ int main(int argc, const char *argv[])
141106

142107
uacpi_free_namespace_node_info(info);
143108

144-
return UACPI_NS_ITERATION_DECISION_CONTINUE;
109+
return UACPI_ITERATION_DECISION_CONTINUE;
145110
};
146111

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);
148113

149114
while (true)
150115
;

userspace/drivers/acpi-daemon/uACPI

Submodule uACPI updated from 2b38e2e to 757dcec

userspace/drivers/acpi-daemon/uacpi_host.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,24 +282,24 @@ uacpi_thread_id uacpi_kernel_get_thread_id(void)
282282
* Try to acquire the mutex with a millisecond timeout.
283283
* A timeout value of 0xFFFF implies infinite wait.
284284
*/
285-
uacpi_bool uacpi_kernel_acquire_mutex(uacpi_handle handle, uacpi_u16 timeout)
285+
uacpi_status uacpi_kernel_acquire_mutex(uacpi_handle handle, uacpi_u16 timeout)
286286
{
287287
auto mutex = reinterpret_cast<std::mutex *>(handle);
288288
if (timeout == 0xFFFF)
289289
{
290290
mutex->lock();
291-
return UACPI_TRUE;
291+
return UACPI_STATUS_OK;
292292
}
293293

294294
auto start = std::chrono::steady_clock::now();
295295
auto end = start + std::chrono::milliseconds(timeout);
296296
while (!mutex->try_lock())
297297
{
298298
if (std::chrono::steady_clock::now() > end)
299-
return UACPI_FALSE;
299+
return UACPI_STATUS_OK;
300300
}
301301

302-
return UACPI_TRUE;
302+
return UACPI_STATUS_OK;
303303
}
304304

305305
void uacpi_kernel_release_mutex(uacpi_handle handle)

0 commit comments

Comments
 (0)