Repository navigation
Releases
Releases · uACPI/uACPI
Release 7.0.0
Changes since 6.1.1
This is a pretty huge release, fixing many critical bugs and addressing important compatibility gaps vs NT's AML driver.
This also makes the kernel API surface much simpler, by collapsing multiple blocking primitives into one. It should also now be much simpler to service uACPI IRQs in a hard-IRQ context, since the most important issue, namely uacpi_kernel_schedule_work, now operates on pre-allocated work items, that means the kernel no longer has to allocate in an IRQ handler or have a fixed size pool of work items. Many of the APIs may now be called form within an IRQ or deferred work handler, and the documentation is now much cleaner in that regard.
See the exact list of changes below:
Non-backwards-compatible changes
- The mutex & event kernel API has been replaced by a single counting semaphore:
uacpi_kernel_{create,free}_semaphore,uacpi_kernel_wait_for_semaphoreanduacpi_kernel_signal_semaphore. This removesuacpi_kernel_{create,free,acquire,release}_mutexas well asuacpi_kernel_{create,free,wait_for,signal,reset}_event. - Deferred work is now scheduled via pre-allocated work items: added
uacpi_kernel_{create,free}_work_item, anduacpi_kernel_schedule_worknow takes a work item and no longer returns a status. This means the kernel no longer has to allocate from an interrupt context or carry a fixed work item pool. As a consequence of that, a GPE can no longer get stuck disabled because its work could not be scheduled. - Fixed a typo in
UACPI_TABLE_INSTALLATION_DISPOSITON_*->UACPI_TABLE_INSTALLATION_DISPOSITION_* - The
shareable.cfile has been removed as its code now lives in a header uacpi_uninstall_address_space_handlernow takes the handler to uninstall, and fails withUACPI_STATUS_INVALID_ARGUMENTif a different one is installed- A raw GPE handler is no longer invoked when its event is polled (e.g. by
uacpi_enable_gpe), only for an actual interrupt. Whoever installs one is expected to poll the event viauacpi_gpe_infoafter enabling it uacpi_enable_gpeonly polls an edge-triggered event when it gets its first user, so enabling an already enabled event no longer dispatches it from the caller's context
NT Compatibility Improvements
- Strings & Buffers stored to a smaller field are now written in field-sized chunks instead of being truncated
Buffer (0) {}andCreateFieldwith a length of 0 are now allowed, empty fields are never accessed- A
PCI_Configregion of a PCI root without an_ADRis no longer assumed to belong to 00:00.0 - Stores and
CopyObjectto a field unit or a buffer field now write to the field instead of replacing it, including via an ArgX reference - Fixed
Index()references not working when passed via an ArgX or stored to a LocalX - Stores via an ArgX reference to a Device, Event, Method, Mutex, OperationRegion, PowerResource, Processor or ThermalZone are now rejected instead of overwriting the object
- A name that holds a reference (e.g. via
CopyObject (RefOf (X), N)) is now treated as an alias of the referenced object - Certain IO ports and PCI configuration space fields are now protected from being accessed or written by AML
General Improvements
- A PCI device that
uacpi_kernel_pci_device_openreported as not found is now looked up again on the next access instead of being treated as missing forever, to support hotplug & wake from suspend - All reference-counting helpers are now inlined, which drastically improves non-LTO code generation
- Notify handlers may now call back into uACPI (evaluate AML, install other handlers) even if the kernel executes deferred work synchronously
uacpi_finalize_gpe_initializationmay now be called again to enable the events of a GPE block that was installed at runtimeuacpi_disable_gpe,uacpi_clear_gpe,uacpi_suspend_gpe,uacpi_resume_gpe,uacpi_finish_handling_gpe,uacpi_enable_gpe_for_wake,uacpi_disable_gpe_for_wakeanduacpi_gpe_infomay now be called from an interrupt context, including from the handler itself- The same goes for
uacpi_enable_fixed_event,uacpi_disable_fixed_event,uacpi_clear_fixed_eventanduacpi_fixed_event_info _REGdisconnect is now executed while the region still has its handler_REGis now executed for an embedded controller that has noEmbeddedControlregions, as well as for a GPIO controller that has noGeneralPurposeIoregions (only if the handler is installed to the controller itself)
Bug Fixes
PCI_Configregions are now attached to the correct PCI device if they live behind a PCI-to-PCI bridge (e.g. PCIe downstream ports)- MSVC: the firmware global lock was never actually acquired because of swapped compare-exchange arguments
- Fixed
uacpi_release_global_lockalways failing withUACPI_STATUS_INVALID_ARGUMENT - Fixed deadlocks in
uacpi_{un,}install_notify_handler,uacpi_mask_gpe,uacpi_{un,}install_gpe_handler,uacpi_setup_gpe_for_wake,uacpi_uninstall_gpe_blockanduacpi_uninstall_fixed_event_handlerif a GPE or notify handler that needed the same lock was in flight - Fixed
uacpi_install_notify_handlerleaving the notify mutex locked on allocation failure, which made every subsequentNotify()hang - Fixed a GPE being dispatched twice, possibly by two CPUs at once, if it was polled and raised an interrupt at the same time, polling also no longer dispatches events that are masked or disabled
- Fixed use-after-free of a GPE that was reconfigured, or whose block was uninstalled, while its work was still in flight
- Fixed use-after-free of the GPE interrupt context after
uacpi_uninstall_gpe_block - Fixed
uacpi_state_resettearing down the namespace with deferred work still in flight - Fixed an off-by-one in the GPE index bounds check that allowed access past the end of a GPE block
- Fixed
uacpi_disable_gpe_for_wakeleaving the event enabled for wake and disabling its neighbors instead - Fixed a GPE mask set via
uacpi_mask_gpebeing silently dropped after a handler was (un)installed or the event was set up for wake - Fixed a masked GPE staying disabled after being unmasked if the runtime events were re-enabled in the meantime, e.g. on wake from sleep
- Fixed the RTC fixed event never being dispatched
- Fixed the events of a GPE block installed for the SCI never being dispatched on systems where the FADT doesn't describe any GPE blocks
- Fixed already pending FADT GPEs not being dispatched during initialization if a GPE block with an interrupt of its own was installed first
- Clearing a fixed event no longer acknowledges every other event pending in the same register, e.g. a power button press could swallow an RTC alarm
- The power & sleep buttons are now cleared and re-enabled on wake
- GPE blocks & handlers are now published to the interrupt handler in a way that is safe on weakly ordered CPUs
- Fixed a memory leak of the implicit notify list of a GPE that was freed with a native handler installed
- Fixed use-after-free if an object was overwritten via
CopyObjectwhile in use by another thread or its own handler _REGdisconnect is now executed for every address space handler that is uninstalled, and only for the regions that it was actually serving- An address space handler now always gets a detach for a region that it has attached, even if the region or the handler was gone by the time the attach completed
- Stores that would create a reference cycle through a package or a local are now rejected with the new
UACPI_STATUS_AML_REFERENCE_CYCLEinstead of leaking the objects or hanging the interpreter - Fixed a raw GPE handler being invoked by a poll and by the interrupt handler at the same time
- Fixed a GPE handler being replaced, or an event being set up for wake or masked, even though the event couldn't be disabled first. These now fail and leave the event as it was
- Fixed a GPE staying disabled for good if its native handler was uninstalled before it was done handling the event, or if the status of the event couldn't be cleared
- Fixed a level-triggered GPE never being cleared if its handler was replaced by an edge-triggered one while it was being handled
- Fixed
uacpi_mask_gpereporting an event as unmasked even though it couldn't be enabled, which left it disabled with no way to retry - Fixed use-after-free of the implicit notify list of a GPE that got an AML handler while its work was in flight
- Fixed
uacpi_uninstall_gpe_handlerleaving the previous AML handler with nothing to keep its event enabled if the event was enabled the maximum number of times. It now fails and leaves the handler installed - Fixed
uacpi_setup_gpe_for_wakereporting success if the wake device couldn't be kept track of - Fixed
uacpi_setup_gpe_for_wakedisabling an event that was enabled by somebody else if it was called more than once for the same event - Fixed
uacpi_install_gpe_blockaccepting a block with no registers, or with more events than a 16-bit index is able to address - Fixed a deadlock in
uacpi_uninstall_gpe_blockif the kernel waits for in-flight interrupts when uninstalling an interrupt handler - Fixed use-after-free of an address space handler that was uninstalled from a detach callback, be it its own or that of a handler it was replacing
- Fixed a region being attached twice, and only detached once, if its handler accessed it while attaching it
- Fixed
_REGconnect being executed for a region that has no handler - Fixed an "internal error" being logged for a region with no handler when an address space handler is uninstalled
- Fixed a reference cycle being created by
_REGof a region that is being overwritten, which the cycle check didn't see - Fixed PCC commands never being sent because the command field was expected at the wrong offset. Note that a PCC region doesn't cover the signature of the shared memory region, so the handler is expected t...
Release 6.1.1
Changes since 6.1.0
Improvements
- The interpreter now takes an optimized path when parsing
ZeroOptargets - Compiling with
-Wformat-signednessis now supported
Bug Fixes
- Duplicate fields are now skipped with a warning instead of aborting the whole table load operation
- Fixed duplicate field unit namespace nodes being installed if they both occurred in the same
FieldOp - Fixed a memory leak during assignment to objects like operation regions, buffer fields/indices etc.
- Fixed a memory leak after a failed deep copy in
CopyObject() - Fixed a memory leak when calling an AML method with an incorrect number of arguments
Installation & usage instructions can be found in the README and osdev wiki
Release 6.1.0
Changes since 6.0.1
Bug Fixes
- Fixed a NULL dereference that would occur with firmware that creates duplicate named objects inside a method (reported & fixed by @DarkFire01)
- The builtin string formatter now honors the '-' and pad char for %s
Features
- Added HMAT table & related structures (by @My-Bad-2)
Installation & usage instructions can be found in the README and osdev wiki
Release 6.0.1
Changes since 6.0.0
Bug Fixes
- The global firmware lock (
\_GL) is now held across an entire field transaction instead of per hardware access, previously firmware (e.g. SMM) could observe torn multi-datum accesses & read-modify-writes ofLockfields - IndexField/BankField selection+data sequences are now atomic with respect to other threads, previously a concurrent access could clobber the selection register mid-sequence, redirecting IO to the wrong register
- Out-of-range index/bank selection values are now rejected instead of silently truncated
- Fixed a false-positive GCC LTO warning about freeing predefined namespace nodes
- Fixed a latent signed overflow when parsing the smallest possible 64-bit integer
- Fixed a bare
NULLusage breaking builds with a custom types header (now enforced in CI) - Fixed a potential response buffer leak for write-then-read accesses with no response pointer
Misc
- Field IO no longer releases & reacquires the namespace lock around every hardware access
- Added a test case for index & bank fields
Installation & usage instructions can be found in the README and osdev wiki
Release 6.0.0
Changes since 5.0.0
Non-backwards-compatible changes
- acpi.h is no longer included directly by any headers to reduce pollution
Features
- AML backtraces are now a lot more detailed and include the offset, size, as well as the opcode, e.g.
#0 in \CAS4()+372/775 at StoreOp
Bug Fixes
- Added missing assignment & copy implementation for PowerResource objects
- Fixed a NULL dereference that would occur under very specific conditions in deeply nested AML callstacks
- Fixed a few memory leaks in the interpreter that would get triggered on OOM return paths
- Fixed a potential NULL dereference on OOM when creating a package
- ToIntegerOp now respects the DSDT bitness
Misc
- A bunch of internal refactoring to make the general interpreter loop & backtraces a bit cleaner
Installation & usage instructions can be found in the README and osdev wiki
Release 5.0.0
Changes since 4.0.0
Non-backwards-compatible changes
- For
uacpi_kernel_map,NULLis now considered a valid return value to allow hosts that identity map all physical memory. Failure is now indicated by returningUACPI_MAP_FAILED. uacpi_eval_{simple_}buffer_or_stringhas been renamed touacpi_eval_{simple_}string_or_bufferto be consistent with all otherstring_or_bufferAPIuacpi_kernel_vlogis no longer a part of the kernel API. It was never used by uACPI so it is now removed.
Features
- New table API:
uacpi_table_{ref,unref}_by_index: allows manipulating a table's refcount without keeping auacpi_tablehandleuacpi_table_count: returns the number of tables uACPI currently managesuacpi_table_get_by_index: allows retrieving a table by its index in the internal arrayuacpi_table_info_get_by_index,uacpi_for_each_table: low level helpers that allow inspecting the entire internal state that uACPI keeps about a table. This includes: index, origin, refcount, signature, address, mapping address, flags, etc.uacpi_table_find_by_signature_at: find a table by signature starting at an offset in the internal arrayuacpi_table_find_nth_by_signature: find an nth instance of a table in firmware enumeration order
- New config option:
UACPI_NATIVE_MMIO. If enabled, this option strips the builtin (naive) uACPI MMIO helpers, and instead requires the host to provide them as part of the kernel API. These helpers are used by uACPI for serving MMIO read/write requests from AML, as well as a few places in the library code. - Added a way to modify the uACPI log messages via
UACPI_{START,END}_OF_LOG_MSGoptions. These are applied to every log message uACPI outputs and can optionally specify a prefix, as well as suffix for each message. By default,UACPI_END_OF_LOG_MSGis set to\nfor backward compatibility - New tables: WAET, DMAR, SCPR, and DBG2 (by @ThatMishakov )
- Added
uacpi_enter_sleep_state_simple, a helper that combines both preparation & the actual sleep state entering into one function for convenience
Bug Fixes
uacpi_table_fadtnow correctly returnsUACPI_STAUTS_NOT_FOUNDif the firmware hasn't provided one, previously it would return a fully zeroed table- Added a missing
uacpi_va_endfor the internal logger - Fixed an accidental usage of
NULLinstead ofUACPI_NULLin default_handlers.c - A bunch of typo fixes
Installation & usage instructions can be found in the README and osdev wiki
Release 4.0.0
Changes since 3.2.0
Non-backwards-compatible changes
- Added new kernel api
uacpi_kernel_{disable,restore}_interrupts, used for more precise control over when interrupts are disabled by uACPI - uACPI is now able to automatically handle AML accesses to PCI devices that don't exist on the system. This behavior is invoked by returning
UACPI_STATUS_NOT_FOUNDfromuacpi_kernel_pci_device_open, previously this would be treated as a hard error
General changes
- Added a new
uacpi_is_platform_reduced_hardwarehelper, which is used to detect whether the current platform is hardware-reduced ACPI - Added a new
uacpi_table_subsystem_availablehelper, which can be used to detect whether the early API in table.h is currently usable - Added support for automatic handling of misaligned early table buffers
- Fixed a bug that caused a sleeping mutex to be grabbed during shutdown with interrupts disabled
- Fixed a bunch of event.h API that didn't properly check against reduced hardware which would produce a bogus error status
- Added support for pkg-config file generation via meson (by @no92)
Installation & usage instructions can be found in the README and osdev wiki
Release 3.2.0
Changes since 3.1.0
- Added definitions for DBG2 and SPCR tables (by @avdgrinten)
- uACPI is now buildable with -Wshadow
- DerefOf now correctly reads field references instead of returning a plain field object
Installation & usage instructions can be found in the README and osdev wiki
Release 3.1.0
Changes since 3.0.0
- Added new _PIC values from the ACPI specification 6.6
- New
uacpi_for_each_subtableAPI for iterating subtables of structures like MADT or SRAT - Tables smaller than the SDT header no longer cause uACPI initialization to fail
- Older GCC compilers that don't have
__has_attributeare now supported by the default platform headers - Expanded the comment about
UACPI_ITERATION_DECISION_NEXT_PEER - Internal cleanups of Load/LoadTable AML opcodes
Installation & usage instructions can be found in the README and osdev wiki
Release 3.0.0
Changes since 2.1.1
- Added support for the OpenWatcom compiler (including a full rewrite of the test-runner in C) by @monkuous
- UACPI_STATIC_ASSERT is now part of compiler.h
- Added a whole bunch of new API documentation
- Fixed a typo in a resource macro (
UACPI_POISITIVE_DECODE->UACPI_POSITIVE_DECODE) - Renamed a field in
uacpi_resource_gpio_connection(interrupt->intr) because OpenWatcom reserves theinterruptkeyword - Fixed a bug where the RSDP length field would be used even for revisions < 2 when dumping it