coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
ec.h File Reference
#include <types.h>
#include <device/device.h>
#include "ec_commands.h"
#include <device/usbc_mux.h>
Include dependency graph for ec.h:

Go to the source code of this file.

Data Structures

struct  chromeec_command
 
struct  google_chromeec_event_info
 
struct  usb_pd_port_caps
 

Macros

#define CROS_SKU_UNKNOWN   0xFFFFFFFF
 
#define CROS_SKU_UNPROVISIONED   0x7FFFFFFF
 
#define MEC_EMI_BASE   0x800
 
#define MEC_EMI_SIZE   8
 
#define MEC_EMI_RANGE_START   EC_HOST_CMD_REGION0
 
#define MEC_EMI_RANGE_END   (EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SIZE)
 

Typedefs

typedef int(* crosec_io_t) (size_t req_size, size_t resp_size, void *context)
 

Functions

void google_chromeec_ioport_range (uint16_t *base, size_t *size)
 
int google_chromeec_i2c_xfer (uint8_t chip, uint8_t addr, int alen, uint8_t *buffer, int len, int is_read)
 
uint64_t google_chromeec_get_wake_mask (void)
 
int google_chromeec_set_sci_mask (uint64_t mask)
 
int google_chromeec_set_smi_mask (uint64_t mask)
 
int google_chromeec_set_wake_mask (uint64_t mask)
 
enum host_event_code google_chromeec_get_event (void)
 
bool google_chromeec_is_uhepi_supported (void)
 
int google_ec_running_ro (void)
 
enum ec_image google_chromeec_get_current_image (void)
 
void google_chromeec_init (void)
 
int google_chromeec_usb_get_pd_mux_info (int port, uint8_t *flags)
 Check for the current mux state in EC. More...
 
int google_chromeec_wait_for_displayport (long timeout_ms)
 Wait for DisplayPort to be ready. More...
 
int google_chromeec_wait_for_dp_hpd (int port, long timeout_ms)
 
int google_chromeec_typec_control_enter_dp_mode (int port)
 
int google_chromeec_get_usbc_mux_info (int port, struct usbc_mux_info *mux_info)
 
uint64_t google_chromeec_get_device_enabled_events (void)
 
int google_chromeec_set_device_enabled_events (uint64_t mask)
 
uint64_t google_chromeec_get_device_current_events (void)
 
int google_chromeec_check_feature (int feature)
 
uint8_t google_chromeec_calc_checksum (const uint8_t *data, int size)
 
int google_chromeec_get_board_version (uint32_t *version)
 google_chromeec_get_board_version() - Get the board version More...
 
uint32_t google_chromeec_get_sku_id (void)
 
int google_chromeec_set_sku_id (uint32_t skuid)
 
uint64_t google_chromeec_get_events_b (void)
 
int google_chromeec_clear_events_b (uint64_t mask)
 
int google_chromeec_kbbacklight (int percent)
 
void google_chromeec_post (uint8_t postcode)
 
int google_chromeec_vbnv_context (int is_read, uint8_t *data, int len)
 
uint8_t google_chromeec_get_switches (void)
 
bool google_chromeec_get_ap_watchdog_flag (void)
 
int google_chromeec_vstore_supported (void)
 
int google_chromeec_vstore_info (uint32_t *locked)
 
int google_chromeec_vstore_read (int slot, uint8_t *data)
 
int google_chromeec_vstore_write (int slot, uint8_t *data, size_t size)
 
int google_chromeec_reboot (int dev_idx, enum ec_reboot_cmd type, uint8_t flags)
 
int google_chromeec_cbi_get_oem_id (uint32_t *id)
 Get data from Cros Board Info. More...
 
int google_chromeec_cbi_get_sku_id (uint32_t *id)
 
int google_chromeec_cbi_get_fw_config (uint64_t *fw_config)
 
int google_chromeec_cbi_get_dram_part_num (char *buf, size_t bufsize)
 
int google_chromeec_cbi_get_oem_name (char *buf, size_t bufsize)
 
int google_chromeec_cbi_get_board_version (uint32_t *version)
 
int google_chromeec_cbi_get_ssfc (uint32_t *ssfc)
 
uint32_t google_chromeec_get_board_sku (void)
 
const char * google_chromeec_smbios_system_sku (void)
 
int google_chromeec_set_usb_charge_mode (uint8_t port_id, enum usb_charge_mode mode)
 
int google_chromeec_set_usb_pd_role (uint8_t port, enum usb_pd_control_role role)
 
int google_chromeec_get_usb_pd_power_info (enum usb_chg_type *type, uint16_t *current_max, uint16_t *voltage_max)
 
int google_chromeec_override_dedicated_charger_limit (uint16_t current_lim, uint16_t voltage_lim)
 
voidcrosec_get_buffer (size_t size, int req)
 
int crosec_command_proto (struct chromeec_command *cec_command, crosec_io_t crosec_io, void *context)
 
int google_chromeec_hello (void)
 Performs light verification of the EC<->AP communication channel. More...
 
int google_chromeec_command (struct chromeec_command *cec_command)
 Send a command to a CrOS EC. More...
 
void google_chromeec_events_init (const struct google_chromeec_event_info *info, bool is_s3_wakeup)
 
