coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
commands.h File Reference
#include <types.h>
Include dependency graph for commands.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ec_response_get_ec_info
 
struct  ec_pm_event_state
 

Macros

#define EC_INFO_MAX_SIZE   9
 

Enumerations

enum  {
  KB_POWER_SMI = 0x04 , KB_POWER_STATUS = 0x05 , KB_POWER_OFF = 0x08 , KB_RADIO_CONTROL = 0x2b ,
  KB_SAVE = 0x2f , KB_RESTORE = 0x30 , KB_CAMERA = 0x33 , KB_EC_INFO = 0x38 ,
  KB_ACPI = 0x3a , KB_BOARD_ID = 0x3d , KB_ACPI_WAKEUP_CHANGE = 0x4a , KB_POWER_BUTTON_TO_HOST = 0x3e ,
  KB_HW_MUTE_CONTROL = 0x60 , KB_SLP_EN = 0x64 , KB_BIOS_PROGRESS = 0xc2 , KB_ERR_CODE = 0x7b ,
  KB_CPU_ID = 0xbf
}
 
enum  ec_ram_addr { EC_RAM_SIGNED_FW = 0x5c , EC_RAM_S0IX_SUPPORT = 0xb8 }
 
enum  set_acpi_mode_cmd { ACPI_OFF = 0 , ACPI_ON }
 
enum  bios_progress_code {
  BIOS_PROGRESS_BEFORE_MEMORY = 0x00 , BIOS_PROGRESS_MEMORY_INIT = 0x01 , BIOS_PROGRESS_VIDEO_INIT = 0x02 , BIOS_PROGRESS_LOGO_DISPLAYED = 0x03 ,
  BIOS_PROGRESS_POST_COMPLETE = 0x04
}
 
enum  ec_audio_mute { AUDIO_MUTE = 0 , AUDIO_UNMUTE_125MS }
 
enum  ec_radio { RADIO_WIFI = 0 , RADIO_WWAN , RADIO_BT }
 
enum  ec_radio_action { RADIO_READ = 1 , RADIO_WRITE , RADIO_TOGGLE }
 
enum  ec_camera { CAMERA_ON = 0 , CAMERA_OFF }
 
enum  ec_err_code { DLED_MEMORY = 0x03 , DLED_PANEL = 0x10 , DLED_ROM = 0x19 }
 
enum  get_ec_info_cmd { GET_EC_LABEL = 0 , GET_EC_SVN_REV , GET_EC_MODEL_NO , GET_EC_BUILD_DATE }
 
enum  ec_power_off_reason {
  EC_PWROFF_FLASH = 0x11 , EC_PWROFF_AC_REMOVED = 0x12 , EC_PWROFF_BAT_REMOVED = 0x13 , EC_PWROFF_LOBAT = 0x15 ,
  EC_PWROFF_PWRB_IN_POST = 0x16 , EC_PWROFF_FORCE_IMMEDIATE = 0x18 , EC_PWROFF_WDT = 0x1b , EC_PWROFF_FORCE_THERMAL = 0x22 ,
  EC_PWROFF_ERR_CODE = 0x23 , EC_PWROFF_PAID_PWRGD = 0x27 , EC_PWROFF_PAID_CPU = 0x28 , EC_PWROFF_PAID_GFX = 0x29 ,
  EC_PWROFF_PAID_CLK = 0x2a , EC_PWROFF_PAID_NOMEMORY = 0x2b , EC_PWROFF_PAID_MEMORY_ERR = 0x2c , EC_PWROFF_PAID_MEMORY_SPD = 0x2d ,
  EC_SWOFF_ACPI = 0x31 , EC_SWOFF_BOOT_PASSWORD = 0x33 , EC_SWOFF_DISK_PASSWORD = 0x34 , EC_SWOFF_POWER_CYCLE = 0x37 ,
  EC_SWOFF_HARD_RESET = 0x3b , EC_SWOFF_FSMI = 0x3f , EC_PWRLOG_THERMTRIP = 0x41 , EC_PWRLOG_NO_S5 = 0x42 ,
  EC_PWROFF_4S_PWRB = 0x44 , EC_PWROFF_ASF2_FORCEOFF = 0x45 , EC_PWROFF_PWRB_THERMAL = 0x48 , EC_PWROFF_AOAC_TIMER = 0x4b
}
 
