gaurav rana | f79323c | 2015-03-10 14:08:50 +0530 | [diff] [blame] | 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 |
Aneesh Bansal | 4310470 | 2016-01-22 16:37:24 +0530 | [diff] [blame] | 11 | |
| 12 | #ifndef CONFIG_FIT_SIGNATURE |
| 13 | #define CONFIG_CHAIN_OF_TRUST |
| 14 | #endif |
| 15 | |
| 16 | #endif |
| 17 | |
| 18 | #ifdef CONFIG_CHAIN_OF_TRUST |
Aneesh Bansal | d31bb3e | 2015-07-31 14:10:03 +0530 | [diff] [blame] | 19 | #define CONFIG_CMD_ESBC_VALIDATE |
| 20 | #define CONFIG_FSL_SEC_MON |
Saksham Jain | c0c38d2 | 2016-03-23 16:24:35 +0530 | [diff] [blame] | 21 | #define CONFIG_SHA_HW_ACCEL |
Aneesh Bansal | d31bb3e | 2015-07-31 14:10:03 +0530 | [diff] [blame] | 22 | #define CONFIG_SHA_PROG_HW_ACCEL |
Aneesh Bansal | d31bb3e | 2015-07-31 14:10:03 +0530 | [diff] [blame] | 23 | #define CONFIG_RSA_FREESCALE_EXP |
Aneesh Bansal | b3e9820 | 2015-12-08 13:54:29 +0530 | [diff] [blame] | 24 | |
Aneesh Bansal | d31bb3e | 2015-07-31 14:10:03 +0530 | [diff] [blame] | 25 | #ifndef CONFIG_FSL_CAAM |
| 26 | #define CONFIG_FSL_CAAM |
| 27 | #endif |
| 28 | |
Sumit Garg | bdddd6e | 2016-06-14 13:52:38 -0400 | [diff] [blame] | 29 | #ifdef CONFIG_SPL_BUILD |
| 30 | #define CONFIG_SPL_BOARD_INIT |
| 31 | #define CONFIG_SPL_DM 1 |
| 32 | #define CONFIG_SPL_CRYPTO_SUPPORT |
| 33 | #define CONFIG_SPL_HASH_SUPPORT |
| 34 | #define CONFIG_SPL_RSA |
| 35 | #define CONFIG_SPL_DRIVERS_MISC_SUPPORT |
| 36 | /* |
| 37 | * Define the key hash for U-Boot here if public/private key pair used to |
| 38 | * sign U-boot are different from the SRK hash put in the fuse |
| 39 | * Example of defining KEY_HASH is |
| 40 | * #define CONFIG_SPL_UBOOT_KEY_HASH \ |
| 41 | * "41066b564c6ffcef40ccbc1e0a5d0d519604000c785d97bbefd25e4d288d1c8b" |
| 42 | * else leave it defined as NULL |
| 43 | */ |
| 44 | |
| 45 | #define CONFIG_SPL_UBOOT_KEY_HASH NULL |
| 46 | #endif /* ifdef CONFIG_SPL_BUILD */ |
| 47 | |
| 48 | #ifndef CONFIG_SPL_BUILD |
| 49 | #define CONFIG_CMD_BLOB |
| 50 | #define CONFIG_CMD_HASH |
Aneesh Bansal | d31bb3e | 2015-07-31 14:10:03 +0530 | [diff] [blame] | 51 | #define CONFIG_KEY_REVOCATION |
| 52 | #ifndef CONFIG_SYS_RAMBOOT |
| 53 | /* The key used for verification of next level images |
| 54 | * is picked up from an Extension Table which has |
| 55 | * been verified by the ISBC (Internal Secure boot Code) |
| 56 | * in boot ROM of the SoC. |
| 57 | * The feature is only applicable in case of NOR boot and is |
| 58 | * not applicable in case of RAMBOOT (NAND, SD, SPI). |
| 59 | */ |
Saksham Jain | 6121f08 | 2016-03-23 16:24:34 +0530 | [diff] [blame] | 60 | #ifndef CONFIG_ESBC_HDR_LS |
| 61 | /* Current Key EXT feature not available in LS ESBC Header */ |
Aneesh Bansal | d31bb3e | 2015-07-31 14:10:03 +0530 | [diff] [blame] | 62 | #define CONFIG_FSL_ISBC_KEY_EXT |
| 63 | #endif |
| 64 | |
Saksham Jain | 6121f08 | 2016-03-23 16:24:34 +0530 | [diff] [blame] | 65 | #endif |
| 66 | |
York Sun | cbe8e1c | 2016-04-04 11:41:26 -0700 | [diff] [blame] | 67 | #if defined(CONFIG_LS1043A) || defined(CONFIG_LS2080A) |
Saksham Jain | c0c38d2 | 2016-03-23 16:24:35 +0530 | [diff] [blame] | 68 | /* For LS1043 (ARMv8), ESBC image Address in Header is 64 bit |
York Sun | cbe8e1c | 2016-04-04 11:41:26 -0700 | [diff] [blame] | 69 | * Similiarly for LS2080 |
Saksham Jain | c0c38d2 | 2016-03-23 16:24:35 +0530 | [diff] [blame] | 70 | */ |
Aneesh Bansal | 962021a | 2016-01-22 16:37:22 +0530 | [diff] [blame] | 71 | #define CONFIG_ESBC_ADDR_64BIT |
| 72 | #endif |
| 73 | |
York Sun | cbe8e1c | 2016-04-04 11:41:26 -0700 | [diff] [blame] | 74 | #ifdef CONFIG_LS2080A |
Saksham Jain | f0eb2ca | 2016-03-23 16:24:38 +0530 | [diff] [blame] | 75 | #define CONFIG_EXTRA_ENV \ |
| 76 | "setenv fdt_high 0xa0000000;" \ |
| 77 | "setenv initrd_high 0xcfffffff;" \ |
| 78 | "setenv hwconfig \'fsl_ddr:ctlr_intlv=null,bank_intlv=null\';" |
| 79 | #else |
gaurav rana | f79323c | 2015-03-10 14:08:50 +0530 | [diff] [blame] | 80 | #define CONFIG_EXTRA_ENV \ |
Sumit Garg | 4564283 | 2016-06-14 13:52:39 -0400 | [diff] [blame] | 81 | "setenv fdt_high 0xffffffff;" \ |
| 82 | "setenv initrd_high 0xffffffff;" \ |
gaurav rana | f79323c | 2015-03-10 14:08:50 +0530 | [diff] [blame] | 83 | "setenv hwconfig \'fsl_ddr:ctlr_intlv=null,bank_intlv=null\';" |
Saksham Jain | f0eb2ca | 2016-03-23 16:24:38 +0530 | [diff] [blame] | 84 | #endif |
gaurav rana | f79323c | 2015-03-10 14:08:50 +0530 | [diff] [blame] | 85 | |
Saksham Jain | 503eab9 | 2016-03-23 16:24:37 +0530 | [diff] [blame] | 86 | /* Copying Bootscript and Header to DDR from NOR for LS2 and for rest, from |
| 87 | * Non-XIP Memory (Nand/SD)*/ |
Sumit Garg | 4564283 | 2016-06-14 13:52:39 -0400 | [diff] [blame] | 88 | #if defined(CONFIG_SYS_RAMBOOT) || defined(CONFIG_LS2080A) || \ |
| 89 | defined(CONFIG_SD_BOOT) |
Saksham Jain | 503eab9 | 2016-03-23 16:24:37 +0530 | [diff] [blame] | 90 | #define CONFIG_BOOTSCRIPT_COPY_RAM |
| 91 | #endif |
Sumit Garg | 4564283 | 2016-06-14 13:52:39 -0400 | [diff] [blame] | 92 | /* The address needs to be modified according to NOR, NAND, SD and |
| 93 | * DDR memory map |
| 94 | */ |
York Sun | cbe8e1c | 2016-04-04 11:41:26 -0700 | [diff] [blame] | 95 | #ifdef CONFIG_LS2080A |
Sumit Garg | 4564283 | 2016-06-14 13:52:39 -0400 | [diff] [blame] | 96 | #define CONFIG_BS_HDR_ADDR_DEVICE 0x583920000 |
| 97 | #define CONFIG_BS_ADDR_DEVICE 0x583900000 |
Saksham Jain | 503eab9 | 2016-03-23 16:24:37 +0530 | [diff] [blame] | 98 | #define CONFIG_BS_HDR_ADDR_RAM 0xa3920000 |
| 99 | #define CONFIG_BS_ADDR_RAM 0xa3900000 |
Sumit Garg | 4564283 | 2016-06-14 13:52:39 -0400 | [diff] [blame] | 100 | #define CONFIG_BS_HDR_SIZE 0x00002000 |
| 101 | #define CONFIG_BS_SIZE 0x00001000 |
Saksham Jain | 503eab9 | 2016-03-23 16:24:37 +0530 | [diff] [blame] | 102 | #else |
Sumit Garg | 4564283 | 2016-06-14 13:52:39 -0400 | [diff] [blame] | 103 | #ifdef CONFIG_SD_BOOT |
| 104 | /* For SD boot address and size are assigned in terms of sector |
| 105 | * offset and no. of sectors respectively. |
| 106 | */ |
| 107 | #define CONFIG_BS_HDR_ADDR_DEVICE 0x00000800 |
| 108 | #define CONFIG_BS_ADDR_DEVICE 0x00000840 |
| 109 | #define CONFIG_BS_HDR_SIZE 0x00000010 |
| 110 | #define CONFIG_BS_SIZE 0x00000008 |
| 111 | #else |
| 112 | #define CONFIG_BS_HDR_ADDR_DEVICE 0x600a0000 |
| 113 | #define CONFIG_BS_ADDR_DEVICE 0x60060000 |
| 114 | #define CONFIG_BS_HDR_SIZE 0x00002000 |
| 115 | #define CONFIG_BS_SIZE 0x00001000 |
| 116 | #endif /* #ifdef CONFIG_SD_BOOT */ |
| 117 | #define CONFIG_BS_HDR_ADDR_RAM 0x81000000 |
| 118 | #define CONFIG_BS_ADDR_RAM 0x81020000 |
Saksham Jain | 503eab9 | 2016-03-23 16:24:37 +0530 | [diff] [blame] | 119 | #endif |
| 120 | |
| 121 | #ifdef CONFIG_BOOTSCRIPT_COPY_RAM |
| 122 | #define CONFIG_BOOTSCRIPT_HDR_ADDR CONFIG_BS_HDR_ADDR_RAM |
Saksham Jain | 503eab9 | 2016-03-23 16:24:37 +0530 | [diff] [blame] | 123 | #define CONFIG_BOOTSCRIPT_ADDR CONFIG_BS_ADDR_RAM |
Saksham Jain | 506c2eb | 2016-03-23 16:24:36 +0530 | [diff] [blame] | 124 | #else |
Sumit Garg | 4564283 | 2016-06-14 13:52:39 -0400 | [diff] [blame] | 125 | #define CONFIG_BOOTSCRIPT_HDR_ADDR CONFIG_BS_HDR_ADDR_DEVICE |
| 126 | /* BOOTSCRIPT_ADDR is not required */ |
Saksham Jain | 506c2eb | 2016-03-23 16:24:36 +0530 | [diff] [blame] | 127 | #endif |
gaurav rana | f79323c | 2015-03-10 14:08:50 +0530 | [diff] [blame] | 128 | |
Sumit Garg | e0f9e9b | 2016-09-01 12:56:44 -0400 | [diff] [blame^] | 129 | #ifdef CONFIG_FSL_LS_PPA |
| 130 | #ifdef CONFIG_SYS_LS_PPA_FW_IN_XIP |
| 131 | #ifdef CONFIG_LS1043A |
| 132 | #define CONFIG_SYS_LS_PPA_ESBC_ADDR 0x600c0000 |
| 133 | #endif |
| 134 | #else |
| 135 | #error "No CONFIG_SYS_LS_PPA_FW_IN_xxx defined" |
| 136 | #endif /* ifdef CONFIG_SYS_LS_PPA_FW_IN_XIP */ |
| 137 | |
| 138 | /* Define the key hash here if SRK used for signing PPA image is |
| 139 | * different from SRK hash put in SFP used for U-Boot. |
| 140 | * Example |
| 141 | * #define CONFIG_PPA_KEY_HASH \ |
| 142 | * "41066b564c6ffcef40ccbc1e0a5d0d519604000c785d97bbefd25e4d288d1c8b" |
| 143 | */ |
| 144 | #define CONFIG_PPA_KEY_HASH NULL |
| 145 | #endif /* ifdef CONFIG_FSL_LS_PPA */ |
| 146 | |
Aneesh Bansal | 4310470 | 2016-01-22 16:37:24 +0530 | [diff] [blame] | 147 | #include <config_fsl_chain_trust.h> |
Sumit Garg | bdddd6e | 2016-06-14 13:52:38 -0400 | [diff] [blame] | 148 | #endif /* #ifndef CONFIG_SPL_BUILD */ |
Aneesh Bansal | 4310470 | 2016-01-22 16:37:24 +0530 | [diff] [blame] | 149 | #endif /* #ifdef CONFIG_CHAIN_OF_TRUST */ |
gaurav rana | f79323c | 2015-03-10 14:08:50 +0530 | [diff] [blame] | 150 | #endif |