int google_chromeec_get_mkbp_event (struct ec_response_get_next_event *event)
 
void google_chromeec_log_events (uint64_t mask)
 
int google_chromeec_flash_protect (uint32_t mask, uint32_t flags, struct ec_response_flash_protect *resp)
 Protect/un-protect EC flash regions. More...
 
int google_chromeec_start_vboot_hash (enum ec_vboot_hash_type hash_type, uint32_t offset, struct ec_response_vboot_hash *resp)
 Calculate image hash for vboot. More...
 
int google_chromeec_get_vboot_hash (uint32_t offset, struct ec_response_vboot_hash *resp)
 Return the EC's vboot image hash. More...
 
int google_chromeec_flash_region_info (enum ec_flash_region region, uint32_t *offset, uint32_t *size)
 Get offset and size of the specified EC flash region. More...
 
int google_chromeec_flash_erase (uint32_t region_offset, uint32_t region_size)
 Erase a region of EC flash. More...
 
int google_chromeec_flash_info (struct ec_response_flash_info *info)
 Return information about the entire flash. More...
 
int google_chromeec_flash_write_block (const uint8_t *data, uint32_t size)
 Write a block into EC flash. More...
 
int google_chromeec_efs_verify (enum ec_flash_region region)
 Verify flash using EFS if available. More...
 
int google_chromeec_battery_cutoff (uint8_t flags)
 Command EC to perform battery cutoff. More...
 
int google_chromeec_read_limit_power_request (int *limit_power)
 Check if the EC is requesting the system to limit input power. More...
 
int google_chromeec_get_protocol_info (struct ec_response_get_protocol_info *resp)
 Get information about the protocol that the EC speaks. More...
 
int google_chromeec_get_cmd_versions (int command, uint32_t *pmask)
 Get available versions of the specified command. More...
 
int google_chromeec_get_num_pd_ports (unsigned int *num_ports)
 Get number of PD-capable USB ports from EC. More...
 
int google_chromeec_get_pd_port_caps (int port, struct usb_pd_port_caps *port_caps)
 Get role-based capabilities for a USB-PD port. More...
 
int google_chromeec_get_keybd_config (struct ec_response_keybd_config *keybd)
 Get the keyboard configuration / layout information from EC. More...
 
int google_chromeec_ap_reset (void)
 Send EC command to perform AP reset. More...
 
int google_chromeec_regulator_enable (uint32_t index, uint8_t enable)
 Configure the regulator as enabled / disabled. More...
 
int google_chromeec_regulator_is_enabled (uint32_t index, uint8_t *enabled)
 Query if the regulator is enabled. More...
 
int google_chromeec_regulator_set_voltage (uint32_t index, uint32_t min_mv, uint32_t max_mv)
 Set voltage for the voltage regulator within the range specified. More...
 
int google_chromeec_regulator_get_voltage (uint32_t index, uint32_t *voltage_mv)
 Get the currently configured voltage for the voltage regulator. More...
 

Macro Definition Documentation

◆ CROS_SKU_UNKNOWN

#define CROS_SKU_UNKNOWN   0xFFFFFFFF

Definition at line 110 of file ec.h.

◆ CROS_SKU_UNPROVISIONED

#define CROS_SKU_UNPROVISIONED   0x7FFFFFFF

Definition at line 111 of file ec.h.

◆ MEC_EMI_BASE

#define MEC_EMI_BASE   0x800

Definition at line 117 of file ec.h.

◆ MEC_EMI_RANGE_END

#define MEC_EMI_RANGE_END   (EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SIZE)

Definition at line 122 of file ec.h.

◆ MEC_EMI_RANGE_START

#define MEC_EMI_RANGE_START   EC_HOST_CMD_REGION0

Definition at line 121 of file ec.h.

◆ MEC_EMI_SIZE

#define MEC_EMI_SIZE   8

Definition at line 118 of file ec.h.

Typedef Documentation

◆ crosec_io_t

typedef int(* crosec_io_t) (size_t req_size, size_t resp_size, void *context)

Definition at line 175 of file ec.h.

Function Documentation

◆ crosec_command_proto()

int crosec_command_proto ( struct chromeec_command cec_command,
crosec_io_t  crosec_io,
void context 
)

Definition at line 240 of file crosec_proto.c.

Referenced by google_chromeec_command().

Here is the caller graph for this function:

◆ crosec_get_buffer()

void* crosec_get_buffer ( size_t  size,
int  req 
)

Definition at line 12 of file crosec_proto.c.

References BIOS_DEBUG, NULL, printk, PROTO3_MAX_PACKET_SIZE, req_buf, and resp_buf.

Referenced by send_command_proto3().

Here is the caller graph for this function:

◆ google_chromeec_ap_reset()

int google_chromeec_ap_reset ( void  )

Send EC command to perform AP reset.

Returns
0 on success, -1 on error

Definition at line 1736 of file ec.c.

References chromeec_command::cmd_code, EC_CMD_AP_RESET, google_chromeec_command(), and NULL.

Here is the call graph for this function:

◆ google_chromeec_battery_cutoff()

int google_chromeec_battery_cutoff ( uint8_t  flags)

Command EC to perform battery cutoff.

Parameters
flagsFlags to pass to the EC
Returns
0 on success, -1 on error

