1 /*****************************************************************************
2 * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved.
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").
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
13 *****************************************************************************/
15 /****************************************************************************/
17 * @file secHw_inline.h
19 * @brief Definitions for configuring/testing secure blocks
24 /****************************************************************************/
26 #ifndef SECHW_INLINE_H
27 #define SECHW_INLINE_H
29 /****************************************************************************/
31 * @brief Configures a device as a secure device
34 /****************************************************************************/
35 static inline void secHw_setSecure(uint32_t mask
/* mask of type secHw_BLK_MASK_XXXXXX */
37 secHw_REGS_t
*regp
= (secHw_REGS_t
*) MM_IO_BASE_TZPC
;
39 if (mask
& 0x0000FFFF) {
40 regp
->reg
[secHw_IDX_LS
].setSecure
= mask
& 0x0000FFFF;
43 if (mask
& 0xFFFF0000) {
44 regp
->reg
[secHw_IDX_MS
].setSecure
= mask
>> 16;
48 /****************************************************************************/
50 * @brief Configures a device as a non-secure device
53 /****************************************************************************/
54 static inline void secHw_setUnsecure(uint32_t mask
/* mask of type secHw_BLK_MASK_XXXXXX */
56 secHw_REGS_t
*regp
= (secHw_REGS_t
*) MM_IO_BASE_TZPC
;
58 if (mask
& 0x0000FFFF) {
59 regp
->reg
[secHw_IDX_LS
].setUnsecure
= mask
& 0x0000FFFF;
61 if (mask
& 0xFFFF0000) {
62 regp
->reg
[secHw_IDX_MS
].setUnsecure
= mask
>> 16;
66 /****************************************************************************/
68 * @brief Get the trustzone status for all components. 1 = non-secure, 0 = secure
71 /****************************************************************************/
72 static inline uint32_t secHw_getStatus(void)
74 secHw_REGS_t
*regp
= (secHw_REGS_t
*) MM_IO_BASE_TZPC
;
76 return (regp
->reg
[1].status
<< 16) + regp
->reg
[0].status
;
79 #endif /* SECHW_INLINE_H */