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(CPU0_BMC_GPIOA0_PRESENT_L) \
30 gpio_name_to_num(BMC_GPIOA1_S01_SYSRESET_L) \
31 gpio_name_to_num(S0_BMC_GPIOA2_FAULT_ALERT) \
32 gpio_name_to_num(JTAG_CMPL2_PD_BIC) \
33 gpio_name_to_num(IRQ_UV_DETECT_N) \
34 gpio_name_to_num(S0_BMC_GPIOA5_FW_BOOT_OK) \
35 gpio_name_to_num(S0_BMC_GPIOA6_SHD_REQ_L) \
36 gpio_name_to_num(HSC_OCP_GPIO1_R)
37
38#define name_gpioB \
39 gpio_name_to_num(S0_BMC_GPIOB0_SHD_ACK_L) \
40 gpio_name_to_num(RST_USB_HUB_R_N) \
41 gpio_name_to_num(P3V_BAT_SCALED_EN_R) \
42 gpio_name_to_num(FM_BIOS_POST_CMPLT_BIC_N) \
43 gpio_name_to_num(S0_BMC_GPIOB4_REBOOT_ACK_L) \
44 gpio_name_to_num(S0_BMC_GPIOB5_PCP_OC_WARN_L) \
45 gpio_name_to_num(S0_BMC_GPIOB6_OVERTEMP_L) \
46 gpio_name_to_num(S0_BMC_GPIOB7_HIGHTEMP_L)
47
48#define name_gpioC \
49 gpio_name_to_num(FM_HSC_TIMER) \
50 gpio_name_to_num(IRQ_SMB_IO_LVC3_STBY_ALRT_N) \
51 gpio_name_to_num(BMC_GPIOC2_S0_RTC_LOCK) \
52 gpio_name_to_num(BMC_GPIOC3_OK) \
53 gpio_name_to_num(S0_BMC_MPRO_HEARTBEAT) \
54 gpio_name_to_num(BMC_GPIOT5_JTAG_SRST_L) \
55 gpio_name_to_num(AUTH_PRSNT_BIC_N) \
56 gpio_name_to_num(BMC_GPIOT6_SPI0_PROGRAM_SEL)
57
58#define name_gpioD \
59 gpio_name_to_num(PWRBTN_R1_N) \
60 gpio_name_to_num(RST_BMC_R_N) \
61 gpio_name_to_num(FM_BIOS_MRC_DEBUG_MSG_DIS) \
62 gpio_name_to_num(BTN_PWR_BUF_BMC_GPIOD3_L) \
63 gpio_name_to_num(BMC_GPIOD4_SW_HBLED) \
64 gpio_name_to_num(FM_SOL_UART_CH_SEL_R) \
65 gpio_name_to_num(Reserve_GPIOD6) \
66 gpio_name_to_num(Reserve_GPIOD7)
67
68#define name_gpioE \
69 gpio_name_to_num(Reserve_GPIOE0) \
70 gpio_name_to_num(S0_BMC_GPIOE1_SYS_AUTH_FAILURE_L) \
71 gpio_name_to_num(CPLD_BMC_GPIOE2_S0_SPI_AUTH_FAIL_L) \
72 gpio_name_to_num(IRQ_HSC_ALERT1_N) \
73 gpio_name_to_num(SMB_SENSOR_LVC3_ALERT_N) \
74 gpio_name_to_num(BIC_FW_RECOVERY_L) \
75 gpio_name_to_num(SYS_PWRBTN_BIC_N) \
76 gpio_name_to_num(RST_PLTRST_BIC_N)
77
78#define name_gpioF \
79 gpio_name_to_num(CPU_BIOS_RECOVER_GPIOF0) \
80 gpio_name_to_num(IRQ_HSC_ALERT2_N) \
81 gpio_name_to_num(Reserve_GPIOF2) \
82 gpio_name_to_num(S0_BMC_GPIOF3_VRHOT_L) \
83 gpio_name_to_num(S0_BMC_GPIOF4_VRD_FAULT_L) \
84 gpio_name_to_num(FM_FAST_PROCHOT_EN_R_N) \
85 gpio_name_to_num(Reserve_GPIOF6) \
86 gpio_name_to_num(BTN_SYS_RST_BMC_GPIOF7_L)
87
88#define name_gpioG \
89 gpio_name_to_num(CPLD_SOC_SPI_NOR_ACCESS) \
90 gpio_name_to_num(CPLD_BMC_SPI_NOR_ACCESS) \
91 gpio_name_to_num(FAST_PROCHOT_N) \
92 gpio_name_to_num(BIC_SALT4_L) \
93 gpio_name_to_num(BIC_JTAG_SEL_R) \
94 gpio_name_to_num(BIC_SALT12_L) \
95 gpio_name_to_num(HSC_OCP_GPIO2_R) \
96 gpio_name_to_num(HSC_OCP_GPIO3_R)
97
98#define name_gpioH \
99 gpio_name_to_num(BIC_SALT7_L) \
100 gpio_name_to_num(BMC_GPIOH1_SPD_SEL) \
101 gpio_name_to_num(BMC_GPIOH2_VRD_SEL) \
102 gpio_name_to_num(FM_CPU_BIC_PROCHOT_LVT3_N) \
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(BMC_GPIOL0_SYS_PSON_L) \
140 gpio_name_to_num(BMC_GPIOL1_SYS_PWRGD) \
141 gpio_name_to_num(BIC_JTAG_MUX_SEL) \
142 gpio_name_to_num(BOARD_ID2) \
143 gpio_name_to_num(Reserve_GPIOL4) \
144 gpio_name_to_num(Reserve_GPIOL5) \
145 gpio_name_to_num(BOARD_ID0) \
146 gpio_name_to_num(BOARD_ID1)
147
148#define name_gpioM \
149 gpio_name_to_num(BIC_SECUREBOOT) \
150 gpio_name_to_num(BOARD_ID3) \
151 gpio_name_to_num(BIC_ESPI_SELECT) \
152 gpio_name_to_num(Reserve_GPIOM3) \
153 gpio_name_to_num(BOARD_ID5) \
154 gpio_name_to_num(BOARD_ID4) \
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(BMC_GPION4_DEBUG_MODE) \
164 gpio_name_to_num(S0_BMC_GPIOM1_DDR_SAVE) \
165 gpio_name_to_num(BMC_GPION6_WD_DISABLE_L) \
166 gpio_name_to_num(BMC_GPION7_EXT_HIGH_TEMP_L)
167
168#define name_gpioO \
169 gpio_name_to_num(BMC_GPIOO0_S01_SPECIAL_BOOT) \
170 gpio_name_to_num(BMC_GPIOO1_S01_PMIN_L) \
171 gpio_name_to_num(BMC_GPIOO2_READY) \
172 gpio_name_to_num(BMC_GPIOO3_USER_MODE) \
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// GPIOQ5 hardware not define
189#define name_gpioQ \
190 gpio_name_to_num(Reserve_GPIOQ0) \
191 gpio_name_to_num(Reserve_GPIOQ1) \
192 gpio_name_to_num(Reserve_GPIOQ2) \
193 gpio_name_to_num(Reserve_GPIOQ3) \
194 gpio_name_to_num(Reserve_GPIOQ4) \
195 gpio_name_to_num(Reserve_GPIOQ5) \
196 gpio_name_to_num(Reserve_GPIOQ6) \
197 gpio_name_to_num(Reserve_GPIOQ7)
198
199#define name_gpioR \
200 gpio_name_to_num(Reserve_GPIOR0) \
201 gpio_name_to_num(Reserve_GPIOR1) \
202 gpio_name_to_num(Reserve_GPIOR2) \
203 gpio_name_to_num(Reserve_GPIOR3) \
204 gpio_name_to_num(Reserve_GPIOR4) \
205 gpio_name_to_num(Reserve_GPIOR5) \
206 gpio_name_to_num(Reserve_GPIOR6) \
207 gpio_name_to_num(Reserve_GPIOR7)
208
209// GPIOS3, S4, S5, S6, S7 hardware not define
210#define name_gpioS \
211 gpio_name_to_num(Reserve_GPIOS0) \
212 gpio_name_to_num(Reserve_GPIOS1) \
213 gpio_name_to_num(Reserve_GPIOS2) \
214 gpio_name_to_num(Reserve_GPIOS3) \
215 gpio_name_to_num(Reserve_GPIOS4) \
216 gpio_name_to_num(Reserve_GPIOS5) \
217 gpio_name_to_num(Reserve_GPIOS6) \
218 gpio_name_to_num(Reserve_GPIOS7)
219
220// GPIOT input only
221#define name_gpioT \
222 gpio_name_to_num(Reserve_GPIOT0) \
223 gpio_name_to_num(Reserve_GPIOT1) \
224 gpio_name_to_num(Reserve_GPIOT2) \
225 gpio_name_to_num(Reserve_GPIOT3) \
226 gpio_name_to_num(Reserve_GPIOT4) \
227 gpio_name_to_num(Reserve_GPIOT5) \
228 gpio_name_to_num(Reserve_GPIOT6) \
229 gpio_name_to_num(HSC_TYPE_0)
230
231// GPIOU input only
232#define name_gpioU \
233 gpio_name_to_num(Reserve_GPIOU0) \
234 gpio_name_to_num(Reserve_GPIOU1) \
235 gpio_name_to_num(Reserve_GPIOU2) \
236 gpio_name_to_num(Reserve_GPIOU3) \
237 gpio_name_to_num(Reserve_GPIOU4) \
238 gpio_name_to_num(Reserve_GPIOU5) \
239 gpio_name_to_num(Reserve_GPIOU6) \
240 gpio_name_to_num(HSC_TYPE_1)
241
242// clang-format on
243
244#define gpio_name_to_num(x) x,
250
251extern enum _GPIO_NUMS_ GPIO_NUMS;
252#undef gpio_name_to_num
253
254extern char *gpio_name[];
255
256#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: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:189
#define name_gpioR
Definition: plat_gpio.h:199
#define name_gpioP
Definition: plat_gpio.h:178
#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:221
#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:210
#define name_gpioU
Definition: plat_gpio.h:232