Soby Mathew | 1ae83bc | 2017-05-10 11:48:40 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef _SBROM_BSV_API_H |
| 8 | #define _SBROM_BSV_API_H |
| 9 | |
| 10 | #ifdef __cplusplus |
| 11 | extern "C" |
| 12 | { |
| 13 | #endif |
| 14 | |
| 15 | /*! @file |
| 16 | @brief This file contains all SBROM library APIs and definitions. |
| 17 | */ |
| 18 | #include "cc_pal_types.h" |
| 19 | |
| 20 | /* Life cycle state definitions */ |
| 21 | #define CC_BSV_CHIP_MANUFACTURE_LCS 0x0 /*!< CM lifecycle value. */ |
| 22 | #define CC_BSV_DEVICE_MANUFACTURE_LCS 0x1 /*!< DM lifecycle value. */ |
| 23 | #define CC_BSV_SECURITY_DISABLED_LCS 0x3 /*!< SD lifecycle value. */ |
| 24 | #define CC_BSV_SECURE_LCS 0x5 /*!< Secure lifecycle value. */ |
| 25 | #define CC_BSV_RMA_LCS 0x7 /*!< RMA lifecycle value. */ |
| 26 | |
| 27 | /*---------------------------- |
| 28 | PUBLIC FUNCTIONS |
| 29 | -----------------------------------*/ |
| 30 | |
| 31 | /*! |
| 32 | @brief This function should be the first ARM TrustZone CryptoCell TEE SBROM library API called. |
| 33 | It verifies the HW product and version numbers. |
| 34 | |
| 35 | @return CC_OK On success. |
| 36 | @return A non-zero value from sbrom_bsv_error.h on failure. |
| 37 | */ |
| 38 | CCError_t CC_BsvSbromInit( |
| 39 | unsigned long hwBaseAddress /*!< [in] HW registers base address. */ |
| 40 | ); |
| 41 | |
| 42 | |
| 43 | /*! |
| 44 | @brief This function can be used for checking the LCS value, after CC_BsvLcsGetAndInit was called by the Boot ROM. |
| 45 | |
| 46 | @return CC_OK On success. |
| 47 | @return A non-zero value from sbrom_bsv_error.h on failure. |
| 48 | */ |
| 49 | CCError_t CC_BsvLcsGet( |
| 50 | unsigned long hwBaseAddress, /*!< [in] HW registers base address. */ |
| 51 | uint32_t *pLcs /*!< [out] Returned lifecycle state. */ |
| 52 | ); |
| 53 | |
| 54 | /*! |
| 55 | @brief This function retrieves the HW security lifecycle state, performs validity checks, |
| 56 | and additional initializations in case the LCS is RMA (sets the Kce to fixed value). |
| 57 | \note Invalid LCS results in an error returned. |
| 58 | In this case, the customer's code must completely disable the device. |
| 59 | |
| 60 | @return CC_OK On success. |
| 61 | @return A non-zero value from sbrom_bsv_error.h on failure. |
| 62 | */ |
| 63 | CCError_t CC_BsvLcsGetAndInit( |
| 64 | unsigned long hwBaseAddress, /*!< [in] HW registers base address. */ |
| 65 | uint32_t *pLcs /*!< [out] Returned lifecycle state. */ |
| 66 | ); |
| 67 | |
| 68 | #ifdef __cplusplus |
| 69 | } |
| 70 | #endif |
| 71 | |
| 72 | #endif |