xref: /rk3399_rockchip-uboot/arch/arm/include/asm/fsl_secure_boot.h (revision 9b6639fa85bddd90df4c371f25a89c791a6ee6ef)
198cb0efdSgaurav rana /*
298cb0efdSgaurav rana  * Copyright 2015 Freescale Semiconductor, Inc.
398cb0efdSgaurav rana  *
498cb0efdSgaurav rana  * SPDX-License-Identifier:	GPL-2.0+
598cb0efdSgaurav rana  */
698cb0efdSgaurav rana 
798cb0efdSgaurav rana #ifndef __FSL_SECURE_BOOT_H
898cb0efdSgaurav rana #define __FSL_SECURE_BOOT_H
998cb0efdSgaurav rana 
10bdc22074SAneesh Bansal #ifdef CONFIG_CHAIN_OF_TRUST
112ed948f4SAneesh Bansal #define CONFIG_CMD_ESBC_VALIDATE
122ed948f4SAneesh Bansal #define CONFIG_FSL_SEC_MON
13fcfdb6d5SSaksham Jain #define CONFIG_SHA_HW_ACCEL
142ed948f4SAneesh Bansal #define CONFIG_SHA_PROG_HW_ACCEL
152ed948f4SAneesh Bansal 
16028ac8c7SSumit Garg #define CONFIG_SPL_BOARD_INIT
17b63f8a43SSimon Glass #ifdef CONFIG_SPL_BUILD
18028ac8c7SSumit Garg /*
19028ac8c7SSumit Garg  * Define the key hash for U-Boot here if public/private key pair used to
20028ac8c7SSumit Garg  * sign U-boot are different from the SRK hash put in the fuse
21028ac8c7SSumit Garg  * Example of defining KEY_HASH is
22028ac8c7SSumit Garg  * #define CONFIG_SPL_UBOOT_KEY_HASH \
23028ac8c7SSumit Garg  *      "41066b564c6ffcef40ccbc1e0a5d0d519604000c785d97bbefd25e4d288d1c8b"
24028ac8c7SSumit Garg  * else leave it defined as NULL
25028ac8c7SSumit Garg  */
26028ac8c7SSumit Garg 
27028ac8c7SSumit Garg #define CONFIG_SPL_UBOOT_KEY_HASH	NULL
28028ac8c7SSumit Garg #endif /* ifdef CONFIG_SPL_BUILD */
29028ac8c7SSumit Garg 
30028ac8c7SSumit Garg #ifndef CONFIG_SPL_BUILD
31028ac8c7SSumit Garg #define CONFIG_CMD_BLOB
32028ac8c7SSumit Garg #define CONFIG_CMD_HASH
332ed948f4SAneesh Bansal #define CONFIG_KEY_REVOCATION
342ed948f4SAneesh Bansal #ifndef CONFIG_SYS_RAMBOOT
352ed948f4SAneesh Bansal /* The key used for verification of next level images
362ed948f4SAneesh Bansal  * is picked up from an Extension Table which has
372ed948f4SAneesh Bansal  * been verified by the ISBC (Internal Secure boot Code)
382ed948f4SAneesh Bansal  * in boot ROM of the SoC.
392ed948f4SAneesh Bansal  * The feature is only applicable in case of NOR boot and is
402ed948f4SAneesh Bansal  * not applicable in case of RAMBOOT (NAND, SD, SPI).
412ed948f4SAneesh Bansal  */
42fd6dbc98SSaksham Jain #ifndef CONFIG_ESBC_HDR_LS
43fd6dbc98SSaksham Jain /* Current Key EXT feature not available in LS ESBC Header */
442ed948f4SAneesh Bansal #define CONFIG_FSL_ISBC_KEY_EXT
452ed948f4SAneesh Bansal #endif
462ed948f4SAneesh Bansal 
47fd6dbc98SSaksham Jain #endif
48fd6dbc98SSaksham Jain 
493c1d218aSYork Sun #if defined(CONFIG_LS1043A) || defined(CONFIG_LS2080A)
50fcfdb6d5SSaksham Jain /* For LS1043 (ARMv8), ESBC image Address in Header is 64 bit
513c1d218aSYork Sun  * Similiarly for LS2080
52fcfdb6d5SSaksham Jain  */
53ef6c55a2SAneesh Bansal #define CONFIG_ESBC_ADDR_64BIT
54ef6c55a2SAneesh Bansal #endif
55ef6c55a2SAneesh Bansal 
563c1d218aSYork Sun #ifdef CONFIG_LS2080A
57bef238cbSSaksham Jain #define CONFIG_EXTRA_ENV \
58bef238cbSSaksham Jain 	"setenv fdt_high 0xa0000000;"	\
59bef238cbSSaksham Jain 	"setenv initrd_high 0xcfffffff;"	\
60bef238cbSSaksham Jain 	"setenv hwconfig \'fsl_ddr:ctlr_intlv=null,bank_intlv=null\';"
61bef238cbSSaksham Jain #else
6298cb0efdSgaurav rana #define CONFIG_EXTRA_ENV \
6369d4b48cSSumit Garg 	"setenv fdt_high 0xffffffff;"	\
6469d4b48cSSumit Garg 	"setenv initrd_high 0xffffffff;"	\
6598cb0efdSgaurav rana 	"setenv hwconfig \'fsl_ddr:ctlr_intlv=null,bank_intlv=null\';"
66bef238cbSSaksham Jain #endif
6798cb0efdSgaurav rana 
683f701cc5SSaksham Jain /* Copying Bootscript and Header to DDR from NOR for LS2 and for rest, from
693f701cc5SSaksham Jain  * Non-XIP Memory (Nand/SD)*/
7039199356SUdit Agarwal #if defined(CONFIG_SYS_RAMBOOT) || defined(CONFIG_FSL_LSCH3) || \
7169d4b48cSSumit Garg 	defined(CONFIG_SD_BOOT)
723f701cc5SSaksham Jain #define CONFIG_BOOTSCRIPT_COPY_RAM
733f701cc5SSaksham Jain #endif
7469d4b48cSSumit Garg /* The address needs to be modified according to NOR, NAND, SD and
7569d4b48cSSumit Garg  * DDR memory map
7669d4b48cSSumit Garg  */
7739199356SUdit Agarwal #ifdef CONFIG_FSL_LSCH3
7839199356SUdit Agarwal #define CONFIG_BS_HDR_ADDR_DEVICE	0x580d00000
7939199356SUdit Agarwal #define CONFIG_BS_ADDR_DEVICE		0x580e00000
8039199356SUdit Agarwal #define CONFIG_BS_HDR_ADDR_RAM		0xa0d00000
8139199356SUdit Agarwal #define CONFIG_BS_ADDR_RAM		0xa0e00000
8269d4b48cSSumit Garg #define CONFIG_BS_HDR_SIZE		0x00002000
8369d4b48cSSumit Garg #define CONFIG_BS_SIZE			0x00001000
84216e93a1SSaksham Jain #else
8569d4b48cSSumit Garg #ifdef CONFIG_SD_BOOT
8669d4b48cSSumit Garg /* For SD boot address and size are assigned in terms of sector
8769d4b48cSSumit Garg  * offset and no. of sectors respectively.
8869d4b48cSSumit Garg  */
89*9b6639faSVinitha Pillai #define CONFIG_BS_HDR_ADDR_DEVICE	0x00000900
90*9b6639faSVinitha Pillai #define CONFIG_BS_ADDR_DEVICE		0x00000940
9169d4b48cSSumit Garg #define CONFIG_BS_HDR_SIZE		0x00000010
9269d4b48cSSumit Garg #define CONFIG_BS_SIZE			0x00000008
9369d4b48cSSumit Garg #else
9469d4b48cSSumit Garg #define CONFIG_BS_HDR_ADDR_DEVICE	0x600a0000
9569d4b48cSSumit Garg #define CONFIG_BS_ADDR_DEVICE		0x60060000
9669d4b48cSSumit Garg #define CONFIG_BS_HDR_SIZE		0x00002000
9769d4b48cSSumit Garg #define CONFIG_BS_SIZE			0x00001000
9869d4b48cSSumit Garg #endif /* #ifdef CONFIG_SD_BOOT */
9969d4b48cSSumit Garg #define CONFIG_BS_HDR_ADDR_RAM		0x81000000
10069d4b48cSSumit Garg #define CONFIG_BS_ADDR_RAM		0x81020000
1013f701cc5SSaksham Jain #endif
1023f701cc5SSaksham Jain 
1033f701cc5SSaksham Jain #ifdef CONFIG_BOOTSCRIPT_COPY_RAM
1043f701cc5SSaksham Jain #define CONFIG_BOOTSCRIPT_HDR_ADDR	CONFIG_BS_HDR_ADDR_RAM
1053f701cc5SSaksham Jain #define CONFIG_BOOTSCRIPT_ADDR		CONFIG_BS_ADDR_RAM
1063f701cc5SSaksham Jain #else
10769d4b48cSSumit Garg #define CONFIG_BOOTSCRIPT_HDR_ADDR	CONFIG_BS_HDR_ADDR_DEVICE
10869d4b48cSSumit Garg /* BOOTSCRIPT_ADDR is not required */
109216e93a1SSaksham Jain #endif
11098cb0efdSgaurav rana 
11107806e62SSumit Garg #ifdef CONFIG_FSL_LS_PPA
11207806e62SSumit Garg #ifdef CONFIG_SYS_LS_PPA_FW_IN_XIP
11307806e62SSumit Garg #ifdef CONFIG_LS1043A
11407806e62SSumit Garg #define CONFIG_SYS_LS_PPA_ESBC_ADDR	0x600c0000
11507806e62SSumit Garg #endif
11607806e62SSumit Garg #else
11707806e62SSumit Garg #error "No CONFIG_SYS_LS_PPA_FW_IN_xxx defined"
11807806e62SSumit Garg #endif /* ifdef CONFIG_SYS_LS_PPA_FW_IN_XIP */
11907806e62SSumit Garg 
12007806e62SSumit Garg /* Define the key hash here if SRK used for signing PPA image is
12107806e62SSumit Garg  * different from SRK hash put in SFP used for U-Boot.
12207806e62SSumit Garg  * Example
12307806e62SSumit Garg  * #define CONFIG_PPA_KEY_HASH \
12407806e62SSumit Garg  *	"41066b564c6ffcef40ccbc1e0a5d0d519604000c785d97bbefd25e4d288d1c8b"
12507806e62SSumit Garg  */
12607806e62SSumit Garg #define CONFIG_PPA_KEY_HASH		NULL
12707806e62SSumit Garg #endif /* ifdef CONFIG_FSL_LS_PPA */
12807806e62SSumit Garg 
129bdc22074SAneesh Bansal #include <config_fsl_chain_trust.h>
130028ac8c7SSumit Garg #endif /* #ifndef CONFIG_SPL_BUILD */
131bdc22074SAneesh Bansal #endif /* #ifdef CONFIG_CHAIN_OF_TRUST */
13298cb0efdSgaurav rana #endif
133