![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include <console/console.h>
#include <delay.h>
#include <device/device.h>
#include <device/path.h>
#include <elog.h>
#include <rtc.h>
#include <security/vboot/vboot_common.h>
#include <stdlib.h>
#include <timer.h>
#include "ec.h"
Go to the source code of this file.
Macros | |
#define | INVALID_HCMD 0xFF |
#define | UHEPI_SUPPORTED 1 |
#define | UHEPI_NOT_SUPPORTED 2 |
#define | USB_SID_DISPLAYPORT 0xff01 |
Variables | |
struct { | |
uint8_t set_cmd | |
uint8_t clear_cmd | |
uint8_t get_cmd | |
} | event_map [] |
#define UHEPI_NOT_SUPPORTED 2 |
#define UHEPI_SUPPORTED 1 |
Definition at line 880 of file ec.c.
References buf, chromeec_command::cmd_code, chromeec_command::cmd_size_out, EC_CMD_GET_CROS_BOARD_INFO, google_chromeec_command(), params, and ec_params_get_cbi::tag.
Referenced by google_chromeec_cbi_get_dram_part_num(), and google_chromeec_cbi_get_oem_name().
Definition at line 814 of file ec.c.
References chromeec_command::cmd_code, chromeec_command::cmd_size_out, EC_CMD_GET_CROS_BOARD_INFO, google_chromeec_command(), params, and ec_params_get_cbi::tag.
Referenced by google_chromeec_cbi_get_board_version(), google_chromeec_cbi_get_fw_config(), google_chromeec_cbi_get_oem_id(), google_chromeec_cbi_get_sku_id(), and google_chromeec_cbi_get_ssfc().
int google_chromeec_ap_reset | ( | void | ) |
Send EC command to perform AP reset.
Definition at line 1736 of file ec.c.
References chromeec_command::cmd_code, EC_CMD_AP_RESET, google_chromeec_command(), and NULL.
int google_chromeec_battery_cutoff | ( | uint8_t | flags | ) |
Command EC to perform battery cutoff.
flags | Flags to pass to the EC |
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().
Definition at line 66 of file ec.c.
Referenced by ec_fill_checksum(), and ec_verify_checksum().
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().
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().
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().
int google_chromeec_cbi_get_oem_id | ( | uint32_t * | id | ) |
Get data from Cros Board Info.
id/fw_config/buf | [OUT] value from CBI. |
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().
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().
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().
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().
int google_chromeec_check_feature | ( | int | feature | ) |
Definition at line 443 of file ec.c.
References chromeec_command::cmd_code, chromeec_command::cmd_dev_index, EC_CMD_GET_FEATURES, EC_FEATURE_MASK_0, ec_response_get_features::flags, and google_chromeec_command().
Referenced by google_chromeec_is_uhepi_supported(), google_chromeec_log_device_events(), google_chromeec_typec_control_enter_dp_mode(), and google_chromeec_vstore_supported().
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().
Definition at line 210 of file ec.c.
References ARRAY_SIZE, assert, clear_cmd, EC_HOST_EVENT_CLEAR, event_map, google_chromeec_handle_non_uhepi_cmd(), google_chromeec_is_uhepi_supported(), google_chromeec_uhepi_cmd(), mask, and type.
Referenced by google_chromeec_clear_events_b().
int google_chromeec_efs_verify | ( | enum ec_flash_region | region | ) |
Verify flash using EFS if available.
region | Which flash region to verify |
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().
void google_chromeec_events_init | ( | const struct google_chromeec_event_info * | info, |
bool | is_s3_wakeup | ||
) |
Definition at line 410 of file ec.c.
References google_chromeec_is_uhepi_supported(), google_chromeec_log_device_events(), google_chromeec_log_events(), google_chromeec_set_lazy_wake_masks(), google_chromeec_set_sci_mask(), google_chromeec_set_smi_mask(), google_chromeec_set_wake_mask(), and info.
Referenced by link_ec_init(), mainboard_ec_init(), and ramstage_ec_init().
Erase a region of EC flash.
offset | Where to begin erasing |
size | Size of area to erase |
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().
int google_chromeec_flash_info | ( | struct ec_response_flash_info * | info | ) |
Return information about the entire flash.
info | Pointer to response structure |
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().
int google_chromeec_flash_protect | ( | uint32_t | mask, |
uint32_t | flags, | ||
struct ec_response_flash_protect * | resp | ||
) |
Protect/un-protect EC flash regions.
mask | Set/clear the requested bits in 'flags' |
flags | Flash protection flags |
resp | Pointer to response structure |
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().
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.
region | Which region of EC flash |
offset | Gets filled with region's offset |
size | Gets filled with region's size |
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().
Write a block into EC flash.
data | Pointer to data to write to flash, prefixed by a struct ec_params_flash_write |
offset | Offset to begin writing data |
size | Number of bytes to be written to flash from data |
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().
Definition at line 1008 of file ec.c.
References ARRAY_SIZE, CHIPSET_RESET_AP_WATCHDOG, EC_RESET_FLAG_AP_WATCHDOG, ec_response_uptime_info::ec_reset_flags, google_chromeec_get_uptime_info(), ec_response_uptime_info::recent_ap_reset, ec_response_uptime_info::ap_reset_log_entry::reset_cause, and ec_response_uptime_info::ap_reset_log_entry::reset_time_ms.
int google_chromeec_get_board_version | ( | uint32_t * | version | ) |
google_chromeec_get_board_version() - Get 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().
int google_chromeec_get_cmd_versions | ( | int | command, |
uint32_t * | pmask | ||
) |
Get available versions of the specified command.
command | Command ID |
pmask | Pointer to version mask |
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().
Definition at line 1313 of file ec.c.
References ec_response_uptime_info::ap_resets_since_ec_boot, ARRAY_SIZE, BIOS_DEBUG, ec_response_uptime_info::ec_reset_flags, google_chromeec_get_uptime_info(), MSECS_PER_SEC, printk, ec_response_uptime_info::recent_ap_reset, ec_response_uptime_info::ap_reset_log_entry::reset_cause, reset_cause_to_str(), ec_response_uptime_info::ap_reset_log_entry::reset_time_ms, and ec_response_uptime_info::time_since_ec_boot_ms.
Referenced by google_ec_running_ro().
Definition at line 344 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_GET_CURRENT_EVENTS, ec_response_device_event::event_mask, google_chromeec_command(), and params.
Referenced by chromeec_smi_device_event_sleep(), and google_chromeec_log_device_events().
Definition at line 300 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_GET_ENABLED_EVENTS, ec_response_device_event::event_mask, google_chromeec_command(), and params.
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().
int google_chromeec_get_keybd_config | ( | struct ec_response_keybd_config * | keybd | ) |
Get the keyboard configuration / layout information from EC.
*keybd | If successful, this is filled with EC filled parameters |
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().
Definition at line 195 of file ec.c.
References ARRAY_SIZE, assert, EC_HOST_EVENT_GET, event_map, get_cmd, google_chromeec_handle_non_uhepi_cmd(), google_chromeec_is_uhepi_supported(), google_chromeec_uhepi_cmd(), type, and value.
Referenced by google_chromeec_get_events_b(), and google_chromeec_get_wake_mask().
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().
int google_chromeec_get_num_pd_ports | ( | unsigned int * | num_ports | ) |
Get number of PD-capable USB ports from EC.
*num_ports | If successful, num_ports is the number of PD-capable USB ports according to the EC. |
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().
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.
port | Which port to get information about |
*power_role_cap | The power-role capability of the port |
*try_power_role_cap | The Try-power-role capability of the port |
*data_role_cap | The data role capability of the port |
*port_location | Location of the port on the device |
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().
int google_chromeec_get_protocol_info | ( | struct ec_response_get_protocol_info * | resp | ) |
Get information about the protocol that the EC speaks.
resp | Filled with host command protocol information. |
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().
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().
|
static |
Definition at line 991 of file ec.c.
References chromeec_command::cmd_code, EC_CMD_GET_UPTIME_INFO, google_chromeec_command(), and NULL.
Referenced by google_chromeec_get_ap_watchdog_flag(), and google_chromeec_get_current_image().
int google_chromeec_get_usb_pd_power_info | ( | enum usb_chg_type * | type, |
uint16_t * | current_max, | ||
uint16_t * | voltage_max | ||
) |
Definition at line 1163 of file ec.c.
References chromeec_command::cmd_code, chromeec_command::cmd_data_out, chromeec_command::cmd_size_out, usb_chg_measures::current_max, EC_CMD_USB_PD_POWER_INFO, google_chromeec_command(), m, ec_response_usb_pd_power_info::meas, params, PD_POWER_CHARGING_PORT, ec_response_usb_pd_power_info::type, type, and usb_chg_measures::voltage_max.
Referenced by mainboard_set_power_limits(), and variant_update_psys_power_limits().
int google_chromeec_get_usbc_mux_info | ( | int | port, |
struct usbc_mux_info * | mux_info | ||
) |
Definition at line 1575 of file ec.c.
References BIOS_ERR, usbc_mux_info::cable, usbc_mux_info::dbg_acc, usbc_mux_info::dp, usbc_mux_info::dp_pin_mode, google_chromeec_usb_get_pd_mux_info(), google_chromeec_usb_pd_get_info(), usbc_mux_info::hpd_irq, usbc_mux_info::hpd_lvl, usbc_mux_info::polarity, printk, usbc_mux_info::ufp, usbc_mux_info::usb, USB_PD_MUX_DP_ENABLED, USB_PD_MUX_HPD_IRQ, USB_PD_MUX_HPD_LVL, USB_PD_MUX_POLARITY_INVERTED, and USB_PD_MUX_USB_ENABLED.
int google_chromeec_get_vboot_hash | ( | uint32_t | offset, |
struct ec_response_vboot_hash * | resp | ||
) |
Return the EC's vboot image hash.
offset | Get hash for flash region beginning here |
resp | Pointer to response structure |
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().
Definition at line 1138 of file ec.c.
References EC_HOST_EVENT_ACTIVE_WAKE_MASK, and google_chromeec_get_mask().
|
static |
Definition at line 143 of file ec.c.
References chromeec_command::cmd_code, chromeec_command::cmd_data_out, chromeec_command::cmd_size_out, EC_HOST_EVENT_GET, google_chromeec_command(), INVALID_HCMD, ec_response_host_event_mask::mask, params, and value.
Referenced by google_chromeec_clear_mask(), google_chromeec_get_mask(), and google_chromeec_set_mask().
int google_chromeec_hello | ( | void | ) |
Performs light verification of the EC<->AP communication channel.
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().
int google_chromeec_i2c_xfer | ( | uint8_t | chip, |
uint8_t | addr, | ||
int | alen, | ||
uint8_t * | buffer, | ||
int | len, | ||
int | is_read | ||
) |
Definition at line 1030 of file ec.c.
References addr, ec_params_i2c_passthru_msg::addr_flags, BIOS_ERR, buffer, chip, 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_response_i2c_passthru::data, EC_CMD_I2C_PASSTHRU, EC_HOST_PARAM_SIZE, EC_I2C_FLAG_READ, EC_I2C_STATUS_ERROR, google_chromeec_command(), ec_response_i2c_passthru::i2c_status, ec_params_i2c_passthru_msg::len, memcpy(), ec_params_i2c_passthru::msg, ec_params_i2c_passthru::num_msgs, params, ec_params_i2c_passthru::port, and printk.
Referenced by tps65090_thru_ec_fet_disable(), and tps65090_thru_ec_fet_set().
Definition at line 1470 of file ec.c.
References google_chromeec_log_uptimeinfo().
Referenced by lpc_ec_init().
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().
int google_chromeec_kbbacklight | ( | int | percent | ) |
Definition at line 75 of file ec.c.
References BIOS_DEBUG, chromeec_command::cmd_code, chromeec_command::cmd_size_out, EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT, google_chromeec_command(), params, ec_response_pwm_get_keyboard_backlight::percent, ec_params_pwm_set_keyboard_backlight::percent, and printk.
Referenced by google_chromeec_post(), mainboard_early_init(), mainboard_memory_init_params(), mainboard_post_raminit(), and variant_romstage_entry().
Definition at line 366 of file ec.c.
References BIOS_INFO, CONFIG, EC_DEVICE_EVENT_MASK, EC_FEATURE_DEVICE_EVENT, elog_add_event_byte(), ELOG_TYPE_EC_DEVICE_EVENT, google_chromeec_check_feature(), google_chromeec_get_device_current_events(), mask, and printk.
Referenced by google_chromeec_events_init().
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().
Definition at line 1313 of file ec.c.
Referenced by google_chromeec_init().
Definition at line 1194 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_params_dedicated_charger_limit::current_lim, EC_CMD_OVERRIDE_DEDICATED_CHARGER_LIMIT, google_chromeec_command(), NULL, params, and ec_params_dedicated_charger_limit::voltage_lim.
|
static |
Check if EC/TCPM is in an alternate mode or not.
svid | SVID of the alternate mode to check |
Definition at line 1612 of file ec.c.
References BIT, 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_USB_PD_GET_AMODE, EC_CMD_USB_PD_PORTS, google_chromeec_command(), NULL, ec_response_usb_pd_ports::num_ports, params, and ec_params_usb_pd_get_mode_response::svid.
Referenced by google_chromeec_wait_for_displayport().
Definition at line 97 of file ec.c.
References google_chromeec_kbbacklight().
int google_chromeec_read_limit_power_request | ( | int * | limit_power | ) |
Check if the EC is requesting the system to limit input power.
limit_power | If successful, limit_power is 1 if EC is requesting input power limits, otherwise 0. |
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().
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().
Configure the regulator as enabled / disabled.
index | Regulator ID |
enable | Set to enable / disable the regulator |
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().
Get the currently configured voltage for the voltage regulator.
index | Regulator ID |
*voltage_mv | If successful, voltage_mv is filled with current voltage |
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().
Query if the regulator is enabled.
index | Regulator ID |
*enabled | If successful, enabled indicates enable/disable status. |
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().
Set voltage for the voltage regulator within the range specified.
index | Regulator ID |
min_mv | Minimum voltage |
max_mv | Maximum voltage |
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().
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().
|
static |
Definition at line 257 of file ec.c.
References BIOS_DEBUG, google_chromeec_set_s0ix_lazy_wake_mask(), google_chromeec_set_s3_lazy_wake_mask(), google_chromeec_set_s5_lazy_wake_mask(), and printk.
Referenced by google_chromeec_events_init().
Definition at line 222 of file ec.c.
References ARRAY_SIZE, assert, EC_HOST_EVENT_SET, event_map, google_chromeec_handle_non_uhepi_cmd(), google_chromeec_is_uhepi_supported(), google_chromeec_uhepi_cmd(), mask, set_cmd, and type.
Referenced by google_chromeec_set_s0ix_lazy_wake_mask(), google_chromeec_set_s3_lazy_wake_mask(), google_chromeec_set_s5_lazy_wake_mask(), google_chromeec_set_sci_mask(), google_chromeec_set_smi_mask(), and google_chromeec_set_wake_mask().
|
static |
Definition at line 250 of file ec.c.
References BIOS_DEBUG, EC_HOST_EVENT_LAZY_WAKE_MASK_S0IX, google_chromeec_set_mask(), mask, and printk.
Referenced by google_chromeec_set_lazy_wake_masks().
|
static |
Definition at line 234 of file ec.c.
References BIOS_DEBUG, EC_HOST_EVENT_LAZY_WAKE_MASK_S3, google_chromeec_set_mask(), mask, and printk.
Referenced by google_chromeec_set_lazy_wake_masks().
|
static |
Definition at line 242 of file ec.c.
References BIOS_DEBUG, EC_HOST_EVENT_LAZY_WAKE_MASK_S5, google_chromeec_set_mask(), mask, and printk.
Referenced by google_chromeec_set_lazy_wake_masks().
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().
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().
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().
int google_chromeec_set_usb_charge_mode | ( | uint8_t | port_id, |
enum usb_charge_mode | mode | ||
) |
Definition at line 1143 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_USB_CHARGE_SET_MODE, google_chromeec_command(), ec_params_usb_charge_set_mode::mode, NULL, and params.
Referenced by mainboard_smi_sleep().
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().
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().
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.
hash_type | The hash types supported by the EC for vboot |
offset | The offset to start hashing in flash |
resp | Pointer to response structure |
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().
int google_chromeec_typec_control_enter_dp_mode | ( | int | port | ) |
Definition at line 1512 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_TYPEC_CONTROL, EC_FEATURE_TYPEC_REQUIRE_AP_MODE_ENTRY, google_chromeec_check_feature(), google_chromeec_command(), NULL, ec_params_typec_control::port, TYPEC_CONTROL_COMMAND_ENTER_MODE, and TYPEC_MODE_DP.
Definition at line 110 of file ec.c.
References ec_params_host_event::action, chromeec_command::cmd_code, chromeec_command::cmd_data_out, chromeec_command::cmd_size_out, EC_CMD_HOST_EVENT, EC_HOST_EVENT_GET, google_chromeec_command(), mask, params, value, and ec_response_host_event::value.
Referenced by google_chromeec_clear_mask(), google_chromeec_get_mask(), and google_chromeec_set_mask().
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().
|
static |
Definition at line 1481 of file ec.c.
References ec_response_usb_pd_control_v2::cc_state, chromeec_command::cmd_code, chromeec_command::cmd_data_out, chromeec_command::cmd_size_out, ec_response_usb_pd_control_v2::control_flags, ec_response_usb_pd_control_v2::dp_mode, EC_CMD_USB_PD_CONTROL, google_chromeec_command(), PD_CC_DFP_ATTACHED, PD_CC_DFP_DEBUG_ACC, ec_params_usb_pd_control::port, USB_PD_CTRL_ACTIVE_CABLE, USB_PD_CTRL_ROLE_NO_CHANGE, and USB_PD_CTRL_SWAP_NONE.
Referenced by google_chromeec_get_usbc_mux_info().
int google_chromeec_vbnv_context | ( | int | is_read, |
uint8_t * | data, | ||
int | len | ||
) |
Definition at line 952 of file ec.c.
References BIOS_ERR, ec_response_vbnvcontext::block, chromeec_command::cmd_code, chromeec_command::cmd_size_out, EC_CMD_VBNV_CONTEXT, EC_VBNV_BLOCK_SIZE, EC_VBNV_CONTEXT_OP_READ, EC_VBNV_CONTEXT_OP_WRITE, EC_VER_VBNV_CONTEXT, google_chromeec_command(), mdelay(), memcpy(), params, printk, and retry.
Referenced by read_vbnv_ec(), and save_vbnv_ec().
int google_chromeec_wait_for_displayport | ( | long | timeout_ms | ) |
Wait for DisplayPort to be ready.
timeout_ms | Wait aborts after <timeout_ms> ms. |
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().
int google_chromeec_wait_for_dp_hpd | ( | int | port, |
long | timeout_ms | ||
) |
Definition at line 1699 of file ec.c.
References BIOS_INFO, BIOS_WARNING, google_chromeec_usb_get_pd_mux_info(), mdelay(), printk, stopwatch_duration_msecs(), stopwatch_expired(), stopwatch_init_msecs_expire(), USB_PD_MUX_DP_ENABLED, and USB_PD_MUX_HPD_LVL.
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().
|
static |
Definition at line 1267 of file ec.c.
References ARRAY_SIZE.
Referenced by google_chromeec_get_current_image().
uint8_t clear_cmd |
Definition at line 26 of file ec.c.
Referenced by google_chromeec_clear_mask().
const { ... } event_map[] |
Referenced by google_chromeec_clear_mask(), google_chromeec_get_mask(), and google_chromeec_set_mask().
uint8_t get_cmd |
Definition at line 27 of file ec.c.
Referenced by google_chromeec_get_mask().
uint8_t set_cmd |
Definition at line 25 of file ec.c.
Referenced by google_chromeec_set_mask().