OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Apr 27, 2024 9:23 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: ACPI SCI IRQ handler not being called
PostPosted: Fri Jul 29, 2016 3:11 am 
Offline
Member
Member
User avatar

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


Top
 Profile  
 
 Post subject: Re: ACPI SCI IRQ handler not being called
PostPosted: Fri Jul 29, 2016 3:39 am 
Offline
Member
Member

Joined: Mon Apr 09, 2007 12:10 pm
Posts: 775
Location: London, UK
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.

_________________
Tysos | rpi-boot


Top
 Profile  
 
 Post subject: Re: ACPI SCI IRQ handler not being called
PostPosted: Fri Jul 29, 2016 3:47 am 
Offline
Member
Member
User avatar

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


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 18 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