Definition at line 679 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_in, chromeec_command::cmd_data_out, chromeec_command::cmd_dev_index, chromeec_command::cmd_size_out, EC_CMD_BATTERY_CUT_OFF, ec_params_battery_cutoff::flags, google_chromeec_command(), NULL, and params.

Referenced by vb2ex_ec_battery_cutoff().

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

◆ google_chromeec_calc_checksum()

uint8_t google_chromeec_calc_checksum ( const uint8_t data,
int  size 
)

Definition at line 66 of file ec.c.

Referenced by ec_fill_checksum(), and ec_verify_checksum().

Here is the caller graph for this function:

◆ google_chromeec_cbi_get_board_version()

int google_chromeec_cbi_get_board_version ( uint32_t version)

Definition at line 870 of file ec.c.

References cbi_get_uint32(), CBI_TAG_BOARD_VERSION, and version.

Referenced by fpmcu_needs_delay(), update_audio_configuration(), variant_devtree_update(), variant_has_active_low_wifi_power(), variant_override_gpio_table(), variant_uses_v3_6_schematics(), and variant_uses_v3_schematics().

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

◆ google_chromeec_cbi_get_dram_part_num()

int google_chromeec_cbi_get_dram_part_num ( char *  buf,
size_t  bufsize 
)

Definition at line 905 of file ec.c.

References buf, cbi_get_string(), and CBI_TAG_DRAM_PART_NUM.

Referenced by mainboard_save_dimm_info(), and prepare_dmi_17().

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

◆ google_chromeec_cbi_get_fw_config()

int google_chromeec_cbi_get_fw_config ( uint64_t fw_config)

Definition at line 844 of file ec.c.

References cbi_get_uint32(), CBI_TAG_FW_CONFIG, config, CONFIG, and google_chromeec_cbi_get_ssfc().

Referenced by board_info_get_fw_config(), fw_config_get(), and get_fw_config().

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

◆ google_chromeec_cbi_get_oem_id()

int google_chromeec_cbi_get_oem_id ( uint32_t id)

Get data from Cros Board Info.

Parameters
id/fw_config/buf[OUT] value from CBI.
Returns
0 on success or negative integer for errors.

Definition at line 865 of file ec.c.

References cbi_get_uint32(), and CBI_TAG_OEM_ID.

Referenced by board_oem_id(), and read_oem_id().

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

◆ google_chromeec_cbi_get_oem_name()

int google_chromeec_cbi_get_oem_name ( char *  buf,
size_t  bufsize 
)

Definition at line 910 of file ec.c.

References buf, cbi_get_string(), and CBI_TAG_OEM_NAME.

Referenced by smbios_mainboard_manufacturer().

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

◆ google_chromeec_cbi_get_sku_id()

int google_chromeec_cbi_get_sku_id ( uint32_t id)

Definition at line 839 of file ec.c.

References cbi_get_uint32(), and CBI_TAG_SKU_ID.

Referenced by board_sku_id(), get_wifi_sar_cbfs_filename(), google_chromeec_get_board_sku(), sku_id(), variant_board_sku(), variant_override_gpio_table(), and variant_update_devtree().

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

◆ google_chromeec_cbi_get_ssfc()

int google_chromeec_cbi_get_ssfc ( uint32_t ssfc)

Definition at line 875 of file ec.c.

References cbi_get_uint32(), and CBI_TAG_SSFC.

Referenced by get_ssfc(), and google_chromeec_cbi_get_fw_config().

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

◆ google_chromeec_check_feature()

int google_chromeec_check_feature ( int  feature)

◆ google_chromeec_clear_events_b()

int google_chromeec_clear_events_b ( uint64_t  mask)

Definition at line 277 of file ec.c.

References BIOS_DEBUG, EC_HOST_EVENT_B, google_chromeec_clear_mask(), mask, and printk.

Referenced by clear_recovery_mode_switch(), and google_chromeec_log_events().

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

◆ google_chromeec_command()

int google_chromeec_command ( struct chromeec_command cec_command)

Send a command to a CrOS EC.

Parameters
cec_commandCrOS EC command to send
Returns
0 for success. Non-zero for error.

Definition at line 176 of file ec_i2c.c.

References BIOS_DEBUG, BIOS_ERR, chip, EcCommandI2c::command, ec_lpc_host_args::command_version, crosec_command_proto(), crosec_spi_io(), cs_cooldown_sw, EcCommandI2c::data, EcResponseI2c::data, EC_CMD_VERSION0, ec_fill_checksum(), EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED, EC_HOST_CMD_FLAG_VERSION_3, EC_RES_ERROR, EC_RES_INVALID_CHECKSUM, EC_RES_INVALID_PARAM, EC_RES_INVALID_RESPONSE, EC_RES_SUCCESS, ec_verify_checksum(), google_chromeec_command_v1(), google_chromeec_command_v3(), google_chromeec_command_version(), i2c_dump(), i2c_read_raw(), i2c_write_raw(), EcCommandI2c::length, EcResponseI2c::length, MAX_I2C_DATA_SIZE, memcpy(), printk, EcResponseI2c::response, slave, spi_setup_slave(), stopwatch_init(), and EcCommandI2c::version.

