ACPI SCI IRQ handler not being called

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
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

ACPI SCI IRQ handler not being called

Post by BrightLight »

Hi.
In my OS, I detect ACPI, locate the FADT and enable ACPI mode by writing the value in acpi_enable to I/O port sci_command and this works. ACPI shutdown also works. In VirtualBox, the ACPI shutdown menu item also becomes valid. As I know, this should emulate a power button press to the guest OS, and it should send an IRQ to the OS. This IRQ should be specified by sci_interrupt in the FADT. My IRQ handler reads the pm1a_event_block and checks if the power button has been pressed. If yes, it shuts down the PC. This works on two real PCs. But in QEMU and VirtualBox, when I send a shutdown event to the OS, nothing happens. No IRQ arrives at all; I know because my IRQ handler writes some text to the serial console before taking any action.

Isn't it odd it works on real HW but not in VMs? Is there something I'm missing here?
Thanks in advance!
You know your OS is advanced when you stop using the Intel programming guide as a reference.
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: ACPI SCI IRQ handler not being called

Post by jnc100 »

I can confirm power button presses are detected on VirtualBox (I'm using v5.0.12, with the ICH9 chipset, IOAPIC and EFI options enabled).

My ACPI setup code goes something like:

Parse tables and namespace, set up device tree
Run \\_SB_._INI
Run _STA and optionally _INI on all devices
Run \\_PIC(1) to say we're in APIC mode
Install SCI handler
Write ACPI_ENABLE to SMI_CMD
Write (1<<8) | (1<<9) to PM1_EN to say we handle both power and sleep button events.

Regards,
John.
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: ACPI SCI IRQ handler not being called

Post by BrightLight »

Oh. I didn't know we had to do all that. TBH, I don't have a complete AML interpreter. Thanks for the tip!
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Post Reply