summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-01-16 14:52:31 -0700
committerSimon Glass <sjg@chromium.org>2021-01-30 14:25:41 -0700
commit10f746591fba16a48f0e3d14641be09f01982807 (patch)
treec311e9e3063e1ca319a9952524ccbc3043c72ac3 /include
parentd9ffaef6fe25e7a29e63911fe1af5d18c9d77a45 (diff)
downloadu-boot-10f746591fba16a48f0e3d14641be09f01982807.tar.gz
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>
Diffstat (limited to 'include')
-rw-r--r--include/cros_ec.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/cros_ec.h b/include/cros_ec.h
index cb91343e3d..eddc23d48f 100644
--- a/include/cros_ec.h
+++ b/include/cros_ec.h
@@ -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