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_COUNT_PMIC_ERROR_OFFSET 7
26#define MAX_COUNT_PMIC_ERROR_TYPE 17
27#define MAX_COUNT_PMIC_VENDER_ID 1
28
29#define CL_CPLD_BMC_CHANNEL_ADDR 0x1E // 8 bits
30#define PMIC_FAULT_STATUS_OFFSET 0x0B
31#define PMIC_VENDER_ID_OFFSET 0x3C
32#define PMIC_CLEAR_STATUS_BITS4_OFFSET 0x14
33#define PMIC_VENDOR_MEMORY_REGION_PASSWORD_UPPER_BYTE_OFFSET 0x37
34#define PMIC_VENDOR_MEMORY_REGION_PASSWORD_LOWER_BYTE_OFFSET 0x38
35#define PMIC_VENDOR_PASSWORD_CONTROL_OFFSET 0x39
36
40};
41
45int get_dimm_info(uint8_t dimm_id, uint8_t *bus, uint8_t *addr);
46int compare_pmic_error(uint8_t dimm_id, uint8_t *pmic_err_data, uint8_t pmic_err_data_len,
47 uint8_t read_path);
48void add_pmic_error_sel(uint8_t dimm_id, uint8_t error_type);
51void clear_pmic_error();
52int write_read_pmic_via_me(uint8_t dimm_id, uint8_t offset, uint8_t read_len, uint8_t write_len,
53 uint8_t *data, int *data_len);
54
55#endif
uint16_t data_len
Definition: ipmb.h:14
uint8_t data[]
Definition: isl69259.c:2
uint8_t addr
Definition: isl69259.c:0
uint32_t offset
Definition: pldm_firmware_update.h:0
int compare_pmic_error(uint8_t dimm_id, uint8_t *pmic_err_data)
Definition: plat_pmic.c:198
void add_pmic_error_sel(uint8_t dimm_id, uint8_t error_type)
Definition: plat_pmic.c:237
int get_dimm_info(uint8_t dimm_id, uint8_t *bus, uint8_t *addr)
Definition: plat_pmic.c:148
void start_monitor_pmic_error_thread()
Definition: plat_pmic.c:77
void monitor_pmic_error_via_me_handler()
Definition: plat_pmic.c:164
READ_PMIC_ERROR_PATH
Definition: plat_pmic.h:37
@ READ_PMIC_ERROR_VIA_ME
Definition: plat_pmic.h:38
@ READ_PMIC_ERROR_VIA_I3C
Definition: plat_pmic.h:39
int write_read_pmic_via_me(uint8_t dimm_id, uint8_t offset, uint8_t read_len, uint8_t write_len, uint8_t *data, int *data_len)
Definition: plat_pmic.c:120
void clear_pmic_error()
Definition: plat_pmic.c:531
void read_pmic_error_when_dc_off()
Definition: plat_pmic.c:434
int get_pmic_fault_status()
Definition: plat_pmic.c:391
void monitor_pmic_error_via_i3c_handler()
Definition: plat_pmic.c:84