While working with real DSDT and comparing reads/writes to what ACPICA does, I found out there are several issues with how reads/writes to regions are done:
[ ] Incorrect calculation of final access addresses/IO ports: typically, ***_region does let address = (region_base + offset), which is incorrect, because we're trying to add bytes (region_base) to bits (offset) here, which yields incorrect addresses
[ ] Not sure if this is intended behavior, but when the address isssue is fixed, the functions allow misaligned access to memory/IO, e.g. trying to read_u32(0xdaf9dfe5)
I caught these issues while running AML of ThinkPad T430 DSDT, specifically, it has the following code (excerpt):
This code seems to be intended to generate a SMI for some graphics card management stuff, but when testing, it actually got stuck waiting for ERR to become != 0x01.
When comparing addresses of reads/writes generated by the acpi crate and what ACPICA does, I found out:
ACPICA only does byte accesses there, so misalignment is not a problem (and the region's AnyAcc allows this)
ACPICA accesses addresses 0xdaf9dfd8..0xdaf9dfe9, while the acpi crate accesses 0xdafa4e18..0xdafa4ea0
While working with real DSDT and comparing reads/writes to what ACPICA does, I found out there are several issues with how reads/writes to regions are done:
let address = (region_base + offset)
, which is incorrect, because we're trying to add bytes (region_base
) to bits (offset
) here, which yields incorrect addressesI caught these issues while running AML of ThinkPad T430 DSDT, specifically, it has the following code (excerpt):
This code seems to be intended to generate a SMI for some graphics card management stuff, but when testing, it actually got stuck waiting for ERR to become != 0x01.
When comparing addresses of reads/writes generated by the
acpi
crate and what ACPICA does, I found out:0xdaf9dfd8..0xdaf9dfe9
, while theacpi
crate accesses0xdafa4e18..0xdafa4ea0