enum  ec_pm1_state {
  EC_PM1_AC_AVAIL = BIT(0) , EC_PM1_BAT_AVAIL = BIT(1) , EC_PM1_LO_BAT1 = BIT(2) , EC_PM1_LO_BAT2 = BIT(3) ,
  EC_PM1_LID_OPEN = BIT(4) , EC_PM1_LCD_POWER = BIT(5) , EC_PM1_OVER_TEMP = BIT(6) , EC_PM1_DOCKED = BIT(7)
}
 
enum  ec_pm2_state { EC_PM2_SYS_MB_PCIE = BIT(0) , EC_PM2_SYS_MB_SATA = BIT(1) , EC_PM2_PWRB_PRESSED = BIT(2) , EC_PM2_TURBO_MODE = BIT(3) }
 
enum  ec_pm3_state { EC_PM3_BAT1_PRES = BIT(2) , EC_PM3_BAT2_PRES = BIT(3) , EC_PM3_LOWER_PSTATE = BIT(6) , EC_PM3_CPU_THROTTLE = BIT(7) }
 
enum  ec_pm4_state {
  EC_PM4_BAT1_CHG = BIT(0) , EC_PM4_BAT2_CHG = BIT(1) , EC_PM4_BAT1_PWR = BIT(2) , EC_PM4_BAT2_PWR = BIT(3) ,
  EC_PM4_PANEL_STATE = BIT(5)
}
 
enum  ec_pm5_state { EC_PM5_INT_HD_SATA = BIT(7) }
 
enum  ec_pm6_state { EC_PM6_WLAN_SWITCH = BIT(0) , EC_PM6_SYS_MB_MODEM = BIT(1) , EC_PM6_ETH_STATE = BIT(2) , EC_PM6_AC_UPDATE = BIT(3) }
 
enum  ec_pm1_event { EC_EV1_PWRB_PRESSED = BIT(0) , EC_EV1_HOTKEY_PRESSED = BIT(1) , EC_EV1_STATE_CHANGED = BIT(2) }
 
enum  ec_pm2_event { EC_EV2_ACPI_MONSWITCH = BIT(0) }
 
enum  ec_wake_change { WAKE_OFF = 0 , WAKE_ON }
 
enum  ec_acpi_wake_events { EC_ACPI_WAKE_PWRB = BIT(0) , EC_ACPI_WAKE_LID = BIT(1) , EC_ACPI_WAKE_RTC = BIT(5) }
 

Functions

int wilco_ec_radio_control (enum ec_radio radio, uint8_t state)
 wilco_ec_radio_control() - Control wireless radios. More...
 
int wilco_ec_get_info (enum get_ec_info_cmd cmd, char *info)
 wilco_ec_get_info More...
 
void wilco_ec_print_all_info (void)
 wilco_ec_print_all_info More...
 
void wilco_ec_power_off (enum ec_power_off_reason reason)
 wilco_ec_power_off More...
 
void wilco_ec_slp_en (void)
 wilco_ec_slp_en More...
 
int wilco_ec_get_pm (struct ec_pm_event_state *pm, bool clear)
 wilco_ec_get_pm More...
 
int wilco_ec_get_lid_state (void)
 wilco_ec_get_lid_state More...
 
int wilco_ec_get_board_id (uint8_t *id)
 wilco_ec_get_board_id More...
 
int wilco_ec_change_wake (uint8_t source, enum ec_wake_change change)
 wilco_ec_change_wake_source More...
 
int wilco_ec_signed_fw (void)
 wilco_ec_signed_fw More...
 
void wilco_ec_save_post_code (uint8_t post_code)
 wilco_ec_save_post_code More...
 
int wilco_ec_set_cpuid (uint32_t cpuid, uint8_t cpu_cores, uint8_t gpu_cores)
 wilco_ec_set_cpuid More...
 

Macro Definition Documentation

◆ EC_INFO_MAX_SIZE

#define EC_INFO_MAX_SIZE   9

