1 /***************************************************************************** 2 * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. 3 * 4 * Unless you and Broadcom execute a separate written software license 5 * agreement governing use of this software, this software is licensed to you 6 * under the terms of the GNU General Public License version 2, available at 7 * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). 8 * 9 * Notwithstanding the above, under no circumstances may you combine this 10 * software in any way with any other Broadcom software provided under a 11 * license other than the GPL, without Broadcom's express prior written 12 * consent. 13 *****************************************************************************/ 14 15 /****************************************************************************/ 16 /** 17 * @file secHw_inline.h 18 * 19 * @brief Definitions for configuring/testing secure blocks 20 * 21 * @note 22 * None 23 */ 24 /****************************************************************************/ 25 26 #ifndef SECHW_INLINE_H 27 #define SECHW_INLINE_H 28 29 /****************************************************************************/ 30 /** 31 * @brief Configures a device as a secure device 32 * 33 */ 34 /****************************************************************************/ secHw_setSecure(uint32_t mask)35static inline void secHw_setSecure(uint32_t mask /* mask of type secHw_BLK_MASK_XXXXXX */ 36 ) { 37 secHw_REGS_t *regp = (secHw_REGS_t *) MM_IO_BASE_TZPC; 38 39 if (mask & 0x0000FFFF) { 40 regp->reg[secHw_IDX_LS].setSecure = mask & 0x0000FFFF; 41 } 42 43 if (mask & 0xFFFF0000) { 44 regp->reg[secHw_IDX_MS].setSecure = mask >> 16; 45 } 46 } 47 48 /****************************************************************************/ 49 /** 50 * @brief Configures a device as a non-secure device 51 * 52 */ 53 /****************************************************************************/ secHw_setUnsecure(uint32_t mask)54static inline void secHw_setUnsecure(uint32_t mask /* mask of type secHw_BLK_MASK_XXXXXX */ 55 ) { 56 secHw_REGS_t *regp = (secHw_REGS_t *) MM_IO_BASE_TZPC; 57 58 if (mask & 0x0000FFFF) { 59 regp->reg[secHw_IDX_LS].setUnsecure = mask & 0x0000FFFF; 60 } 61 if (mask & 0xFFFF0000) { 62 regp->reg[secHw_IDX_MS].setUnsecure = mask >> 16; 63 } 64 } 65 66 /****************************************************************************/ 67 /** 68 * @brief Get the trustzone status for all components. 1 = non-secure, 0 = secure 69 * 70 */ 71 /****************************************************************************/ secHw_getStatus(void)72static inline uint32_t secHw_getStatus(void) 73 { 74 secHw_REGS_t *regp = (secHw_REGS_t *) MM_IO_BASE_TZPC; 75 76 return (regp->reg[1].status << 16) + regp->reg[0].status; 77 } 78 79 #endif /* SECHW_INLINE_H */ 80