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#define BB_CABLE_MATCH_SLOT1 0x3
22#define BB_CABLE_MATCH_SLOT3 0x1
23
24// gpio_cfg(chip, number, is_init, direction, status, int_type, int_callback)
25// dedicate gpio A0~A7, B0~B7, C0~C7, D0~D7, E0~E7, total 40 gpios
26// Default name: Reserve_GPIOH0
27
28// clang-format off
29
30#define name_gpioA \
31 gpio_name_to_num(SMB_TEMP_ALERT_BIC_N) \
32 gpio_name_to_num(SMB_BIC_HOTSWAP_ALERT_N_R) \
33 gpio_name_to_num(PWROK_STBY_BIC_SLOT1_R) \
34 gpio_name_to_num(PRSNT_MB_BIC_SLOT3_BB_N_R) \
35 gpio_name_to_num(AC_ON_OFF_BTN_BIC_SLOT1_N_R) \
36 gpio_name_to_num(AC_ON_OFF_BTN_BIC_SLOT3_N_R) \
37 gpio_name_to_num(HSC_FAULT_BIC_SLOT1_N_R) \
38 gpio_name_to_num(HSC_FAULT_BIC_SLOT3_N_R)
39
40#define name_gpioB \
41 gpio_name_to_num(FM_RESBTN_SLOT1_BIC_N) \
42 gpio_name_to_num(FM_RESBTN_SLOT3_BIC_N) \
43 gpio_name_to_num(FM_BIC_SLOT1_ISOLATED_EN_R) \
44 gpio_name_to_num(FM_BIC_SLOT3_ISOLATED_EN_R) \
45 gpio_name_to_num(FAST_PROCHOT_BIC_N_R) \
46 gpio_name_to_num(PWROK_STBY_BIC_SLOT3_R) \
47 gpio_name_to_num(FM_DEBUG_UART_MUX_BIC_R) \
48 gpio_name_to_num(PRSNT_MB_BIC_SLOT1_BB_N_R)
49
50#define name_gpioC \
51 gpio_name_to_num(DUAL_FAN0_DETECT_BIC_N_R) \
52 gpio_name_to_num(DUAL_FAN1_DETECT_BIC_N_R) \
53 gpio_name_to_num(FAN0_BIC_CPLD_EN_R) \
54 gpio_name_to_num(FAN1_BIC_CPLD_EN_R) \
55 gpio_name_to_num(FAN2_BIC_CPLD_EN_R) \
56 gpio_name_to_num(FAN3_BIC_CPLD_EN_R) \
57 gpio_name_to_num(BB_BUTTON_BMC_BIC_N_R) \
58 gpio_name_to_num(USB_CPLD_BIC_EN_R)
59
60#define name_gpioD \
61 gpio_name_to_num(P5V_USB_PG_BIC) \
62 gpio_name_to_num(OCP_DEBUG_BIC_PRSNT_N_R) \
63 gpio_name_to_num(FM_HSC_BIC_FAULT_N_R) \
64 gpio_name_to_num(BIC_READY_R) \
65 gpio_name_to_num(BOARD_ID0) \
66 gpio_name_to_num(BOARD_ID1) \
67 gpio_name_to_num(BOARD_ID2) \
68 gpio_name_to_num(BOARD_ID3)
69
70#define name_gpioE \
71 gpio_name_to_num(SLOT1_ID1_DETECT_BIC_N) \
72 gpio_name_to_num(SLOT1_ID0_DETECT_BIC_N) \
73 gpio_name_to_num(SLOT2_ID1_DETECT_BIC_N) \
74 gpio_name_to_num(SLOT2_ID0_DETECT_BIC_N) \
75 gpio_name_to_num(SLOT3_ID1_DETECT_BIC_N) \
76 gpio_name_to_num(SLOT3_ID0_DETECT_BIC_N) \
77 gpio_name_to_num(SLOT4_ID1_DETECT_BIC_N) \
78 gpio_name_to_num(SLOT4_ID0_DETECT_BIC_N)
79
80#define name_gpioF \
81 gpio_name_to_num(Reserve_GPIOF0) \
82 gpio_name_to_num(Reserve_GPIOF1) \
83 gpio_name_to_num(Reserve_GPIOF2) \
84 gpio_name_to_num(Reserve_GPIOF3) \
85 gpio_name_to_num(Reserve_GPIOF4) \
86 gpio_name_to_num(Reserve_GPIOF5) \
87 gpio_name_to_num(Reserve_GPIOF6) \
88 gpio_name_to_num(Reserve_GPIOF7)
89
90#define name_gpioG \
91 gpio_name_to_num(Reserve_GPIOG0) \
92 gpio_name_to_num(Reserve_GPIOG1) \
93 gpio_name_to_num(Reserve_GPIOG2) \
94 gpio_name_to_num(Reserve_GPIOG3) \
95 gpio_name_to_num(Reserve_GPIOG4) \
96 gpio_name_to_num(Reserve_GPIOG5) \
97 gpio_name_to_num(Reserve_GPIOG6) \
98 gpio_name_to_num(Reserve_GPIOG7)
99
100#define name_gpioH \
101 gpio_name_to_num(Reserve_GPIOH0) \
102 gpio_name_to_num(Reserve_GPIOH1) \
103 gpio_name_to_num(Reserve_GPIOH2) \
104 gpio_name_to_num(Reserve_GPIOH3) \
105 gpio_name_to_num(Reserve_GPIOH4) \
106 gpio_name_to_num(Reserve_GPIOH5) \
107 gpio_name_to_num(Reserve_GPIOH6) \
108 gpio_name_to_num(Reserve_GPIOH7)
109
110#define name_gpioI \
111 gpio_name_to_num(Reserve_GPIOI0) \
112 gpio_name_to_num(Reserve_GPIOI1) \
113 gpio_name_to_num(Reserve_GPIOI2) \
114 gpio_name_to_num(Reserve_GPIOI3) \
115 gpio_name_to_num(Reserve_GPIOI4) \
116 gpio_name_to_num(Reserve_GPIOI5) \
117 gpio_name_to_num(Reserve_GPIOI6) \
118 gpio_name_to_num(Reserve_GPIOI7)
119
120#define name_gpioJ \
121 gpio_name_to_num(Reserve_GPIOJ0) \
122 gpio_name_to_num(Reserve_GPIOJ1) \
123 gpio_name_to_num(Reserve_GPIOJ2) \
124 gpio_name_to_num(Reserve_GPIOJ3) \
125 gpio_name_to_num(Reserve_GPIOJ4) \
126 gpio_name_to_num(Reserve_GPIOJ5) \
127 gpio_name_to_num(Reserve_GPIOJ6) \
128 gpio_name_to_num(Reserve_GPIOJ7)
129
130#define name_gpioK \
131 gpio_name_to_num(Reserve_GPIOK0) \
132 gpio_name_to_num(Reserve_GPIOK1) \
133 gpio_name_to_num(Reserve_GPIOK2) \
134 gpio_name_to_num(Reserve_GPIOK3) \
135 gpio_name_to_num(Reserve_GPIOK4) \
136 gpio_name_to_num(Reserve_GPIOK5) \
137 gpio_name_to_num(Reserve_GPIOK6) \
138 gpio_name_to_num(Reserve_GPIOK7)
139
140#define name_gpioL \
141 gpio_name_to_num(Reserve_GPIOL0) \
142 gpio_name_to_num(TP_SLOT1_BIC_RSVD2) \
143 gpio_name_to_num(TP_SLOT1_BIC_RSVD3) \
144 gpio_name_to_num(TP_SLOT1_BIC_RSVD4) \
145 gpio_name_to_num(TP_SLOT1_BIC_RSVD5) \
146 gpio_name_to_num(TP_SLOT1_BIC_RSVD6) \
147 gpio_name_to_num(TP_SLOT1_BIC_RSVD7) \
148 gpio_name_to_num(TP_SLOT1_BIC_RSVD0)
149
150#define name_gpioM \
151 gpio_name_to_num(BIC_STRAP_TXD6) \
152 gpio_name_to_num(TP_SLOT3_BIC_RSVD2) \
153 gpio_name_to_num(BIC_STRAP_TXD7) \
154 gpio_name_to_num(TP_SLOT3_BIC_RSVD4) \
155 gpio_name_to_num(USB_SW_EN_BIC_N_R) \
156 gpio_name_to_num(USB_SW_BIC_CB_R) \
157 gpio_name_to_num(Reserve_GPIOM6) \
158 gpio_name_to_num(Reserve_GPIOM7)
159
160#define name_gpioN \
161 gpio_name_to_num(BIC_SGPMCK) \
162 gpio_name_to_num(Reserve_GPION1) \
163 gpio_name_to_num(BIC_SGPMO) \
164 gpio_name_to_num(Reserve_GPION3) \
165 gpio_name_to_num(Reserve_GPION4) \
166 gpio_name_to_num(Reserve_GPION5) \
167 gpio_name_to_num(Reserve_GPION6) \
168 gpio_name_to_num(Reserve_GPION7)
169
170#define name_gpioO \
171 gpio_name_to_num(Reserve_GPIOO0) \
172 gpio_name_to_num(Reserve_GPIOO1) \
173 gpio_name_to_num(Reserve_GPIOO2) \
174 gpio_name_to_num(Reserve_GPIOO3) \
175 gpio_name_to_num(Reserve_GPIOO4) \
176 gpio_name_to_num(Reserve_GPIOO5) \
177 gpio_name_to_num(Reserve_GPIOO6) \
178 gpio_name_to_num(Reserve_GPIOO7)
179
180#define name_gpioP \
181 gpio_name_to_num(Reserve_GPIOP0) \
182 gpio_name_to_num(Reserve_GPIOP1) \
183 gpio_name_to_num(Reserve_GPIOP2) \
184 gpio_name_to_num(Reserve_GPIOP3) \
185 gpio_name_to_num(Reserve_GPIOP4) \
186 gpio_name_to_num(Reserve_GPIOP5) \
187 gpio_name_to_num(Reserve_GPIOP6) \
188 gpio_name_to_num(Reserve_GPIOP7)
189
190#define name_gpioQ \
191 gpio_name_to_num(Reserve_GPIOQ0) \
192 gpio_name_to_num(Reserve_GPIOQ1) \
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#define name_gpioS \
210 gpio_name_to_num(Reserve_GPIOS0) \
211 gpio_name_to_num(Reserve_GPIOS1) \
212 gpio_name_to_num(Reserve_GPIOS2) \
213 gpio_name_to_num(Reserve_GPIOS3) \
214 gpio_name_to_num(Reserve_GPIOS4) \
215 gpio_name_to_num(Reserve_GPIOS5) \
216 gpio_name_to_num(Reserve_GPIOS6) \
217 gpio_name_to_num(Reserve_GPIOS7)
218
219#define name_gpioT \
220 gpio_name_to_num(Reserve_GPIOT0) \
221 gpio_name_to_num(Reserve_GPIOT1) \
222 gpio_name_to_num(Reserve_GPIOT2) \
223 gpio_name_to_num(Reserve_GPIOT3) \
224 gpio_name_to_num(Reserve_GPIOT4) \
225 gpio_name_to_num(Reserve_GPIOT5) \
226 gpio_name_to_num(Reserve_GPIOT6) \
227 gpio_name_to_num(Reserve_GPIOT7)
228
229#define name_gpioU \
230 gpio_name_to_num(Reserve_GPIOU0) \
231 gpio_name_to_num(Reserve_GPIOU1) \
232 gpio_name_to_num(Reserve_GPIOU2) \
233 gpio_name_to_num(Reserve_GPIOU3) \
234 gpio_name_to_num(Reserve_GPIOU4) \
235 gpio_name_to_num(Reserve_GPIOU5) \
236 gpio_name_to_num(Reserve_GPIOU6) \
237 gpio_name_to_num(Reserve_GPIOU7)
238
239// clang-format on
240
241#define gpio_name_to_num(x) x,
247
248extern enum _GPIO_NUMS_ GPIO_NUMS;
249#undef gpio_name_to_num
250
251extern char *gpio_name[];
252
253#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:170
#define name_gpioK
Definition: plat_gpio.h:130
#define name_gpioH
Definition: plat_gpio.h:100
#define name_gpioF
Definition: plat_gpio.h:80
#define name_gpioQ
Definition: plat_gpio.h:190
#define name_gpioR
Definition: plat_gpio.h:199
#define name_gpioP
Definition: plat_gpio.h:180
#define name_gpioE
Definition: plat_gpio.h:70
#define name_gpioL
Definition: plat_gpio.h:140
#define name_gpioC
Definition: plat_gpio.h:50
#define name_gpioD
Definition: plat_gpio.h:60
#define name_gpioT
Definition: plat_gpio.h:219
#define name_gpioN
Definition: plat_gpio.h:160
#define name_gpioM
Definition: plat_gpio.h:150
#define name_gpioI
Definition: plat_gpio.h:110
#define name_gpioB
Definition: plat_gpio.h:40
#define name_gpioJ
Definition: plat_gpio.h:120
#define name_gpioA
Definition: plat_gpio.h:30
#define name_gpioG
Definition: plat_gpio.h:90
#define name_gpioS
Definition: plat_gpio.h:209
#define name_gpioU
Definition: plat_gpio.h:229