#ifndef _RKP_H #define _RKP_H #ifndef __ASSEMBLY__ #ifndef LINKER_SCRIPT #include /* uH_RKP Command ID */ enum __RKP_CMD_ID{ RKP_START = 0x01, RKP_DEFERRED_START = 0x02, RKP_WRITE_PGT1 = 0x03, RKP_WRITE_PGT2 = 0x04, RKP_WRITE_PGT3 = 0x05, RKP_EMULT_TTBR0 = 0x06, RKP_EMULT_TTBR1 = 0x07, RKP_EMULT_DORESUME = 0x08, RKP_FREE_PGD = 0x09, RKP_NEW_PGD = 0x0A, RKP_KASLR_MEM = 0x0B, RKP_FIMC_VERIFY = 0x0C, /* CFP cmds */ RKP_JOPP_INIT = 0x0D, RKP_ROPP_INIT = 0x0E, RKP_ROPP_SAVE = 0x0F, RKP_ROPP_RELOAD = 0x10, /* RKP robuffer cmds*/ RKP_RKP_ROBUFFER_ALLOC = 0x11, RKP_RKP_ROBUFFER_FREE = 0x12, RKP_GET_RO_BITMAP = 0x13, RKP_GET_DBL_BITMAP = 0x14, RKP_GET_RKP_GET_BUFFER_BITMAP = 0x15, /* dynamic load */ RKP_DYNAMIC_LOAD = 0x20, RKP_MODULE_LOAD = 0x21, RKP_BFP_LOAD = 0x22, /* and KDP cmds */ RKP_KDP_X40 = 0x40, RKP_KDP_X41 = 0x41, RKP_KDP_X42 = 0x42, RKP_KDP_X43 = 0x43, RKP_KDP_X44 = 0x44, RKP_KDP_X45 = 0x45, RKP_KDP_X46 = 0x46, RKP_KDP_X47 = 0x47, RKP_KDP_X48 = 0x48, RKP_KDP_X49 = 0x49, RKP_KDP_X4A = 0x4A, RKP_KDP_X4B = 0x4B, RKP_KDP_X4C = 0x4C, RKP_KDP_X4D = 0x4D, RKP_KDP_X4E = 0x4E, RKP_KDP_X4F = 0x4F, RKP_KDP_X50 = 0x50, RKP_KDP_X51 = 0x51, RKP_KDP_X52 = 0x52, RKP_KDP_X53 = 0x53, RKP_KDP_X54 = 0x54, RKP_KDP_X55 = 0x55, RKP_KDP_X56 = 0x56, RKP_KDP_X60 = 0x60, #ifdef CONFIG_RKP_TEST CMD_ID_TEST_GET_PAR = 0x81, CMD_ID_TEST_GET_RO = 0x83, CMD_ID_TEST_GET_VA_XN, CMD_ID_TEST_GET_VMM_INFO, #endif }; #ifdef CONFIG_RKP_TEST #define RKP_INIT_MAGIC 0x5afe0002 #else #define RKP_INIT_MAGIC 0x5afe0001 #endif #define RKP_FIMC_FAIL 0x10 #define RKP_FIMC_SUCCESS 0xa5 #define CRED_JAR_RO "cred_jar_ro" #define TSEC_JAR "tsec_jar" #define VFSMNT_JAR "vfsmnt_cache" #define SPARSE_UNIT_BIT (30) #define SPARSE_UNIT_SIZE (1<map) return uninitialized_ret; offset = pa - kernel_bitmap->start_addr; map_loc = ((offset % SPARSE_UNIT_SIZE) / PAGE_SIZE) >> 3; bit_offset = ((offset % SPARSE_UNIT_SIZE) / PAGE_SIZE) % 8; if(kernel_bitmap->maxn <= (offset >> SPARSE_UNIT_BIT)) return overflow_ret; map = kernel_bitmap->map[(offset >> SPARSE_UNIT_BIT)]; if(!map) return uninitialized_ret; val = ((u8)map[map_loc] >> bit_offset) & ((u8)1); return val; } static inline unsigned int is_rkp_ro_page(u64 va){ return rkp_check_bitmap(__pa(va), rkp_s_bitmap_buffer, 0, 0); } static inline u8 rkp_is_pg_protected(u64 va){ return rkp_check_bitmap(__pa(va), rkp_s_bitmap_ro, 1, 0); } static inline u8 rkp_is_pg_dbl_mapped(u64 pa){ return rkp_check_bitmap(pa, rkp_s_bitmap_dbl, 0, 0); } #endif // LINKER_SCRIPT #endif //__ASSEMBLY__ #endif //_RKP_H