Monday 26 September 2011

Mac Mini rebooting tweaks: setpci -s 0:1f.0 0xa4.b=0

Last night I was asked why Mac Minis require "setpci -s 0:1f.0 0xa4.b=0" to force the Mac to auto-reboot in the event of a power failure.  Well, after a lot of Googling around I found that this setpci rune is quoted in a lot of places and at a guess probably originated from advice on the Mythical Beasts website. However, the explanation of what this rune actually did was distinctly lacking.

So, why is it required?

After some more searching around I found that device 00:1f.0 on the Mac Mini refers to:

00:1f.0 ISA bridge: Intel Corporation 82801GBM (ICH7-M) LPC Interface Bridge (rev 02)

..so my next step was to figure out why writing a zero byte to register 0xa4 on this device allows the Mac Mini to reboot. I located and download the ICH7 PDF from Intel and register at offset 0xa4 can be found in section 10.8.1.3.  This refers to GEN_PMCON_3—General PM Configuration 3 Register.   Even though the setpci command is clearing this whole register, I suspect we are just interested in clearing bit zero. The PDF states:

"AFTERG3_EN — R/W. This bit determines what state to go to when power is re-applied after a power failure (G3 state). This bit is in the RTC well and is not cleared by any type of reset except writes to CF9h or RTCRST#.

0 = System will return to S0 state (boot) after power is re-applied.
1 = System will return to the S5 state (except if it was in S4, in which case it will return to S4). In the S5 state, the only enabled wake event is the Power Button or any enabled wake event that was preserved through the power failure."

So, it looks like the "setpci -s 0:1f.0 0xa4.b=0" magic is just to return to a S0 (boot state) after power is re-applied after a power failure.   All is explained, so not so magical after all.

4 comments:

  1. Make sure you check lspci, the device is not 0:1f.0 on all mac minis. On my 2010 mac mini it is:

    00:03.0 ISA bridge: NVIDIA Corporation MCP89 LPC Bridge (rev a2)

    So the command I used was:

    sudo setpci -s 0:03.0 0xa4.b=0

    ReplyDelete
  2. Brilliant!

    I've confirmed that this works on EeePC netbooks
    00:1f.0 ISA bridge: Intel Corporation 82801FBM (ICH6M) LPC Interface Bridge (rev 04)

    Also Acer Aspire One notebooks, and Gateway LT40 notebook
    00:1f.0 ISA bridge: Intel Corporation NM10 Family LPC Controller (rev 02)

    ReplyDelete
  3. On FreeBSD the equivalent command is:

    pciconf -w pci0:0:31:0: 0xa4 0

    ReplyDelete
  4. Gerardo Chemello26 June 2020 at 16:08

    Thank you very much for this post, works flawlessly.

    ReplyDelete