OpenBIC
OpenSource Bridge-IC
plat_log.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef PLAT_LOG_H
18#define PLAT_LOG_H
19
20#include "plat_pldm_sensor.h"
21
22#define CPLD_REGISTER_MAX_NUM 72
23#define CPLD_REGISTER_1ST_PART_START_OFFSET \
24 0x00 // first part of cpld register offset from 0x00 to 0x47
25#define CPLD_REGISTER_1ST_PART_NUM 72
26#define FRU_LOG_SIZE sizeof(plat_err_log_mapping)
27
28#define LOG_ASSERT 1
29#define LOG_DEASSERT 0
30
31#define VR_POWER_FAULT_1_REG 0x0D
32#define VR_POWER_FAULT_2_REG 0x0E
33#define VR_POWER_FAULT_3_REG 0x0F
34#define VR_POWER_FAULT_4_REG 0x10
35#define VR_POWER_FAULT_5_REG 0x11
36
38 //pwr fault reg 1
47 //pwr fault reg 2
56 //pwr fault reg 3
65 //pwr fault reg 4
74 //pwr fault reg 5
84};
85
86uint16_t error_log_count(void);
87void init_load_eeprom_log(void);
88
89void plat_log_read(uint8_t *log_data, uint8_t cmd_size, uint16_t order);
90void error_log_event(uint16_t error_code, bool log_status);
91uint8_t plat_log_get_num(void);
92void plat_clear_log();
93void reset_error_log_event(uint8_t err_type);
94
95typedef struct __attribute__((packed)) _plat_err_log_mapping {
96 uint16_t index;
97 uint16_t err_code;
98 uint64_t sys_time;
99 uint8_t error_data[20];
100 uint8_t cpld_dump[CPLD_REGISTER_MAX_NUM];
101 uint8_t reserved[24];
103
110 MAX_TRIGGER_CAUSE = 0b1000, //trigger cause maxium 3 bit
111};
112
113bool check_temp_status_bit(uint8_t bit_num);
114#endif
void error_log_event(uint8_t sensor_num, bool val_normal)
Definition: plat_log.c:160
void init_load_eeprom_log(void)
Definition: plat_log.c:220
uint16_t error_log_count(void)
Definition: plat_log.c:94
plat_err_log_mapping
Definition: plat_log.h:60
LOG_ERROR_TRIGGER_CAUSE
Definition: plat_log.h:62
@ AC_ON_TRIGGER_CAUSE
Definition: plat_log.h:65
@ CPLD_UNEXPECTED_VAL_TRIGGER_CAUSE
Definition: plat_log.h:63
@ MAX_TRIGGER_CAUSE
Definition: plat_log.h:68
@ DC_ON_TRIGGER_CAUSE
Definition: plat_log.h:66
@ POWER_ON_SEQUENCE_TRIGGER_CAUSE
Definition: plat_log.h:64
void plat_clear_log()
Definition: plat_log.c:138
uint8_t plat_log_get_num(void)
Definition: plat_log.c:454
void reset_error_log_event(uint8_t err_type)
Definition: plat_log.c:440
void plat_log_read(uint8_t *log_data, uint8_t cmd_size, uint16_t order)
Definition: plat_log.c:99
uint32_t reserved
Definition: plat_ncsi.h:4
VR_ERR_LOG_DEVICE_INDEX_E
Definition: plat_log.h:37
@ PWRGD_P3V3_R_FAULT
Definition: plat_log.h:77
@ PWRGD_OWL_E_VDD_R_FAULT
Definition: plat_log.h:50
@ PWRGD_MEDHA1_VDD_FAULT
Definition: plat_log.h:48
@ PWRGD_HAMSA_VDD_R_FAULT
Definition: plat_log.h:52
@ PWRGD_OWL_E_TRVDD0P75_R_FAULT
Definition: plat_log.h:41
@ PWRGD_OWL_W_VDD_R_FAULT
Definition: plat_log.h:51
@ PWRGD_VPP_HBM1_HBM3_HBM5_HBM7_R_FAULT
Definition: plat_log.h:63
@ PWRGD_HAMSA_AVDD_PCIE_R_FAULT
Definition: plat_log.h:43
@ PWRGD_OWL_W_TRVDD0P9_R_FAULT
Definition: plat_log.h:40
@ PWRGD_MAX_M_VDD_R_FAULT
Definition: plat_log.h:54
@ PWRGD_HAMSA_VDDHRXTX_PCIE_R_FAULT
Definition: plat_log.h:44
@ PWRGD_OWL_E_TRVDD0P9_R_FAULT
Definition: plat_log.h:39
@ PWRGD_PVDD1P5_FAULT
Definition: plat_log.h:82
@ PWRGD_PLL_VDDA15_HBM4_HBM6_FAULT
Definition: plat_log.h:67
@ PWRGD_P1V8_R_FAULT
Definition: plat_log.h:78
@ PWRGD_P0V9_OWL_W_PVDD_FAULT
Definition: plat_log.h:71
@ PWRGD_VDDQL_HBM0_HBM2_HBM4_HBM6_R_FAULT
Definition: plat_log.h:57
@ PWRGD_P1V5_W_RVDD_FAULT
Definition: plat_log.h:73
@ VR_ERR_DEVICE_DONT_CARE
Definition: plat_log.h:83
@ PWRGD_P1V5_E_RVDD_FAULT
Definition: plat_log.h:72
@ PWRGD_VPP_HBM0_HBM2_HBM4_HBM6_R_FAULT
Definition: plat_log.h:59
@ PWRGD_P0V75_AVDD_HCSL_R_FAULT
Definition: plat_log.h:46
@ P12V_UBC_PWRGD_FAULT
Definition: plat_log.h:75
@ PWRGD_P5V_R_FAULT
Definition: plat_log.h:76
@ PWRGD_P0V9_OWL_E_PVDD_FAULT
Definition: plat_log.h:70
@ PWRGD_MAX_S_VDD_R_FAULT
Definition: plat_log.h:53
@ PWRGD_VDDQC_HBM1_HBM3_HBM5_HBM7_R_FAULT
Definition: plat_log.h:62
@ PWRGD_PLL_VDDA15_HBM1_HBM3_FAULT
Definition: plat_log.h:68
@ PWRGD_P1V5_PLL_VDDA_SOC_FAULT
Definition: plat_log.h:81
@ PWRGD_OWL_W_TRVDD0P75_R_FAULT
Definition: plat_log.h:42
@ PWRGD_VDDPHY_HBM1_HBM3_HBM5_HBM7_R_FAULT
Definition: plat_log.h:64
@ PWRGD_PLL_VDDA15_HBM0_HBM2_FAULT
Definition: plat_log.h:66
@ PWRGD_VDDPHY_HBM0_HBM2_HBM4_HBM6_R_FAULT
Definition: plat_log.h:60
@ PWRGD_P4V2_R_FAULT
Definition: plat_log.h:45
@ PWRGD_LDO_IN_1V2_R_FAULT
Definition: plat_log.h:79
@ PWRGD_VDDQC_HBM0_HBM2_HBM4_HBM6_R_FAULT
Definition: plat_log.h:58
@ PWRGD_VDDQL_HBM1_HBM3_HBM5_HBM7_R_FAULT
Definition: plat_log.h:61
@ PWRGD_MEDHA0_VDD_FAULT
Definition: plat_log.h:49
@ PWRGD_PLL_VDDA15_HBM5_HBM7_FAULT
Definition: plat_log.h:69
@ PWRGD_MAX_N_VDD_R_FAULT
Definition: plat_log.h:55
@ PWRGD_P1V5_PLL_VDDA_OWL_FAULT
Definition: plat_log.h:80
bool check_temp_status_bit(uint8_t bit_num)
Definition: plat_log.c:549
@ TEMPERATURE_TRIGGER_CAUSE
Definition: plat_log.h:109
#define CPLD_REGISTER_MAX_NUM
Definition: plat_log.h:22
Definition: pldm_smbios.h:61