Path: blob/master/arch/arm/mach-bcmring/include/mach/csp/secHw_inline.h
10821 views
/*****************************************************************************1* Copyright 2003 - 2008 Broadcom Corporation. All rights reserved.2*3* Unless you and Broadcom execute a separate written software license4* agreement governing use of this software, this software is licensed to you5* under the terms of the GNU General Public License version 2, available at6* http://www.broadcom.com/licenses/GPLv2.php (the "GPL").7*8* Notwithstanding the above, under no circumstances may you combine this9* software in any way with any other Broadcom software provided under a10* license other than the GPL, without Broadcom's express prior written11* consent.12*****************************************************************************/1314/****************************************************************************/15/**16* @file secHw_inline.h17*18* @brief Definitions for configuring/testing secure blocks19*20* @note21* None22*/23/****************************************************************************/2425#ifndef SECHW_INLINE_H26#define SECHW_INLINE_H2728/****************************************************************************/29/**30* @brief Configures a device as a secure device31*32*/33/****************************************************************************/34static inline void secHw_setSecure(uint32_t mask /* mask of type secHw_BLK_MASK_XXXXXX */35) {36secHw_REGS_t *regp = (secHw_REGS_t *) MM_IO_BASE_TZPC;3738if (mask & 0x0000FFFF) {39regp->reg[secHw_IDX_LS].setSecure = mask & 0x0000FFFF;40}4142if (mask & 0xFFFF0000) {43regp->reg[secHw_IDX_MS].setSecure = mask >> 16;44}45}4647/****************************************************************************/48/**49* @brief Configures a device as a non-secure device50*51*/52/****************************************************************************/53static inline void secHw_setUnsecure(uint32_t mask /* mask of type secHw_BLK_MASK_XXXXXX */54) {55secHw_REGS_t *regp = (secHw_REGS_t *) MM_IO_BASE_TZPC;5657if (mask & 0x0000FFFF) {58regp->reg[secHw_IDX_LS].setUnsecure = mask & 0x0000FFFF;59}60if (mask & 0xFFFF0000) {61regp->reg[secHw_IDX_MS].setUnsecure = mask >> 16;62}63}6465/****************************************************************************/66/**67* @brief Get the trustzone status for all components. 1 = non-secure, 0 = secure68*69*/70/****************************************************************************/71static inline uint32_t secHw_getStatus(void)72{73secHw_REGS_t *regp = (secHw_REGS_t *) MM_IO_BASE_TZPC;7475return (regp->reg[1].status << 16) + regp->reg[0].status;76}7778#endif /* SECHW_INLINE_H */798081