Referenced by cbi_get_string(), cbi_get_uint32(), google_chromeec_ap_reset(), google_chromeec_battery_cutoff(), google_chromeec_check_feature(), google_chromeec_efs_verify(), google_chromeec_flash_erase(), google_chromeec_flash_info(), google_chromeec_flash_protect(), google_chromeec_flash_region_info(), google_chromeec_flash_write_block(), google_chromeec_get_board_version(), google_chromeec_get_cmd_versions(), google_chromeec_get_device_current_events(), google_chromeec_get_device_enabled_events(), google_chromeec_get_keybd_config(), google_chromeec_get_mkbp_event(), google_chromeec_get_num_pd_ports(), google_chromeec_get_pd_port_caps(), google_chromeec_get_protocol_info(), google_chromeec_get_sku_id(), google_chromeec_get_uptime_info(), google_chromeec_get_usb_pd_power_info(), google_chromeec_get_vboot_hash(), google_chromeec_handle_non_uhepi_cmd(), google_chromeec_hello(), google_chromeec_i2c_xfer(), google_chromeec_kbbacklight(), google_chromeec_override_dedicated_charger_limit(), google_chromeec_pd_get_amode(), google_chromeec_read_limit_power_request(), google_chromeec_reboot(), google_chromeec_regulator_enable(), google_chromeec_regulator_get_voltage(), google_chromeec_regulator_is_enabled(), google_chromeec_regulator_set_voltage(), google_chromeec_set_device_enabled_events(), google_chromeec_set_sku_id(), google_chromeec_set_usb_charge_mode(), google_chromeec_set_usb_pd_role(), google_chromeec_start_vboot_hash(), google_chromeec_typec_control_enter_dp_mode(), google_chromeec_uhepi_cmd(), google_chromeec_usb_get_pd_mux_info(), google_chromeec_usb_pd_get_info(), google_chromeec_vbnv_context(), google_chromeec_vstore_info(), google_chromeec_vstore_read(), and google_chromeec_vstore_write().

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

◆ google_chromeec_efs_verify()

int google_chromeec_efs_verify ( enum ec_flash_region  region)

Verify flash using EFS if available.

Parameters
regionWhich flash region to verify
Returns
0 on success, -1 on error

Definition at line 653 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_in, chromeec_command::cmd_data_out, chromeec_command::cmd_dev_index, chromeec_command::cmd_size_out, EC_CMD_EFS_VERIFY, EC_RES_INVALID_COMMAND, google_chromeec_command(), NULL, params, and ec_params_efs_verify::region.

Referenced by ec_update_image().

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

◆ google_chromeec_events_init()

void google_chromeec_events_init ( const struct google_chromeec_event_info info,
bool  is_s3_wakeup 
)

◆ google_chromeec_flash_erase()

int google_chromeec_flash_erase ( uint32_t  region_offset,
uint32_t  region_size 
)

Erase a region of EC flash.

Parameters
offsetWhere to begin erasing
sizeSize of area to erase
Returns
0 on success, -1 on error

Definition at line 587 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_in, chromeec_command::cmd_data_out, chromeec_command::cmd_dev_index, chromeec_command::cmd_size_out, EC_CMD_FLASH_ERASE, google_chromeec_command(), NULL, offset, params, and ec_params_flash_erase::size.

Referenced by ec_update_image().

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

◆ google_chromeec_flash_info()

int google_chromeec_flash_info ( struct ec_response_flash_info info)

Return information about the entire flash.

Parameters
infoPointer to response structure
Returns
0 on success, -1 on error

Definition at line 609 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_in, chromeec_command::cmd_data_out, chromeec_command::cmd_dev_index, chromeec_command::cmd_size_in, chromeec_command::cmd_size_out, chromeec_command::cmd_version, EC_CMD_FLASH_INFO, google_chromeec_command(), info, and NULL.

Referenced by ec_flash_write().

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

◆ google_chromeec_flash_protect()

int google_chromeec_flash_protect ( uint32_t  mask,
uint32_t  flags,
struct ec_response_flash_protect resp 
)

Protect/un-protect EC flash regions.

Parameters
maskSet/clear the requested bits in 'flags'
flagsFlash protection flags
respPointer to response structure
Returns
0 on success, -1 on error

Definition at line 536 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_in, chromeec_command::cmd_size_out, EC_CMD_FLASH_PROTECT, EC_VER_FLASH_PROTECT, ec_params_flash_protect::flags, google_chromeec_command(), mask, and params.

Referenced by ec_protect_flash().

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

◆ google_chromeec_flash_region_info()

int google_chromeec_flash_region_info ( enum ec_flash_region  region,
uint32_t offset,
uint32_t size 
)

Get offset and size of the specified EC flash region.

Parameters
regionWhich region of EC flash
offsetGets filled with region's offset
sizeGets filled with region's size
Returns
0 on success, -1 on error

Definition at line 559 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_in, chromeec_command::cmd_size_out, EC_CMD_FLASH_REGION_INFO, EC_VER_FLASH_REGION_INFO, google_chromeec_command(), offset, ec_response_flash_region_info::offset, params, ec_params_flash_region_info::region, and ec_response_flash_region_info::size.

Referenced by ec_update_image().

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

◆ google_chromeec_flash_write_block()

int google_chromeec_flash_write_block ( const uint8_t data,
uint32_t  size 
)

Write a block into EC flash.

