OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 2:12 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: ACPI LAI on aarch64
PostPosted: Wed Nov 02, 2022 1:08 am 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 898
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:
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:
    /* 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.

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: ACPI LAI on aarch64
PostPosted: Wed Nov 02, 2022 1:09 am 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 898
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.

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: ACPI LAI on aarch64
PostPosted: Wed Nov 02, 2022 12:53 pm 
Offline
Member
Member
User avatar

Joined: Sun Apr 30, 2017 12:16 pm
Posts: 68
Location: Poland
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.


Top
 Profile  
 
 Post subject: Re: ACPI LAI on aarch64
PostPosted: Wed Nov 02, 2022 1:02 pm 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 898
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.

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: ACPI LAI on aarch64
PostPosted: Wed Nov 02, 2022 3:19 pm 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 898
I created a pull request to address this: https://github.com/managarm/lai/pull/132

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: DotBot [Bot], Google [Bot], Majestic-12 [Bot], thewrongchristian and 83 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group