Definition at line 112 of file commands.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
KB_POWER_SMI 
KB_POWER_STATUS 
KB_POWER_OFF 
KB_RADIO_CONTROL 
KB_SAVE 
KB_RESTORE 
KB_CAMERA 
KB_EC_INFO 
KB_ACPI 
KB_BOARD_ID 
KB_ACPI_WAKEUP_CHANGE 
KB_POWER_BUTTON_TO_HOST 
KB_HW_MUTE_CONTROL 
KB_SLP_EN 
KB_BIOS_PROGRESS 
KB_ERR_CODE 
KB_CPU_ID 

Definition at line 8 of file commands.h.

◆ bios_progress_code

Enumerator
BIOS_PROGRESS_BEFORE_MEMORY 
BIOS_PROGRESS_MEMORY_INIT 
BIOS_PROGRESS_VIDEO_INIT 
BIOS_PROGRESS_LOGO_DISPLAYED 
BIOS_PROGRESS_POST_COMPLETE 

Definition at line 57 of file commands.h.

◆ ec_acpi_wake_events

Enumerator
EC_ACPI_WAKE_PWRB 
EC_ACPI_WAKE_LID 
EC_ACPI_WAKE_RTC 

Definition at line 302 of file commands.h.

◆ ec_audio_mute

Enumerator
AUDIO_MUTE 
AUDIO_UNMUTE_125MS 

Definition at line 65 of file commands.h.

◆ ec_camera

enum ec_camera
Enumerator
CAMERA_ON 
CAMERA_OFF 

Definition at line 82 of file commands.h.

◆ ec_err_code

Enumerator
DLED_MEMORY 
DLED_PANEL 
DLED_ROM 

Definition at line 87 of file commands.h.

◆ ec_pm1_event

Enumerator
EC_EV1_PWRB_PRESSED 
EC_EV1_HOTKEY_PRESSED 
EC_EV1_STATE_CHANGED 

Definition at line 236 of file commands.h.

◆ ec_pm1_state

Enumerator
EC_PM1_AC_AVAIL 
EC_PM1_BAT_AVAIL 
EC_PM1_LO_BAT1 
EC_PM1_LO_BAT2 
EC_PM1_LID_OPEN 
EC_PM1_LCD_POWER 
EC_PM1_OVER_TEMP 
EC_PM1_DOCKED 

Definition at line 192 of file commands.h.

◆ ec_pm2_event

Enumerator
EC_EV2_ACPI_MONSWITCH 

Definition at line 242 of file commands.h.

◆ ec_pm2_state

Enumerator
EC_PM2_SYS_MB_PCIE 
EC_PM2_SYS_MB_SATA 
EC_PM2_PWRB_PRESSED 
EC_PM2_TURBO_MODE 

Definition at line 203 of file commands.h.

◆ ec_pm3_state

Enumerator
EC_PM3_BAT1_PRES 
EC_PM3_BAT2_PRES 
EC_PM3_LOWER_PSTATE 
EC_PM3_CPU_THROTTLE 

Definition at line 210 of file commands.h.

◆ ec_pm4_state

Enumerator
EC_PM4_BAT1_CHG 
EC_PM4_BAT2_CHG 
EC_PM4_BAT1_PWR 
EC_PM4_BAT2_PWR 
EC_PM4_PANEL_STATE 

Definition at line 217 of file commands.h.

◆ ec_pm5_state

Enumerator
EC_PM5_INT_HD_SATA 

Definition at line 225 of file commands.h.

◆ ec_pm6_state

Enumerator
EC_PM6_WLAN_SWITCH 
EC_PM6_SYS_MB_MODEM 
EC_PM6_ETH_STATE 
EC_PM6_AC_UPDATE 

Definition at line 229 of file commands.h.

◆ ec_power_off_reason

