1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-10-22 10:31:56 +02:00

cros_ec: Add vstore support

The EC can store small amounts of data for the benefit of the
verified boot process. Since the EC is seldom reset, this can allow the
AP to store data that survives a reboot or a suspend/resume cycle.

Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2021-01-16 14:52:31 -07:00
parent d9ffaef6fe
commit 10f746591f
4 changed files with 202 additions and 2 deletions

View File

@@ -596,4 +596,47 @@ int cros_ec_check_feature(struct udevice *dev, uint feature);
*/
int cros_ec_get_switches(struct udevice *dev);
/**
* cros_ec_vstore_supported() - Check if vstore is supported
*
* @dev: CROS-EC device
* @return false if not supported, true if supported, -ve on error
*/
int cros_ec_vstore_supported(struct udevice *dev);
/**
* cros_ec_vstore_info() - Get vstore information
*
* @dev: CROS-EC device
* @lockedp: mask of locked slots
* @return number of vstore slots supported by the EC,, -ve on error
*/
int cros_ec_vstore_info(struct udevice *dev, u32 *lockedp);
/**
* cros_ec_vstore_read() - Read data from EC vstore slot
*
* @dev: CROS-EC device
* @slot: vstore slot to read from
* @data: buffer to store read data, must be EC_VSTORE_SLOT_SIZE bytes
* @return 0 if OK, -ve on error
*/
int cros_ec_vstore_read(struct udevice *dev, int slot, uint8_t *data);
/**
* cros_ec_vstore_write() - Save data into EC vstore slot
*
* The maximum size of data is EC_VSTORE_SLOT_SIZE. It is the caller's
* responsibility to check the number of implemented slots by querying the
* vstore info.
*
* @dev: CROS-EC device
* @slot: vstore slot to write into
* @data: data to write
* @size: size of data in bytes
* @return 0 if OK, -ve on error
*/
int cros_ec_vstore_write(struct udevice *dev, int slot, const uint8_t *data,
size_t size);
#endif