Search code examples
operating-systembiosacpi

Why does OS know it's time to enter ACPI mode


I know that entering ACPI mode is by setting the SCI_EN bit after receiving an event, but why does the OS start ACPI mode when this bit is set? Why is the SCI_EN bit set instead of other bits when an event is received?


Solution

  • When a computer is first turned on firmware is in control of power management, and anything that would cause a power management event is treated as an SMI to cause the firmware to enter a special mode called System Management Mode where it can determine what the event was and take care of the event.

    When an OS wants control of power management it uses SCI_EN, which mostly triggers another switch firmware's System Management Mode so that firmware can prepare to transfer control from itself to the OS. Once this completes (and control is returned from SMM to OS), anything that would cause a power management event is treated as an SCI ("System Control Interrupt") which is handled by the OS (and not handled by the firmware's SMM code); and the OS determines what the event was and take care of the event.

    I know that entering ACPI mode is by setting the SCI_EN bit after receiving an event

    No, SCI_EN is set by OS before it can receive an event (and not after OS receives an event).

    why does the OS start ACPI mode when this bit is set

    If the OS never sets the SCI_EN bit; then the computer is in "legacy mode" (with firmware doing all the power management).

    Why is the SCI_EN bit set instead of other bits when an event is received?

    I'd guess the SCI_EN bit is just left as "set" after the OS sets it (it's fulfilled it's only purpose at that point).