Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread safety p.3 #101

Merged
merged 9 commits into from
Dec 19, 2024
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ A portable and easy-to-integrate implementation of the Advanced Configuration an
> [!WARNING]
> Not yet ready for production use! While the project is mostly feature-complete,
> it is still under active development. Public API may change, get added or
> removed without notice. Thread safety is currently lacking, see
> [#74](/../../issues/74) for more info & progress.
> removed without notice.

## Features

Expand All @@ -27,6 +26,7 @@ A portable and easy-to-integrate implementation of the Advanced Configuration an
- Client-defined Notify() handlers
- Firmware global lock management (_GL, locked fields, public API)
- GAS read/write API
- Fully thread safe

## Why would I use this over ACPICA?

Expand Down
3 changes: 1 addition & 2 deletions include/uacpi/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ uacpi_status uacpi_install_gpe_handler(
* NOTE: 'gpe_device' may be null for GPEs managed by \_GPE
*/
UACPI_ALWAYS_ERROR_FOR_REDUCED_HARDWARE(
uacpi_status uacpi_install_gpe_handler_raw(
uacpi_status uacpi_install_gpe_handler_raw(
uacpi_namespace_node *gpe_device, uacpi_u16 idx,
uacpi_gpe_triggering triggering, uacpi_gpe_handler handler, uacpi_handle ctx
))
Expand Down Expand Up @@ -151,7 +151,6 @@ uacpi_status uacpi_disable_gpe_for_wake(
uacpi_namespace_node *gpe_device, uacpi_u16 idx
))


/*
* Finalize GPE initialization by enabling all GPEs not configured for wake and
* having a matching AML handler detected.
Expand Down
8 changes: 6 additions & 2 deletions include/uacpi/internal/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@
// This fixed event is internal-only, and we don't expose it in the enum
#define UACPI_FIXED_EVENT_GLOBAL_LOCK 0

UACPI_ALWAYS_OK_FOR_REDUCED_HARDWARE(
uacpi_status uacpi_initialize_events_early(void)
)

UACPI_ALWAYS_OK_FOR_REDUCED_HARDWARE(
uacpi_status uacpi_initialize_events(void)
)
UACPI_STUB_IF_REDUCED_HARDWARE(
void uacpi_deinitialize_events(void)
)

UACPI_ALWAYS_OK_FOR_REDUCED_HARDWARE(
uacpi_status uacpi_events_match_post_dynamic_table_load(void)
UACPI_STUB_IF_REDUCED_HARDWARE(
void uacpi_events_match_post_dynamic_table_load(void)
)

UACPI_ALWAYS_ERROR_FOR_REDUCED_HARDWARE(
Expand Down
8 changes: 4 additions & 4 deletions include/uacpi/internal/namespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ uacpi_bool uacpi_namespace_node_is_dangling(uacpi_namespace_node *node);
uacpi_bool uacpi_namespace_node_is_temporary(uacpi_namespace_node *node);
uacpi_bool uacpi_namespace_node_is_predefined(uacpi_namespace_node *node);

uacpi_status uacpi_namespace_read_lock();
uacpi_status uacpi_namespace_read_unlock();
uacpi_status uacpi_namespace_read_lock(void);
uacpi_status uacpi_namespace_read_unlock(void);

uacpi_status uacpi_namespace_write_lock();
uacpi_status uacpi_namespace_write_unlock();
uacpi_status uacpi_namespace_write_lock(void);
uacpi_status uacpi_namespace_write_unlock(void);
3 changes: 3 additions & 0 deletions include/uacpi/internal/registers.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

#include <uacpi/types.h>

uacpi_status uacpi_ininitialize_registers(void);
void uacpi_deininitialize_registers(void);

enum uacpi_register {
UACPI_REGISTER_PM1_STS = 0,
UACPI_REGISTER_PM1_EN,
Expand Down
6 changes: 5 additions & 1 deletion include/uacpi/kernel_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,11 @@ uacpi_status uacpi_kernel_schedule_work(
);

/*
* Blocks until all scheduled work is complete and the work queue becomes empty.
* Waits for two types of work to finish:
* 1. All in-flight interrupts installed via uacpi_kernel_install_interrupt_handler
* 2. All work scheduled via uacpi_kernel_schedule_work
*
* Note that the waits must be done in this order specifically.
*/
uacpi_status uacpi_kernel_wait_for_work_completion(void);

Expand Down
Loading
Loading