Enumerator
EC_PWROFF_FLASH 
EC_PWROFF_AC_REMOVED 
EC_PWROFF_BAT_REMOVED 
EC_PWROFF_LOBAT 
EC_PWROFF_PWRB_IN_POST 
EC_PWROFF_FORCE_IMMEDIATE 
EC_PWROFF_WDT 
EC_PWROFF_FORCE_THERMAL 
EC_PWROFF_ERR_CODE 
EC_PWROFF_PAID_PWRGD 
EC_PWROFF_PAID_CPU 
EC_PWROFF_PAID_GFX 
EC_PWROFF_PAID_CLK 
EC_PWROFF_PAID_NOMEMORY 
EC_PWROFF_PAID_MEMORY_ERR 
EC_PWROFF_PAID_MEMORY_SPD 
EC_SWOFF_ACPI 
EC_SWOFF_BOOT_PASSWORD 
EC_SWOFF_DISK_PASSWORD 
EC_SWOFF_POWER_CYCLE 
EC_SWOFF_HARD_RESET 
EC_SWOFF_FSMI 
EC_PWRLOG_THERMTRIP 
EC_PWRLOG_NO_S5 
EC_PWROFF_4S_PWRB 
EC_PWROFF_ASF2_FORCEOFF 
EC_PWROFF_PWRB_THERMAL 
EC_PWROFF_AOAC_TIMER 

Definition at line 147 of file commands.h.

◆ ec_radio

enum ec_radio
Enumerator
RADIO_WIFI 
RADIO_WWAN 
RADIO_BT 

Definition at line 70 of file commands.h.

◆ ec_radio_action

Enumerator
RADIO_READ 
RADIO_WRITE 
RADIO_TOGGLE 

Definition at line 76 of file commands.h.

◆ ec_ram_addr

Enumerator
EC_RAM_SIGNED_FW 
EC_RAM_S0IX_SUPPORT 

Definition at line 45 of file commands.h.

◆ ec_wake_change

Enumerator
WAKE_OFF 
WAKE_ON 

Definition at line 287 of file commands.h.

◆ get_ec_info_cmd

Enumerator
GET_EC_LABEL 
GET_EC_SVN_REV 
GET_EC_MODEL_NO 
GET_EC_BUILD_DATE 

Definition at line 105 of file commands.h.

◆ set_acpi_mode_cmd

Enumerator
ACPI_OFF 
ACPI_ON 

Definition at line 52 of file commands.h.

Function Documentation

◆ wilco_ec_change_wake()

int wilco_ec_change_wake ( uint8_t  source,
enum ec_wake_change  change 
)

wilco_ec_change_wake_source

Change acpi wake up source. @source: Wake up source that can be enabled/disabled. @ec_wake_change: On/off switch.

Returns -1 if the EC command failed

Definition at line 156 of file commands.c.

References ARRAY_SIZE, KB_ACPI_WAKEUP_CHANGE, NULL, wilco_ec_mailbox(), and WILCO_EC_MSG_DEFAULT.

Referenced by wilco_ec_smi_sleep().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wilco_ec_get_board_id()

int wilco_ec_get_board_id ( uint8_t id)

wilco_ec_get_board_id

Retrieve the board ID value from the EC. @id: Pointer to variable to store the ID read from the EC.

Returns number of bytes transferred from the EC Returns -1 if the EC command failed

Definition at line 125 of file commands.c.

References KB_BOARD_ID, NULL, wilco_ec_mailbox(), and WILCO_EC_MSG_RAW.

Referenced by board_id().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wilco_ec_get_info()

int wilco_ec_get_info ( enum get_ec_info_cmd  cmd,
char *  info 
)

wilco_ec_get_info

Read a specific information string from the EC and return it in the caller-provided buffer of at least EC_INFO_MAX_SIZE bytes.

@cmd: Information to retrieve @info: Character array of EC_INFO_MAX_SIZE bytes

Returns 0 if successful and resulting string is in 'info' Returns -1 if the EC command fails

Definition at line 11 of file commands.c.

References ec_response_get_ec_info::data, info, KB_EC_INFO, strncpy(), type, and wilco_ec_sendrecv().

Referenced by wilco_ec_print_all_info().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wilco_ec_get_lid_state()

int wilco_ec_get_lid_state ( void  )

wilco_ec_get_lid_state

Retrieve the lid state without clearing it in the EC.

Returns 1 if the lid is open, 0 if it is closed Returns -1 if the EC command failed

Definition at line 115 of file commands.c.

References EC_PM1_LID_OPEN, ec_pm_event_state::state, and wilco_ec_get_power_status().

