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(Reserve_GPIOA0) \
30 gpio_name_to_num(Reserve_GPIOA1) \
31 gpio_name_to_num(Reserve_GPIOA2) \
32 gpio_name_to_num(INA230_E1S_ALERT_L) \
33 gpio_name_to_num(I2C_2_CPU_ALERT_R_L) \
34 gpio_name_to_num(FPGA_WATCH_DOG_TIMER0_L) \
35 gpio_name_to_num(FPGA_WATCH_DOG_TIMER1_L) \
36 gpio_name_to_num(HSC_OCP_GPIO1)
37
38#define name_gpioB \
39 gpio_name_to_num(FPGA_WATCH_DOG_TIMER2_L) \
40 gpio_name_to_num(RST_USB_HUB_R_L) \
41 gpio_name_to_num(P3V_BAT_SCALED_EN_R) \
42 gpio_name_to_num(WP_HW_EXT_CTRL_L) \
43 gpio_name_to_num(BIC_EROT_LVSFT_EN) \
44 gpio_name_to_num(RTC_CLR_L) \
45 gpio_name_to_num(I2C_SSIF_ALERT_L) \
46 gpio_name_to_num(FPGA_CPU_BOOT_DONE_L)
47
48#define name_gpioC \
49 gpio_name_to_num(FM_HSC_TIMER) \
50 gpio_name_to_num(IRQ_I2C_IO_LVC_STBY_ALRT_L) \
51 gpio_name_to_num(BIC_TMP_LVSFT_EN) \
52 gpio_name_to_num(BIC_I2C_0_FPGA_ALERT_L) \
53 gpio_name_to_num(BIC_I2C_1_FPGA_ALERT_L) \
54 gpio_name_to_num(JTAG_TRST_CPU_BMC_L) \
55 gpio_name_to_num(RST_I2C_E1S_L) \
56 gpio_name_to_num(FM_PWRDIS_E1S)
57
58#define name_gpioD \
59 gpio_name_to_num(PWRBTN_L) \
60 gpio_name_to_num(RST_BMC_L) \
61 gpio_name_to_num(FM_BIOS_MRC_DEBUG_DIS_L) \
62 gpio_name_to_num(BMC_READY) \
63 gpio_name_to_num(BIC_READY) \
64 gpio_name_to_num(PWR_BRAKE_CPU1) \
65 gpio_name_to_num(Reserve_GPIOD6) \
66 gpio_name_to_num(Reserve_GPIOD7)
67
68#define name_gpioE \
69 gpio_name_to_num(RUN_POWER_PG) \
70 gpio_name_to_num(BIC_RETIMER_MUX_SEL) \
71 gpio_name_to_num(SPI_BMC_FPGA_INT_L) \
72 gpio_name_to_num(IRQ_HSC_ALERT1_L) \
73 gpio_name_to_num(I2C_SENSOR_LVC_ALERT_L) \
74 gpio_name_to_num(INA_CRIT_ALERT1_L) \
75 gpio_name_to_num(RUN_POWER_EN) \
76 gpio_name_to_num(SPI_HOST_TPM_RST_L)
77
78#define name_gpioF \
79 gpio_name_to_num(HSC_TYPE_0) \
80 gpio_name_to_num(THERM_WARN_CPU1_L_3V3) \
81 gpio_name_to_num(RUN_POWER_FAULT_L) \
82 gpio_name_to_num(SENSOR_AIR0_THERM_L) \
83 gpio_name_to_num(SENSOR_AIR1_THERM_L) \
84 gpio_name_to_num(FM_FAST_PROCHOT_EN) \
85 gpio_name_to_num(THERM_BB_OVERT_L) \
86 gpio_name_to_num(THERM_BB_WARN_L)
87
88#define name_gpioG \
89 gpio_name_to_num(BIC_CPU_JTAG_MUX_SEL) \
90 gpio_name_to_num(FM_VR_FW_PROGRAM_L) \
91 gpio_name_to_num(FAST_PROCHOT_L) \
92 gpio_name_to_num(CPU_EROT_FATAL_ERROR_L) \
93 gpio_name_to_num(BIC_REMOTEJTAG_EN) \
94 gpio_name_to_num(THERM_OVERT_CPU1_L_3V3) \
95 gpio_name_to_num(HSC_OCP_GPIO2) \
96 gpio_name_to_num(HSC_OCP_GPIO3)
97
98#define name_gpioH \
99 gpio_name_to_num(SENSOR_AIR0_ALERT_L) \
100 gpio_name_to_num(SENSOR_AIR1_ALERT_L) \
101 gpio_name_to_num(BIC_CPLD_VRD_MUX_SEL) \
102 gpio_name_to_num(CPU_BIC_PROCHOT_L) \
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(VIRTUAL_E1S_PRSNT_L) \
140 gpio_name_to_num(CPLD_JTAG_MUX_SEL) \
141 gpio_name_to_num(JTAG_FPGA_MUX_SEL) \
142 gpio_name_to_num(VIRTUAL_RETIMER_PG) \
143 gpio_name_to_num(VIRTUAL_SATMC_READY) \
144 gpio_name_to_num(Reserve_GPIOL5) \
145 gpio_name_to_num(BOARD_ID0) \
146 gpio_name_to_num(BOARD_ID1)
147
148// GPIOM6, M7 hardware not define
149#define name_gpioM \
150 gpio_name_to_num(Reserve_GPIOM0) \
151 gpio_name_to_num(BOARD_ID2) \
152 gpio_name_to_num(Reserve_GPIOM2) \
153 gpio_name_to_num(BOARD_ID3) \
154 gpio_name_to_num(BOARD_ID4) \
155 gpio_name_to_num(BOARD_ID5) \
156 gpio_name_to_num(Reserve_GPIOM6) \
157 gpio_name_to_num(Reserve_GPIOM7)
158
159#define name_gpioN \
160 gpio_name_to_num(VIRTUAL_BIOS_POST_COMPLETE_L) \
161 gpio_name_to_num(Reserve_GPION1) \
162 gpio_name_to_num(Reserve_GPION2) \
163 gpio_name_to_num(Reserve_GPION3) \
164 gpio_name_to_num(Reserve_GPION4) \
165 gpio_name_to_num(Reserve_GPION5) \
166 gpio_name_to_num(Reserve_GPION6) \
167 gpio_name_to_num(Reserve_GPION7)
168
169#define name_gpioO \
170 gpio_name_to_num(Reserve_GPIOO0) \
171 gpio_name_to_num(Reserve_GPIOO1) \
172 gpio_name_to_num(Reserve_GPIOO2) \
173 gpio_name_to_num(Reserve_GPIOO3) \
174 gpio_name_to_num(Reserve_GPIOO4) \
175 gpio_name_to_num(Reserve_GPIOO5) \
176 gpio_name_to_num(Reserve_GPIOO6) \
177 gpio_name_to_num(Reserve_GPIOO7)
178
179#define name_gpioP \
180 gpio_name_to_num(Reserve_GPIOP0) \
181 gpio_name_to_num(Reserve_GPIOP1) \
182 gpio_name_to_num(Reserve_GPIOP2) \
183 gpio_name_to_num(Reserve_GPIOP3) \
184 gpio_name_to_num(Reserve_GPIOP4) \
185 gpio_name_to_num(Reserve_GPIOP5) \
186 gpio_name_to_num(Reserve_GPIOP6) \
187 gpio_name_to_num(Reserve_GPIOP7)
188
189// GPIOQ5 hardware not define
190#define name_gpioQ \
191 gpio_name_to_num(Reserve_GPIOQ0) \
192 gpio_name_to_num(Reserve_GPIOQ1) \
193 gpio_name_to_num(Reserve_GPIOQ2) \
194 gpio_name_to_num(Reserve_GPIOQ3) \
195 gpio_name_to_num(Reserve_GPIOQ4) \
196 gpio_name_to_num(Reserve_GPIOQ5) \
197 gpio_name_to_num(Reserve_GPIOQ6) \
198 gpio_name_to_num(Reserve_GPIOQ7)
199
200#define name_gpioR \
201 gpio_name_to_num(Reserve_GPIOR0) \
202 gpio_name_to_num(Reserve_GPIOR1) \
203 gpio_name_to_num(Reserve_GPIOR2) \
204 gpio_name_to_num(Reserve_GPIOR3) \
205 gpio_name_to_num(Reserve_GPIOR4) \
206 gpio_name_to_num(Reserve_GPIOR5) \
207 gpio_name_to_num(Reserve_GPIOR6) \
208 gpio_name_to_num(Reserve_GPIOR7)
209
210// GPIOS3, S4, S5, S6, S7 hardware not define
211#define name_gpioS \
212 gpio_name_to_num(Reserve_GPIOS0) \
213 gpio_name_to_num(Reserve_GPIOS1) \
214 gpio_name_to_num(Reserve_GPIOS2) \
215 gpio_name_to_num(Reserve_GPIOS3) \
216 gpio_name_to_num(Reserve_GPIOS4) \
217 gpio_name_to_num(Reserve_GPIOS5) \
218 gpio_name_to_num(Reserve_GPIOS6) \
219 gpio_name_to_num(Reserve_GPIOS7)
220
221// GPIOT input only
222#define name_gpioT \
223 gpio_name_to_num(Reserve_GPIOT0) \
224 gpio_name_to_num(Reserve_GPIOT1) \
225 gpio_name_to_num(Reserve_GPIOT2) \
226 gpio_name_to_num(Reserve_GPIOT3) \
227 gpio_name_to_num(Reserve_GPIOT4) \
228 gpio_name_to_num(Reserve_GPIOT5) \
229 gpio_name_to_num(Reserve_GPIOT6) \
230 gpio_name_to_num(Reserve_GPIOT7)
231
232// GPIOU input only
233#define name_gpioU \
234 gpio_name_to_num(Reserve_GPIOU0) \
235 gpio_name_to_num(Reserve_GPIOU1) \
236 gpio_name_to_num(Reserve_GPIOU2) \
237 gpio_name_to_num(Reserve_GPIOU3) \
238 gpio_name_to_num(Reserve_GPIOU4) \
239 gpio_name_to_num(Reserve_GPIOU5) \
240 gpio_name_to_num(Reserve_GPIOU6) \
241 gpio_name_to_num(Reserve_GPIOU7)
242
243// clang-format on
244
245#define gpio_name_to_num(x) x,
251
252extern enum _GPIO_NUMS_ GPIO_NUMS;
253#undef gpio_name_to_num
254
255extern char *gpio_name[];
256
257#endif
char * gpio_name[]
Definition: hal_gpio.c:49
_GPIO_NUMS_
Definition: plat_gpio.h:228
enum _GPIO_NUMS_ GPIO_NUMS
#define name_gpioO
Definition: plat_gpio.h:169
#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:190
#define name_gpioR
Definition: plat_gpio.h:200
#define name_gpioP
Definition: plat_gpio.h:179
#define name_gpioE
Definition: plat_gpio.h:68
#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:222
#define name_gpioN
Definition: plat_gpio.h:159
#define name_gpioM
Definition: plat_gpio.h:149
#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:211
#define name_gpioU
Definition: plat_gpio.h:233