OpenBIC
OpenSource Bridge-IC
plat_class.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_CLASS_H
18#define PLAT_CLASS_H
19
20#include <stdbool.h>
21#include <stdint.h>
22#include "plat_i2c.h"
23#include "plat_gpio.h"
24#include "i2c-mux-pca954x.h"
25
26#define ASIC_CARD_COUNT 12
27#define ACCL_CARD_DEV_COUNT 2
28
29#define POWER_MONITOR_PIN_NUM BOARD_ID3
30#define HSC_MODULE_PIN_NUM BOARD_ID2
31#define POWER_BRICK_MODULE_PIN_NUM BOARD_ID1
32#define VR_MODULE_PIN_NUM BOARD_ID0
33
34#define CPLD_ADDR (0xA0 >> 1)
35#define CPLD_NORMAL_ENABLE_OFFSET 0x03
36#define CPLD_PWRGD_1_OFFSET 0x05
37#define CPLD_PWRGD_2_OFFSET 0x06
38#define CPLD_SW_ERR_OFFSET 0x0F
39#define CPLD_12V_ACCLA_PWRGD_OFFSET 0x22
40#define CPLD_12V_ACCLB_PWRGD_OFFSET 0x23
41#define CPLD_ACCLA_PWRGD_OFFSET 0x24
42#define CPLD_ACCLB_PWRGD_OFFSET 0x25
43#define CPLD_ACCL_7_12_POWER_CABLE_PRESENT_OFFSET 0x26
44#define CPLD_ACCL_1_6_POWER_CABLE_PRESENT_OFFSET 0x27
45#define CPLD_ACCL_7_12_POWER_CABLE_PG_OFFSET 0x28
46#define CPLD_ACCL_1_6_POWER_CABLE_PG_OFFSET 0x29
47#define CPLD_ACCL_7_12_POWER_CABLE_PG_FAULT_OFFSET 0x32
48#define CPLD_ACCL_1_6_POWER_CABLE_PG_FAULT_OFFSET 0x33
49#define CPLD_ACCL_7_12_POWER_CABLE_PG_TIMEOUT_OFFSET 0x34
50#define CPLD_ACCL_1_6_POWER_CABLE_PG_TIMEOUT_OFFSET 0x35
51#define CPLD_ACCL_1_6_PRESENT_OFFSET 0x3F
52#define CPLD_ACCL_7_12_PRESENT_OFFSET 0x3E
53#define CPLD_PWRGD_BIT BIT(0)
54#define CPLD_SW_0_ERR_BIT BIT(1)
55#define CPLD_SW_1_ERR_BIT BIT(0)
56#define CPLD_P0V8_1_EN_BIT BIT(0)
57
58#define CPLD_ACCL_3V3_POWER_TOUT_BIT BIT(0)
59#define CPLD_ACCL_12V_POWER_TOUT_BIT BIT(1)
60#define CPLD_ACCL_3V3_AUX_POWER_TOUT_BIT BIT(2)
61#define CPLD_ACCL_3V3_POWER_FAULT_BIT BIT(3)
62#define CPLD_ACCL_12V_POWER_FAULT_BIT BIT(4)
63#define CPLD_ACCL_3V3_AUX_FAULT_BIT BIT(5)
64
65#define IOEXP_U228_ADDR (0x40 >> 1)
66#define IOEXP_U229_ADDR (0x42 >> 1)
67#define IOEXP_U230_ADDR (0x44 >> 1)
68#define IOEXP_U233_ADDR (0x46 >> 1)
69#define IOEXP_CARD_PRESENCE_COUNT 4
70#define IOEXP_CARD_PRESENCE_PIN_COUNT 4
71#define IOEXP_CARD_PRESENCE_MAP_VAL 0x0F
72#define IOEXP_CARD_PRESENT_VAL BIT(3)
73#define IOEXP_DEV_1_PRESENT_VAL BIT(1)
74#define IOEXP_DEV_2_PRESENT_VAL BIT(2)
75
77 POC_STAGE = 0b000,
78 EVT1_STAGE = 0b001,
79 EVT2_STAGE = 0b010,
80 DVT_STAGE = 0b011,
81 PVT_STAGE = 0b100,
82 MP_STAGE = 0b101,
84};
85
90};
91
95 VR_UNKNOWN = 0xFF,
96};
97
102};
103
108};
109
114};
115
120};
121
125};
126
130};
131
136};
137
151};
152
166};
167
171};
172
176 uint8_t card_type;
180};
181
183
186uint8_t get_board_revision();
187uint8_t get_hsc_module();
188uint8_t get_vr_module();
189uint8_t get_pwr_brick_module();
190uint8_t get_pwr_monitor_module();
193int get_cpld_register(uint8_t offset, uint8_t *value);
196
197#endif
uint8_t get_hsc_module()
Definition: plat_class.c:30
HSC_MODULE
Definition: plat_class.h:23
@ HSC_MODULE_ADM1272
Definition: plat_class.h:24
@ HSC_MODULE_UNKNOWN
Definition: plat_class.h:26
ASIC_CARD_STATUS
Definition: plat_class.h:110
@ ASIC_CARD_PRESENT
Definition: plat_class.h:112
@ ASIC_CARD_UNKNOWN_STATUS
Definition: plat_class.h:113
@ ASIC_CARD_NOT_PRESENT
Definition: plat_class.h:111
POWER_MONITOR_MODULE
Definition: plat_class.h:104
@ POWER_MONITOR_UNKNOWN
Definition: plat_class.h:107
@ POWER_MONITOR_INA233_SQ52205
Definition: plat_class.h:105
@ POWER_MONITOR_SQ52205_INA230
Definition: plat_class.h:106
uint8_t get_board_revision()
Definition: plat_class.c:431
void init_accl_presence_check_work()
Definition: plat_class.c:558
CPLD_ACCL_POWER_FAULT_REG
Definition: plat_class.h:153
@ ACCL12_POWER_FAULT_REG
Definition: plat_class.h:165
@ ACCL11_POWER_FAULT_REG
Definition: plat_class.h:164
@ ACCL4_POWER_FAULT_REG
Definition: plat_class.h:157
@ ACCL9_POWER_FAULT_REG
Definition: plat_class.h:162
@ ACCL2_POWER_FAULT_REG
Definition: plat_class.h:155
@ ACCL7_POWER_FAULT_REG
Definition: plat_class.h:160
@ ACCL3_POWER_FAULT_REG
Definition: plat_class.h:156
@ ACCL10_POWER_FAULT_REG
Definition: plat_class.h:163
@ ACCL6_POWER_FAULT_REG
Definition: plat_class.h:159
@ ACCL8_POWER_FAULT_REG
Definition: plat_class.h:161
@ ACCL1_POWER_FAULT_REG
Definition: plat_class.h:154
@ ACCL5_POWER_FAULT_REG
Definition: plat_class.h:158
bool get_acb_power_status()
Definition: plat_class.c:456
ASIC_CARD_DEVICE_STATUS
Definition: plat_class.h:116
@ ASIC_CARD_DEVICE_PRESENT
Definition: plat_class.h:118
@ ASIC_CARD_DEVICE_UNKNOWN_STATUS
Definition: plat_class.h:119
@ ASIC_CARD_DEVICE_NOT_PRESENT
Definition: plat_class.h:117
struct ASIC_CARD_INFO asic_card_info[ASIC_CARD_COUNT]
Definition: plat_class.c:56
#define ASIC_CARD_COUNT
Definition: plat_class.h:26
BOARD_REVISION_ID
Definition: plat_class.h:76
@ EVT2_STAGE
Definition: plat_class.h:79
@ PVT_STAGE
Definition: plat_class.h:81
@ POC_STAGE
Definition: plat_class.h:77
@ MP_STAGE
Definition: plat_class.h:82
@ DVT_STAGE
Definition: plat_class.h:80
@ UNKNOWN_STAGE
Definition: plat_class.h:83
@ EVT1_STAGE
Definition: plat_class.h:78
VR_MODULE
Definition: plat_class.h:92
@ VR_UNKNOWN
Definition: plat_class.h:95
@ VR_XDPE15284D
Definition: plat_class.h:93
@ VR_MP2985H
Definition: plat_class.h:94
int init_platform_config()
Definition: expansion_board.c:43
ASIC_CARD_TYPE
Definition: plat_class.h:122
@ ASIC_CARD_WITH_ARTEMIS_MODULE
Definition: plat_class.h:123
@ ASIC_CARD_UNKNOWN_TYPE
Definition: plat_class.h:124
PCIE_DEVICE_ID
Definition: plat_class.h:132
@ PCIE_DEVICE_ID2
Definition: plat_class.h:134
@ PCIE_DEVICE_ID3
Definition: plat_class.h:135
@ PCIE_DEVICE_ID1
Definition: plat_class.h:133
int get_cpld_register(uint8_t offset, uint8_t *value)
Definition: plat_class.c:174
void check_accl_device_presence_status_via_ioexp()
Definition: plat_class.c:265
uint8_t get_pwr_brick_module()
Definition: plat_class.c:441
uint8_t get_vr_module()
Definition: plat_class.c:451
bool get_acb_power_good_flag()
Definition: plat_class.c:495
POWER_BRICK_MODULE
Definition: plat_class.h:98
@ POWER_BRICK_Q50SN120A1
Definition: plat_class.h:99
@ POWER_BRICK_BMR3512202
Definition: plat_class.h:100
@ POWER_BRICK_UNKNOWN
Definition: plat_class.h:101
@ HSC_MODULE_LTC4286
Definition: plat_class.h:88
PCIE_CARD_INDEX
Definition: plat_class.h:138
@ PCIE_CARD_6
Definition: plat_class.h:144
@ PCIE_CARD_3
Definition: plat_class.h:141
@ PCIE_CARD_7
Definition: plat_class.h:145
@ PCIE_CARD_4
Definition: plat_class.h:142
@ PCIE_CARD_1
Definition: plat_class.h:139
@ PCIE_CARD_10
Definition: plat_class.h:148
@ PCIE_CARD_11
Definition: plat_class.h:149
@ PCIE_CARD_9
Definition: plat_class.h:147
@ PCIE_CARD_12
Definition: plat_class.h:150
@ PCIE_CARD_8
Definition: plat_class.h:146
@ PCIE_CARD_2
Definition: plat_class.h:140
@ PCIE_CARD_5
Definition: plat_class.h:143
FIO_STATUS
Definition: plat_class.h:127
@ FIO_NOT_PRESENT
Definition: plat_class.h:128
@ FIO_PRESENT
Definition: plat_class.h:129
ACCL_PRESENCE_OPTION
Definition: plat_class.h:168
@ ACCL_CABLE_PRESENCE
Definition: plat_class.h:170
@ ACCL_CARD_PRESENCE
Definition: plat_class.h:169
uint8_t get_pwr_monitor_module()
Definition: plat_class.c:446
void init_asic_jtag_select_ioexp()
Definition: plat_class.c:572
uint32_t offset
Definition: pldm_firmware_update.h:0
Definition: plat_class.h:173
bool card_status
Definition: plat_class.h:174
uint8_t power_fault_reg
Definition: plat_class.h:179
bool asic_1_status
Definition: plat_class.h:177
bool asic_2_status
Definition: plat_class.h:178
bool pwr_cbl_status
Definition: plat_class.h:175
uint8_t card_type
Definition: plat_class.h:176