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(FM_BMC_PCH_SCI_LPC_N) \
30 gpio_name_to_num(FM_BIOS_POST_CMPLT_BMC_N) \
31 gpio_name_to_num(FM_SLPS3_R_N) \
32 gpio_name_to_num(IRQ_BMC_PCH_SMI_LPC_R_N) \
33 gpio_name_to_num(IRQ_UV_DETECT_N) \
34 gpio_name_to_num(FM_UV_ADR_TRIGGER_EN) \
35 gpio_name_to_num(IRQ_SMI_ACTIVE_BMC_N) \
36 gpio_name_to_num(HSC_SET_EN)
37
38#define name_gpioB \
39 gpio_name_to_num(FM_BIC_RST_RTCRST) \
40 gpio_name_to_num(RST_USB_HUB_N_R) \
41 gpio_name_to_num(A_P3V_BAT_SCALED_EN) \
42 gpio_name_to_num(FM_CPU_FIVR_FAULT_LVT3_N) \
43 gpio_name_to_num(DBP_SYSPWROK_R) \
44 gpio_name_to_num(FM_SLPS4_R_N) \
45 gpio_name_to_num(RST_RSTBTN_OUT_N) \
46 gpio_name_to_num(PWRGD_SYS_PWROK)
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(IRQ_PVCCIN_CPU_VRHOT_LVC3_N) \
52 gpio_name_to_num(FM_BMC_PREQ_N_NODE_R1) \
53 gpio_name_to_num(FM_CPU_THERMTRIP_LATCH_LVT3_N) \
54 gpio_name_to_num(FM_CPU_SKTOCC_LVT3_N) \
55 gpio_name_to_num(FM_CPU_MEMHOT_OUT_N) \
56 gpio_name_to_num(RST_PLTRST_FROM_PCH_N)
57
58#define name_gpioD \
59 gpio_name_to_num(PWRBTN_N) \
60 gpio_name_to_num(RST_BMC_R_N) \
61 gpio_name_to_num(IRQ_BMC_PRDY_NODE_OD_N) \
62 gpio_name_to_num(BMC_READY) \
63 gpio_name_to_num(BIC_READY) \
64 gpio_name_to_num(FM_SOL_UART_CH_SEL_R) \
65 gpio_name_to_num(HSC_MUX_SWITCH_R) \
66 gpio_name_to_num(RST_PLTRST_BMC_N)
67
68#define name_gpioE \
69 gpio_name_to_num(PWRGD_CPU_LVC3_R) \
70 gpio_name_to_num(FM_PCH_BMC_THERMTRIP_N) \
71 gpio_name_to_num(HSC_DETECT0) \
72 gpio_name_to_num(HSC_DETECT1) \
73 gpio_name_to_num(HSC_DETECT2) \
74 gpio_name_to_num(FM_CPU_MSMI_CATERR_LVT3_N) \
75 gpio_name_to_num(FM_PWRBTN_OUT_N) \
76 gpio_name_to_num(PWRGD_BMC_PS_PWROK_R)
77
78#define name_gpioF \
79 gpio_name_to_num(IRQ_BMC_PCH_NMI_R) \
80 gpio_name_to_num(IRQ_SML1_PMBUS_ALERT_N) \
81 gpio_name_to_num(IRQ_NMI_EVENT_R_N) \
82 gpio_name_to_num(FM_BMC_DEBUG_ENABLE_N) \
83 gpio_name_to_num(DBP_PRESENT_R2_N) \
84 gpio_name_to_num(FM_FAST_PROCHOT_EN_N) \
85 gpio_name_to_num(FM_BMC_ONCTL_R_N) \
86 gpio_name_to_num(FM_BMC_CPU_PWR_DEBUG_N)
87
88#define name_gpioG \
89 gpio_name_to_num(FM_PEHPCPU_INT) \
90 gpio_name_to_num(FM_MRC_DEBUG_EN) \
91 gpio_name_to_num(FAST_PROCHOT_N) \
92 gpio_name_to_num(FM_JTAG_TCK_MUX_SEL) \
93 gpio_name_to_num(BMC_JTAG_SEL) \
94 gpio_name_to_num(FM_CPU_ERR0_LVT3_N) \
95 gpio_name_to_num(FM_CPU_ERR1_LVT3_N) \
96 gpio_name_to_num(FM_CPU_ERR2_LVT3_N)
97
98#define name_gpioH \
99 gpio_name_to_num(RST_RSMRST_BMC_N) \
100 gpio_name_to_num(FM_MP_PS_FAIL_N) \
101 gpio_name_to_num(FM_MEM_THERM_EVENT_LVT3_N) \
102 gpio_name_to_num(IRQ_SML0_ALERT_MUX_R_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(Reserve_GPIOL0) \
140 gpio_name_to_num(Reserve_GPIOL1) \
141 gpio_name_to_num(Reserve_GPIOL2) \
142 gpio_name_to_num(BOARD_ID2) \
143 gpio_name_to_num(IRQ_PVDDQ_ABC_VRHOT_LVT3_N) \
144 gpio_name_to_num(FM_CPU_THERMTRIP_LVT3_N) \
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_ID3) \
152 gpio_name_to_num(Reserve_GPIOM2) \
153 gpio_name_to_num(FM_THERMTRIP_DLY_TO_PCH) \
154 gpio_name_to_num(IRQ_PVDDQ_DEF_VRHOT_LVT3_N) \
155 gpio_name_to_num(IRQ_PVCCIO_CPU_VRHOT_LVC3_N) \
156 gpio_name_to_num(Reserve_GPIOM6) \
157 gpio_name_to_num(Reserve_GPIOM7)
158
159#define name_gpioN \
160 gpio_name_to_num(SGPIO_BMC_CLK_R) \
161 gpio_name_to_num(SGPIO_BMC_LD_N) \
162 gpio_name_to_num(SGPIO_BMC_DOUT_R) \
163 gpio_name_to_num(SGPIO_BMC_DIN) \
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(FM_SPD_DDRCPU_LVLSHFT_EN) \
187 gpio_name_to_num(FM_BMC_PCHIE_N)
188
189// GPIOQ5 hardware not define
190#define name_gpioQ \
191 gpio_name_to_num(IRQ_HSC_ALERT2_N) \
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
255//align ti bic for bmc get gpio inform
256#define PVCCIO_CPU 0xFF
257#define BMC_HEARTBEAT_LED_R 0xFF
258#define FM_FORCE_ADR_N_R 0xFF
259#define JTAG_BMC_NTRST_R_N 0xff
260
261extern char *gpio_name[];
262// GPIO Table SET/GET GPIO Configuration align to Ti BIC
263extern uint8_t gpio_align_t[];
264extern int gpio_align_table_length;
265
272uint8_t get_exported_gpio_num(uint8_t internal_gpio_num);
273#endif
char * gpio_name[]
Definition: hal_gpio.c:49
_GPIO_NUMS_
Definition: plat_gpio.h:228
enum _GPIO_NUMS_ GPIO_NUMS
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:169
#define name_gpioK
Definition: plat_gpio.h:128
#define name_gpioH
Definition: plat_gpio.h:98
void disable_SYS_Throttle_interrupt()
Definition: plat_gpio.c:378
#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
uint8_t get_exported_gpio_num(uint8_t internal_gpio_num)
Definition: plat_gpio.c:383
#define name_gpioD
Definition: plat_gpio.h:58
void enable_SYS_Throttle_interrupt()
Definition: plat_gpio.c:373
void enable_UV_detect_interrupt()
Definition: plat_gpio.c:363
#define name_gpioT
Definition: plat_gpio.h:222
#define name_gpioN
Definition: plat_gpio.h:159
#define name_gpioM
Definition: plat_gpio.h:149
uint8_t gpio_align_t[]
Definition: plat_gpio.c:260
#define name_gpioI
Definition: plat_gpio.h:108
void disable_UV_detect_interrupt()
Definition: plat_gpio.c:368
#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
int gpio_align_table_length
Definition: plat_gpio.c:343
#define name_gpioU
Definition: plat_gpio.h:233