ACPI on Macbook
Hello.
I have been working on getting my new Macbook working with Ubuntu dapper for suspend.
Initially, the machine would crash on wake up. I created a fix to the PCI drivers for that and now it doesn't crash (fix is now in the Ubuntu kernel repository).
After this fix I noticed that ACPI was non-functional after reboot. This is because the irq9 handler gets disabled with the "nobody cared" message.
This happens because when the machine comes up, irq9 is high (level-triggered) but the ACPI code doesn't think it has anything to do. It therefore returns IRQ_NONE instead of IRQ_HANDLED and the kernel starts ignoring irq9 (preventing ACPI from working).
I found that the cause of this problem is that when the laptop returns from sleep the SCI_EN bit has been cleared. Actually, the entire PM1 register has been cleared (from inspecting the ports with a userspace app). On the ICH7 you can directly set this bit by 'or'ing the contents of the PM1 port (0x404) with the value 0x01.
Currently in my custom-patched kernel I have a quick outw(1, 0x404); as soon as the system comes back from sleep (before re-enabling interrupts, even). This fixes the problem and no spurious irq9's are issued.
This works smashingly well for me but unfortunately it's a gigantic ugly hack. I've been talking to Matthew Garrett (mjg59) about this problem and he suggested that it might be at least a tiny bit cleaner to put a call to acpi_enable() there instead (set SCI_EN indirectly since the ACPI spec says it might not be correct to set it directly). Unfortunately, when I do this the machine locks on resume.
So I'm writing this list to ask a couple of things:
1) Why do y'all think SCI_EN is being cleared when the machine goes to sleep and wakes up again?
2) What is the best way of dealing with this problem in a non-hackish way?
I'm not on the list so please reply-to-all.
Cheers
Hi,
Quoted 12 lines · Ryan Lortie <desrt <at> desrt.ca> writes:
I have been working on getting my new Macbook working with Ubuntu dapper for suspend.
[...]
After this fix I noticed that ACPI was non-functional after reboot. This is because the irq9 handler gets disabled with the "nobody cared" message.This happens because when the machine comes up, irq9 is high (level-triggered) but the ACPI code doesn't think it has anything to do. It therefore returns
IRQ_NONEinstead ofIRQ_HANDLEDand the kernel starts ignoring irq9 (preventing ACPI from working).
Quoted 6 lines
I found that the cause of this problem is that when the laptop returns from sleep the
SCI_ENbit has been cleared.
[...]
Currently in my custom-patched kernel I have a quickoutw(1, 0x404); as soon as the system comes back from sleep (before re-enabling interrupts, even). This fixes the problem and no spurious irq9's are issued.
Same symptoms for me on an Intel Core Duo Mac Mini (I had filed a bug about it
http://bugzilla.kernel.org/show_bug.cgi?id=6670 ). Ryan's hack does fix it as well for me; anybody has any clue how to fix that properly ?
Fred.