aon_defs.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Always ON (AON) register interface between bootloader and Linux
  4. *
  5. * Copyright © 2014-2017 Broadcom
  6. */
  7. #ifndef __BRCMSTB_AON_DEFS_H__
  8. #define __BRCMSTB_AON_DEFS_H__
  9. #include <linux/compiler.h>
  10. /* Magic number in upper 16-bits */
  11. #define BRCMSTB_S3_MAGIC_MASK 0xffff0000
  12. #define BRCMSTB_S3_MAGIC_SHORT 0x5AFE0000
  13. enum {
  14. /* Restore random key for AES memory verification (off = fixed key) */
  15. S3_FLAG_LOAD_RANDKEY = (1 << 0),
  16. /* Scratch buffer page table is present */
  17. S3_FLAG_SCRATCH_BUFFER_TABLE = (1 << 1),
  18. /* Skip all memory verification */
  19. S3_FLAG_NO_MEM_VERIFY = (1 << 2),
  20. /*
  21. * Modification of this bit reserved for bootloader only.
  22. * 1=PSCI started Linux, 0=Direct jump to Linux.
  23. */
  24. S3_FLAG_PSCI_BOOT = (1 << 3),
  25. /*
  26. * Modification of this bit reserved for bootloader only.
  27. * 1=64 bit boot, 0=32 bit boot.
  28. */
  29. S3_FLAG_BOOTED64 = (1 << 4),
  30. };
  31. #define BRCMSTB_HASH_LEN (128 / 8) /* 128-bit hash */
  32. #define AON_REG_MAGIC_FLAGS 0x00
  33. #define AON_REG_CONTROL_LOW 0x04
  34. #define AON_REG_CONTROL_HIGH 0x08
  35. #define AON_REG_S3_HASH 0x0c /* hash of S3 params */
  36. #define AON_REG_CONTROL_HASH_LEN 0x1c
  37. #define AON_REG_PANIC 0x20
  38. #define BRCMSTB_S3_MAGIC 0x5AFEB007
  39. #define BRCMSTB_PANIC_MAGIC 0x512E115E
  40. #define BOOTLOADER_SCRATCH_SIZE 64
  41. #define BRCMSTB_DTU_STATE_MAP_ENTRIES (8*1024)
  42. #define BRCMSTB_DTU_CONFIG_ENTRIES (512)
  43. #define BRCMSTB_DTU_COUNT (2)
  44. #define IMAGE_DESCRIPTORS_BUFSIZE (2 * 1024)
  45. #define S3_BOOTLOADER_RESERVED (S3_FLAG_PSCI_BOOT | S3_FLAG_BOOTED64)
  46. struct brcmstb_bootloader_dtu_table {
  47. uint32_t dtu_state_map[BRCMSTB_DTU_STATE_MAP_ENTRIES];
  48. uint32_t dtu_config[BRCMSTB_DTU_CONFIG_ENTRIES];
  49. };
  50. /*
  51. * Bootloader utilizes a custom parameter block left in DRAM for handling S3
  52. * warm resume
  53. */
  54. struct brcmstb_s3_params {
  55. /* scratch memory for bootloader */
  56. uint8_t scratch[BOOTLOADER_SCRATCH_SIZE];
  57. uint32_t magic; /* BRCMSTB_S3_MAGIC */
  58. uint64_t reentry; /* PA */
  59. /* descriptors */
  60. uint32_t hash[BRCMSTB_HASH_LEN / 4];
  61. /*
  62. * If 0, then ignore this parameter (there is only one set of
  63. * descriptors)
  64. *
  65. * If non-0, then a second set of descriptors is stored at:
  66. *
  67. * descriptors + desc_offset_2
  68. *
  69. * The MAC result of both descriptors is XOR'd and stored in @hash
  70. */
  71. uint32_t desc_offset_2;
  72. /*
  73. * (Physical) address of a brcmstb_bootloader_scratch_table, for
  74. * providing a large DRAM buffer to the bootloader
  75. */
  76. uint64_t buffer_table;
  77. uint32_t spare[70];
  78. uint8_t descriptors[IMAGE_DESCRIPTORS_BUFSIZE];
  79. /*
  80. * Must be last member of struct. See brcmstb_pm_s3_finish() for reason.
  81. */
  82. struct brcmstb_bootloader_dtu_table dtu[BRCMSTB_DTU_COUNT];
  83. } __packed;
  84. #endif /* __BRCMSTB_AON_DEFS_H__ */