ACPI/Board-EC interaction

From coreboot
Jump to navigation Jump to search

The wiki is being retired!

Documentation is now handled by the same processes we use for code: Add something to the Documentation/ directory in the coreboot repo, and it will be rendered to https://doc.coreboot.org/. Contributions welcome!

This page details the required interface and implementation details for connecting embedded controller ASL files to mainboard ASL files. Implementing this specification is mandatory for every new mainboard/EC added to the tree.

WARNING! The rules presented here are still a work-in-progress and should not yet be taken as as mandatory. However, if you are implementing a new EC, mainboard, or are interested in refactoring existing ASL files, you should join in the conversation and get this specification finalized.

EC ASL files should be self-contained, and not depend on the specific chipset or mainboard. As a result all variables and methods which are used must be standardized to foster interoperability and modularity. This specification details how to achieve those points.

Hotkey event methods

Two proposals exist:

The hammer method

Define a set of common ACPI method names which the mainboard code should define, and the EC code can always use.

The mainboard must #define these to an existing method. The actual ASL methods must not use these long names in ASL. The "MB_" prefix indicates that the mainboard is providing these methods.

Notice that these methods are only called on hotkey events. As such, unless the user has really fast fingers, there isn't a huge ACPI overhead as opposed to setting/clearing the needed bits directly in the caller.

  • MB_TOGGLE_WLAN() or MB_TOGGLE_WIRELESS() (TODO: only one method should be defined!!!)
    • Toggle wireless LAN on and off, or wireless LAN and bluetooth (respectively). EC calls this on hotkey events.
  • MB_INCREASE_BRIGHTNESS() and MB_DECREASE_BRIGHTNESS()
    • Increase or decrease screen brightness. EC calls this on hotkey events.
  • MB_SWITCH_DISPLAY()
    • Switch the active display. EC calls this on hotkey events.
  • MB_NOTIFY_POWER_EVENT()
    • Handle power state notifications and notify CPU device objects to re-evaluate their _PPC and _CST tables.

The mainboard handler method

Provide a generic mainboard "EC event" method that any EC _Qxx could call and pass the event ID to. The event ID is a standard defined event ID , greater than 255 so as not to conflict with possible Qxx IDs. This limits the permutations of mainboard EC event handlers and gives the flexibility to pass all the various EC events to the mainboard for handling.

For example:

#define EC_EVENT_LID_CLOSED 0x100

In the EC ASL:

/* lid closed */
Method (_Q01) {                 
        \_SB.MBEC (EC_EVENT_LID_CLOSED)
}

And the mainboard handler could look like:

Scope (\_SB)
{
        /* mainboard event handler */
        Method (MBEC, 1, Serialized) {
        Switch (ToInteger (Arg0)) {
                Case (EC_EVENT_LID_CLOSED) { ... }
                Case (EC_EVENT_...) { ... }
        }
 }