Parameters
dataPointer to data to write to flash, prefixed by a struct ec_params_flash_write
offsetOffset to begin writing data
sizeNumber of bytes to be written to flash from data
Returns
0 on success, -1 on error

Definition at line 632 of file ec.c.

References assert, chromeec_command::cmd_code, EC_CMD_FLASH_WRITE, EC_VER_FLASH_WRITE, google_chromeec_command(), and NULL.

Referenced by ec_flash_write().

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

◆ google_chromeec_get_ap_watchdog_flag()

◆ google_chromeec_get_board_sku()

◆ google_chromeec_get_board_version()

int google_chromeec_get_board_version ( uint32_t version)

google_chromeec_get_board_version() - Get the board version

Version
: Out parameter to retrieve the board Version

Return: 0 on success or -1 on failure/error.

This function is used to get the board version information from EC.

Definition at line 915 of file ec.c.

References ec_response_board_version::board_version, chromeec_command::cmd_code, chromeec_command::cmd_data_out, chromeec_command::cmd_dev_index, EC_CMD_GET_BOARD_VERSION, google_chromeec_command(), and version.

Referenced by board_id(), get_board_id_via_ext_ec(), mainboard_init(), samus_board_version(), variant_board_id(), variant_mem_is_half_populated(), and variant_romstage_entry().

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

◆ google_chromeec_get_cmd_versions()

int google_chromeec_get_cmd_versions ( int  command,
uint32_t pmask 
)

Get available versions of the specified command.

Parameters
commandCommand ID
pmaskPointer to version mask
Returns
0 on success, -1 on error

Definition at line 464 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_in, chromeec_command::cmd_size_out, EC_CMD_GET_CMD_VERSIONS, google_chromeec_command(), params, and ec_response_get_cmd_versions::version_mask.

Referenced by fill_ssdt_typec_device().

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

◆ google_chromeec_get_current_image()

◆ google_chromeec_get_device_current_events()

uint64_t google_chromeec_get_device_current_events ( void  )

◆ google_chromeec_get_device_enabled_events()

uint64_t google_chromeec_get_device_enabled_events ( void  )

◆ google_chromeec_get_event()

enum host_event_code google_chromeec_get_event ( void  )

Definition at line 176 of file ec_i2c.c.

Referenced by chromeec_process_one_event(), clear_pending_events(), mainboard_ec_init(), mainboard_smi_apmc(), mainboard_smi_ec(), and mainboard_smi_sleep().

Here is the caller graph for this function:

◆ google_chromeec_get_events_b()

uint64_t google_chromeec_get_events_b ( void  )

Definition at line 272 of file ec.c.

References EC_HOST_EVENT_B, and google_chromeec_get_mask().

Referenced by elog_add_recovery_mode_switch_event(), get_recovery_mode_retrain_switch(), get_recovery_mode_switch(), and google_chromeec_log_events().

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

◆ google_chromeec_get_keybd_config()

int google_chromeec_get_keybd_config ( struct ec_response_keybd_config keybd)

Get the keyboard configuration / layout information from EC.

Parameters
*keybdIf successful, this is filled with EC filled parameters
Returns
0 on success, -1 on error

Definition at line 1718 of file ec.c.

References chromeec_command::cmd_code, EC_CMD_GET_KEYBD_CONFIG, google_chromeec_command(), and NULL.

Referenced by fill_ssdt_ps2_keyboard().

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

◆ google_chromeec_get_mkbp_event()

int google_chromeec_get_mkbp_event ( struct ec_response_get_next_event event)

Definition at line 284 of file ec.c.

References chromeec_command::cmd_code, EC_CMD_GET_NEXT_EVENT, google_chromeec_command(), and NULL.

Referenced by clear_pending_events().

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

◆ google_chromeec_get_num_pd_ports()

int google_chromeec_get_num_pd_ports ( unsigned int *  num_ports)

Get number of PD-capable USB ports from EC.

Parameters
*num_portsIf successful, num_ports is the number of PD-capable USB ports according to the EC.
Returns
0 on success, -1 on error

Definition at line 1419 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_dev_index, EC_CMD_USB_PD_PORTS, google_chromeec_command(), and ec_response_charge_port_count::port_count.

Referenced by fill_ssdt_typec_device().

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

◆ google_chromeec_get_pd_port_caps()

int google_chromeec_get_pd_port_caps ( int  port,
struct usb_pd_port_caps port_caps 
)

Get role-based capabilities for a USB-PD port.

Parameters
portWhich port to get information about
*power_role_capThe power-role capability of the port
*try_power_role_capThe Try-power-role capability of the port
*data_role_capThe data role capability of the port
*port_locationLocation of the port on the device
Returns
0 on success, -1 on error

Definition at line 1440 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_out, chromeec_command::cmd_size_out, usb_pd_port_caps::data_role_cap, EC_CMD_GET_PD_PORT_CAPS, google_chromeec_command(), params, ec_response_get_pd_port_caps::pd_data_role_cap, ec_response_get_pd_port_caps::pd_port_location, ec_response_get_pd_port_caps::pd_power_role_cap, ec_response_get_pd_port_caps::pd_try_power_role_cap, port_caps, usb_pd_port_caps::port_location, usb_pd_port_caps::power_role_cap, and usb_pd_port_caps::try_power_role_cap.

