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 AEGIS_CPLD_REGISTER_MAX_NUM 96
23#define AEGIS_CPLD_REGISTER_1ST_PART_START_OFFSET \
24 0x00 // first part of cpld register offset from 0x00 to 0x47
25#define AEGIS_CPLD_REGISTER_1ST_PART_NUM 72
26#define AEGIS_CPLD_REGISTER_2ND_PART_START_OFFSET 0x97
27#define AEGIS_CPLD_REGISTER_2ND_PART_NUM \
28 (AEGIS_CPLD_REGISTER_MAX_NUM - AEGIS_CPLD_REGISTER_1ST_PART_NUM)
29#define AEGIS_FRU_LOG_SIZE sizeof(plat_err_log_mapping)
30
31#define LOG_ASSERT 1
32#define LOG_DEASSERT 0
33
34uint16_t error_log_count(void);
35void init_load_eeprom_log(void);
36
37void plat_log_read(uint8_t *log_data, uint8_t cmd_size, uint16_t order);
38void error_log_event(uint16_t error_code, bool log_status);
39void plat_clear_log();
40uint8_t plat_log_get_num(void);
41void reset_error_log_event(uint8_t err_type);
42bool vr_fault_get_error_data(uint8_t sensor_id, uint8_t device_id, uint8_t *data);
43
45 uint16_t year;
46 uint8_t month;
47 uint8_t day;
48 uint8_t hour;
49 uint8_t min;
50 uint8_t sec;
51 uint8_t _padding;
52};
53
54typedef struct __attribute__((packed)) _plat_err_log_mapping {
55 uint16_t index;
56 uint16_t err_code;
57 struct rtc_datetime sys_datetime;
58 uint8_t error_data[20];
59 uint8_t cpld_dump[AEGIS_CPLD_REGISTER_MAX_NUM];
61
67 MAX_TRIGGER_CAUSE = 0b1000, //trigger cause maxium 3 bit
68};
69
71 UBC_1 = 1,
85};
86
87#endif
void error_log_event(uint8_t sensor_num, bool val_normal)
Definition: plat_log.c:157
void init_load_eeprom_log(void)
Definition: plat_log.c:217
uint16_t error_log_count(void)
Definition: plat_log.c:91
uint8_t data[]
Definition: isl69259.c:2
bool vr_fault_get_error_data(uint8_t sensor_id, uint8_t device_id, uint8_t *data)
Definition: plat_log.c:195
plat_err_log_mapping
Definition: plat_log.h:60
VR_UBC_INDEX_E
Definition: plat_log.h:70
@ VR_1
Definition: plat_log.h:73
@ VR_8
Definition: plat_log.h:80
@ VR_7
Definition: plat_log.h:79
@ VR_11
Definition: plat_log.h:83
@ VR_6
Definition: plat_log.h:78
@ VR_9
Definition: plat_log.h:81
@ VR_5
Definition: plat_log.h:77
@ VR_3
Definition: plat_log.h:75
@ UBC_2
Definition: plat_log.h:72
@ VR_2
Definition: plat_log.h:74
@ VR_4
Definition: plat_log.h:76
@ UBC_1
Definition: plat_log.h:71
@ VR_MAX
Definition: plat_log.h:84
@ VR_10
Definition: plat_log.h:82
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:67
@ 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:136
uint8_t plat_log_get_num(void)
Definition: plat_log.c:452
void reset_error_log_event(uint8_t err_type)
Definition: plat_log.c:438
void plat_log_read(uint8_t *log_data, uint8_t cmd_size, uint16_t order)
Definition: plat_log.c:97
#define AEGIS_CPLD_REGISTER_MAX_NUM
Definition: plat_log.h:22
uint16_t sensor_id
Definition: pldm_monitor.h:0
device_id
Definition: power_shell.h:29
Definition: pldm_smbios.h:61
Definition: plat_log.h:44
uint8_t sec
Definition: plat_log.h:50
uint8_t hour
Definition: plat_log.h:48
uint8_t day
Definition: plat_log.h:47
uint8_t month
Definition: plat_log.h:46
uint8_t min
Definition: plat_log.h:49
uint16_t year
Definition: plat_log.h:45
uint8_t _padding
Definition: plat_log.h:51