Stefano Babic | b83c709 | 2013-06-28 00:20:21 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Freescale Semiconductor, Inc. All Rights Reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef __SECURE_MX6Q_H__ |
| 9 | #define __SECURE_MX6Q_H__ |
| 10 | |
| 11 | #include <linux/types.h> |
| 12 | |
| 13 | /* -------- start of HAB API updates ------------*/ |
| 14 | /* The following are taken from HAB4 SIS */ |
| 15 | |
| 16 | /* Status definitions */ |
| 17 | enum hab_status { |
| 18 | HAB_STS_ANY = 0x00, |
| 19 | HAB_FAILURE = 0x33, |
| 20 | HAB_WARNING = 0x69, |
| 21 | HAB_SUCCESS = 0xf0 |
| 22 | }; |
| 23 | |
| 24 | /* Security Configuration definitions */ |
| 25 | enum hab_config { |
| 26 | HAB_CFG_RETURN = 0x33, /**< Field Return IC */ |
| 27 | HAB_CFG_OPEN = 0xf0, /**< Non-secure IC */ |
| 28 | HAB_CFG_CLOSED = 0xcc /**< Secure IC */ |
| 29 | }; |
| 30 | |
| 31 | /* State definitions */ |
| 32 | enum hab_state { |
| 33 | HAB_STATE_INITIAL = 0x33, /**< Initialising state (transitory) */ |
| 34 | HAB_STATE_CHECK = 0x55, /**< Check state (non-secure) */ |
| 35 | HAB_STATE_NONSECURE = 0x66, /**< Non-secure state */ |
| 36 | HAB_STATE_TRUSTED = 0x99, /**< Trusted state */ |
| 37 | HAB_STATE_SECURE = 0xaa, /**< Secure state */ |
| 38 | HAB_STATE_FAIL_SOFT = 0xcc, /**< Soft fail state */ |
| 39 | HAB_STATE_FAIL_HARD = 0xff, /**< Hard fail state (terminal) */ |
| 40 | HAB_STATE_NONE = 0xf0, /**< No security state machine */ |
| 41 | HAB_STATE_MAX |
| 42 | }; |
| 43 | |
| 44 | /*Function prototype description*/ |
| 45 | typedef enum hab_status hab_rvt_report_event_t(enum hab_status, uint32_t, |
| 46 | uint8_t* , size_t*); |
| 47 | typedef enum hab_status hab_rvt_report_status_t(enum hab_config *, |
| 48 | enum hab_state *); |
| 49 | typedef enum hab_status hab_loader_callback_f_t(void**, size_t*, const void*); |
| 50 | typedef enum hab_status hab_rvt_entry_t(void); |
| 51 | typedef enum hab_status hab_rvt_exit_t(void); |
| 52 | typedef void *hab_rvt_authenticate_image_t(uint8_t, ptrdiff_t, |
| 53 | void **, size_t *, hab_loader_callback_f_t); |
| 54 | typedef void hapi_clock_init_t(void); |
| 55 | |
Nitin Garg | 13bc8603 | 2014-09-30 11:39:29 -0500 | [diff] [blame^] | 56 | #ifdef CONFIG_MX6SX |
| 57 | #define HAB_RVT_BASE 0x00000100 |
| 58 | #else |
| 59 | #define HAB_RVT_BASE 0x00000094 |
| 60 | #endif |
| 61 | |
| 62 | #define HAB_RVT_ENTRY (*(uint32_t *)(HAB_RVT_BASE + 0x04)) |
| 63 | #define HAB_RVT_EXIT (*(uint32_t *)(HAB_RVT_BASE + 0x08)) |
| 64 | #define HAB_RVT_AUTHENTICATE_IMAGE (*(uint32_t *)(HAB_RVT_BASE + 0x10)) |
| 65 | #define HAB_RVT_REPORT_EVENT (*(uint32_t *)(HAB_RVT_BASE + 0x20)) |
| 66 | #define HAB_RVT_REPORT_STATUS (*(uint32_t *)(HAB_RVT_BASE + 0x24)) |
Stefano Babic | f2f07e8 | 2014-06-10 10:26:22 +0200 | [diff] [blame] | 67 | |
| 68 | #define HAB_RVT_REPORT_EVENT_NEW (*(uint32_t *)0x000000B8) |
| 69 | #define HAB_RVT_REPORT_STATUS_NEW (*(uint32_t *)0x000000BC) |
| 70 | #define HAB_RVT_AUTHENTICATE_IMAGE_NEW (*(uint32_t *)0x000000A8) |
| 71 | #define HAB_RVT_ENTRY_NEW (*(uint32_t *)0x0000009C) |
| 72 | #define HAB_RVT_EXIT_NEW (*(uint32_t *)0x000000A0) |
Stefano Babic | b83c709 | 2013-06-28 00:20:21 +0200 | [diff] [blame] | 73 | |
| 74 | #define HAB_CID_ROM 0 /**< ROM Caller ID */ |
| 75 | #define HAB_CID_UBOOT 1 /**< UBOOT Caller ID*/ |
| 76 | /* ----------- end of HAB API updates ------------*/ |
| 77 | |
| 78 | #endif |