When a computer goes into ACPI S4 state it saves its RAM contents to disk and shuts down.
But what happens to registers, VRAM, or volatile memory inside extension cards or similar?
The TL:DR answer to your question is: Not as a part of the hardware/BIOS S4 implementation, though there is nothing stopping the OS/drivers from doing it.
According to the ACPI specification the Operating System is responsible for initializing all system devices to a usable state after restoring from an S4 hibernation.
ACPI Spec page 7-142 "System \ _S4 State":
- Devices states are compatible with the current Power Resource states. In other words, all devices are in the D3 state when the system state is S4
The D3 state is defined as:
D3 - Off:
Power has been fully removed from the device. The device context is lost when this state is entered, so the OS software will reinitialize the device when powering it back on. Since device context and power are lost, devices in this state do not decode their addresses lines. Devices in this state have the longest restore times.
All classes of devices define this state.
For the driver to function under Windows (or any OS for that matter) then it will have to allocate any buffers necessary and store some quantity of state information. This will be stored in the OS memory space and thus will be stored in the hibernation file.
The OS knows what devices to initialize and likely just calls the registered driver initialization code which will check whether any state information was saved in its internal buffers and restore the card to a usable state.
This just reiterates that the cards themselves know nothing of how to bring themselves out of hibernation state and come up into their default "power on" state until Windows (through the drivers) tells it otherwise. There is no requirement to store the card registers outside of OS dependent drivers which will get their memory space saved by the hibernation process.
When the computer's execution is interrupted for sleeping, all CPU registers for the current executing thread(s) are saved in system RAM, as is the normal procedure with interrupts. So these are saved with the RAM and can be seamlessly restarted on wake.
Video RAM or VRAM is not saved and will have to be re-generated by the OS when it wakes to refresh the display, which it does automatically. So a black screen might result for an extremely short (usually unnoticeable) time.
If a used extension card is withdrawn during the sleep, the process that is using it will fail after wake, as will any CD-reading software if the CD is withdrawn, or any process using an outstanding Internet connection. What happens then depends on how that process was programmed.
They are according to wikipedia: S4: Hibernation or Suspend to Disk. All content of main memory is saved to non-volatile memory such as a hard drive, and is powered down. Also according to here.
Specifically it is said:
S3 - "Suspend to RAM"
All power to the cpu is shut off, and the contents of its registers are flushed to RAM, which remains on. In Microsoft Windows, the "Standby" command can be associated with this state if enabled in the BIOS. Because it requires a high degree of coordination between the cpu, chipset, devices, OS, BIOS, and OS device drivers, this system state is the most prone to errors and instability. Pavel Machek has created a small document with some hints how to solve problems with S3. You can find it in the kernel sources at Documentation/power/tricks.txt. S3 is currently not supported by the 2.4.x kernel series in Linux. S4 - "Suspend to Disk"
CPU power shut off as in S3, but RAM is written to disk and shut off as well. In Microsoft Windows, the "Hibernate" command is associated with this state. A variation called S4BIOS is most prevalent, where the system image is stored and loaded by the BIOS instead of the OS. Because the contents of RAM are written out to disk, system context is maintained. For example, unsaved files would not be lost following an S4 transition. S4 is currently not supported by the 2.4.x kernel series in Linux, but you might have good luck with SWSUSP. Some machines offer S4_BIOS whose support is considered to be experimental within Linux/ACPI.