Fujitsu P2120 Suspend-to-RAM under Linux

The Quest for S3

Loosing video on resume is a major showstopper for Suspend-to-RAM (ACPI S3) to be useful on the P2120. In addition, the NIC needs some tender care to start working again on resume. Consequently, even though an out-of-the-box 2.5.64 suspends and resumes the P2120 "correctly",  the cycle results in a blind, deaf, mute and dumb machine.

It turns out that the BIOS is less than helpful when it comes to restoring the Radeon Mobility M6 LY graphics adapter as well as the 8139C NIC. Setting the PCI power state and rewriting the PCI configuration apparently is enough to make the 8139 happy. Unfortunately the story is not that simple for the Radeon. Firstly, PCI configuration has to be done with interrupts off during RESUME_POWER_ON, and hooks for that still needs to be added to the PCI infrastructure. Secondly, configuring any graphics adapter from scratch is not for the faint of heart, as writing the wrong value to the right register could cause it to give up its magic smoke...

Instead of spending hours over the video hardware manuals, using the adapter ROM POST seems like a good idea. Unfortunately, the simple minded approach offered by wakeup.S  (acpi_sleep=s3_bios) doesn't work, for at least three reasons:
  1. The POST code expects bus:slot.function as an argument.
  2. The adapter PCI interface is not configured yet
  3. I don't have a clue what the third reason is, lcall $0xc000,$3 from real mode just doesn't work.
Fortunately (for the first time), XFree86 comes with a x86 emulator specificially designed to handle adapter ROMs. In principle it should be possible to execute the POST code using vm86 directly from kernel space, but it would require quite some infrastructure (interrupts, ports, half of dosemu and the kitchen sink) and, frankly, I'm fed up with hanging kernels. Thus, the work is shared between the radeonfb kernel module (reconfigure PCI) and XFree86 (POST the adapter). Furthermore, as XFree86 currently knows nothing about ACPI events, it is told to POST on every VT change.

The Steps to S3

This information is provided purely on a works-for-me basis, and is probably better suited for someone who is prepared to muck about.  If it works for you too, great!

Install a recent 2.5-series kernel

Apply some kernel patches

Patch the XFree86-4.2.99 Radeon Driver

Wrapping it all up