coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
commands.c File Reference
#include <console/console.h>
#include <ec/acpi/ec.h>
#include <stdint.h>
#include <string.h>
#include "ec.h"
#include "commands.h"
Include dependency graph for commands.c:

Go to the source code of this file.

Data Structures

struct  err_code_entry
 

Functions

int wilco_ec_get_info (enum get_ec_info_cmd type, char *info)
 wilco_ec_get_info More...
 
void wilco_ec_print_all_info (void)
 wilco_ec_print_all_info More...
 
static int wilco_ec_get_power_smi (struct ec_pm_event_state *pm)
 
static int wilco_ec_get_power_status (struct ec_pm_event_state *pm)
 
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...
 
void wilco_ec_slp_en (void)
 wilco_ec_slp_en More...
 
void wilco_ec_power_off (enum ec_power_off_reason reason)
 wilco_ec_power_off More...
 
int wilco_ec_radio_control (enum ec_radio radio, uint8_t state)
 wilco_ec_radio_control() - Control wireless radios. 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...
 
void die_notify (void)
 
int wilco_ec_set_cpuid (uint32_t cpuid, uint8_t cpu_cores, uint8_t gpu_cores)
 wilco_ec_set_cpuid More...
 

Variables

static enum ec_err_code default_ec_err = DLED_ROM
 
static const struct err_code_entry post_code_err_map []
 
static uint8_t wilco_ec_saved_post_code
 

Function Documentation

◆ die_notify()

void die_notify ( void  )

◆ 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_get_power_smi()

static int wilco_ec_get_power_smi ( struct ec_pm_event_state pm)
static

Definition at line 42 of file commands.c.

References ec_pm_event_state::event, ec_pm_event_state::hotkey, KB_POWER_SMI, ec_pm_event_state::state, and wilco_ec_sendrecv_noargs().

Referenced by wilco_ec_get_pm().

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

◆ wilco_ec_get_power_status()

static int wilco_ec_get_power_status ( struct ec_pm_event_state pm)
static

Definition at line 74 of file commands.c.

References ec_pm_event_state::ac_type, ec_pm_event_state::event, ec_pm_event_state::hotkey, KB_POWER_STATUS, ec_pm_event_state::state, and wilco_ec_sendrecv_noargs().

Referenced by wilco_ec_get_lid_state(), and wilco_ec_get_pm().

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:

Variable Documentation

◆ default_ec_err

enum ec_err_code default_ec_err = DLED_ROM
static

Definition at line 165 of file commands.c.

Referenced by die_notify().

◆ post_code_err_map

const struct err_code_entry post_code_err_map[]
static
Initial value:
= {
{ .post_code = POST_RAM_FAILURE, .ec_err = DLED_MEMORY, },
{ .post_code = POST_VIDEO_FAILURE, .ec_err = DLED_PANEL, },
}
@ DLED_MEMORY
Definition: commands.h:88
@ DLED_PANEL
Definition: commands.h:89
#define POST_VIDEO_FAILURE
Video failure.
Definition: post_codes.h:360
#define POST_RAM_FAILURE
RAM failure.
Definition: post_codes.h:346

Definition at line 165 of file commands.c.

Referenced by die_notify().

◆ wilco_ec_saved_post_code

uint8_t wilco_ec_saved_post_code
static

Definition at line 187 of file commands.c.

Referenced by die_notify(), and wilco_ec_save_post_code().