fsl_secure_boot.h 3.7 KB

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