OpenBIC
OpenSource Bridge-IC
plat_gpio.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_GPIO_H
18#define PLAT_GPIO_H
19
20#include "hal_gpio.h"
21
22// gpio_cfg(chip, number, is_init, direction, status, int_type, int_callback)
23// dedicate gpio A0~A7, B0~B7, C0~C7, D0~D7, E0~E7, total 40 gpios
24// Default name: Reserve_GPIOH0
25
26// clang-format off
27
28#define name_gpioA \
29 gpio_name_to_num(MEB_PEX0_CNFG0_R) \
30 gpio_name_to_num(MEB_PEX0_CNFG1_R) \
31 gpio_name_to_num(MEB_PEX0_CNFG2_R) \
32 gpio_name_to_num(MEB_PEX1_CNFG0_R) \
33 gpio_name_to_num(MEB_PEX1_CNFG1_R) \
34 gpio_name_to_num(MEB_PEX1_CNFG2_R) \
35 gpio_name_to_num(MEB_STRAP0_N_R) \
36 gpio_name_to_num(MEB_STRAP1_N_R)
37
38#define name_gpioB \
39 gpio_name_to_num(SMB_2_MUX1_CH7_ALERT_R_N) \
40 gpio_name_to_num(SMB_2_MUX1_CH6_ALERT_R_N) \
41 gpio_name_to_num(SMB_2_MUX1_CH5_ALERT_R_N) \
42 gpio_name_to_num(SMB_2_MUX1_CH4_ALERT_R_N) \
43 gpio_name_to_num(SMB_2_MUX1_CH3_ALERT_R_N) \
44 gpio_name_to_num(SMB_2_MUX1_CH2_ALERT_R_N) \
45 gpio_name_to_num(SMB_2_MUX1_CH1_ALERT_R_N) \
46 gpio_name_to_num(SMB_2_MUX1_CH0_ALERT_R_N)
47
48#define name_gpioC \
49 gpio_name_to_num(RST_SMB_2_MUX_N) \
50 gpio_name_to_num(RST_BMC_MEB_MUX1_N) \
51 gpio_name_to_num(RST_SMB_8_MUX_N) \
52 gpio_name_to_num(RST_SMB_7_MUX_N) \
53 gpio_name_to_num(RST_SMB_4_MUX_N) \
54 gpio_name_to_num(RST_SMB_3_INA233_MUX_N) \
55 gpio_name_to_num(JTAG_MUX_SEL) \
56 gpio_name_to_num(RST_BIC_SELF_HW_RST_N_R)
57
58#define name_gpioD \
59 gpio_name_to_num(HSC_D_OC_BIC_N) \
60 gpio_name_to_num(CPLD_INT_N) \
61 gpio_name_to_num(RST_SMB_NIC0_N) \
62 gpio_name_to_num(RST_SMB_E1S_N) \
63 gpio_name_to_num(P12V_AUX_ALERT_R_N) \
64 gpio_name_to_num(SMB_3_INA233_P12V_AUX_ALERT_N) \
65 gpio_name_to_num(RST_SMB_NIC1_N) \
66 gpio_name_to_num(IOEXP_INT_R_N)
67
68#define name_gpioE \
69 gpio_name_to_num(FM_PRSNT1_PCIE_CARD9_R1) \
70 gpio_name_to_num(FM_PRSNT2_PCIE_CARD9_R1) \
71 gpio_name_to_num(FM_PRSNT3_PCIE_CARD9_R1) \
72 gpio_name_to_num(FM_PRSNT4_PCIE_CARD9_R1) \
73 gpio_name_to_num(FM_PRSNT1_PCIE_CARD10_R1) \
74 gpio_name_to_num(FM_PRSNT2_PCIE_CARD10_R1) \
75 gpio_name_to_num(FM_PRSNT3_PCIE_CARD10_R1) \
76 gpio_name_to_num(FM_PRSNT4_PCIE_CARD10_R1)
77
78#define name_gpioF \
79 gpio_name_to_num(MEB_STBY_PWRGD_BIC) \
80 gpio_name_to_num(MEB_NORMAL_PWRGD_BIC) \
81 gpio_name_to_num(RST_USB_HUB1_N) \
82 gpio_name_to_num(RST_USB_HUB2_N) \
83 gpio_name_to_num(RST_USB_HUB3_N) \
84 gpio_name_to_num(Reserve_GPIOF5) \
85 gpio_name_to_num(Reserve_GPIOF6) \
86 gpio_name_to_num(Reserve_GPIOF7)
87
88#define name_gpioG \
89 gpio_name_to_num(FM_PRSNT1_PCIE_CARD3_R1) \
90 gpio_name_to_num(FM_PRSNT2_PCIE_CARD3_R1) \
91 gpio_name_to_num(FM_PRSNT3_PCIE_CARD3_R1) \
92 gpio_name_to_num(FM_PRSNT4_PCIE_CARD3_R1) \
93 gpio_name_to_num(FM_PRSNT1_PCIE_CARD4_R1) \
94 gpio_name_to_num(FM_PRSNT2_PCIE_CARD4_R1) \
95 gpio_name_to_num(FM_PRSNT3_PCIE_CARD4_R1) \
96 gpio_name_to_num(FM_PRSNT4_PCIE_CARD4_R1)
97
98#define name_gpioH \
99 gpio_name_to_num(RST_BMC_MEB_MUX0_N) \
100 gpio_name_to_num(Reserve_GPIOH1) \
101 gpio_name_to_num(Reserve_GPIOH2) \
102 gpio_name_to_num(Reserve_GPIOH3) \
103 gpio_name_to_num(Reserve_GPIOH4) \
104 gpio_name_to_num(Reserve_GPIOH5) \
105 gpio_name_to_num(Reserve_GPIOH6) \
106 gpio_name_to_num(Reserve_GPIOH7)
107
108#define name_gpioI \
109 gpio_name_to_num(Reserve_GPIOI0) \
110 gpio_name_to_num(Reserve_GPIOI1) \
111 gpio_name_to_num(Reserve_GPIOI2) \
112 gpio_name_to_num(Reserve_GPIOI3) \
113 gpio_name_to_num(Reserve_GPIOI4) \
114 gpio_name_to_num(Reserve_GPIOI5) \
115 gpio_name_to_num(Reserve_GPIOI6) \
116 gpio_name_to_num(Reserve_GPIOI7)
117
118#define name_gpioJ \
119 gpio_name_to_num(Reserve_GPIOJ0) \
120 gpio_name_to_num(Reserve_GPIOJ1) \
121 gpio_name_to_num(Reserve_GPIOJ2) \
122 gpio_name_to_num(Reserve_GPIOJ3) \
123 gpio_name_to_num(Reserve_GPIOJ4) \
124 gpio_name_to_num(Reserve_GPIOJ5) \
125 gpio_name_to_num(Reserve_GPIOJ6) \
126 gpio_name_to_num(Reserve_GPIOJ7)
127
128#define name_gpioK \
129 gpio_name_to_num(Reserve_GPIOK0) \
130 gpio_name_to_num(Reserve_GPIOK1) \
131 gpio_name_to_num(Reserve_GPIOK2) \
132 gpio_name_to_num(Reserve_GPIOK3) \
133 gpio_name_to_num(Reserve_GPIOK4) \
134 gpio_name_to_num(Reserve_GPIOK5) \
135 gpio_name_to_num(Reserve_GPIOK6) \
136 gpio_name_to_num(Reserve_GPIOK7)
137
138#define name_gpioL \
139 gpio_name_to_num(Reserve_GPIOL0) \
140 gpio_name_to_num(Reserve_GPIOL1) \
141 gpio_name_to_num(Reserve_GPIOL2) \
142 gpio_name_to_num(Reserve_GPIOL3) \
143 gpio_name_to_num(Reserve_GPIOL4) \
144 gpio_name_to_num(Reserve_GPIOL5) \
145 gpio_name_to_num(Reserve_GPIOL6) \
146 gpio_name_to_num(Reserve_GPIOL7)
147
148#define name_gpioM \
149 gpio_name_to_num(Reserve_GPIOM0) \
150 gpio_name_to_num(Reserve_GPIOM1) \
151 gpio_name_to_num(Reserve_GPIOM2) \
152 gpio_name_to_num(Reserve_GPIOM3) \
153 gpio_name_to_num(Reserve_GPIOM4) \
154 gpio_name_to_num(Reserve_GPIOM5) \
155 gpio_name_to_num(Reserve_GPIOM6) \
156 gpio_name_to_num(Reserve_GPIOM7)
157
158#define name_gpioN \
159 gpio_name_to_num(Reserve_GPION0) \
160 gpio_name_to_num(Reserve_GPION1) \
161 gpio_name_to_num(Reserve_GPION2) \
162 gpio_name_to_num(Reserve_GPION3) \
163 gpio_name_to_num(BOARD_ID1) \
164 gpio_name_to_num(BOARD_ID2) \
165 gpio_name_to_num(BOARD_ID3) \
166 gpio_name_to_num(BOARD_ID4)
167
168#define name_gpioO \
169 gpio_name_to_num(BOARD_ID0) \
170 gpio_name_to_num(REV_ID0) \
171 gpio_name_to_num(REV_ID1) \
172 gpio_name_to_num(REV_ID2) \
173 gpio_name_to_num(Reserve_GPIOO4) \
174 gpio_name_to_num(Reserve_GPIOO5) \
175 gpio_name_to_num(Reserve_GPIOO6) \
176 gpio_name_to_num(Reserve_GPIOO7)
177
178#define name_gpioP \
179 gpio_name_to_num(Reserve_GPIOP0) \
180 gpio_name_to_num(Reserve_GPIOP1) \
181 gpio_name_to_num(Reserve_GPIOP2) \
182 gpio_name_to_num(Reserve_GPIOP3) \
183 gpio_name_to_num(Reserve_GPIOP4) \
184 gpio_name_to_num(Reserve_GPIOP5) \
185 gpio_name_to_num(Reserve_GPIOP6) \
186 gpio_name_to_num(Reserve_GPIOP7)
187
188#define name_gpioQ \
189 gpio_name_to_num(Reserve_GPIOQ0) \
190 gpio_name_to_num(Reserve_GPIOQ1) \
191 gpio_name_to_num(Reserve_GPIOQ3) \
192 gpio_name_to_num(Reserve_GPIOQ4) \
193 gpio_name_to_num(Reserve_GPIOQ5) \
194 gpio_name_to_num(Reserve_GPIOQ6) \
195 gpio_name_to_num(Reserve_GPIOQ7)
196
197#define name_gpioR \
198 gpio_name_to_num(Reserve_GPIOR0) \
199 gpio_name_to_num(Reserve_GPIOR1) \
200 gpio_name_to_num(Reserve_GPIOR2) \
201 gpio_name_to_num(Reserve_GPIOR3) \
202 gpio_name_to_num(Reserve_GPIOR4) \
203 gpio_name_to_num(Reserve_GPIOR5) \
204 gpio_name_to_num(Reserve_GPIOR6) \
205 gpio_name_to_num(Reserve_GPIOR7)
206
207#define name_gpioS \
208 gpio_name_to_num(Reserve_GPIOS0) \
209 gpio_name_to_num(Reserve_GPIOS1) \
210 gpio_name_to_num(Reserve_GPIOS2) \
211 gpio_name_to_num(Reserve_GPIOS3) \
212 gpio_name_to_num(Reserve_GPIOS4) \
213 gpio_name_to_num(Reserve_GPIOS5) \
214 gpio_name_to_num(Reserve_GPIOS6) \
215 gpio_name_to_num(Reserve_GPIOS7)
216
217#define name_gpioT \
218 gpio_name_to_num(Reserve_GPIOT0) \
219 gpio_name_to_num(Reserve_GPIOT1) \
220 gpio_name_to_num(Reserve_GPIOT2) \
221 gpio_name_to_num(Reserve_GPIOT3) \
222 gpio_name_to_num(Reserve_GPIOT4) \
223 gpio_name_to_num(Reserve_GPIOT5) \
224 gpio_name_to_num(Reserve_GPIOT6) \
225 gpio_name_to_num(Reserve_GPIOT7)
226
227#define name_gpioU \
228 gpio_name_to_num(Reserve_GPIOU0) \
229 gpio_name_to_num(Reserve_GPIOU1) \
230 gpio_name_to_num(Reserve_GPIOU2) \
231 gpio_name_to_num(Reserve_GPIOU3) \
232 gpio_name_to_num(Reserve_GPIOU4) \
233 gpio_name_to_num(Reserve_GPIOU5) \
234 gpio_name_to_num(Reserve_GPIOU6) \
235 gpio_name_to_num(Reserve_GPIOU7)
236
237#define update_name_gpioD \
238 gpio_name_to_num(HSC_D_OC_BIC_N) \
239 gpio_name_to_num(CPLD_INT_N) \
240 gpio_name_to_num(RST_SMB_NIC0_N) \
241 gpio_name_to_num(RST_SMB_E1S_N) \
242 gpio_name_to_num(P12V_AUX_ALERT_R_N) \
243 gpio_name_to_num(SMB_3_INA233_P12V_AUX_CH0_ALERT_N) \
244 gpio_name_to_num(RST_SMB_NIC1_N) \
245 gpio_name_to_num(IOEXP_INT_R_N)
246
247#define update_name_gpioE \
248 gpio_name_to_num(PWRGD_CARD8_0V6_PWR_BIC) \
249 gpio_name_to_num(PWRGD_CARD7_0V6_PWR_BIC) \
250 gpio_name_to_num(RST_USB_HUB3_N) \
251 gpio_name_to_num(RESERVE_GPIOE3) \
252 gpio_name_to_num(RESERVE_GPIOE4) \
253 gpio_name_to_num(PWRGD_CARD6_0V6_PWR_BIC) \
254 gpio_name_to_num(PWRGD_CARD5_0V6_PWR_BIC) \
255 gpio_name_to_num(PWRGD_CARD3_0V6_PWR_BIC)
256
257#define update_name_gpioF \
258 gpio_name_to_num(MEB_STBY_PWRGD_BIC) \
259 gpio_name_to_num(MEB_NORMAL_PWRGD_BIC) \
260 gpio_name_to_num(RST_USB_HUB1_N) \
261 gpio_name_to_num(RST_USB_HUB2_N) \
262 gpio_name_to_num(RESERVE_GPIOF4) \
263 gpio_name_to_num(Reserve_GPIOF5) \
264 gpio_name_to_num(Reserve_GPIOF6) \
265 gpio_name_to_num(Reserve_GPIOF7)
266
267#define update_name_gpioG \
268 gpio_name_to_num(Reserve_GPIOG0) \
269 gpio_name_to_num(Reserve_GPIOG1) \
270 gpio_name_to_num(Reserve_GPIOG2) \
271 gpio_name_to_num(Reserve_GPIOG3) \
272 gpio_name_to_num(Reserve_GPIOG4) \
273 gpio_name_to_num(Reserve_GPIOG5) \
274 gpio_name_to_num(Reserve_GPIOG6) \
275 gpio_name_to_num(Reserve_GPIOG7)
276
277#define update_name_gpioH \
278 gpio_name_to_num(RST_BMC_MEB_MUX0_N) \
279 gpio_name_to_num(Reserve_GPIOH1) \
280 gpio_name_to_num(Reserve_GPIOH2) \
281 gpio_name_to_num(PWRGD_CARD4_0V6_PWR_BIC) \
282 gpio_name_to_num(Reserve_GPIOH4) \
283 gpio_name_to_num(Reserve_GPIOH5) \
284 gpio_name_to_num(Reserve_GPIOH6) \
285 gpio_name_to_num(Reserve_GPIOH7)
286
287#define update_name_gpioL \
288 gpio_name_to_num(Reserve_GPIOL0) \
289 gpio_name_to_num(Reserve_GPIOL1) \
290 gpio_name_to_num(PWRGD_CARD1_0V6_PWR_BIC) \
291 gpio_name_to_num(PWRGD_CARD2_0V6_PWR_BIC) \
292 gpio_name_to_num(RST_MB_PERST_MEB0_R1_N) \
293 gpio_name_to_num(RST_MB_PERST_MEB1_R1_N) \
294 gpio_name_to_num(Reserve_GPIOL6) \
295 gpio_name_to_num(RST_SMB_6_MUX_N)
296
297#define update_name_gpioM \
298 gpio_name_to_num(Reserve_GPIOM0) \
299 gpio_name_to_num(RST_I3C_4_MUX_N) \
300 gpio_name_to_num(Reserve_GPIOM2) \
301 gpio_name_to_num(SMB_3_INA233_P12V_AUX_CH1_ALERT_N) \
302 gpio_name_to_num(Reserve_GPIOM4) \
303 gpio_name_to_num(Reserve_GPIOM5) \
304 gpio_name_to_num(Reserve_GPIOM6) \
305 gpio_name_to_num(Reserve_GPIOM7)
306
307#define update_name_gpioN \
308 gpio_name_to_num(Reserve_GPION0) \
309 gpio_name_to_num(SMB_3_INA233_P12V_AUX_CH2_ALERT_N) \
310 gpio_name_to_num(Reserve_GPION2) \
311 gpio_name_to_num(SMB_3_INA233_P12V_AUX_CH3_ALERT_N) \
312 gpio_name_to_num(BOARD_ID1) \
313 gpio_name_to_num(BOARD_ID2) \
314 gpio_name_to_num(BOARD_ID3) \
315 gpio_name_to_num(BOARD_ID4)
316// clang-format on
317
318#define gpio_name_to_num(x) x,
324
325extern enum _GPIO_NUMS_ GPIO_NUMS;
326#undef gpio_name_to_num
327
328extern char *gpio_name[];
329
332int get_cxl_ioexp_alert_pin(uint8_t cxl_id, uint8_t *alert_pin);
334
335#endif
char * gpio_name[]
Definition: hal_gpio.c:49
_GPIO_NUMS_
Definition: plat_gpio.h:228
enum _GPIO_NUMS_ GPIO_NUMS
void init_board_rev_gpio()
Definition: plat_gpio.c:300
void enable_PRDY_interrupt()
Definition: plat_gpio.c:265
void disable_PRDY_interrupt()
Definition: plat_gpio.c:270
#define name_gpioO
Definition: plat_gpio.h:168
#define name_gpioK
Definition: plat_gpio.h:128
#define name_gpioH
Definition: plat_gpio.h:98
#define name_gpioF
Definition: plat_gpio.h:78
#define name_gpioQ
Definition: plat_gpio.h:188
#define name_gpioR
Definition: plat_gpio.h:197
#define name_gpioP
Definition: plat_gpio.h:178
#define name_gpioE
Definition: plat_gpio.h:68
int get_cxl_ioexp_alert_pin(uint8_t cxl_id, uint8_t *alert_pin)
Definition: plat_gpio.c:358
#define name_gpioL
Definition: plat_gpio.h:138
#define name_gpioC
Definition: plat_gpio.h:48
#define name_gpioD
Definition: plat_gpio.h:58
#define name_gpioT
Definition: plat_gpio.h:217
#define name_gpioN
Definition: plat_gpio.h:158
#define name_gpioM
Definition: plat_gpio.h:148
#define name_gpioI
Definition: plat_gpio.h:108
#define name_gpioB
Definition: plat_gpio.h:38
#define name_gpioJ
Definition: plat_gpio.h:118
#define name_gpioA
Definition: plat_gpio.h:28
#define name_gpioG
Definition: plat_gpio.h:88
#define name_gpioS
Definition: plat_gpio.h:207
#define name_gpioU
Definition: plat_gpio.h:227