Referenced by fill_ssdt_typec_device().

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

◆ google_chromeec_get_protocol_info()

int google_chromeec_get_protocol_info ( struct ec_response_get_protocol_info resp)

Get information about the protocol that the EC speaks.

Parameters
respFilled with host command protocol information.
Returns
0 on success, -1 on error

Definition at line 734 of file ec.c.

References chromeec_command::cmd_code, EC_CMD_GET_PROTOCOL_INFO, google_chromeec_command(), and NULL.

Referenced by ec_flash_write().

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

◆ google_chromeec_get_sku_id()

uint32_t google_chromeec_get_sku_id ( void  )

Definition at line 934 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_out, chromeec_command::cmd_dev_index, EC_CMD_GET_SKU_ID, google_chromeec_command(), and ec_sku_id_info::sku_id.

Referenced by sku_id(), variant_board_sku(), variant_devtree_update(), and variant_romstage_entry().

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

◆ google_chromeec_get_switches()

uint8_t google_chromeec_get_switches ( void  )

Definition at line 359 of file ec_lpc.c.

References EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SWITCHES, and read_byte().

Referenced by get_lid_switch(), and get_recovery_mode_switch().

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

◆ google_chromeec_get_usb_pd_power_info()

int google_chromeec_get_usb_pd_power_info ( enum usb_chg_type type,
uint16_t current_max,
uint16_t voltage_max 
)

◆ google_chromeec_get_usbc_mux_info()

◆ google_chromeec_get_vboot_hash()

int google_chromeec_get_vboot_hash ( uint32_t  offset,
struct ec_response_vboot_hash resp 
)

Return the EC's vboot image hash.

Parameters
offsetGet hash for flash region beginning here
respPointer to response structure
Returns
0 on success, -1 on error

Definition at line 487 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_in, chromeec_command::cmd_size_out, EC_CMD_VBOOT_HASH, EC_VBOOT_HASH_GET, google_chromeec_command(), offset, and params.

Referenced by ec_hash_image().

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

◆ google_chromeec_get_wake_mask()

uint64_t google_chromeec_get_wake_mask ( void  )

Definition at line 1138 of file ec.c.

References EC_HOST_EVENT_ACTIVE_WAKE_MASK, and google_chromeec_get_mask().

Here is the call graph for this function:

◆ google_chromeec_hello()

int google_chromeec_hello ( void  )

Performs light verification of the EC<->AP communication channel.

Returns
0 on success, -1 on error

Definition at line 1236 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_size_out, EC_CMD_HELLO, google_chromeec_command(), ec_response_hello::out_data, and params.

Referenced by vb2ex_ec_jump_to_rw().

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

◆ google_chromeec_i2c_xfer()

◆ google_chromeec_init()

void google_chromeec_init ( void  )

Definition at line 1470 of file ec.c.

References google_chromeec_log_uptimeinfo().

Referenced by lpc_ec_init().

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

◆ google_chromeec_ioport_range()

void google_chromeec_ioport_range ( uint16_t base,
size_t size 
)

Definition at line 364 of file ec_lpc.c.

References assert, base, CONFIG, EC_HOST_CMD_REGION0, EC_HOST_CMD_REGION_SIZE, EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE, MEC_EMI_BASE, and MEC_EMI_SIZE.

Referenced by bootblock_ec_init(), early_ec_init(), and lpc_ec_read_resources().

Here is the caller graph for this function:

◆ google_chromeec_is_uhepi_supported()

bool google_chromeec_is_uhepi_supported ( void  )

Definition at line 177 of file ec.c.

References BIOS_DEBUG, EC_FEATURE_UNIFIED_WAKE_MASKS, google_chromeec_check_feature(), printk, UHEPI_NOT_SUPPORTED, and UHEPI_SUPPORTED.

Referenced by chromeec_smi_sleep(), google_chromeec_clear_mask(), google_chromeec_events_init(), google_chromeec_get_mask(), and google_chromeec_set_mask().

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

◆ google_chromeec_kbbacklight()

◆ google_chromeec_log_events()

void google_chromeec_log_events ( uint64_t  mask)

Definition at line 386 of file ec.c.

References CONFIG, EC_HOST_EVENT_MASK, elog_add_event_byte(), ELOG_TYPE_EC_EVENT, google_chromeec_clear_events_b(), google_chromeec_get_events_b(), and mask.

Referenced by elog_gsmi_cb_mainboard_log_wake_source(), and google_chromeec_events_init().

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

◆ google_chromeec_override_dedicated_charger_limit()

◆ google_chromeec_post()

void google_chromeec_post ( uint8_t  postcode)

Definition at line 97 of file ec.c.

References google_chromeec_kbbacklight().

Here is the call graph for this function:

◆ google_chromeec_read_limit_power_request()

int google_chromeec_read_limit_power_request ( int *  limit_power)

Check if the EC is requesting the system to limit input power.

Parameters
limit_powerIf successful, limit_power is 1 if EC is requesting input power limits, otherwise 0.
Returns
0 on success, -1 on error

Definition at line 700 of file ec.c.

