Aluveitie sent me to well of knowledge with no end. I have 10+ tabs open, full of dense information regarding the infamous
_PWR
method. This Sleep / Wake thing is amazing, really.
For starters, a refresher what sleep states exist:
Gx | Name | Sx | Description |
---|
G0 | Working | S0 | The computer is running and the CPU executes instructions. "Awaymode" is a subset of S0, where monitor is off but background tasks are running |
G1 | Sleeping | S0ix | Modern Standby,[37] or "Low Power S0 Idle". Partial processor SoC sleep.[38][39] Known to ARM and x86 devices. |
| | S1 | Power on Suspend (POS): Processor caches are flushed, and the CPU(s) stops executing instructions. The power to the CPU(s) and RAM is maintained. Devices that do not indicate they must remain on may be powered off |
| | S2 | CPU powered off. Dirty cache is flushed to RAM |
| | S3 | commonly referred to as Standby, Sleep, or Suspend to RAM (STR): RAM remains powered |
| | S4 | Hibernation or Suspend to Disk: All content of the main memory is saved to non-volatile memory such as a hard drive, and the system is powered down |
G2 | Soft Off | S5 | G2/S5 is almost the same as G3 Mechanical Off, except that the power supply unit (PSU) still supplies power, at a minimum, to the power button to allow return to S0. A full reboot is required. No previous content is retained. Other components may remain powered so the computer can "wake" on input from the keyboard, clock, modem, LAN, or USB device |
G3 | Mechanical Off | | The computer's power has been totally removed via a mechanical switch (as on the rear of a PSU). The power cord can be removed and the system is safe for disassembly (typically, only the real-time clock continues to run using its own small battery) |
Okie, so S0 is fully awake, S5 is shutdown. S4 is hibernation and for desktop machines this is overkill to aim for.
Thus what we – on desktop Hackintosh – are chasing is S3.
We want to enter S3 reliably and wake from S3 back to S0.
Now — first to learn
what _PRW is: Power Resources for Wake.
The typical form we see is this:
Code:
Method (_PRW, 0, NotSerialized) // _PRW: Power Resources for Wake
{
Return (Package (0x02)
{
0x69,
0x03
})
}
Per docs from the link above, I understand that return value is
Code:
Package {
EventInfo // Integer
DeepestSleepState // Integer
}
Important bits:
(1) With
EventInfo
being
Integer
, then: "If it is an Integer, then it contains the bit index of the wake event within the FADT-based GPE enable register." OK, will see later what FADT / GPE register is.
(2)
DeepestSleepState is an
Integer that contains the deepest power system sleeping state that can be entered while still providing wake functionality.
Now remembering what SSDT-GPRW (I used so far) does: finds _PRW instances where it returns
0x08 0x04
and changes that into
0x08 0x00
.
If I get this correct — original value of
0x04
for second argument meant that these devices can enter S4 (hibernation) and still wake the system from it. By changing
4
to
0
, it means device can now enter S0 (==fully awake) and in any other state it will not be able to perform wake.
W.T.H?! This makes no sense. How is then mouse or keyboard able to wake-up the system from S3?
(This is the point where I asked myself do I even understand what I am reading).
For fun, I checked DSDT from actual MacPro7,1 and looked what _PRW implementations it has. Here's a typical one:
Code:
Method (_PRW, 0, NotSerialized)
{
If (OSDW ())
{
Return (Package (0x02)
{
0x69,
0x03
})
}
Else
{
Return (Package (0x02)
{
0x69,
0x04
})
}
}
OSDW
method is checking if OS is Darwin, thus this thing returns S3 state for Mac and S4 for Linux, Windows etc. Which actually
does make sense.
My conclusion so far is that SSDT-GPRW should be adjusted to return
0x03
.
But that remains to be tested, which takes a loooot of time that's not easy to find at the moment. These tabs will stay open for quite a while.