1c1db9d73STony Lindgren /* 2c1db9d73STony Lindgren * omap-secure.h: OMAP Secure infrastructure header. 3c1db9d73STony Lindgren * 4c1db9d73STony Lindgren * Copyright (C) 2011 Texas Instruments, Inc. 5c1db9d73STony Lindgren * Santosh Shilimkar <santosh.shilimkar@ti.com> 64748a724SPali Rohár * Copyright (C) 2012 Ivaylo Dimitrov <freemangordon@abv.bg> 74748a724SPali Rohár * Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com> 8c1db9d73STony Lindgren * 9c1db9d73STony Lindgren * This program is free software; you can redistribute it and/or modify 10c1db9d73STony Lindgren * it under the terms of the GNU General Public License version 2 as 11c1db9d73STony Lindgren * published by the Free Software Foundation. 12c1db9d73STony Lindgren */ 13c1db9d73STony Lindgren #ifndef OMAP_ARCH_OMAP_SECURE_H 14c1db9d73STony Lindgren #define OMAP_ARCH_OMAP_SECURE_H 15c1db9d73STony Lindgren 16c1db9d73STony Lindgren /* Monitor error code */ 17c1db9d73STony Lindgren #define API_HAL_RET_VALUE_NS2S_CONVERSION_ERROR 0xFFFFFFFE 18c1db9d73STony Lindgren #define API_HAL_RET_VALUE_SERVICE_UNKNWON 0xFFFFFFFF 19c1db9d73STony Lindgren 20c1db9d73STony Lindgren /* HAL API error codes */ 21c1db9d73STony Lindgren #define API_HAL_RET_VALUE_OK 0x00 22c1db9d73STony Lindgren #define API_HAL_RET_VALUE_FAIL 0x01 23c1db9d73STony Lindgren 24c1db9d73STony Lindgren /* Secure HAL API flags */ 25c1db9d73STony Lindgren #define FLAG_START_CRITICAL 0x4 26c1db9d73STony Lindgren #define FLAG_IRQFIQ_MASK 0x3 27c1db9d73STony Lindgren #define FLAG_IRQ_ENABLE 0x2 28c1db9d73STony Lindgren #define FLAG_FIQ_ENABLE 0x1 29c1db9d73STony Lindgren #define NO_FLAG 0x0 30c1db9d73STony Lindgren 31c1db9d73STony Lindgren /* Maximum Secure memory storage size */ 32c1db9d73STony Lindgren #define OMAP_SECURE_RAM_STORAGE (88 * SZ_1K) 33c1db9d73STony Lindgren 34c1db9d73STony Lindgren /* Secure low power HAL API index */ 35c1db9d73STony Lindgren #define OMAP4_HAL_SAVESECURERAM_INDEX 0x1a 36c1db9d73STony Lindgren #define OMAP4_HAL_SAVEHW_INDEX 0x1b 37c1db9d73STony Lindgren #define OMAP4_HAL_SAVEALL_INDEX 0x1c 38c1db9d73STony Lindgren #define OMAP4_HAL_SAVEGIC_INDEX 0x1d 39c1db9d73STony Lindgren 40c1db9d73STony Lindgren /* Secure Monitor mode APIs */ 41c1db9d73STony Lindgren #define OMAP4_MON_SCU_PWR_INDEX 0x108 42c1db9d73STony Lindgren #define OMAP4_MON_L2X0_DBG_CTRL_INDEX 0x100 43c1db9d73STony Lindgren #define OMAP4_MON_L2X0_CTRL_INDEX 0x102 44c1db9d73STony Lindgren #define OMAP4_MON_L2X0_AUXCTRL_INDEX 0x109 45c1db9d73STony Lindgren #define OMAP4_MON_L2X0_PREFETCH_INDEX 0x113 46c1db9d73STony Lindgren 47c1db9d73STony Lindgren /* Secure PPA(Primary Protected Application) APIs */ 48c1db9d73STony Lindgren #define OMAP4_PPA_L2_POR_INDEX 0x23 49c1db9d73STony Lindgren #define OMAP4_PPA_CPU_ACTRL_SMP_INDEX 0x25 50c1db9d73STony Lindgren 514748a724SPali Rohár /* Secure RX-51 PPA (Primary Protected Application) APIs */ 524748a724SPali Rohár #define RX51_PPA_HWRNG 29 534748a724SPali Rohár #define RX51_PPA_L2_INVAL 40 544748a724SPali Rohár #define RX51_PPA_WRITE_ACR 42 554748a724SPali Rohár 56c1db9d73STony Lindgren #ifndef __ASSEMBLER__ 57c1db9d73STony Lindgren 58c1db9d73STony Lindgren extern u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs, 59c1db9d73STony Lindgren u32 arg1, u32 arg2, u32 arg3, u32 arg4); 60c1db9d73STony Lindgren extern u32 omap_smc2(u32 id, u32 falg, u32 pargs); 61a33f1788SPali Rohár extern u32 omap_smc3(u32 id, u32 process, u32 flag, u32 pargs); 62c1db9d73STony Lindgren extern phys_addr_t omap_secure_ram_mempool_base(void); 63f7a9b8a1SLokesh Vutla extern int omap_secure_ram_reserve_memblock(void); 64c1db9d73STony Lindgren 654748a724SPali Rohár extern u32 rx51_secure_dispatcher(u32 idx, u32 process, u32 flag, u32 nargs, 664748a724SPali Rohár u32 arg1, u32 arg2, u32 arg3, u32 arg4); 674748a724SPali Rohár extern u32 rx51_secure_update_aux_cr(u32 set_bits, u32 clear_bits); 68*d2065e2bSPali Rohár extern u32 rx51_secure_rng_call(u32 ptr, u32 count, u32 flag); 694748a724SPali Rohár 70f7a9b8a1SLokesh Vutla #ifdef CONFIG_OMAP4_ERRATA_I688 71f7a9b8a1SLokesh Vutla extern int omap_barrier_reserve_memblock(void); 72f7a9b8a1SLokesh Vutla #else 73f7a9b8a1SLokesh Vutla static inline void omap_barrier_reserve_memblock(void) 74f7a9b8a1SLokesh Vutla { } 75f7a9b8a1SLokesh Vutla #endif 76c1db9d73STony Lindgren #endif /* __ASSEMBLER__ */ 77c1db9d73STony Lindgren #endif /* OMAP_ARCH_OMAP_SECURE_H */ 78