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