OpenBIC
OpenSource Bridge-IC
plat_pmic.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_PMIC_H
18#define PLAT_PMIC_H
19
20#include <stdint.h>
21
22#define MONITOR_PMIC_ERROR_STACK_SIZE 4096
23#define MONITOR_PMIC_ERROR_TIME_MS (3 * 1000) // 3s
24
25#define MAX_LEN_GET_PMIC_ERROR_INFO 6
26#define MAX_LEN_I3C_GET_PMIC_ERROR_INFO 7
27
28#define MAX_COUNT_DIMM 6
29#define MAX_COUNT_PMIC_ERROR_TYPE 17
30
31#define I3C_MUX_TO_BIC 0x1
32#define I3C_MUX_TO_CPU 0x0
33#define DIMM_MUX_TO_DIMM_A0A1A3 0x0
34#define DIMM_MUX_TO_DIMM_A4A6A7 0x1
35
36#define CL_CPLD_BMC_CHANNEL_ADDR 0x1E // 8 bits
37#define PMIC_FAULT_STATUS_OFFSET 0x0B
38#define DIMM_I3C_MUX_CONTROL_OFFSET 0x0B
39
40enum DIMM_ID {
47};
48
52};
53
56int compare_pmic_error(uint8_t dimm_id, uint8_t *pmic_err_data, uint8_t pmic_err_data_len,
57 uint8_t read_path);
58int get_dimm_info(uint8_t dimm_id, uint8_t *bus, uint8_t *addr);
59void add_pmic_error_sel(uint8_t dimm_id, uint8_t error_type);
60int switch_i3c_dimm_mux(uint8_t i3c_mux_position, uint8_t dimm_mux_position);
63
64#endif
READ_PMIC_ERROR_PATH
Definition: plat_pmic.h:49
@ READ_PMIC_ERROR_VIA_ME
Definition: plat_pmic.h:50
@ READ_PMIC_ERROR_VIA_I3C
Definition: plat_pmic.h:51
int compare_pmic_error(uint8_t dimm_id, uint8_t *pmic_err_data, uint8_t pmic_err_data_len, uint8_t read_path)
Definition: plat_pmic.c:210
DIMM_ID
Definition: plat_pmic.h:40
@ DIMM_ID_A2
Definition: plat_pmic.h:42
@ DIMM_ID_A7
Definition: plat_pmic.h:46
@ DIMM_ID_A6
Definition: plat_pmic.h:45
@ DIMM_ID_A0
Definition: plat_pmic.h:41
@ DIMM_ID_A3
Definition: plat_pmic.h:43
@ DIMM_ID_A4
Definition: plat_pmic.h:44
int get_pmic_fault_status()
Definition: plat_pmic.c:280
void read_pmic_error_via_i3c()
Definition: plat_pmic.c:343
void add_pmic_error_sel(uint8_t dimm_id, uint8_t error_type)
Definition: plat_pmic.c:263
void monitor_pmic_error_handler()
Definition: plat_pmic.c:85
int get_dimm_info(uint8_t dimm_id, uint8_t *bus, uint8_t *addr)
Definition: plat_pmic.c:155
int switch_i3c_dimm_mux(uint8_t i3c_mux_position, uint8_t dimm_mux_position)
Definition: plat_pmic.c:324
void start_monitor_pmic_error_thread()
Definition: plat_pmic.c:73
uint8_t addr
Definition: isl69259.c:0