References BIOS_INFO, CHARGE_STATE_CMD_GET_PARAM, chromeec_command::cmd_code, chromeec_command::cmd_data_in, chromeec_command::cmd_size_out, CS_PARAM_LIMIT_POWER, EC_CMD_CHARGE_STATE, EC_RES_INVALID_COMMAND, EC_RES_INVALID_PARAM, ec_response_charge_state::get_param, google_chromeec_command(), params, and printk.

Referenced by vb2ex_ec_vboot_done().

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

◆ google_chromeec_reboot()

int google_chromeec_reboot ( int  dev_idx,
enum ec_reboot_cmd  type,
uint8_t  flags 
)

Definition at line 794 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_dev_index, chromeec_command::cmd_size_out, EC_CMD_REBOOT_EC, ec_params_reboot_ec::flags, google_chromeec_command(), params, and type.

Referenced by do_board_reset(), vb2ex_ec_disable_jump(), vb2ex_ec_jump_to_rw(), and vboot_sync_ec().

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

◆ google_chromeec_regulator_enable()

int google_chromeec_regulator_enable ( uint32_t  index,
uint8_t  enable 
)

Configure the regulator as enabled / disabled.

Parameters
indexRegulator ID
enableSet to enable / disable the regulator
Returns
0 on success, -1 on error

Definition at line 1754 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_out, chromeec_command::cmd_dev_index, chromeec_command::cmd_size_out, EC_CMD_REGULATOR_ENABLE, ec_params_regulator_enable::enable, google_chromeec_command(), ec_params_regulator_enable::index, NULL, and params.

Referenced by mainboard_enable_regulator().

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

◆ google_chromeec_regulator_get_voltage()

int google_chromeec_regulator_get_voltage ( uint32_t  index,
uint32_t voltage_mv 
)

Get the currently configured voltage for the voltage regulator.

Parameters
indexRegulator ID
*voltage_mvIf successful, voltage_mv is filled with current voltage
Returns
0 on success, -1 on error

Definition at line 1824 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_out, chromeec_command::cmd_size_out, EC_CMD_REGULATOR_GET_VOLTAGE, google_chromeec_command(), ec_params_regulator_get_voltage::index, params, and ec_response_regulator_get_voltage::voltage_mv.

Referenced by mainboard_get_regulator_vol().

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

◆ google_chromeec_regulator_is_enabled()

int google_chromeec_regulator_is_enabled ( uint32_t  index,
uint8_t enabled 
)

Query if the regulator is enabled.

Parameters
indexRegulator ID
*enabledIf successful, enabled indicates enable/disable status.
Returns
0 on success, -1 on error

Definition at line 1776 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_out, chromeec_command::cmd_size_out, EC_CMD_REGULATOR_IS_ENABLED, ec_response_regulator_is_enabled::enabled, google_chromeec_command(), ec_params_regulator_is_enabled::index, and params.

Referenced by mainboard_regulator_is_enabled().

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

◆ google_chromeec_regulator_set_voltage()

int google_chromeec_regulator_set_voltage ( uint32_t  index,
uint32_t  min_mv,
uint32_t  max_mv 
)

Set voltage for the voltage regulator within the range specified.

Parameters
indexRegulator ID
min_mvMinimum voltage
max_mvMaximum voltage
Returns
0 on success, -1 on error

Definition at line 1800 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_out, chromeec_command::cmd_dev_index, chromeec_command::cmd_size_out, EC_CMD_REGULATOR_SET_VOLTAGE, google_chromeec_command(), ec_params_regulator_set_voltage::index, ec_params_regulator_set_voltage::max_mv, ec_params_regulator_set_voltage::min_mv, NULL, and params.

Referenced by mainboard_set_regulator_vol().

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

◆ google_chromeec_set_device_enabled_events()

int google_chromeec_set_device_enabled_events ( uint64_t  mask)

Definition at line 323 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_out, chromeec_command::cmd_size_out, EC_CMD_DEVICE_EVENT, EC_DEVICE_EVENT_PARAM_SET_ENABLED_EVENTS, google_chromeec_command(), mask, ec_params_device_event::param, and params.

Referenced by chromeec_smi_device_event_sleep().

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

◆ google_chromeec_set_sci_mask()

int google_chromeec_set_sci_mask ( uint64_t  mask)

Definition at line 1119 of file ec.c.

References BIOS_DEBUG, EC_HOST_EVENT_SCI_MASK, google_chromeec_set_mask(), mask, and printk.

Referenced by chromeec_smi_apmc(), chromeec_smi_sleep(), google_chromeec_events_init(), mainboard_smi_apmc(), and mainboard_smi_sleep().

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

◆ google_chromeec_set_sku_id()

int google_chromeec_set_sku_id ( uint32_t  skuid)

Definition at line 753 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_in, chromeec_command::cmd_data_out, chromeec_command::cmd_dev_index, chromeec_command::cmd_size_out, EC_CMD_SET_SKU_ID, google_chromeec_command(), NULL, and params.

Referenced by configure_ec(), and variant_board_ec_set_skuid().

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

◆ google_chromeec_set_smi_mask()

int google_chromeec_set_smi_mask ( uint64_t  mask)

Definition at line 1125 of file ec.c.

References BIOS_DEBUG, EC_HOST_EVENT_SMI_MASK, google_chromeec_set_mask(), mask, and printk.

Referenced by chromeec_smi_apmc(), chromeec_smi_sleep(), google_chromeec_events_init(), mainboard_smi_apmc(), and mainboard_smi_sleep().

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

