rmm_core_manifest.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * Copyright (c) 2022-2024, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef RMM_CORE_MANIFEST_H
  7. #define RMM_CORE_MANIFEST_H
  8. #include <assert.h>
  9. #include <stddef.h>
  10. #include <stdint.h>
  11. #include <lib/cassert.h>
  12. #define RMMD_MANIFEST_VERSION_MAJOR U(0)
  13. #define RMMD_MANIFEST_VERSION_MINOR U(3)
  14. #define RMM_CONSOLE_MAX_NAME_LEN U(8)
  15. /*
  16. * Manifest version encoding:
  17. * - Bit[31] RES0
  18. * - Bits [30:16] Major version
  19. * - Bits [15:0] Minor version
  20. */
  21. #define SET_RMMD_MANIFEST_VERSION(_major, _minor) \
  22. ((((_major) & 0x7FFF) << 16) | ((_minor) & 0xFFFF))
  23. #define RMMD_MANIFEST_VERSION SET_RMMD_MANIFEST_VERSION( \
  24. RMMD_MANIFEST_VERSION_MAJOR, \
  25. RMMD_MANIFEST_VERSION_MINOR)
  26. #define RMMD_GET_MANIFEST_VERSION_MAJOR(_version) \
  27. ((_version >> 16) & 0x7FFF)
  28. #define RMMD_GET_MANIFEST_VERSION_MINOR(_version) \
  29. (_version & 0xFFFF)
  30. /* NS DRAM bank structure */
  31. struct ns_dram_bank {
  32. uintptr_t base; /* Base address */
  33. uint64_t size; /* Size of bank */
  34. };
  35. CASSERT(offsetof(struct ns_dram_bank, base) == 0UL,
  36. rmm_manifest_base_unaligned);
  37. CASSERT(offsetof(struct ns_dram_bank, size) == 8UL,
  38. rmm_manifest_size_unaligned);
  39. /* NS DRAM layout info structure */
  40. struct ns_dram_info {
  41. uint64_t num_banks; /* Number of NS DRAM banks */
  42. struct ns_dram_bank *banks; /* Pointer to ns_dram_bank[] */
  43. uint64_t checksum; /* Checksum of ns_dram_info data */
  44. };
  45. CASSERT(offsetof(struct ns_dram_info, num_banks) == 0UL,
  46. rmm_manifest_num_banks_unaligned);
  47. CASSERT(offsetof(struct ns_dram_info, banks) == 8UL,
  48. rmm_manifest_dram_data_unaligned);
  49. CASSERT(offsetof(struct ns_dram_info, checksum) == 16UL,
  50. rmm_manifest_checksum_unaligned);
  51. /* Console info structure */
  52. struct console_info {
  53. uintptr_t base; /* Console base address */
  54. uint64_t map_pages; /* Num of pages to be mapped in RMM for the console MMIO */
  55. char name[RMM_CONSOLE_MAX_NAME_LEN]; /* Name of console */
  56. uint64_t clk_in_hz; /* UART clock (in Hz) for the console */
  57. uint64_t baud_rate; /* Baud rate */
  58. uint64_t flags; /* Additional flags RES0 */
  59. };
  60. CASSERT(offsetof(struct console_info, base) == 0UL,
  61. rmm_manifest_console_base_unaligned);
  62. CASSERT(offsetof(struct console_info, map_pages) == 8UL,
  63. rmm_manifest_console_map_pages_unaligned);
  64. CASSERT(offsetof(struct console_info, name) == 16UL,
  65. rmm_manifest_console_name_unaligned);
  66. CASSERT(offsetof(struct console_info, clk_in_hz) == 24UL,
  67. rmm_manifest_console_clk_in_hz_unaligned);
  68. CASSERT(offsetof(struct console_info, baud_rate) == 32UL,
  69. rmm_manifest_console_baud_rate_unaligned);
  70. CASSERT(offsetof(struct console_info, flags) == 40UL,
  71. rmm_manifest_console_flags_unaligned);
  72. struct console_list {
  73. uint64_t num_consoles; /* Number of consoles */
  74. struct console_info *consoles; /* Pointer to console_info[] */
  75. uint64_t checksum; /* Checksum of console_list data */
  76. };
  77. CASSERT(offsetof(struct console_list, num_consoles) == 0UL,
  78. rmm_manifest_num_consoles);
  79. CASSERT(offsetof(struct console_list, consoles) == 8UL,
  80. rmm_manifest_consoles);
  81. CASSERT(offsetof(struct console_list, checksum) == 16UL,
  82. rmm_manifest_console_list_checksum);
  83. /* Boot manifest core structure as per v0.3 */
  84. struct rmm_manifest {
  85. uint32_t version; /* Manifest version */
  86. uint32_t padding; /* RES0 */
  87. uintptr_t plat_data; /* Manifest platform data */
  88. struct ns_dram_info plat_dram; /* Platform NS DRAM data (v0.2) */
  89. struct console_list plat_console; /* Platform console list (v0.3) */
  90. };
  91. CASSERT(offsetof(struct rmm_manifest, version) == 0UL,
  92. rmm_manifest_version_unaligned);
  93. CASSERT(offsetof(struct rmm_manifest, plat_data) == 8UL,
  94. rmm_manifest_plat_data_unaligned);
  95. CASSERT(offsetof(struct rmm_manifest, plat_dram) == 16UL,
  96. rmm_manifest_plat_dram_unaligned);
  97. CASSERT(offsetof(struct rmm_manifest, plat_console) == 40UL,
  98. rmm_manifest_plat_console_unaligned);
  99. #endif /* RMM_CORE_MANIFEST_H */