cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

cros_ec_trace.c (8502B)


      1// SPDX-License-Identifier: GPL-2.0
      2// Trace events for the ChromeOS Embedded Controller
      3//
      4// Copyright 2019 Google LLC.
      5
      6#define TRACE_SYMBOL(a) {a, #a}
      7
      8// Generate the list using the following script:
      9// sed -n 's/^#define \(EC_CMD_[[:alnum:]_]*\)\s.*/\tTRACE_SYMBOL(\1), \\/p' include/linux/platform_data/cros_ec_commands.h
     10#define EC_CMDS \
     11	TRACE_SYMBOL(EC_CMD_ACPI_READ), \
     12	TRACE_SYMBOL(EC_CMD_ACPI_WRITE), \
     13	TRACE_SYMBOL(EC_CMD_ACPI_BURST_ENABLE), \
     14	TRACE_SYMBOL(EC_CMD_ACPI_BURST_DISABLE), \
     15	TRACE_SYMBOL(EC_CMD_ACPI_QUERY_EVENT), \
     16	TRACE_SYMBOL(EC_CMD_PROTO_VERSION), \
     17	TRACE_SYMBOL(EC_CMD_HELLO), \
     18	TRACE_SYMBOL(EC_CMD_GET_VERSION), \
     19	TRACE_SYMBOL(EC_CMD_READ_TEST), \
     20	TRACE_SYMBOL(EC_CMD_GET_BUILD_INFO), \
     21	TRACE_SYMBOL(EC_CMD_GET_CHIP_INFO), \
     22	TRACE_SYMBOL(EC_CMD_GET_BOARD_VERSION), \
     23	TRACE_SYMBOL(EC_CMD_READ_MEMMAP), \
     24	TRACE_SYMBOL(EC_CMD_GET_CMD_VERSIONS), \
     25	TRACE_SYMBOL(EC_CMD_GET_COMMS_STATUS), \
     26	TRACE_SYMBOL(EC_CMD_TEST_PROTOCOL), \
     27	TRACE_SYMBOL(EC_CMD_GET_PROTOCOL_INFO), \
     28	TRACE_SYMBOL(EC_CMD_GSV_PAUSE_IN_S5), \
     29	TRACE_SYMBOL(EC_CMD_GET_FEATURES), \
     30	TRACE_SYMBOL(EC_CMD_GET_SKU_ID), \
     31	TRACE_SYMBOL(EC_CMD_SET_SKU_ID), \
     32	TRACE_SYMBOL(EC_CMD_FLASH_INFO), \
     33	TRACE_SYMBOL(EC_CMD_FLASH_READ), \
     34	TRACE_SYMBOL(EC_CMD_FLASH_WRITE), \
     35	TRACE_SYMBOL(EC_CMD_FLASH_ERASE), \
     36	TRACE_SYMBOL(EC_CMD_FLASH_PROTECT), \
     37	TRACE_SYMBOL(EC_CMD_FLASH_REGION_INFO), \
     38	TRACE_SYMBOL(EC_CMD_VBNV_CONTEXT), \
     39	TRACE_SYMBOL(EC_CMD_FLASH_SPI_INFO), \
     40	TRACE_SYMBOL(EC_CMD_FLASH_SELECT), \
     41	TRACE_SYMBOL(EC_CMD_PWM_GET_FAN_TARGET_RPM), \
     42	TRACE_SYMBOL(EC_CMD_PWM_SET_FAN_TARGET_RPM), \
     43	TRACE_SYMBOL(EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT), \
     44	TRACE_SYMBOL(EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT), \
     45	TRACE_SYMBOL(EC_CMD_PWM_SET_FAN_DUTY), \
     46	TRACE_SYMBOL(EC_CMD_PWM_SET_DUTY), \
     47	TRACE_SYMBOL(EC_CMD_PWM_GET_DUTY), \
     48	TRACE_SYMBOL(EC_CMD_LIGHTBAR_CMD), \
     49	TRACE_SYMBOL(EC_CMD_LED_CONTROL), \
     50	TRACE_SYMBOL(EC_CMD_VBOOT_HASH), \
     51	TRACE_SYMBOL(EC_CMD_MOTION_SENSE_CMD), \
     52	TRACE_SYMBOL(EC_CMD_FORCE_LID_OPEN), \
     53	TRACE_SYMBOL(EC_CMD_CONFIG_POWER_BUTTON), \
     54	TRACE_SYMBOL(EC_CMD_USB_CHARGE_SET_MODE), \
     55	TRACE_SYMBOL(EC_CMD_PSTORE_INFO), \
     56	TRACE_SYMBOL(EC_CMD_PSTORE_READ), \
     57	TRACE_SYMBOL(EC_CMD_PSTORE_WRITE), \
     58	TRACE_SYMBOL(EC_CMD_RTC_GET_VALUE), \
     59	TRACE_SYMBOL(EC_CMD_RTC_GET_ALARM), \
     60	TRACE_SYMBOL(EC_CMD_RTC_SET_VALUE), \
     61	TRACE_SYMBOL(EC_CMD_RTC_SET_ALARM), \
     62	TRACE_SYMBOL(EC_CMD_PORT80_LAST_BOOT), \
     63	TRACE_SYMBOL(EC_CMD_PORT80_READ), \
     64	TRACE_SYMBOL(EC_CMD_VSTORE_INFO), \
     65	TRACE_SYMBOL(EC_CMD_VSTORE_READ), \
     66	TRACE_SYMBOL(EC_CMD_VSTORE_WRITE), \
     67	TRACE_SYMBOL(EC_CMD_THERMAL_SET_THRESHOLD), \
     68	TRACE_SYMBOL(EC_CMD_THERMAL_GET_THRESHOLD), \
     69	TRACE_SYMBOL(EC_CMD_THERMAL_AUTO_FAN_CTRL), \
     70	TRACE_SYMBOL(EC_CMD_TMP006_GET_CALIBRATION), \
     71	TRACE_SYMBOL(EC_CMD_TMP006_SET_CALIBRATION), \
     72	TRACE_SYMBOL(EC_CMD_TMP006_GET_RAW), \
     73	TRACE_SYMBOL(EC_CMD_MKBP_STATE), \
     74	TRACE_SYMBOL(EC_CMD_MKBP_INFO), \
     75	TRACE_SYMBOL(EC_CMD_MKBP_SIMULATE_KEY), \
     76	TRACE_SYMBOL(EC_CMD_GET_KEYBOARD_ID), \
     77	TRACE_SYMBOL(EC_CMD_MKBP_SET_CONFIG), \
     78	TRACE_SYMBOL(EC_CMD_MKBP_GET_CONFIG), \
     79	TRACE_SYMBOL(EC_CMD_KEYSCAN_SEQ_CTRL), \
     80	TRACE_SYMBOL(EC_CMD_GET_NEXT_EVENT), \
     81	TRACE_SYMBOL(EC_CMD_KEYBOARD_FACTORY_TEST), \
     82	TRACE_SYMBOL(EC_CMD_TEMP_SENSOR_GET_INFO), \
     83	TRACE_SYMBOL(EC_CMD_HOST_EVENT_GET_B), \
     84	TRACE_SYMBOL(EC_CMD_HOST_EVENT_GET_SMI_MASK), \
     85	TRACE_SYMBOL(EC_CMD_HOST_EVENT_GET_SCI_MASK), \
     86	TRACE_SYMBOL(EC_CMD_HOST_EVENT_GET_WAKE_MASK), \
     87	TRACE_SYMBOL(EC_CMD_HOST_EVENT_SET_SMI_MASK), \
     88	TRACE_SYMBOL(EC_CMD_HOST_EVENT_SET_SCI_MASK), \
     89	TRACE_SYMBOL(EC_CMD_HOST_EVENT_CLEAR), \
     90	TRACE_SYMBOL(EC_CMD_HOST_EVENT_SET_WAKE_MASK), \
     91	TRACE_SYMBOL(EC_CMD_HOST_EVENT_CLEAR_B), \
     92	TRACE_SYMBOL(EC_CMD_HOST_EVENT), \
     93	TRACE_SYMBOL(EC_CMD_SWITCH_ENABLE_BKLIGHT), \
     94	TRACE_SYMBOL(EC_CMD_SWITCH_ENABLE_WIRELESS), \
     95	TRACE_SYMBOL(EC_CMD_GPIO_SET), \
     96	TRACE_SYMBOL(EC_CMD_GPIO_GET), \
     97	TRACE_SYMBOL(EC_CMD_I2C_READ), \
     98	TRACE_SYMBOL(EC_CMD_I2C_WRITE), \
     99	TRACE_SYMBOL(EC_CMD_CHARGE_CONTROL), \
    100	TRACE_SYMBOL(EC_CMD_CONSOLE_SNAPSHOT), \
    101	TRACE_SYMBOL(EC_CMD_CONSOLE_READ), \
    102	TRACE_SYMBOL(EC_CMD_BATTERY_CUT_OFF), \
    103	TRACE_SYMBOL(EC_CMD_USB_MUX), \
    104	TRACE_SYMBOL(EC_CMD_LDO_SET), \
    105	TRACE_SYMBOL(EC_CMD_LDO_GET), \
    106	TRACE_SYMBOL(EC_CMD_POWER_INFO), \
    107	TRACE_SYMBOL(EC_CMD_I2C_PASSTHRU), \
    108	TRACE_SYMBOL(EC_CMD_HANG_DETECT), \
    109	TRACE_SYMBOL(EC_CMD_CHARGE_STATE), \
    110	TRACE_SYMBOL(EC_CMD_CHARGE_CURRENT_LIMIT), \
    111	TRACE_SYMBOL(EC_CMD_EXTERNAL_POWER_LIMIT), \
    112	TRACE_SYMBOL(EC_CMD_OVERRIDE_DEDICATED_CHARGER_LIMIT), \
    113	TRACE_SYMBOL(EC_CMD_HIBERNATION_DELAY), \
    114	TRACE_SYMBOL(EC_CMD_HOST_SLEEP_EVENT), \
    115	TRACE_SYMBOL(EC_CMD_DEVICE_EVENT), \
    116	TRACE_SYMBOL(EC_CMD_SB_READ_WORD), \
    117	TRACE_SYMBOL(EC_CMD_SB_WRITE_WORD), \
    118	TRACE_SYMBOL(EC_CMD_SB_READ_BLOCK), \
    119	TRACE_SYMBOL(EC_CMD_SB_WRITE_BLOCK), \
    120	TRACE_SYMBOL(EC_CMD_BATTERY_VENDOR_PARAM), \
    121	TRACE_SYMBOL(EC_CMD_SB_FW_UPDATE), \
    122	TRACE_SYMBOL(EC_CMD_ENTERING_MODE), \
    123	TRACE_SYMBOL(EC_CMD_I2C_PASSTHRU_PROTECT), \
    124	TRACE_SYMBOL(EC_CMD_CEC_WRITE_MSG), \
    125	TRACE_SYMBOL(EC_CMD_CEC_SET), \
    126	TRACE_SYMBOL(EC_CMD_CEC_GET), \
    127	TRACE_SYMBOL(EC_CMD_EC_CODEC), \
    128	TRACE_SYMBOL(EC_CMD_EC_CODEC_DMIC), \
    129	TRACE_SYMBOL(EC_CMD_EC_CODEC_I2S_RX), \
    130	TRACE_SYMBOL(EC_CMD_EC_CODEC_WOV), \
    131	TRACE_SYMBOL(EC_CMD_REBOOT_EC), \
    132	TRACE_SYMBOL(EC_CMD_GET_PANIC_INFO), \
    133	TRACE_SYMBOL(EC_CMD_REBOOT), \
    134	TRACE_SYMBOL(EC_CMD_RESEND_RESPONSE), \
    135	TRACE_SYMBOL(EC_CMD_VERSION0), \
    136	TRACE_SYMBOL(EC_CMD_PD_EXCHANGE_STATUS), \
    137	TRACE_SYMBOL(EC_CMD_PD_HOST_EVENT_STATUS), \
    138	TRACE_SYMBOL(EC_CMD_USB_PD_CONTROL), \
    139	TRACE_SYMBOL(EC_CMD_USB_PD_PORTS), \
    140	TRACE_SYMBOL(EC_CMD_USB_PD_POWER_INFO), \
    141	TRACE_SYMBOL(EC_CMD_CHARGE_PORT_COUNT), \
    142	TRACE_SYMBOL(EC_CMD_USB_PD_FW_UPDATE), \
    143	TRACE_SYMBOL(EC_CMD_USB_PD_RW_HASH_ENTRY), \
    144	TRACE_SYMBOL(EC_CMD_USB_PD_DEV_INFO), \
    145	TRACE_SYMBOL(EC_CMD_USB_PD_DISCOVERY), \
    146	TRACE_SYMBOL(EC_CMD_PD_CHARGE_PORT_OVERRIDE), \
    147	TRACE_SYMBOL(EC_CMD_PD_GET_LOG_ENTRY), \
    148	TRACE_SYMBOL(EC_CMD_USB_PD_GET_AMODE), \
    149	TRACE_SYMBOL(EC_CMD_USB_PD_SET_AMODE), \
    150	TRACE_SYMBOL(EC_CMD_PD_WRITE_LOG_ENTRY), \
    151	TRACE_SYMBOL(EC_CMD_PD_CONTROL), \
    152	TRACE_SYMBOL(EC_CMD_USB_PD_MUX_INFO), \
    153	TRACE_SYMBOL(EC_CMD_PD_CHIP_INFO), \
    154	TRACE_SYMBOL(EC_CMD_RWSIG_CHECK_STATUS), \
    155	TRACE_SYMBOL(EC_CMD_RWSIG_ACTION), \
    156	TRACE_SYMBOL(EC_CMD_EFS_VERIFY), \
    157	TRACE_SYMBOL(EC_CMD_GET_CROS_BOARD_INFO), \
    158	TRACE_SYMBOL(EC_CMD_SET_CROS_BOARD_INFO), \
    159	TRACE_SYMBOL(EC_CMD_GET_UPTIME_INFO), \
    160	TRACE_SYMBOL(EC_CMD_ADD_ENTROPY), \
    161	TRACE_SYMBOL(EC_CMD_ADC_READ), \
    162	TRACE_SYMBOL(EC_CMD_ROLLBACK_INFO), \
    163	TRACE_SYMBOL(EC_CMD_AP_RESET), \
    164	TRACE_SYMBOL(EC_CMD_REGULATOR_GET_INFO), \
    165	TRACE_SYMBOL(EC_CMD_REGULATOR_ENABLE), \
    166	TRACE_SYMBOL(EC_CMD_REGULATOR_IS_ENABLED), \
    167	TRACE_SYMBOL(EC_CMD_REGULATOR_SET_VOLTAGE), \
    168	TRACE_SYMBOL(EC_CMD_REGULATOR_GET_VOLTAGE), \
    169	TRACE_SYMBOL(EC_CMD_CR51_BASE), \
    170	TRACE_SYMBOL(EC_CMD_CR51_LAST), \
    171	TRACE_SYMBOL(EC_CMD_FP_PASSTHRU), \
    172	TRACE_SYMBOL(EC_CMD_FP_MODE), \
    173	TRACE_SYMBOL(EC_CMD_FP_INFO), \
    174	TRACE_SYMBOL(EC_CMD_FP_FRAME), \
    175	TRACE_SYMBOL(EC_CMD_FP_TEMPLATE), \
    176	TRACE_SYMBOL(EC_CMD_FP_CONTEXT), \
    177	TRACE_SYMBOL(EC_CMD_FP_STATS), \
    178	TRACE_SYMBOL(EC_CMD_FP_SEED), \
    179	TRACE_SYMBOL(EC_CMD_FP_ENC_STATUS), \
    180	TRACE_SYMBOL(EC_CMD_TP_SELF_TEST), \
    181	TRACE_SYMBOL(EC_CMD_TP_FRAME_INFO), \
    182	TRACE_SYMBOL(EC_CMD_TP_FRAME_SNAPSHOT), \
    183	TRACE_SYMBOL(EC_CMD_TP_FRAME_GET), \
    184	TRACE_SYMBOL(EC_CMD_BATTERY_GET_STATIC), \
    185	TRACE_SYMBOL(EC_CMD_BATTERY_GET_DYNAMIC), \
    186	TRACE_SYMBOL(EC_CMD_CHARGER_CONTROL), \
    187	TRACE_SYMBOL(EC_CMD_BOARD_SPECIFIC_BASE), \
    188	TRACE_SYMBOL(EC_CMD_BOARD_SPECIFIC_LAST)
    189
    190/* See the enum ec_status in include/linux/platform_data/cros_ec_commands.h */
    191#define EC_RESULT \
    192	TRACE_SYMBOL(EC_RES_SUCCESS), \
    193	TRACE_SYMBOL(EC_RES_INVALID_COMMAND), \
    194	TRACE_SYMBOL(EC_RES_ERROR), \
    195	TRACE_SYMBOL(EC_RES_INVALID_PARAM), \
    196	TRACE_SYMBOL(EC_RES_ACCESS_DENIED), \
    197	TRACE_SYMBOL(EC_RES_INVALID_RESPONSE), \
    198	TRACE_SYMBOL(EC_RES_INVALID_VERSION), \
    199	TRACE_SYMBOL(EC_RES_INVALID_CHECKSUM), \
    200	TRACE_SYMBOL(EC_RES_IN_PROGRESS), \
    201	TRACE_SYMBOL(EC_RES_UNAVAILABLE), \
    202	TRACE_SYMBOL(EC_RES_TIMEOUT), \
    203	TRACE_SYMBOL(EC_RES_OVERFLOW), \
    204	TRACE_SYMBOL(EC_RES_INVALID_HEADER), \
    205	TRACE_SYMBOL(EC_RES_REQUEST_TRUNCATED), \
    206	TRACE_SYMBOL(EC_RES_RESPONSE_TOO_BIG), \
    207	TRACE_SYMBOL(EC_RES_BUS_ERROR), \
    208	TRACE_SYMBOL(EC_RES_BUSY), \
    209	TRACE_SYMBOL(EC_RES_INVALID_HEADER_VERSION), \
    210	TRACE_SYMBOL(EC_RES_INVALID_HEADER_CRC), \
    211	TRACE_SYMBOL(EC_RES_INVALID_DATA_CRC), \
    212	TRACE_SYMBOL(EC_RES_DUP_UNAVAILABLE)
    213
    214#define CREATE_TRACE_POINTS
    215#include "cros_ec_trace.h"