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 EVT_EXAMAX_RESERVED_1 18
29#define EVT_EXAMAX_RESERVED_2 25
30#define EVT_EXAMAX_RESERVED_4 43
31#define EVT_CPU_TYPE_1 52
32#define EVT_RTM_IOEXP_INT_N 53
33#define EVT_EXAMAX_RESERVED_3 55
34#define EVT_AUTH_COMPLETE 72
35#define EVT_BIC_READY_TOP_EXP 73
36#define EVT_RTM2_IOEXP_INT_N 74
37#define EVT_SIDECAR_CABLE_PRESENT 75
38#define EVT_BIC_READY_FRONT_EXP 76
39#define EVT_CPU_BIC_RTC_GET_N 77
40#define EVT_SMB_RTM1_INA233_ALRT_N 78
41#define EVT_SMB_RTM2_INA233_ALRT_N 79
42#define EVT_EXAMMAX_TYPE 95
43#define EVT_Reserve_GPIOM0 96
44#define EVT_MEDUSA_HSC_R_PG 98
45#define EVT_Reserve_GPIOM3 99
46
47#define name_gpioA \
48 gpio_name_to_num(FM_CPU_BIC_SLP_S5_N) \
49 gpio_name_to_num(FM_CPU_BIC_SLP_S3_N) \
50 gpio_name_to_num(RST_RSMRST_BMC_N) \
51 gpio_name_to_num(PWRGD_CPU_LVC3) \
52 gpio_name_to_num(CPU_SMERR_BIC_N) \
53 gpio_name_to_num(BMC_READY) \
54 gpio_name_to_num(RST_CPU_RESET_BIC_N) \
55 gpio_name_to_num(RST_USB_HUB_R_N)
56
57#define name_gpioB \
58 gpio_name_to_num(AUTH_PRSNT_BIC_N) \
59 gpio_name_to_num(BIC_CPU_NMI_N) \
60 gpio_name_to_num(FM_SMI_ACTIVE_N) \
61 gpio_name_to_num(IRQ_BIC_CPU_SMI_N) \
62 gpio_name_to_num(FM_CPU_BIC_THERMTRIP_N) \
63 gpio_name_to_num(APML_CPU_ALERT_BIC_N) \
64 gpio_name_to_num(PRSNT_CPU_R_N) \
65 gpio_name_to_num(SYS_PWRBTN_BIC_N)
66
67#define name_gpioC \
68 gpio_name_to_num(PVDDCR_CPU0_PMALERT_N) \
69 gpio_name_to_num(FM_HSC_TIMER_ALT_N) \
70 gpio_name_to_num(SMB_RTM1_INA233_ALRT_N) \
71 gpio_name_to_num(PVDDCR_CPU1_PMALERT_N) \
72 gpio_name_to_num(PWRBTN_N) \
73 gpio_name_to_num(RST_BMC_R_N) \
74 gpio_name_to_num(HDT_BIC_DBREQ_R_N) \
75 gpio_name_to_num(BIC_READY_R)
76
77#define name_gpioD \
78 gpio_name_to_num(FM_SOL_UART_CH_SEL_R) \
79 gpio_name_to_num(SMB_RTM2_INA233_ALRT_N) \
80 gpio_name_to_num(FAST_PROCHOT_N) \
81 gpio_name_to_num(BIC_JTAG_SEL_R) \
82 gpio_name_to_num(FM_CPU_BIC_PROCHOT_LVT3_N) \
83 gpio_name_to_num(SMB_E1S_0_RST_R_N) \
84 gpio_name_to_num(SMB_E1S_1_RST_R_N) \
85 gpio_name_to_num(SMB_E1S_0_INA233_ALRT_N)
86
87#define name_gpioE \
88 gpio_name_to_num(FM_BIOS_MRC_DEBUG_MSG_DIS) \
89 gpio_name_to_num(SMB_SENSOR_LVC3_ALERT_N) \
90 gpio_name_to_num(FM_BIOS_POST_CMPLT_BIC_N) \
91 gpio_name_to_num(IRQ_UV_DETECT_N) \
92 gpio_name_to_num(PVDDCR_CPU0_OCP_N) \
93 gpio_name_to_num(PVDDCR_CPU1_OCP_N) \
94 gpio_name_to_num(P3V_BAT_SCALED_R_EN) \
95 gpio_name_to_num(HDT_BIC_TRST_R_N)
96
97#define name_gpioF \
98 gpio_name_to_num(CARD_TYPE_EXP) \
99 gpio_name_to_num(CPU_ERROR_BIC_LVC3_R_N) \
100 gpio_name_to_num(PVDD11_S3_PMALERT_N) \
101 gpio_name_to_num(BIC_READY_FRONT_EXP) \
102 gpio_name_to_num(CPU_TYPE0) \
103 gpio_name_to_num(FM_BMC_DEBUG_ENABLE_R_N) \
104 gpio_name_to_num(FM_DBP_PRESENT_N) \
105 gpio_name_to_num(FM_FAST_PROCHOT_R_EN_N)
106
107#define name_gpioG \
108 gpio_name_to_num(IO_EXP_ALERT) \
109 gpio_name_to_num(FM_CPLD_BMC_BIC_READY) \
110 gpio_name_to_num(BIC_JTAG_MUX_SEL) \
111 gpio_name_to_num(RST_PLTRST_BIC_N) \
112 gpio_name_to_num(CPU_BIC_RTC_GET_N) \
113 gpio_name_to_num(AUTH_COMPLETE) \
114 gpio_name_to_num(P3V3_STBY_SIDECAR_FAULT_N) \
115 gpio_name_to_num(BIC_READY_TOP_EXP)
116
117#define name_gpioH \
118 gpio_name_to_num(PRSNT_CEM_CONN) \
119 gpio_name_to_num(TOP_CXL_SMBUS_ALERT_N) \
120 gpio_name_to_num(FRONT_CXL_SMBUS_ALERT_N) \
121 gpio_name_to_num(P1V2_STBY_SIDECAR_FAULT_N) \
122 gpio_name_to_num(Reserve_GPIOH4) \
123 gpio_name_to_num(Reserve_GPIOH5) \
124 gpio_name_to_num(Reserve_GPIOH6) \
125 gpio_name_to_num(Reserve_GPIOH7)
126
127#define name_gpioI \
128 gpio_name_to_num(Reserve_GPIOI0) \
129 gpio_name_to_num(Reserve_GPIOI1) \
130 gpio_name_to_num(Reserve_GPIOI2) \
131 gpio_name_to_num(Reserve_GPIOI3) \
132 gpio_name_to_num(Reserve_GPIOI4) \
133 gpio_name_to_num(Reserve_GPIOI5) \
134 gpio_name_to_num(Reserve_GPIOI6) \
135 gpio_name_to_num(Reserve_GPIOI7)
136
137#define name_gpioJ \
138 gpio_name_to_num(Reserve_GPIOJ0) \
139 gpio_name_to_num(Reserve_GPIOJ1) \
140 gpio_name_to_num(Reserve_GPIOJ2) \
141 gpio_name_to_num(Reserve_GPIOJ3) \
142 gpio_name_to_num(RTM2_INT_N) \
143 gpio_name_to_num(RTM_IOEXP_INT_N) \
144 gpio_name_to_num(Reserve_GPIOJ6) \
145 gpio_name_to_num(Reserve_GPIOJ7)
146
147#define name_gpioK \
148 gpio_name_to_num(Reserve_GPIOK0) \
149 gpio_name_to_num(Reserve_GPIOK1) \
150 gpio_name_to_num(Reserve_GPIOK2) \
151 gpio_name_to_num(Reserve_GPIOK3) \
152 gpio_name_to_num(Reserve_GPIOK4) \
153 gpio_name_to_num(Reserve_GPIOK5) \
154 gpio_name_to_num(Reserve_GPIOK6) \
155 gpio_name_to_num(Reserve_GPIOK7)
156
157#define name_gpioL \
158 gpio_name_to_num(Reserve_GPIOL0) \
159 gpio_name_to_num(Reserve_GPIOL1) \
160 gpio_name_to_num(PWRGD_HSC_SLOT_BIC) \
161 gpio_name_to_num(SIDECAR_PRESENT_BIC_N) \
162 gpio_name_to_num(SMB_E1S_1_INA233_ALRT_N) \
163 gpio_name_to_num(VR_TYPE_0) \
164 gpio_name_to_num(VR_TYPE_1) \
165 gpio_name_to_num(RTM_TYPE_0)
166
167#define name_gpioM \
168 gpio_name_to_num(Reserve_GPIOM0) \
169 gpio_name_to_num(RTM_TYPE_1) \
170 gpio_name_to_num(Reserve_GPIOM2) \
171 gpio_name_to_num(BIC_ESPI_SELECT) \
172 gpio_name_to_num(Reserve_GPIOM4) \
173 gpio_name_to_num(Reserve_GPIOM5) \
174 gpio_name_to_num(Reserve_GPIOM6) \
175 gpio_name_to_num(Reserve_GPIOM7)
176
177#define name_gpioN \
178 gpio_name_to_num(Reserve_GPION0) \
179 gpio_name_to_num(Reserve_GPION1) \
180 gpio_name_to_num(Reserve_GPION2) \
181 gpio_name_to_num(Reserve_GPION3) \
182 gpio_name_to_num(Reserve_GPION4) \
183 gpio_name_to_num(Reserve_GPION5) \
184 gpio_name_to_num(Reserve_GPION6) \
185 gpio_name_to_num(Reserve_GPION7)
186
187#define name_gpioO \
188 gpio_name_to_num(Reserve_GPIOO0) \
189 gpio_name_to_num(Reserve_GPIOO1) \
190 gpio_name_to_num(Reserve_GPIOO2) \
191 gpio_name_to_num(Reserve_GPIOO3) \
192 gpio_name_to_num(Reserve_GPIOO4) \
193 gpio_name_to_num(Reserve_GPIOO5) \
194 gpio_name_to_num(Reserve_GPIOO6) \
195 gpio_name_to_num(Reserve_GPIOO7)
196
197#define name_gpioP \
198 gpio_name_to_num(Reserve_GPIOP0) \
199 gpio_name_to_num(Reserve_GPIOP1) \
200 gpio_name_to_num(Reserve_GPIOP2) \
201 gpio_name_to_num(Reserve_GPIOP3) \
202 gpio_name_to_num(Reserve_GPIOP4) \
203 gpio_name_to_num(Reserve_GPIOP5) \
204 gpio_name_to_num(Reserve_GPIOP6) \
205 gpio_name_to_num(Reserve_GPIOP7)
206
207#define name_gpioQ \
208 gpio_name_to_num(Reserve_GPIOQ0) \
209 gpio_name_to_num(Reserve_GPIOQ1) \
210 gpio_name_to_num(Reserve_GPIOQ2) \
211 gpio_name_to_num(Reserve_GPIOQ3) \
212 gpio_name_to_num(Reserve_GPIOQ4) \
213 gpio_name_to_num(Reserve_GPIOQ5) \
214 gpio_name_to_num(Reserve_GPIOQ6) \
215 gpio_name_to_num(Reserve_GPIOQ7)
216
217#define name_gpioR \
218 gpio_name_to_num(Reserve_GPIOR0) \
219 gpio_name_to_num(Reserve_GPIOR1) \
220 gpio_name_to_num(Reserve_GPIOR2) \
221 gpio_name_to_num(Reserve_GPIOR3) \
222 gpio_name_to_num(Reserve_GPIOR4) \
223 gpio_name_to_num(Reserve_GPIOR5) \
224 gpio_name_to_num(Reserve_GPIOR6) \
225 gpio_name_to_num(Reserve_GPIOR7)
226
227#define name_gpioS \
228 gpio_name_to_num(Reserve_GPIOS0) \
229 gpio_name_to_num(Reserve_GPIOS1) \
230 gpio_name_to_num(Reserve_GPIOS2) \
231 gpio_name_to_num(Reserve_GPIOS3) \
232 gpio_name_to_num(Reserve_GPIOS4) \
233 gpio_name_to_num(Reserve_GPIOS5) \
234 gpio_name_to_num(Reserve_GPIOS6) \
235 gpio_name_to_num(Reserve_GPIOS7)
236
237#define name_gpioT \
238 gpio_name_to_num(Reserve_GPIOT0) \
239 gpio_name_to_num(Reserve_GPIOT1) \
240 gpio_name_to_num(Reserve_GPIOT2) \
241 gpio_name_to_num(Reserve_GPIOT3) \
242 gpio_name_to_num(Reserve_GPIOT4) \
243 gpio_name_to_num(Reserve_GPIOT5) \
244 gpio_name_to_num(Reserve_GPIOT6) \
245 gpio_name_to_num(Reserve_GPIOT7)
246
247#define name_gpioU \
248 gpio_name_to_num(Reserve_GPIOU0) \
249 gpio_name_to_num(Reserve_GPIOU1) \
250 gpio_name_to_num(Reserve_GPIOU2) \
251 gpio_name_to_num(Reserve_GPIOU3) \
252 gpio_name_to_num(Reserve_GPIOU4) \
253 gpio_name_to_num(Reserve_GPIOU5) \
254 gpio_name_to_num(Reserve_GPIOU6) \
255 gpio_name_to_num(Reserve_GPIOU7)
256
257// clang-format on
258
259#define gpio_name_to_num(x) x,
265
266extern enum _GPIO_NUMS_ GPIO_NUMS;
267#undef gpio_name_to_num
268
269extern char *gpio_name[];
270
271void sync_bmc_ready_pin();
272void reset_usb_hub();
273#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:187
#define name_gpioK
Definition: plat_gpio.h:147
#define name_gpioH
Definition: plat_gpio.h:117
void sync_bmc_ready_pin()
Definition: plat_gpio.c:301
#define name_gpioF
Definition: plat_gpio.h:97
#define name_gpioQ
Definition: plat_gpio.h:207
#define name_gpioR
Definition: plat_gpio.h:217
#define name_gpioP
Definition: plat_gpio.h:197
#define name_gpioE
Definition: plat_gpio.h:87
#define name_gpioL
Definition: plat_gpio.h:157
#define name_gpioC
Definition: plat_gpio.h:67
#define name_gpioD
Definition: plat_gpio.h:77
#define name_gpioT
Definition: plat_gpio.h:237
#define name_gpioN
Definition: plat_gpio.h:177
#define name_gpioM
Definition: plat_gpio.h:167
#define name_gpioI
Definition: plat_gpio.h:127
#define name_gpioB
Definition: plat_gpio.h:57
#define name_gpioJ
Definition: plat_gpio.h:137
#define name_gpioA
Definition: plat_gpio.h:47
#define name_gpioG
Definition: plat_gpio.h:107
#define name_gpioS
Definition: plat_gpio.h:227
#define name_gpioU
Definition: plat_gpio.h:247
void reset_usb_hub()
Definition: plat_gpio.c:307