config_fsl_chain_trust.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright 2015 Freescale Semiconductor, Inc.
  4. */
  5. #ifndef __CONFIG_FSL_CHAIN_TRUST_H
  6. #define __CONFIG_FSL_CHAIN_TRUST_H
  7. #include <linux/stringify.h>
  8. #ifdef CONFIG_CHAIN_OF_TRUST
  9. /*
  10. * Control should not reach back to uboot after validation of images
  11. * for secure boot flow and therefore bootscript should have
  12. * the bootm command. If control reaches back to uboot anyhow
  13. * after validating images, core should just spin.
  14. */
  15. #ifdef CONFIG_USE_BOOTARGS
  16. #define SET_BOOTARGS "setenv bootargs \'" CONFIG_BOOTARGS" \';"
  17. #else
  18. #define SET_BOOTARGS "setenv bootargs \'root=/dev/ram " \
  19. "rw console=ttyS0,115200 ramdisk_size=600000\';"
  20. #endif
  21. #define SECBOOT \
  22. "setenv bs_hdraddr " __stringify(CONFIG_BOOTSCRIPT_HDR_ADDR)";" \
  23. SET_BOOTARGS \
  24. "esbc_validate $bs_hdraddr;" \
  25. "source $img_addr;" \
  26. "esbc_halt\0"
  27. #ifdef CONFIG_BOOTSCRIPT_COPY_RAM
  28. #define BS_COPY_ENV \
  29. "setenv bs_hdr_ram " __stringify(CONFIG_BS_HDR_ADDR_RAM)";" \
  30. "setenv bs_hdr_device " __stringify(CONFIG_BS_HDR_ADDR_DEVICE)";" \
  31. "setenv bs_hdr_size " __stringify(CONFIG_BS_HDR_SIZE)";" \
  32. "setenv bs_ram " __stringify(CONFIG_BS_ADDR_RAM)";" \
  33. "setenv bs_device " __stringify(CONFIG_BS_ADDR_DEVICE)";" \
  34. "setenv bs_size " __stringify(CONFIG_BS_SIZE)";"
  35. /* For secure boot flow, default environment used will be used */
  36. #if defined(CONFIG_SYS_RAMBOOT) || defined(CONFIG_NAND_BOOT) || \
  37. defined(CONFIG_SD_BOOT)
  38. #if defined(CONFIG_NAND_BOOT)
  39. #define BS_COPY_CMD \
  40. "nand read $bs_hdr_ram $bs_hdr_device $bs_hdr_size ;" \
  41. "nand read $bs_ram $bs_device $bs_size ;"
  42. #elif defined(CONFIG_SD_BOOT)
  43. #define BS_COPY_CMD \
  44. "mmc read $bs_hdr_ram $bs_hdr_device $bs_hdr_size ;" \
  45. "mmc read $bs_ram $bs_device $bs_size ;"
  46. #endif
  47. #else
  48. #define BS_COPY_CMD \
  49. "cp.b $bs_hdr_device $bs_hdr_ram $bs_hdr_size ;" \
  50. "cp.b $bs_device $bs_ram $bs_size ;"
  51. #endif
  52. #else /* !CONFIG_BOOTSCRIPT_COPY_RAM */
  53. #define BS_COPY_ENV
  54. #define BS_COPY_CMD
  55. #endif /* CONFIG_BOOTSCRIPT_COPY_RAM */
  56. #define CHAIN_BOOT_CMD BS_COPY_ENV \
  57. BS_COPY_CMD \
  58. SECBOOT
  59. #endif
  60. #endif