183d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */ 248ef0d2aSRuchika Gupta /* 348ef0d2aSRuchika Gupta * Common internal memory map for some Freescale SoCs 448ef0d2aSRuchika Gupta * 548ef0d2aSRuchika Gupta * Copyright 2014 Freescale Semiconductor, Inc. 648ef0d2aSRuchika Gupta */ 748ef0d2aSRuchika Gupta 848ef0d2aSRuchika Gupta #ifndef __FSL_SEC_H 948ef0d2aSRuchika Gupta #define __FSL_SEC_H 1048ef0d2aSRuchika Gupta 1148ef0d2aSRuchika Gupta #include <common.h> 1248ef0d2aSRuchika Gupta #include <asm/io.h> 1348ef0d2aSRuchika Gupta 14028dbb8dSRuchika Gupta #ifdef CONFIG_SYS_FSL_SEC_LE 15028dbb8dSRuchika Gupta #define sec_in32(a) in_le32(a) 16028dbb8dSRuchika Gupta #define sec_out32(a, v) out_le32(a, v) 17028dbb8dSRuchika Gupta #define sec_in16(a) in_le16(a) 18028dbb8dSRuchika Gupta #define sec_clrbits32 clrbits_le32 19028dbb8dSRuchika Gupta #define sec_setbits32 setbits_le32 20028dbb8dSRuchika Gupta #elif defined(CONFIG_SYS_FSL_SEC_BE) 21028dbb8dSRuchika Gupta #define sec_in32(a) in_be32(a) 22028dbb8dSRuchika Gupta #define sec_out32(a, v) out_be32(a, v) 23028dbb8dSRuchika Gupta #define sec_in16(a) in_be16(a) 24028dbb8dSRuchika Gupta #define sec_clrbits32 clrbits_be32 25028dbb8dSRuchika Gupta #define sec_setbits32 setbits_be32 2690b80386SYork Sun #elif defined(CONFIG_SYS_FSL_HAS_SEC) 27028dbb8dSRuchika Gupta #error Neither CONFIG_SYS_FSL_SEC_LE nor CONFIG_SYS_FSL_SEC_BE is defined 28028dbb8dSRuchika Gupta #endif 29028dbb8dSRuchika Gupta 3048ef0d2aSRuchika Gupta /* Security Engine Block (MS = Most Sig., LS = Least Sig.) */ 3148ef0d2aSRuchika Gupta #if CONFIG_SYS_FSL_SEC_COMPAT >= 4 32c5de15cbSRuchika Gupta /* RNG4 TRNG test registers */ 33c5de15cbSRuchika Gupta struct rng4tst { 34c5de15cbSRuchika Gupta #define RTMCTL_PRGM 0x00010000 /* 1 -> program mode, 0 -> run mode */ 35c4065517SAlex Porosanu #define RTMCTL_SAMP_MODE_VON_NEUMANN_ES_SC 0 /* use von Neumann data in 36c4065517SAlex Porosanu both entropy shifter and 37c4065517SAlex Porosanu statistical checker */ 38c4065517SAlex Porosanu #define RTMCTL_SAMP_MODE_RAW_ES_SC 1 /* use raw data in both 39c4065517SAlex Porosanu entropy shifter and 40c4065517SAlex Porosanu statistical checker */ 41c4065517SAlex Porosanu #define RTMCTL_SAMP_MODE_VON_NEUMANN_ES_RAW_SC 2 /* use von Neumann data in 42c4065517SAlex Porosanu entropy shifter, raw data 43c4065517SAlex Porosanu in statistical checker */ 44c4065517SAlex Porosanu #define RTMCTL_SAMP_MODE_INVALID 3 /* invalid combination */ 45c5de15cbSRuchika Gupta u32 rtmctl; /* misc. control register */ 46c5de15cbSRuchika Gupta u32 rtscmisc; /* statistical check misc. register */ 47c5de15cbSRuchika Gupta u32 rtpkrrng; /* poker range register */ 4817649e1bSAlex Porosanu #define RTSDCTL_ENT_DLY_MIN 3200 49c5de15cbSRuchika Gupta #define RTSDCTL_ENT_DLY_MAX 12800 50c5de15cbSRuchika Gupta union { 51c5de15cbSRuchika Gupta u32 rtpkrmax; /* PRGM=1: poker max. limit register */ 52c5de15cbSRuchika Gupta u32 rtpkrsq; /* PRGM=0: poker square calc. result register */ 53c5de15cbSRuchika Gupta }; 54c5de15cbSRuchika Gupta #define RTSDCTL_ENT_DLY_SHIFT 16 55c5de15cbSRuchika Gupta #define RTSDCTL_ENT_DLY_MASK (0xffff << RTSDCTL_ENT_DLY_SHIFT) 56c5de15cbSRuchika Gupta u32 rtsdctl; /* seed control register */ 57c5de15cbSRuchika Gupta union { 58c5de15cbSRuchika Gupta u32 rtsblim; /* PRGM=1: sparse bit limit register */ 59c5de15cbSRuchika Gupta u32 rttotsam; /* PRGM=0: total samples register */ 60c5de15cbSRuchika Gupta }; 61c5de15cbSRuchika Gupta u32 rtfreqmin; /* frequency count min. limit register */ 62026a3f1bSAlex Porosanu #define RTFRQMAX_DISABLE (1 << 20) 63c5de15cbSRuchika Gupta union { 64c5de15cbSRuchika Gupta u32 rtfreqmax; /* PRGM=1: freq. count max. limit register */ 65c5de15cbSRuchika Gupta u32 rtfreqcnt; /* PRGM=0: freq. count register */ 66c5de15cbSRuchika Gupta }; 67c5de15cbSRuchika Gupta u32 rsvd1[40]; 68c5de15cbSRuchika Gupta #define RNG_STATE0_HANDLE_INSTANTIATED 0x00000001 69dfaec760SLukas Auer #define RNG_STATE1_HANDLE_INSTANTIATED 0x00000002 70dfaec760SLukas Auer #define RNG_STATE_HANDLE_MASK \ 71dfaec760SLukas Auer (RNG_STATE0_HANDLE_INSTANTIATED | RNG_STATE1_HANDLE_INSTANTIATED) 72c5de15cbSRuchika Gupta u32 rdsta; /*RNG DRNG Status Register*/ 73c5de15cbSRuchika Gupta u32 rsvd2[15]; 74c5de15cbSRuchika Gupta }; 75c5de15cbSRuchika Gupta 7648ef0d2aSRuchika Gupta typedef struct ccsr_sec { 7748ef0d2aSRuchika Gupta u32 res0; 7848ef0d2aSRuchika Gupta u32 mcfgr; /* Master CFG Register */ 7948ef0d2aSRuchika Gupta u8 res1[0x4]; 8048ef0d2aSRuchika Gupta u32 scfgr; 8148ef0d2aSRuchika Gupta struct { 8248ef0d2aSRuchika Gupta u32 ms; /* Job Ring LIODN Register, MS */ 8348ef0d2aSRuchika Gupta u32 ls; /* Job Ring LIODN Register, LS */ 8448ef0d2aSRuchika Gupta } jrliodnr[4]; 8548ef0d2aSRuchika Gupta u8 res2[0x2c]; 8648ef0d2aSRuchika Gupta u32 jrstartr; /* Job Ring Start Register */ 8748ef0d2aSRuchika Gupta struct { 8848ef0d2aSRuchika Gupta u32 ms; /* RTIC LIODN Register, MS */ 8948ef0d2aSRuchika Gupta u32 ls; /* RTIC LIODN Register, LS */ 9048ef0d2aSRuchika Gupta } rticliodnr[4]; 9148ef0d2aSRuchika Gupta u8 res3[0x1c]; 9248ef0d2aSRuchika Gupta u32 decorr; /* DECO Request Register */ 9348ef0d2aSRuchika Gupta struct { 9448ef0d2aSRuchika Gupta u32 ms; /* DECO LIODN Register, MS */ 9548ef0d2aSRuchika Gupta u32 ls; /* DECO LIODN Register, LS */ 9648ef0d2aSRuchika Gupta } decoliodnr[8]; 9748ef0d2aSRuchika Gupta u8 res4[0x40]; 9848ef0d2aSRuchika Gupta u32 dar; /* DECO Avail Register */ 9948ef0d2aSRuchika Gupta u32 drr; /* DECO Reset Register */ 100c5de15cbSRuchika Gupta u8 res5[0x4d8]; 101c5de15cbSRuchika Gupta struct rng4tst rng; /* RNG Registers */ 102f91e65a7SUlises Cardenas u8 res6[0x8a0]; 10348ef0d2aSRuchika Gupta u32 crnr_ms; /* CHA Revision Number Register, MS */ 10448ef0d2aSRuchika Gupta u32 crnr_ls; /* CHA Revision Number Register, LS */ 10548ef0d2aSRuchika Gupta u32 ctpr_ms; /* Compile Time Parameters Register, MS */ 10648ef0d2aSRuchika Gupta u32 ctpr_ls; /* Compile Time Parameters Register, LS */ 107f91e65a7SUlises Cardenas u8 res7[0x10]; 10848ef0d2aSRuchika Gupta u32 far_ms; /* Fault Address Register, MS */ 10948ef0d2aSRuchika Gupta u32 far_ls; /* Fault Address Register, LS */ 11048ef0d2aSRuchika Gupta u32 falr; /* Fault Address LIODN Register */ 11148ef0d2aSRuchika Gupta u32 fadr; /* Fault Address Detail Register */ 112f91e65a7SUlises Cardenas u8 res8[0x4]; 11348ef0d2aSRuchika Gupta u32 csta; /* CAAM Status Register */ 114f91e65a7SUlises Cardenas u32 smpart; /* Secure Memory Partition Parameters */ 115f91e65a7SUlises Cardenas u32 smvid; /* Secure Memory Version ID */ 11648ef0d2aSRuchika Gupta u32 rvid; /* Run Time Integrity Checking Version ID Reg.*/ 11748ef0d2aSRuchika Gupta u32 ccbvid; /* CHA Cluster Block Version ID Register */ 11848ef0d2aSRuchika Gupta u32 chavid_ms; /* CHA Version ID Register, MS */ 11948ef0d2aSRuchika Gupta u32 chavid_ls; /* CHA Version ID Register, LS */ 12048ef0d2aSRuchika Gupta u32 chanum_ms; /* CHA Number Register, MS */ 12148ef0d2aSRuchika Gupta u32 chanum_ls; /* CHA Number Register, LS */ 12248ef0d2aSRuchika Gupta u32 secvid_ms; /* SEC Version ID Register, MS */ 12348ef0d2aSRuchika Gupta u32 secvid_ls; /* SEC Version ID Register, LS */ 124*d8d5fdb7SLaurentiu Tudor #if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3) 125*d8d5fdb7SLaurentiu Tudor u8 res9[0x6f020]; 126*d8d5fdb7SLaurentiu Tudor #else 12748ef0d2aSRuchika Gupta u8 res9[0x6020]; 128*d8d5fdb7SLaurentiu Tudor #endif 12948ef0d2aSRuchika Gupta u32 qilcr_ms; /* Queue Interface LIODN CFG Register, MS */ 13048ef0d2aSRuchika Gupta u32 qilcr_ls; /* Queue Interface LIODN CFG Register, LS */ 131*d8d5fdb7SLaurentiu Tudor #if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3) 132*d8d5fdb7SLaurentiu Tudor u8 res10[0x8ffd8]; 133*d8d5fdb7SLaurentiu Tudor #else 13448ef0d2aSRuchika Gupta u8 res10[0x8fd8]; 135*d8d5fdb7SLaurentiu Tudor #endif 13648ef0d2aSRuchika Gupta } ccsr_sec_t; 13748ef0d2aSRuchika Gupta 13848ef0d2aSRuchika Gupta #define SEC_CTPR_MS_AXI_LIODN 0x08000000 13948ef0d2aSRuchika Gupta #define SEC_CTPR_MS_QI 0x02000000 14048ef0d2aSRuchika Gupta #define SEC_CTPR_MS_VIRT_EN_INCL 0x00000001 14148ef0d2aSRuchika Gupta #define SEC_CTPR_MS_VIRT_EN_POR 0x00000002 14248ef0d2aSRuchika Gupta #define SEC_RVID_MA 0x0f000000 14348ef0d2aSRuchika Gupta #define SEC_CHANUM_MS_JRNUM_MASK 0xf0000000 14448ef0d2aSRuchika Gupta #define SEC_CHANUM_MS_JRNUM_SHIFT 28 14548ef0d2aSRuchika Gupta #define SEC_CHANUM_MS_DECONUM_MASK 0x0f000000 14648ef0d2aSRuchika Gupta #define SEC_CHANUM_MS_DECONUM_SHIFT 24 14748ef0d2aSRuchika Gupta #define SEC_SECVID_MS_IPID_MASK 0xffff0000 14848ef0d2aSRuchika Gupta #define SEC_SECVID_MS_IPID_SHIFT 16 14948ef0d2aSRuchika Gupta #define SEC_SECVID_MS_MAJ_REV_MASK 0x0000ff00 15048ef0d2aSRuchika Gupta #define SEC_SECVID_MS_MAJ_REV_SHIFT 8 15148ef0d2aSRuchika Gupta #define SEC_CCBVID_ERA_MASK 0xff000000 15248ef0d2aSRuchika Gupta #define SEC_CCBVID_ERA_SHIFT 24 15348ef0d2aSRuchika Gupta #define SEC_SCFGR_RDBENABLE 0x00000400 15448ef0d2aSRuchika Gupta #define SEC_SCFGR_VIRT_EN 0x00008000 15548ef0d2aSRuchika Gupta #define SEC_CHAVID_LS_RNG_SHIFT 16 15648ef0d2aSRuchika Gupta #define SEC_CHAVID_RNG_LS_MASK 0x000f0000 157b9eebfadSRuchika Gupta 158b9eebfadSRuchika Gupta #define CONFIG_JRSTARTR_JR0 0x00000001 159b9eebfadSRuchika Gupta 160b9eebfadSRuchika Gupta struct jr_regs { 161f91e65a7SUlises Cardenas #if defined(CONFIG_SYS_FSL_SEC_LE) && \ 162f91e65a7SUlises Cardenas !(defined(CONFIG_MX6) || defined(CONFIG_MX7)) 163b9eebfadSRuchika Gupta u32 irba_l; 164b9eebfadSRuchika Gupta u32 irba_h; 165b9eebfadSRuchika Gupta #else 166b9eebfadSRuchika Gupta u32 irba_h; 167b9eebfadSRuchika Gupta u32 irba_l; 168b9eebfadSRuchika Gupta #endif 169b9eebfadSRuchika Gupta u32 rsvd1; 170b9eebfadSRuchika Gupta u32 irs; 171b9eebfadSRuchika Gupta u32 rsvd2; 172b9eebfadSRuchika Gupta u32 irsa; 173b9eebfadSRuchika Gupta u32 rsvd3; 174b9eebfadSRuchika Gupta u32 irja; 175f91e65a7SUlises Cardenas #if defined(CONFIG_SYS_FSL_SEC_LE) && \ 176f91e65a7SUlises Cardenas !(defined(CONFIG_MX6) || defined(CONFIG_MX7)) 177b9eebfadSRuchika Gupta u32 orba_l; 178b9eebfadSRuchika Gupta u32 orba_h; 179b9eebfadSRuchika Gupta #else 180b9eebfadSRuchika Gupta u32 orba_h; 181b9eebfadSRuchika Gupta u32 orba_l; 182b9eebfadSRuchika Gupta #endif 183b9eebfadSRuchika Gupta u32 rsvd4; 184b9eebfadSRuchika Gupta u32 ors; 185b9eebfadSRuchika Gupta u32 rsvd5; 186b9eebfadSRuchika Gupta u32 orjr; 187b9eebfadSRuchika Gupta u32 rsvd6; 188b9eebfadSRuchika Gupta u32 orsf; 189b9eebfadSRuchika Gupta u32 rsvd7; 190b9eebfadSRuchika Gupta u32 jrsta; 191b9eebfadSRuchika Gupta u32 rsvd8; 192b9eebfadSRuchika Gupta u32 jrint; 193b9eebfadSRuchika Gupta u32 jrcfg0; 194b9eebfadSRuchika Gupta u32 jrcfg1; 195b9eebfadSRuchika Gupta u32 rsvd9; 196b9eebfadSRuchika Gupta u32 irri; 197b9eebfadSRuchika Gupta u32 rsvd10; 198b9eebfadSRuchika Gupta u32 orwi; 199b9eebfadSRuchika Gupta u32 rsvd11; 200b9eebfadSRuchika Gupta u32 jrcr; 201b9eebfadSRuchika Gupta }; 202b9eebfadSRuchika Gupta 20394e3c8c4Sgaurav rana /* 20494e3c8c4Sgaurav rana * Scatter Gather Entry - Specifies the the Scatter Gather Format 20594e3c8c4Sgaurav rana * related information 20694e3c8c4Sgaurav rana */ 20794e3c8c4Sgaurav rana struct sg_entry { 208f91e65a7SUlises Cardenas #if defined(CONFIG_SYS_FSL_SEC_LE) && \ 209f91e65a7SUlises Cardenas !(defined(CONFIG_MX6) || defined(CONFIG_MX7)) 21094e3c8c4Sgaurav rana uint32_t addr_lo; /* Memory Address - lo */ 211f59e69cbSAneesh Bansal uint32_t addr_hi; /* Memory Address of start of buffer - hi */ 21294e3c8c4Sgaurav rana #else 213f59e69cbSAneesh Bansal uint32_t addr_hi; /* Memory Address of start of buffer - hi */ 21494e3c8c4Sgaurav rana uint32_t addr_lo; /* Memory Address - lo */ 21594e3c8c4Sgaurav rana #endif 21694e3c8c4Sgaurav rana 21794e3c8c4Sgaurav rana uint32_t len_flag; /* Length of the data in the frame */ 21894e3c8c4Sgaurav rana #define SG_ENTRY_LENGTH_MASK 0x3FFFFFFF 21994e3c8c4Sgaurav rana #define SG_ENTRY_EXTENSION_BIT 0x80000000 22094e3c8c4Sgaurav rana #define SG_ENTRY_FINAL_BIT 0x40000000 22194e3c8c4Sgaurav rana uint32_t bpid_offset; 22294e3c8c4Sgaurav rana #define SG_ENTRY_BPID_MASK 0x00FF0000 22394e3c8c4Sgaurav rana #define SG_ENTRY_BPID_SHIFT 16 22494e3c8c4Sgaurav rana #define SG_ENTRY_OFFSET_MASK 0x00001FFF 22594e3c8c4Sgaurav rana #define SG_ENTRY_OFFSET_SHIFT 0 22694e3c8c4Sgaurav rana }; 22794e3c8c4Sgaurav rana 228598e9dccSClemens Gruber #define BLOB_SIZE(x) ((x) + 32 + 16) /* Blob buffer size */ 229598e9dccSClemens Gruber 230f91e65a7SUlises Cardenas #if defined(CONFIG_MX6) || defined(CONFIG_MX7) 231f91e65a7SUlises Cardenas /* Job Ring Base Address */ 232f91e65a7SUlises Cardenas #define JR_BASE_ADDR(x) (CONFIG_SYS_FSL_SEC_ADDR + 0x1000 * (x + 1)) 233f91e65a7SUlises Cardenas /* Secure Memory Offset varies accross versions */ 234f91e65a7SUlises Cardenas #define SM_V1_OFFSET 0x0f4 235f91e65a7SUlises Cardenas #define SM_V2_OFFSET 0xa00 236f91e65a7SUlises Cardenas /*Secure Memory Versioning */ 237f91e65a7SUlises Cardenas #define SMVID_V2 0x20105 238f91e65a7SUlises Cardenas #define SM_VERSION(x) (x < SMVID_V2 ? 1 : 2) 239f91e65a7SUlises Cardenas #define SM_OFFSET(x) (x == 1 ? SM_V1_OFFSET : SM_V2_OFFSET) 2400200020bSRaul Cardenas /* CAAM Job Ring 0 Registers */ 2410200020bSRaul Cardenas /* Secure Memory Partition Owner register */ 2420200020bSRaul Cardenas #define SMCSJR_PO (3 << 6) 2430200020bSRaul Cardenas /* JR Allocation Error */ 2440200020bSRaul Cardenas #define SMCSJR_AERR (3 << 12) 2450200020bSRaul Cardenas /* Secure memory partition 0 page 0 owner register */ 246f91e65a7SUlises Cardenas #define CAAM_SMPO_0 (CONFIG_SYS_FSL_SEC_ADDR + 0x1FBC) 2470200020bSRaul Cardenas /* Secure memory command register */ 248f91e65a7SUlises Cardenas #define CAAM_SMCJR(v, jr) (JR_BASE_ADDR(jr) + SM_OFFSET(v) + SM_CMD(v)) 2490200020bSRaul Cardenas /* Secure memory command status register */ 250f91e65a7SUlises Cardenas #define CAAM_SMCSJR(v, jr) (JR_BASE_ADDR(jr) + SM_OFFSET(v) + SM_STATUS(v)) 2510200020bSRaul Cardenas /* Secure memory access permissions register */ 252f91e65a7SUlises Cardenas #define CAAM_SMAPJR(v, jr, y) \ 253f91e65a7SUlises Cardenas (JR_BASE_ADDR(jr) + SM_OFFSET(v) + SM_PERM(v) + y * 16) 2540200020bSRaul Cardenas /* Secure memory access group 2 register */ 255f91e65a7SUlises Cardenas #define CAAM_SMAG2JR(v, jr, y) \ 256f91e65a7SUlises Cardenas (JR_BASE_ADDR(jr) + SM_OFFSET(v) + SM_GROUP2(v) + y * 16) 2570200020bSRaul Cardenas /* Secure memory access group 1 register */ 258f91e65a7SUlises Cardenas #define CAAM_SMAG1JR(v, jr, y) \ 259f91e65a7SUlises Cardenas (JR_BASE_ADDR(jr) + SM_OFFSET(v) + SM_GROUP1(v) + y * 16) 2600200020bSRaul Cardenas 2610200020bSRaul Cardenas /* Commands and macros for secure memory */ 262f91e65a7SUlises Cardenas #define SM_CMD(v) (v == 1 ? 0x0 : 0x1E4) 263f91e65a7SUlises Cardenas #define SM_STATUS(v) (v == 1 ? 0x8 : 0x1EC) 264f91e65a7SUlises Cardenas #define SM_PERM(v) (v == 1 ? 0x10 : 0x4) 265f91e65a7SUlises Cardenas #define SM_GROUP2(v) (v == 1 ? 0x14 : 0x8) 266f91e65a7SUlises Cardenas #define SM_GROUP1(v) (v == 1 ? 0x18 : 0xC) 2670200020bSRaul Cardenas #define CMD_PAGE_ALLOC 0x1 2680200020bSRaul Cardenas #define CMD_PAGE_DEALLOC 0x2 2690200020bSRaul Cardenas #define CMD_PART_DEALLOC 0x3 2700200020bSRaul Cardenas #define CMD_INQUIRY 0x5 2710200020bSRaul Cardenas #define CMD_COMPLETE (3 << 14) 2720200020bSRaul Cardenas #define PAGE_AVAILABLE 0 2730200020bSRaul Cardenas #define PAGE_OWNED (3 << 6) 2740200020bSRaul Cardenas #define PAGE(x) (x << 16) 2750200020bSRaul Cardenas #define PARTITION(x) (x << 8) 2760200020bSRaul Cardenas #define PARTITION_OWNER(x) (0x3 << (x*2)) 2770200020bSRaul Cardenas 2780200020bSRaul Cardenas /* Address of secure 4kbyte pages */ 2790200020bSRaul Cardenas #define SEC_MEM_PAGE0 CAAM_ARB_BASE_ADDR 2800200020bSRaul Cardenas #define SEC_MEM_PAGE1 (CAAM_ARB_BASE_ADDR + 0x1000) 2810200020bSRaul Cardenas #define SEC_MEM_PAGE2 (CAAM_ARB_BASE_ADDR + 0x2000) 2820200020bSRaul Cardenas #define SEC_MEM_PAGE3 (CAAM_ARB_BASE_ADDR + 0x3000) 2830200020bSRaul Cardenas 2840200020bSRaul Cardenas #define JR_MID 2 /* Matches ROM configuration */ 2850200020bSRaul Cardenas #define KS_G1 (1 << JR_MID) /* CAAM only */ 2860200020bSRaul Cardenas #define PERM 0x0000B008 /* Clear on release, lock SMAP 2870200020bSRaul Cardenas * lock SMAG group 1 Blob */ 2880200020bSRaul Cardenas 2890200020bSRaul Cardenas /* HAB WRAPPED KEY header */ 2900200020bSRaul Cardenas #define WRP_HDR_SIZE 0x08 2910200020bSRaul Cardenas #define HDR_TAG 0x81 2920200020bSRaul Cardenas #define HDR_PAR 0x41 2930200020bSRaul Cardenas /* HAB WRAPPED KEY Data */ 2940200020bSRaul Cardenas #define HAB_MOD 0x66 2950200020bSRaul Cardenas #define HAB_ALG 0x55 2960200020bSRaul Cardenas #define HAB_FLG 0x00 2970200020bSRaul Cardenas 2980200020bSRaul Cardenas /* Partition and Page IDs */ 2990200020bSRaul Cardenas #define PARTITION_1 1 3000200020bSRaul Cardenas #define PAGE_1 1 3010200020bSRaul Cardenas 3020200020bSRaul Cardenas #define ERROR_IN_PAGE_ALLOC 1 3030200020bSRaul Cardenas #define ECONSTRJDESC -1 3040200020bSRaul Cardenas 3050200020bSRaul Cardenas #endif 3060200020bSRaul Cardenas 3070200020bSRaul Cardenas /* blob_dek: 3080200020bSRaul Cardenas * Encapsulates the src in a secure blob and stores it dst 3090200020bSRaul Cardenas * @src: reference to the plaintext 3100200020bSRaul Cardenas * @dst: reference to the output adrress 3110200020bSRaul Cardenas * @len: size in bytes of src 3120200020bSRaul Cardenas * @return: 0 on success, error otherwise 3130200020bSRaul Cardenas */ 3140200020bSRaul Cardenas int blob_dek(const u8 *src, u8 *dst, u8 len); 3150200020bSRaul Cardenas 3164fd64746SYork Sun #if defined(CONFIG_ARCH_C29X) 31776394c9cSAlex Porosanu int sec_init_idx(uint8_t); 31876394c9cSAlex Porosanu #endif 31976394c9cSAlex Porosanu int sec_init(void); 32048ef0d2aSRuchika Gupta #endif 32148ef0d2aSRuchika Gupta 32248ef0d2aSRuchika Gupta #endif /* __FSL_SEC_H */ 323