Here is the call graph for this function:

◆ wilco_ec_get_pm()

int wilco_ec_get_pm ( struct ec_pm_event_state pm,
bool  clear 
)

wilco_ec_get_pm

Retrieve power and event information from the EC.

@pm: Power event state structure to fill out @clear: Clear EC event state after reading

Returns 0 if EC command was successful Returns -1 if EC command failed

Definition at line 107 of file commands.c.

References wilco_ec_get_power_smi(), and wilco_ec_get_power_status().

Referenced by wilco_ec_smi_espi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wilco_ec_power_off()

void wilco_ec_power_off ( enum ec_power_off_reason  reason)

wilco_ec_power_off

Tell the EC why the host is about to power off.

Definition at line 139 of file commands.c.

References BIOS_ERR, KB_POWER_OFF, NULL, printk, wilco_ec_mailbox(), and WILCO_EC_MSG_NO_RESPONSE.

Referenced by wilco_ec_smi_sleep().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wilco_ec_print_all_info()

void wilco_ec_print_all_info ( void  )

wilco_ec_print_all_info

Retrieve and print all the information strings from the EC:

GET_EC_LABEL GET_EC_SVN_REV GET_EC_MODEL_NO GET_EC_BUILD_DATE

Definition at line 25 of file commands.c.

References BIOS_INFO, EC_INFO_MAX_SIZE, GET_EC_BUILD_DATE, GET_EC_LABEL, GET_EC_MODEL_NO, GET_EC_SVN_REV, info, printk, and wilco_ec_get_info().

Referenced by wilco_ec_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wilco_ec_radio_control()

int wilco_ec_radio_control ( enum ec_radio  radio,
uint8_t  state 
)

wilco_ec_radio_control() - Control wireless radios.

@ec_radio: Wireless radio type. @state: Turn radio on or off. Return: 0 if successful or negative error code on failure.

Definition at line 147 of file commands.c.

References ARRAY_SIZE, KB_RADIO_CONTROL, NULL, RADIO_WRITE, wilco_ec_mailbox(), and WILCO_EC_MSG_DEFAULT.

Referenced by wilco_ec_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wilco_ec_save_post_code()

void wilco_ec_save_post_code ( uint8_t  post_code)

wilco_ec_save_post_code

Save this post code as the most recent progress step. If the boot fails and calls die_notify() this post code will be used to send an error code to the EC indicating the failure.

@post_code: Post code to save

Definition at line 189 of file commands.c.

References post_code, and wilco_ec_saved_post_code.

Referenced by mainboard_post().

Here is the caller graph for this function:

◆ wilco_ec_set_cpuid()

int wilco_ec_set_cpuid ( uint32_t  cpuid,
uint8_t  cpu_cores,
uint8_t  gpu_cores 
)

wilco_ec_set_cpuid

Set CPU ID to EC.

@cpuid: read CPU ID from cpu_eax(1) @cpu_cores: cores of CPU @gpu_cores: cores of GPU

Returns 0 if EC command was successful Returns -1 if EC command failed

Definition at line 225 of file commands.c.

References ARRAY_SIZE, cpu_id, cpuid, KB_CPU_ID, NULL, wilco_ec_mailbox(), and WILCO_EC_MSG_DEFAULT.

Referenced by wilco_set_cpu_id().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wilco_ec_signed_fw()

int wilco_ec_signed_fw ( void  )

wilco_ec_signed_fw

Indicate if the EC uses signed firmware.

Returns 1 if EC uses signed firmware, otherwise returns 0

Definition at line 165 of file commands.c.

Referenced by get_sku_index(), sku_id(), and smbios_system_sku().

Here is the caller graph for this function:

◆ wilco_ec_slp_en()

void wilco_ec_slp_en ( void  )

wilco_ec_slp_en

Tell the EC that the host is entering a sleep state.

Definition at line 131 of file commands.c.

References BIOS_ERR, KB_SLP_EN, NULL, printk, wilco_ec_mailbox(), and WILCO_EC_MSG_NO_RESPONSE.

Referenced by wilco_ec_smi_sleep().

Here is the call graph for this function:
Here is the caller graph for this function: