Commit 8de0d8ba5bb87fe4f40e63b4ca275e523326e640

Authored by Ye Li
1 parent 3b88124641

MLK-21899 imx8: sci: Add SCFW API sc_seco_gen_key_blob

Porting the sc_seco_gen_key_blob to sci_api.c which is used to
generate key blob

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>

Showing 2 changed files with 29 additions and 0 deletions Side-by-side Diff

arch/arm/include/asm/arch-imx8/sci/sci.h
... ... @@ -129,6 +129,8 @@
129 129 uint32_t *commit);
130 130 int sc_seco_get_event(sc_ipc_t ipc, uint8_t idx,
131 131 uint32_t *event);
  132 +int sc_seco_gen_key_blob(sc_ipc_t ipc, uint32_t id,
  133 + sc_faddr_t load_addr, sc_faddr_t export_addr, uint16_t max_size);
132 134  
133 135 #endif
drivers/misc/imx8/scu_api.c
... ... @@ -945,4 +945,31 @@
945 945  
946 946 return ret;
947 947 }
  948 +
  949 +int sc_seco_gen_key_blob(sc_ipc_t ipc, uint32_t id,
  950 + sc_faddr_t load_addr, sc_faddr_t export_addr, uint16_t max_size)
  951 +{
  952 + struct udevice *dev = gd->arch.scu_dev;
  953 + struct sc_rpc_msg_s msg;
  954 + int size = sizeof(struct sc_rpc_msg_s);
  955 + int ret;
  956 +
  957 + RPC_VER(&msg) = SC_RPC_VERSION;
  958 + RPC_SVC(&msg) = (u8)(SC_RPC_SVC_SECO);
  959 + RPC_FUNC(&msg) = (u8)(SECO_FUNC_GEN_KEY_BLOB);
  960 + RPC_U32(&msg, 0U) = (u32)(load_addr >> 32ULL);
  961 + RPC_U32(&msg, 4U) = (u32)(load_addr);
  962 + RPC_U32(&msg, 8U) = (u32)(export_addr >> 32ULL);
  963 + RPC_U32(&msg, 12U) = (u32)(export_addr);
  964 + RPC_U32(&msg, 16U) = (u32)(id);
  965 + RPC_U16(&msg, 20U) = (u16)(max_size);
  966 + RPC_SIZE(&msg) = 7U;
  967 +
  968 + ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
  969 + if (ret)
  970 + printf("%s: id: %u, load_addr 0x%llx, export_addr 0x%llx, res:%d\n",
  971 + __func__, id, load_addr, export_addr, RPC_R8(&msg));
  972 +
  973 + return ret;
  974 +}