summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorHaoran.Wang <elven.wang@nxp.com>2017-08-28 18:30:06 +0800
committerYe Li <ye.li@nxp.com>2018-06-13 03:06:46 -0700
commitce4e9dc35ff89a2429224ae6d0ffb4109cb42e28 (patch)
tree002ee3bac30e229e8bd3de18790139f8f564dfca /include
parent0ccdd527a794c2b450658980361a7857ce7495c9 (diff)
MLK-18591-5 android: iot: Export eMMC RPMB interface for Secure Storage proxy
Secure Storage service in Trusty OS will compute the encrypted mmc frame and the rpmb proxy inject the frame to driver directly. So that need to export RPMB related interface for Secure Storage proxy use. Change-Id: I7f69831a20a440f597d323b610fa615fd4344d05 Signed-off-by: Haoran.Wang <elven.wang@nxp.com> (cherry picked from commit 4d2c1873ce8221e35874265e41dc42a6df169659)
Diffstat (limited to 'include')
-rw-r--r--include/mmc.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/mmc.h b/include/mmc.h
index 9ec452cd7d6..1b3b380ea89 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -767,12 +767,34 @@ int mmc_set_boot_bus_width(struct mmc *mmc, u8 width, u8 reset, u8 mode);
/* Function to modify the RST_n_FUNCTION field of EXT_CSD */
int mmc_set_rst_n_function(struct mmc *mmc, u8 enable);
/* Functions to read / write the RPMB partition */
+/* Sizes of RPMB data frame */
+#define RPMB_SZ_STUFF 196
+#define RPMB_SZ_MAC 32
+#define RPMB_SZ_DATA 256
+#define RPMB_SZ_NONCE 16
+
+/* Structure of RPMB data frame. */
+struct s_rpmb {
+ unsigned char stuff[RPMB_SZ_STUFF];
+ unsigned char mac[RPMB_SZ_MAC];
+ unsigned char data[RPMB_SZ_DATA];
+ unsigned char nonce[RPMB_SZ_NONCE];
+ unsigned long write_counter;
+ unsigned short address;
+ unsigned short block_count;
+ unsigned short result;
+ unsigned short request;
+};
int mmc_rpmb_set_key(struct mmc *mmc, void *key);
int mmc_rpmb_get_counter(struct mmc *mmc, unsigned long *counter);
int mmc_rpmb_read(struct mmc *mmc, void *addr, unsigned short blk,
unsigned short cnt, unsigned char *key);
int mmc_rpmb_write(struct mmc *mmc, void *addr, unsigned short blk,
unsigned short cnt, unsigned char *key);
+int mmc_rpmb_request(struct mmc *mmc, const struct s_rpmb *s,
+ unsigned int count, bool is_rel_write);
+int mmc_rpmb_response(struct mmc *mmc, struct s_rpmb *s,
+ unsigned int count, unsigned short expected);
#ifdef CONFIG_CMD_BKOPS_ENABLE
int mmc_set_bkops_enable(struct mmc *mmc);
#endif