bcm_elog_ddr.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * Copyright 2019-2020 Broadcom
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef BCM_ELOG_DDR_H
  7. #define BCM_ELOG_DDR_H
  8. #define ELOG_GLOBAL_META_HDR_SIG 0x45524c47
  9. #define ELOG_MAX_REC_COUNT 13
  10. #define ELOG_MAX_REC_FORMAT 1
  11. #define ELOG_MAX_NVM_TYPE 4
  12. /* Use a default NVM, set by m0 configuration */
  13. #define ELOG_NVM_DEFAULT 0xff
  14. /* Max. number of cmd parameters per elog spec */
  15. #define ELOG_PARAM_COUNT 3
  16. /*
  17. * Number of supported RECORD Types-
  18. * SYSRESET, THERMAL, DDR_ECC, APBOOTLG, IDM
  19. */
  20. #define ELOG_SUPPORTED_REC_CNT 5
  21. #define ELOG_REC_DESC_LENGTH 8
  22. #define ELOG_SECTOR_SIZE 0x1000
  23. /* Default Record size for all record types except APBOOTLOG */
  24. #define ELOG_DEFAULT_REC_SIZE 0x10000
  25. /* Default record size for APBOOTLOG record */
  26. #define ELOG_APBOOTLG_REC_SIZE 0x60000
  27. /* Use default CRMU provided mem address */
  28. #define ELOG_USE_DEFAULT_MEM_ADDR 0x0
  29. /* Temporary place to hold metadata */
  30. #define TMP_ELOG_METADATA_BASE (ELOG_AP_UART_LOG_BASE + \
  31. BCM_ELOG_BL2_SIZE)
  32. /* IDM ELOG source memory address */
  33. #define ELOG_IDM_SRC_MEM_ADDR 0x8f213000
  34. #define IDM_ELOG_REC_TYPE 5
  35. enum elog_record_type {
  36. ELOG_REC_SYS_RESET_EVT = 0,
  37. ELOG_REC_THERMAL_EVT,
  38. ELOG_REC_DDR_ECC,
  39. ELOG_REC_UART_LOG,
  40. ELOG_REC_IDM_LOG,
  41. ELOG_REC_MAX
  42. };
  43. enum elog_record_format {
  44. ELOG_REC_FMT_ASCII = 0,
  45. ELOG_REC_FMT_CUSTOM
  46. };
  47. enum elog_src_memory_type {
  48. ELOG_SRC_MEM_TYPE_CRMU_SCRATCH = 0,
  49. ELOG_SRC_MEM_TYPE_FS4_SCRATCH,
  50. ELOG_SRC_MEM_TYPE_DDR,
  51. ELOG_SRC_MEM_TYPE_CHIMP_SCRATCH
  52. };
  53. enum elog_setup_cmd {
  54. ELOG_SETUP_CMD_VALIDATE_META,
  55. ELOG_SETUP_CMD_WRITE_META,
  56. ELOG_SETUP_CMD_ERASE,
  57. ELOG_SETUP_CMD_READ,
  58. ELOG_SETUP_CMD_CHECK
  59. };
  60. struct elog_setup {
  61. uint32_t cmd;
  62. uint32_t params[ELOG_PARAM_COUNT];
  63. uint32_t result;
  64. uint32_t ret_code;
  65. };
  66. struct elog_meta_record {
  67. uint8_t type;
  68. uint8_t format;
  69. uint8_t src_mem_type;
  70. uint8_t alt_src_mem_type;
  71. uint8_t nvm_type;
  72. char rec_desc[ELOG_REC_DESC_LENGTH];
  73. uint64_t src_mem_addr;
  74. uint64_t alt_src_mem_addr;
  75. uint64_t rec_addr;
  76. uint32_t rec_size;
  77. uint32_t sector_size;
  78. uint8_t padding[3];
  79. } __packed;
  80. struct elog_global_header {
  81. uint32_t signature;
  82. uint32_t sector_size;
  83. uint8_t revision;
  84. uint8_t rec_count;
  85. uint16_t padding;
  86. } __packed;
  87. void elog_init_ddr_log(void);
  88. #endif /* BCM_ELOG_DDR_H */