diff options
Diffstat (limited to 'firmware/bdb/bdb_api.h')
-rw-r--r-- | firmware/bdb/bdb_api.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/firmware/bdb/bdb_api.h b/firmware/bdb/bdb_api.h index 53823fae..9979824e 100644 --- a/firmware/bdb/bdb_api.h +++ b/firmware/bdb/bdb_api.h @@ -8,10 +8,22 @@ #include <stdint.h> #include "vboot_register.h" +#include "nvm.h" +#include "secrets.h" struct vba_context { /* Indicate which slot is being tried: 0 - primary, 1 - secondary */ uint8_t slot; + + /* BDB */ + uint8_t *bdb; + + /* Secrets */ + struct bdb_ro_secrets *ro_secrets; + struct bdb_rw_secrets *rw_secrets; + + /* NVM-RW buffer */ + struct nvmrw nvmrw; }; /** @@ -38,6 +50,24 @@ int vba_bdb_finalize(struct vba_context *ctx); void vba_bdb_fail(struct vba_context *ctx); /** + * Update kernel and its data key version in NVM + * + * This is the function called from SP-RW, which receives a kernel version + * from an AP-RW after successful verification of a kernel. + * + * It checks whether the version in NVM-RW is older than the reported version + * or not. If so, it updates the version in NVM-RW. + * + * @param ctx + * @param kernel_data_key_version + * @param kernel_version + * @return BDB_SUCCESS or BDB_ERROR_* + */ +int vba_update_kernel_version(struct vba_context *ctx, + uint32_t kernel_data_key_version, + uint32_t kernel_version); + +/** * Get vboot register value * * Implemented by each chip @@ -65,4 +95,28 @@ void vbe_set_vboot_register(enum vboot_register type, uint32_t val); */ void vbe_reset(void); +/** + * Read contents from Non-Volatile Memory + * + * Implemented by each chip. + * + * @param type Type of NVM + * @param buf Buffer where the data will be read to + * @param size Size of data to read + * @return Zero if success or non-zero otherwise + */ +int vbe_read_nvm(enum nvm_type type, uint8_t *buf, uint32_t size); + +/** + * Write contents to Non-Volatile Memory + * + * Implemented by each chip. + * + * @param type Type of NVM + * @param buf Buffer where the data will be written from + * @param size Size of data to write + * @return Zero if success or non-zero otherwise + */ +int vbe_write_nvm(enum nvm_type type, void *buf, uint32_t size); + #endif |