macbook sleep now working

yesterday, starting with some pointers from mjg59, i tried to find the cause of my macbook crashing on wakeup from sleep.

i narrowed it down to the code which resumes the pci bridge. as it turns out, the kernel restores the pci configuration space by copying in the values it had before the suspend. it does this in a bad order though, and the card becomes enabled before it is fully configured.

reversing the order fixed the problem — sleep now works on the macbook.

benc has merged the fix into the dapper git tree and the changes will be available with the next dapper kernel release.

there are still two small problems (one with a very easy fix). the harder once is acpi. when returning from sleep a random irq9 is thrown with no handler registered causing all further irq9s to be disabled. this means no acpi events get reported. no idea how i’d start fixing this. please help.

3 Comments

  1. Posted June 5, 2006 at 9:19 pm | Permalink

    Out of curiosity, how were you debugging this? Debugging the kernel over a serial line or something?

    I have an old Thinkpad T21 that starts to wake from sleep but never makes it that far. I’d like to find out why and maybe even try to fix the problem.

    Any hints would be welcome.

  2. Posted June 5, 2006 at 11:31 pm | Permalink

    Thing about the Macbook:

    1) The monitor doesn’t immediately come back on when you return from sleep.
    2) There is not a single pin on the entire laptop which is easily controlled from software via easy instructions (ie: no serial, parallel or anything… just firewire and USB, etc.)

    Because it was basically impossible to convey information to myself I followed a technique that mjg59 recommended: insert calls to reboot the machine at certain points in the code. If the machine reboots, it got that far. If it doesn’t reboot, it crashed first. By doing this over and over (it took me about 90 boots) you can narrow down where the crash is.

  3. sb
    Posted June 6, 2006 at 2:20 am | Permalink

    This is a great technique. Do you have a link to clearer instructions? I culdn’t find anything on Google. I don’t need it now but I’m sure I will at some point in the future…

    And, speaking on behalf of tons of macbook owners out there, thanks for doing this!