fd25e1567120b650a4fa4f945e73f2f2a85eeb50
[oweals/u-boot.git] / arch / arm / include / asm / fsl_secure_boot.h
1 /*
2  * Copyright 2015 Freescale Semiconductor, Inc.
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6
7 #ifndef __FSL_SECURE_BOOT_H
8 #define __FSL_SECURE_BOOT_H
9
10 #ifdef CONFIG_SECURE_BOOT
11
12 #ifndef CONFIG_FIT_SIGNATURE
13 #define CONFIG_CHAIN_OF_TRUST
14 #endif
15
16 #endif
17
18 #ifdef CONFIG_CHAIN_OF_TRUST
19 #define CONFIG_CMD_ESBC_VALIDATE
20 #define CONFIG_FSL_SEC_MON
21 #define CONFIG_SHA_HW_ACCEL
22 #define CONFIG_SHA_PROG_HW_ACCEL
23 #define CONFIG_RSA_FREESCALE_EXP
24
25 #ifndef CONFIG_FSL_CAAM
26 #define CONFIG_FSL_CAAM
27 #endif
28
29 #define CONFIG_SPL_BOARD_INIT
30 #define CONFIG_SPL_CRYPTO_SUPPORT
31 #define CONFIG_SPL_HASH_SUPPORT
32 #define CONFIG_SPL_RSA
33 #define CONFIG_SPL_DRIVERS_MISC_SUPPORT
34 #ifdef CONFIG_SPL_BUILD
35 /*
36  * Define the key hash for U-Boot here if public/private key pair used to
37  * sign U-boot are different from the SRK hash put in the fuse
38  * Example of defining KEY_HASH is
39  * #define CONFIG_SPL_UBOOT_KEY_HASH \
40  *      "41066b564c6ffcef40ccbc1e0a5d0d519604000c785d97bbefd25e4d288d1c8b"
41  * else leave it defined as NULL
42  */
43
44 #define CONFIG_SPL_UBOOT_KEY_HASH       NULL
45 #endif /* ifdef CONFIG_SPL_BUILD */
46
47 #ifndef CONFIG_SPL_BUILD
48 #define CONFIG_CMD_BLOB
49 #define CONFIG_CMD_HASH
50 #define CONFIG_KEY_REVOCATION
51 #ifndef CONFIG_SYS_RAMBOOT
52 /* The key used for verification of next level images
53  * is picked up from an Extension Table which has
54  * been verified by the ISBC (Internal Secure boot Code)
55  * in boot ROM of the SoC.
56  * The feature is only applicable in case of NOR boot and is
57  * not applicable in case of RAMBOOT (NAND, SD, SPI).
58  */
59 #ifndef CONFIG_ESBC_HDR_LS
60 /* Current Key EXT feature not available in LS ESBC Header */
61 #define CONFIG_FSL_ISBC_KEY_EXT
62 #endif
63
64 #endif
65
66 #if defined(CONFIG_LS1043A) || defined(CONFIG_LS2080A)
67 /* For LS1043 (ARMv8), ESBC image Address in Header is 64 bit
68  * Similiarly for LS2080
69  */
70 #define CONFIG_ESBC_ADDR_64BIT
71 #endif
72
73 #ifdef CONFIG_LS2080A
74 #define CONFIG_EXTRA_ENV \
75         "setenv fdt_high 0xa0000000;"   \
76         "setenv initrd_high 0xcfffffff;"        \
77         "setenv hwconfig \'fsl_ddr:ctlr_intlv=null,bank_intlv=null\';"
78 #else
79 #define CONFIG_EXTRA_ENV \
80         "setenv fdt_high 0xffffffff;"   \
81         "setenv initrd_high 0xffffffff;"        \
82         "setenv hwconfig \'fsl_ddr:ctlr_intlv=null,bank_intlv=null\';"
83 #endif
84
85 /* Copying Bootscript and Header to DDR from NOR for LS2 and for rest, from
86  * Non-XIP Memory (Nand/SD)*/
87 #if defined(CONFIG_SYS_RAMBOOT) || defined(CONFIG_LS2080A) || \
88         defined(CONFIG_SD_BOOT)
89 #define CONFIG_BOOTSCRIPT_COPY_RAM
90 #endif
91 /* The address needs to be modified according to NOR, NAND, SD and
92  * DDR memory map
93  */
94 #ifdef CONFIG_LS2080A
95 #define CONFIG_BS_HDR_ADDR_DEVICE       0x583920000
96 #define CONFIG_BS_ADDR_DEVICE           0x583900000
97 #define CONFIG_BS_HDR_ADDR_RAM          0xa3920000
98 #define CONFIG_BS_ADDR_RAM              0xa3900000
99 #define CONFIG_BS_HDR_SIZE              0x00002000
100 #define CONFIG_BS_SIZE                  0x00001000
101 #else
102 #ifdef CONFIG_SD_BOOT
103 /* For SD boot address and size are assigned in terms of sector
104  * offset and no. of sectors respectively.
105  */
106 #define CONFIG_BS_HDR_ADDR_DEVICE       0x00000800
107 #define CONFIG_BS_ADDR_DEVICE           0x00000840
108 #define CONFIG_BS_HDR_SIZE              0x00000010
109 #define CONFIG_BS_SIZE                  0x00000008
110 #else
111 #define CONFIG_BS_HDR_ADDR_DEVICE       0x600a0000
112 #define CONFIG_BS_ADDR_DEVICE           0x60060000
113 #define CONFIG_BS_HDR_SIZE              0x00002000
114 #define CONFIG_BS_SIZE                  0x00001000
115 #endif /* #ifdef CONFIG_SD_BOOT */
116 #define CONFIG_BS_HDR_ADDR_RAM          0x81000000
117 #define CONFIG_BS_ADDR_RAM              0x81020000
118 #endif
119
120 #ifdef CONFIG_BOOTSCRIPT_COPY_RAM
121 #define CONFIG_BOOTSCRIPT_HDR_ADDR      CONFIG_BS_HDR_ADDR_RAM
122 #define CONFIG_BOOTSCRIPT_ADDR          CONFIG_BS_ADDR_RAM
123 #else
124 #define CONFIG_BOOTSCRIPT_HDR_ADDR      CONFIG_BS_HDR_ADDR_DEVICE
125 /* BOOTSCRIPT_ADDR is not required */
126 #endif
127
128 #include <config_fsl_chain_trust.h>
129 #endif /* #ifndef CONFIG_SPL_BUILD */
130 #endif /* #ifdef CONFIG_CHAIN_OF_TRUST */
131 #endif