Contributed by marco on from the ACPI-interrupts-are-more-complex-than-they-should-be dept.
1. During autoconf create a deferred thread to deal with interrupts while retaining context. 2. In the kernel thread initialize the GPEs by writing all zeros to the GPE_ENABLE register and ones to GPE_STATUS. 3. In the kernel thread initialize which GPEs you want, we for now only care about 0x1d events (button events) 4. Go to sleep waiting for an event ... a while later ... 5. We receive an event in the ACPI ISR. 6. Disable all ACPI interrupts (shit you not) 7. Wakeup the kernel thread 8. In the kernel thread figure out who gets the interrupt 9. In the kernel thread execute the AML code associated with the interrupt 10. In the kernel thread acknowledge the interrupt 11. Re-enable the interrupts and go to step 4Phew, that's a lot of work for a stupid power or sleep button event. Besides the amount of code it is quite unforgiving too. The only positive news here is that the device drivers that gets these events are extremely simple since a lot of the magic was handled in the kernel thread. Anyway after this started working it was simple to rig the ACPI button driver with for example the power down code. So why in the world isn't it working while we are receiving the interrupts?
This is a screamer... Some boxes were powering down and some were not. Since our laptops were working we had not yet gotten around to figure out why some people's computers were acting up. Alexander (grange@) just committed some code to clean up the set state code so he immediately got blamed :-) Jordan and I started debugging this, went back and forth with old and new code but it was unreliable and Alex's code really seemed good. Many reboots later we figure out that the values we are sending to the power down function is garbage. Hmmm so how did it get corrupted? Ah a good old struct sleeptype[5] that should have been struct sleeptype[6]; crap an off by one in the array declaration. So tons of debug code later it all makes sense suddenly and a 1 line commit. HA! and now we have powerdown when we hit the button, schaweet!!
(Comments are closed)
By Brad (216.138.195.228) brad at comstyle dot com on
By Bernhard (128.130.39.94) on
By Anonymous Coward (142.166.105.108) on
By Anonymous Coward (128.171.90.200) on
Comments
By Anonymous Coward (71.145.208.228) on
Comments
By Anonymous Coward (128.171.90.200) on
Comments
By tedu (69.12.168.114) on