First, find the right Intel Controller (this may be different on your machine):
root@macmini:~# lspci | grep LPC
00:1f.0 ISA bridge: Intel Corporation HM65 Express Chipset Family LPC Controller (rev 05)
Next, look up the datasheet for that controller. In this case, it's https://www.intel.com/content/dam/www/public/us/en/documents/datasheets/6-chipset-c200-chipset-datasheet.pdf
Read it. I wanted the AFTERG3_EN
bit in the "GEN_PMCON_3 - General PM Configuration 3 Register", which documented on pp.510-513.
Offset Address is A4h and Size: 16-bit.
Cool. We'll read the existing value:
root@macmini:~# setpci -s 00:1f.0 0xa4.w
9809
Looks hopeful. Note:
0xa4
is the register address from the manual.
.w
is the size of the register, 16-bits in this case (word).
9809
is the value in hex.
What's that in binary?
root@macmini:~# bc -q
obase=2
ibase=16
9809
1001100000001001
Blow that up a bit:
bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
----------------------------------------------------
val: 1 0 0 1 1 0 0 0 0 0 0 0 1 0 0 1
AFTERG3_EN is at bit 0, and it's set to 1. According to the manual:
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 only cleared by RTCRST# assertion. 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.
That makes sense as my machine was not coming back on after power failure.
Flip that bit, convert back to hex:
root@macmini:~# bc -q
obase=16
ibase=2
1001100000001000
9808
Set it.
root@macmini:~# setpci -s 00:1f.0 0xa4.w=9808
Check it.
root@macmini:~# setpci -s 00:1f.0 0xa4.w
9808
Test to see if it worked (run sync a few times, remount read only, etc... prepare for power off). Pull out power plug. Put power plug back in.
It boots again! Yay!
Checked again and it actually persisted across reboot. Success!
I really didn't want to have to boot OSX just to change this setting. Googling I found these useful:
https://smackerelofopinion.blogspot.com.au/2011/09/mac-mini-rebooting-tweaks-setpci-s-01f0.html
https://www.virtuallyghetto.com/2013/02/enable-auto-startup-after-power-failure.html
But neither appears to apply to my machine properly and I didn't like the way they seemed to treat the register as the wrong size, and also just clobbered what was there.