mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-24 02:18:18 +07:00
mfd: cros_ec: Add SKU ID and Secure storage API
Add API to store SKU, Cros board information in EC flash memory. Add API to store security data in EC. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Acked-by: Benson Leung <bleung@chromium.org> Reviewed-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
parent
a0d50b31ce
commit
cc3a032fd7
@ -1292,6 +1292,17 @@ struct ec_response_get_features {
|
|||||||
uint32_t flags[2];
|
uint32_t flags[2];
|
||||||
} __ec_align4;
|
} __ec_align4;
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Get the board's SKU ID from EC */
|
||||||
|
#define EC_CMD_GET_SKU_ID 0x000E
|
||||||
|
|
||||||
|
/* Set SKU ID from AP */
|
||||||
|
#define EC_CMD_SET_SKU_ID 0x000F
|
||||||
|
|
||||||
|
struct ec_sku_id_info {
|
||||||
|
uint32_t sku_id;
|
||||||
|
} __ec_align4;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Flash commands */
|
/* Flash commands */
|
||||||
|
|
||||||
@ -2902,6 +2913,49 @@ struct ec_response_port80_last_boot {
|
|||||||
uint16_t code;
|
uint16_t code;
|
||||||
} __ec_align2;
|
} __ec_align2;
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Temporary secure storage for host verified boot use */
|
||||||
|
|
||||||
|
/* Number of bytes in a vstore slot */
|
||||||
|
#define EC_VSTORE_SLOT_SIZE 64
|
||||||
|
|
||||||
|
/* Maximum number of vstore slots */
|
||||||
|
#define EC_VSTORE_SLOT_MAX 32
|
||||||
|
|
||||||
|
/* Get persistent storage info */
|
||||||
|
#define EC_CMD_VSTORE_INFO 0x0049
|
||||||
|
struct ec_response_vstore_info {
|
||||||
|
/* Indicates which slots are locked */
|
||||||
|
uint32_t slot_locked;
|
||||||
|
/* Total number of slots available */
|
||||||
|
uint8_t slot_count;
|
||||||
|
} __ec_align_size1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read temporary secure storage
|
||||||
|
*
|
||||||
|
* Response is EC_VSTORE_SLOT_SIZE bytes of data.
|
||||||
|
*/
|
||||||
|
#define EC_CMD_VSTORE_READ 0x004A
|
||||||
|
|
||||||
|
struct ec_params_vstore_read {
|
||||||
|
uint8_t slot; /* Slot to read from */
|
||||||
|
} __ec_align1;
|
||||||
|
|
||||||
|
struct ec_response_vstore_read {
|
||||||
|
uint8_t data[EC_VSTORE_SLOT_SIZE];
|
||||||
|
} __ec_align1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write temporary secure storage and lock it.
|
||||||
|
*/
|
||||||
|
#define EC_CMD_VSTORE_WRITE 0x004B
|
||||||
|
|
||||||
|
struct ec_params_vstore_write {
|
||||||
|
uint8_t slot; /* Slot to write to */
|
||||||
|
uint8_t data[EC_VSTORE_SLOT_SIZE];
|
||||||
|
} __ec_align1;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Thermal engine commands. Note that there are two implementations. We'll
|
/* Thermal engine commands. Note that there are two implementations. We'll
|
||||||
* reuse the command number, but the data and behavior is incompatible.
|
* reuse the command number, but the data and behavior is incompatible.
|
||||||
@ -5069,6 +5123,59 @@ struct ec_params_efs_verify {
|
|||||||
uint8_t region; /* enum ec_flash_region */
|
uint8_t region; /* enum ec_flash_region */
|
||||||
} __ec_align1;
|
} __ec_align1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Retrieve info from Cros Board Info store. Response is based on the data
|
||||||
|
* type. Integers return a uint32. Strings return a string, using the response
|
||||||
|
* size to determine how big it is.
|
||||||
|
*/
|
||||||
|
#define EC_CMD_GET_CROS_BOARD_INFO 0x011F
|
||||||
|
/*
|
||||||
|
* Write info into Cros Board Info on EEPROM. Write fails if the board has
|
||||||
|
* hardware write-protect enabled.
|
||||||
|
*/
|
||||||
|
#define EC_CMD_SET_CROS_BOARD_INFO 0x0120
|
||||||
|
|
||||||
|
enum cbi_data_tag {
|
||||||
|
CBI_TAG_BOARD_VERSION = 0, /* uint32_t or smaller */
|
||||||
|
CBI_TAG_OEM_ID = 1, /* uint32_t or smaller */
|
||||||
|
CBI_TAG_SKU_ID = 2, /* uint32_t or smaller */
|
||||||
|
CBI_TAG_DRAM_PART_NUM = 3, /* variable length ascii, nul terminated. */
|
||||||
|
CBI_TAG_OEM_NAME = 4, /* variable length ascii, nul terminated. */
|
||||||
|
CBI_TAG_MODEL_ID = 5, /* uint32_t or smaller */
|
||||||
|
CBI_TAG_COUNT,
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Flags to control read operation
|
||||||
|
*
|
||||||
|
* RELOAD: Invalidate cache and read data from EEPROM. Useful to verify
|
||||||
|
* write was successful without reboot.
|
||||||
|
*/
|
||||||
|
#define CBI_GET_RELOAD BIT(0)
|
||||||
|
|
||||||
|
struct ec_params_get_cbi {
|
||||||
|
uint32_t tag; /* enum cbi_data_tag */
|
||||||
|
uint32_t flag; /* CBI_GET_* */
|
||||||
|
} __ec_align4;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Flags to control write behavior.
|
||||||
|
*
|
||||||
|
* NO_SYNC: Makes EC update data in RAM but skip writing to EEPROM. It's
|
||||||
|
* useful when writing multiple fields in a row.
|
||||||
|
* INIT: Need to be set when creating a new CBI from scratch. All fields
|
||||||
|
* will be initialized to zero first.
|
||||||
|
*/
|
||||||
|
#define CBI_SET_NO_SYNC BIT(0)
|
||||||
|
#define CBI_SET_INIT BIT(1)
|
||||||
|
|
||||||
|
struct ec_params_set_cbi {
|
||||||
|
uint32_t tag; /* enum cbi_data_tag */
|
||||||
|
uint32_t flag; /* CBI_SET_* */
|
||||||
|
uint32_t size; /* Data size */
|
||||||
|
uint8_t data[]; /* For string and raw data */
|
||||||
|
} __ec_align1;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Fingerprint MCU commands: range 0x0400-0x040x */
|
/* Fingerprint MCU commands: range 0x0400-0x040x */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user