ACPI LAI on aarch64

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
kzinti
Member
Member
Posts: 898
Joined: Mon Feb 02, 2015 7:11 pm

ACPI LAI on aarch64

Post by kzinti »

I am using LAI (https://github.com/managarm/lai) to add ACPI support to my "OS". This works wonderfully under x86_64. Now under aarch64, it appears to work except it is making unexpected calls to laihost_outb() and laihost_inw() which have no mapping in the ARMv8 world.

The firmware is ovmf-aarch64 (UEFI). and I am using "qemu-system-aarch64 -machine virt".

Here is the relevant part of the log:

Code: Select all

Debug  : [ACPI] attempt to enable ACPI...
Error  : [ACPI] laihost_outb() not implemented: 0, 0
Error  : [ACPI] laihost_sleep() not implemented (10 ms)
Error  : [ACPI] laihost_inw() not implemented: 0
Debug  : [ACPI] wrote event register value 0x8300
Debug  : [ACPI] ACPI is now enabled.
This seems to be happening because of the following code in lai_enable_acpi():

Code: Select all

    /* enable ACPI SCI */
    laihost_outb(instance->fadt->smi_command_port, instance->fadt->acpi_enable);
    laihost_sleep(10);

    for (size_t i = 0; i < 100; i++) {
        if (laihost_inw(instance->fadt->pm1a_control_block) & ACPI_ENABLED)
            break;

        laihost_sleep(10);
    }
I believe this code is not necessary on aarch64? The ACPI spec mentions that FADT::SMI_CMD must be zero on system that do not support System Management mode. If I comment out all of the above (and the check for the existence of laihost_inw / laihost_outb), things appear to work correctly.

I can look into submitting a pull request, but was wondering if I am missing something here.
kzinti
Member
Member
Posts: 898
Joined: Mon Feb 02, 2015 7:11 pm

Re: ACPI LAI on aarch64

Post by kzinti »

I am starting to think that I should simply not call lai_enable_acpi() on aarch64... There is nothing in there that seems useful / can work. ACPI is already enabled as far as I can tell and all the fields related to SMI/SCI are zero, including FADT's sci_irq.
User avatar
qookie
Member
Member
Posts: 72
Joined: Sun Apr 30, 2017 12:16 pm
Libera.chat IRC: qookie
Location: Poland

Re: ACPI LAI on aarch64

Post by qookie »

Checking the SMI/SCI fields and only enabling it if they're not zero seems like the correct fix to me. Although lai_enable_acpi may still be useful since it invokes all the _INI methods.

EDIT: Now I wonder, how does ACPI report power button events and such if SCI is unsupported?
Working on managarm.
kzinti
Member
Member
Posts: 898
Joined: Mon Feb 02, 2015 7:11 pm

Re: ACPI LAI on aarch64

Post by kzinti »

My expectation was to find a SCI interrupt number in the FADT table, but I see a zero. This might not be true of other/real aarch64 devices.
kzinti
Member
Member
Posts: 898
Joined: Mon Feb 02, 2015 7:11 pm

Re: ACPI LAI on aarch64

Post by kzinti »

I created a pull request to address this: https://github.com/managarm/lai/pull/132
Post Reply