As I’ve written before, Windows 7 and Mac Pros are made for each other. Except when the Mac Pro doesn’t want to wake up from sleep or restore from hibernation. That’s one scary problem and I thought I’d share my debugging notes on how I diagnosed the problem. As I am feeling generous on this Monday morning, I’ll even share the solution, too.
Everything was working great on my machine after I installed Windows 7 x64, but about a month ago, I’d occasionally have a problem where once the computer had gone to sleep it wouldn’t wake up. When I woke up the machine, the mouse would jerk across the screen and after unlocking the machine, it was nearly unusable. With Process Explorer running, I could see the machine suffering from a DPC storm (Deferred Procedure Call) where one of the four CPUs was stuck in kernel mode. In order to get the machine back, I’d have to force power off the machine.
The problem was very intermittent but I did occasionally see the a HAL error 12 in the Event Log:
The platform firmware has corrupted memory across the previous system power transition. Please check for updated firmware for your system.
Most of the reports of the problem were related to SATA drives on normal PCs and for Apple computers some were thinking it was related to NVIDIA graphics drivers. As I have an ATI card in the machine that definitely wasn’t the problem I was seeing. As it was so infrequent, I didn’t worry about the wake from sleep problem too much.
Until last week, that is. The week before I’d had two instances where it wouldn’t wake from sleep. What was weird about those was that after I held the power button down the restart the machine, the machine was showing the same hung signs when Windows started. It took a couple of reboots before I got the machine restarted correctly. At the beginning of last week, I had three instances where I got stuck in the multiple power recycles. I did notice that when restarting the machine from a stuck sleep state, that if Windows didn’t play the startup sound, the machine was suffering the DPC Storm and logging in was almost impossible.
By the end of the week, I had completely lost the ability to wake from sleep. If the machine did sleep, I’d have to do five or six power cycles and sometimes go into Safe Mode to get a working computer. Things were definitely not happy. I tried hibernating, but now when I restarted the machine it would hang restoring from hibernation. The weird thing is that in both cases, there were no errors at all in the event log related to any problem with waking up or anything else. As I had to get some work done once I got the machine started and working, I turned off sleeping until I had a chance to look at the problem.
My thinking was that this was feeling like hardware problems so to test that hypothesis I booted into OS X and tried all the same sleep options. Everything worked like perfectly and no matter how I tried sleeping the machine, it always woke right back up.
Now I was feeling that this was a software issue, but what could it be? I looked at all the installed software and the last driver I installed was when I installed Windows 7 on the machine. Since I could get the DPC storm at will now, I figured the only thing I could do was to hook up a kernel debugger and start debugging the shutdown and wake up. That was definitely not a prospect that I was looking forward to doing as that had “pain in the butt” written all over it.
Before I went down that black hole, I stepped back and said what do I know?
That got me thinking about how Apple computers boot. They boot through EFI (Extensible Firmware Interface) where PC’s boot through the BIOS (Basic Input/Output System). Mac’s essentially emulate the BIOS so Boot Camp can load Windows. (Starting with Vista SP1 x64, Microsoft now supports booting from EFI.) My Mac Pro is a 1,1 model, which is the first Intel-based Mac Pro so I’m pretty sure the Windows boot mechanism goes through BIOS emulation unlike the later models.
A crazy idea popped in my head at this point. When I bought my first Macintosh a while ago, a Power PC MacBook Pro, and the fans never shut off when I first started it. I called Apple Support and the very sharp Apple support guy explained to me that many of the hardware settings are stored in a thing called “parameter RAM” (PRAM) and on rare occasions you have to reset it like a program. Looking at the Apple Knowledge base turned up an article on resetting both PRAM and the nonvolatile RAM (NVRAM) as well as explained what was stored in both.
The article didn’t say anything about the BIOS or Boot Camp settings, but resetting the PRAM/NVRAM is much easier than hooking up a kernel debugging so I give it a shot. Two Mac startup chimes later, I booted into OS X and verified that it was still working. Restarting into Windows 7, I heard its startup sound and after logging in, I manually put the computer to sleep. One key press and the log in prompt was right there. No jerky mouse problems or DPC storms at all.
I’ve been testing the machine all weekend and everything is running great. My guess is that the PRAM/NVRAM settings on my machine have been having issues for a while and the HAL error 12 was when they first started. As there’s more work going on with the BIOS emulation to boot into Windows, the corrupted data was causing more problems as time went by. I know next time I see a HAL error 12 it’s a PRAM/NVRAM reset for me.
It looks like others have been having the HAL error 12 reported on their Macs so if you’re seeing that you might want to give the PRAM/NVRAM reset a try before you experience the problems I did. I’m almost positive that I’ve never reset PRAM/NVRAM ever on this machine. Let me know if this helps you out.