aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mfd
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2019-06-03 14:33:59 -0400
committerLee Jones <lee.jones@linaro.org>2019-06-10 04:15:08 -0400
commitcc3a032fd7128d03715c655ad66a263b6d518071 (patch)
treeeba31cbc1da1c7f09569228d30b104945c7dfef3 /include/linux/mfd
parenta0d50b31cee948de1be0ad14b78127a00530f43e (diff)
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>
Diffstat (limited to 'include/linux/mfd')
-rw-r--r--include/linux/mfd/cros_ec_commands.h107
1 files changed, 107 insertions, 0 deletions
diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index 3d3a37b11002..860a76274334 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -1293,6 +1293,17 @@ struct ec_response_get_features {
1293} __ec_align4; 1293} __ec_align4;
1294 1294
1295/*****************************************************************************/ 1295/*****************************************************************************/
1296/* Get the board's SKU ID from EC */
1297#define EC_CMD_GET_SKU_ID 0x000E
1298
1299/* Set SKU ID from AP */
1300#define EC_CMD_SET_SKU_ID 0x000F
1301
1302struct ec_sku_id_info {
1303 uint32_t sku_id;
1304} __ec_align4;
1305
1306/*****************************************************************************/
1296/* Flash commands */ 1307/* Flash commands */
1297 1308
1298/* Get flash info */ 1309/* Get flash info */
@@ -2903,6 +2914,49 @@ struct ec_response_port80_last_boot {
2903} __ec_align2; 2914} __ec_align2;
2904 2915
2905/*****************************************************************************/ 2916/*****************************************************************************/
2917/* Temporary secure storage for host verified boot use */
2918
2919/* Number of bytes in a vstore slot */
2920#define EC_VSTORE_SLOT_SIZE 64
2921
2922/* Maximum number of vstore slots */
2923#define EC_VSTORE_SLOT_MAX 32
2924
2925/* Get persistent storage info */
2926#define EC_CMD_VSTORE_INFO 0x0049
2927struct ec_response_vstore_info {
2928 /* Indicates which slots are locked */
2929 uint32_t slot_locked;
2930 /* Total number of slots available */
2931 uint8_t slot_count;
2932} __ec_align_size1;
2933
2934/*
2935 * Read temporary secure storage
2936 *
2937 * Response is EC_VSTORE_SLOT_SIZE bytes of data.
2938 */
2939#define EC_CMD_VSTORE_READ 0x004A
2940
2941struct ec_params_vstore_read {
2942 uint8_t slot; /* Slot to read from */
2943} __ec_align1;
2944
2945struct ec_response_vstore_read {
2946 uint8_t data[EC_VSTORE_SLOT_SIZE];
2947} __ec_align1;
2948
2949/*
2950 * Write temporary secure storage and lock it.
2951 */
2952#define EC_CMD_VSTORE_WRITE 0x004B
2953
2954struct ec_params_vstore_write {
2955 uint8_t slot; /* Slot to write to */
2956 uint8_t data[EC_VSTORE_SLOT_SIZE];
2957} __ec_align1;
2958
2959/*****************************************************************************/
2906/* Thermal engine commands. Note that there are two implementations. We'll 2960/* Thermal engine commands. Note that there are two implementations. We'll
2907 * reuse the command number, but the data and behavior is incompatible. 2961 * reuse the command number, but the data and behavior is incompatible.
2908 * Version 0 is what originally shipped on Link. 2962 * Version 0 is what originally shipped on Link.
@@ -5069,6 +5123,59 @@ struct ec_params_efs_verify {
5069 uint8_t region; /* enum ec_flash_region */ 5123 uint8_t region; /* enum ec_flash_region */
5070} __ec_align1; 5124} __ec_align1;
5071 5125
5126/*
5127 * Retrieve info from Cros Board Info store. Response is based on the data
5128 * type. Integers return a uint32. Strings return a string, using the response
5129 * size to determine how big it is.
5130 */
5131#define EC_CMD_GET_CROS_BOARD_INFO 0x011F
5132/*
5133 * Write info into Cros Board Info on EEPROM. Write fails if the board has
5134 * hardware write-protect enabled.
5135 */
5136#define EC_CMD_SET_CROS_BOARD_INFO 0x0120
5137
5138enum cbi_data_tag {
5139 CBI_TAG_BOARD_VERSION = 0, /* uint32_t or smaller */
5140 CBI_TAG_OEM_ID = 1, /* uint32_t or smaller */
5141 CBI_TAG_SKU_ID = 2, /* uint32_t or smaller */
5142 CBI_TAG_DRAM_PART_NUM = 3, /* variable length ascii, nul terminated. */
5143 CBI_TAG_OEM_NAME = 4, /* variable length ascii, nul terminated. */
5144 CBI_TAG_MODEL_ID = 5, /* uint32_t or smaller */
5145 CBI_TAG_COUNT,
5146};
5147
5148/*
5149 * Flags to control read operation
5150 *
5151 * RELOAD: Invalidate cache and read data from EEPROM. Useful to verify
5152 * write was successful without reboot.
5153 */
5154#define CBI_GET_RELOAD BIT(0)
5155
5156struct ec_params_get_cbi {
5157 uint32_t tag; /* enum cbi_data_tag */
5158 uint32_t flag; /* CBI_GET_* */
5159} __ec_align4;
5160
5161/*
5162 * Flags to control write behavior.
5163 *
5164 * NO_SYNC: Makes EC update data in RAM but skip writing to EEPROM. It's
5165 * useful when writing multiple fields in a row.
5166 * INIT: Need to be set when creating a new CBI from scratch. All fields
5167 * will be initialized to zero first.
5168 */
5169#define CBI_SET_NO_SYNC BIT(0)
5170#define CBI_SET_INIT BIT(1)
5171
5172struct ec_params_set_cbi {
5173 uint32_t tag; /* enum cbi_data_tag */
5174 uint32_t flag; /* CBI_SET_* */
5175 uint32_t size; /* Data size */
5176 uint8_t data[]; /* For string and raw data */
5177} __ec_align1;
5178
5072/*****************************************************************************/ 5179/*****************************************************************************/
5073/* Fingerprint MCU commands: range 0x0400-0x040x */ 5180/* Fingerprint MCU commands: range 0x0400-0x040x */
5074 5181