◆ google_chromeec_set_usb_charge_mode()

int google_chromeec_set_usb_charge_mode ( uint8_t  port_id,
enum usb_charge_mode  mode 
)

◆ google_chromeec_set_usb_pd_role()

int google_chromeec_set_usb_pd_role ( uint8_t  port,
enum usb_pd_control_role  role 
)

Definition at line 1214 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_out, chromeec_command::cmd_size_out, EC_CMD_USB_PD_CONTROL, google_chromeec_command(), params, ec_params_usb_pd_control::role, USB_PD_CTRL_MUX_NO_CHANGE, and USB_PD_CTRL_SWAP_NONE.

Referenced by usb_power_cycle().

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

◆ google_chromeec_set_wake_mask()

int google_chromeec_set_wake_mask ( uint64_t  mask)

Definition at line 1131 of file ec.c.

References BIOS_DEBUG, EC_HOST_EVENT_ACTIVE_WAKE_MASK, google_chromeec_set_mask(), mask, and printk.

Referenced by chromeec_smi_sleep(), google_chromeec_events_init(), and mainboard_smi_sleep().

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

◆ google_chromeec_smbios_system_sku()

const char* google_chromeec_smbios_system_sku ( void  )

Definition at line 9 of file ec_smbios.c.

References google_chromeec_get_board_sku(), sku_id(), and snprintf().

Referenced by smbios_system_sku().

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

◆ google_chromeec_start_vboot_hash()

int google_chromeec_start_vboot_hash ( enum ec_vboot_hash_type  hash_type,
uint32_t  offset,
struct ec_response_vboot_hash resp 
)

Calculate image hash for vboot.

Parameters
hash_typeThe hash types supported by the EC for vboot
offsetThe offset to start hashing in flash
respPointer to response structure
Returns
0 on success, -1 on error

Definition at line 510 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_in, chromeec_command::cmd_size_out, EC_CMD_VBOOT_HASH, EC_VBOOT_HASH_START, google_chromeec_command(), ec_params_vboot_hash::hash_type, and params.

Referenced by ec_hash_image().

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

◆ google_chromeec_typec_control_enter_dp_mode()

◆ google_chromeec_usb_get_pd_mux_info()

int google_chromeec_usb_get_pd_mux_info ( int  port,
uint8_t flags 
)

Check for the current mux state in EC.

Flags representing the mux state found in ec_commands.h

Definition at line 1543 of file ec.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_out, chromeec_command::cmd_size_out, EC_CMD_USB_PD_MUX_INFO, ec_response_usb_pd_mux_info::flags, google_chromeec_command(), and ec_params_usb_pd_mux_info::port.

Referenced by google_chromeec_get_usbc_mux_info(), and google_chromeec_wait_for_dp_hpd().

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

◆ google_chromeec_vbnv_context()

int google_chromeec_vbnv_context ( int  is_read,
uint8_t data,
int  len 
)

◆ google_chromeec_vstore_info()

int google_chromeec_vstore_info ( uint32_t locked)

Definition at line 22 of file vstore.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_out, EC_CMD_VSTORE_INFO, google_chromeec_command(), and info.

Referenced by vboot_save_hash().

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

◆ google_chromeec_vstore_read()

int google_chromeec_vstore_read ( int  slot,
uint8_t data 
)

◆ google_chromeec_vstore_supported()

int google_chromeec_vstore_supported ( void  )

Definition at line 11 of file vstore.c.

References EC_FEATURE_VSTORE, and google_chromeec_check_feature().

Here is the call graph for this function:

◆ google_chromeec_vstore_write()

int google_chromeec_vstore_write ( int  slot,
uint8_t data,
size_t  size 
)

Definition at line 75 of file vstore.c.

References chromeec_command::cmd_code, chromeec_command::cmd_data_in, ec_params_vstore_write::data, EC_CMD_VSTORE_WRITE, EC_VSTORE_SLOT_MAX, EC_VSTORE_SLOT_SIZE, google_chromeec_command(), memcpy(), and ec_params_vstore_write::slot.

Referenced by vboot_save_hash().

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

◆ google_chromeec_wait_for_displayport()

int google_chromeec_wait_for_displayport ( long  timeout_ms)

Wait for DisplayPort to be ready.

Parameters
timeout_msWait aborts after <timeout_ms> ms.
Returns
-1: Error. 0: Timeout. >=1: Bitmask of the ports that DP device is connected

Definition at line 1668 of file ec.c.

References BIOS_ERR, BIOS_INFO, BIOS_WARNING, google_chromeec_pd_get_amode(), mdelay(), printk, stopwatch_duration_msecs(), stopwatch_expired(), stopwatch_init_msecs_expire(), and USB_SID_DISPLAYPORT.

Referenced by variant_chip_display_init(), and variant_ramstage_init().

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

◆ google_chromeec_wait_for_dp_hpd()

int google_chromeec_wait_for_dp_hpd ( int  port,
long  timeout_ms 
)

◆ google_ec_running_ro()

int google_ec_running_ro ( void  )

Definition at line 1475 of file ec.c.

References EC_IMAGE_RO, and google_chromeec_get_current_image().

Referenced by vb2ex_ec_running_rw().

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