xref: /openbmc/linux/include/pcmcia/device_id.h (revision b830f94f)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * device_id.h -- PCMCIA driver matching helpers
4  *
5  * (C) 2003 - 2004	David Woodhouse
6  * (C) 2003 - 2004	Dominik Brodowski
7  */
8 
9 #ifndef _LINUX_PCMCIA_DEVICE_ID_H
10 #define _LINUX_PCMCIA_DEVICE_ID_H
11 
12 #ifdef __KERNEL__
13 
14 #define PCMCIA_DEVICE_MANF_CARD(manf, card) { \
15 	.match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
16 			PCMCIA_DEV_ID_MATCH_CARD_ID, \
17 	.manf_id = (manf), \
18 	.card_id = (card), }
19 
20 #define PCMCIA_DEVICE_FUNC_ID(func) { \
21 	.match_flags = PCMCIA_DEV_ID_MATCH_FUNC_ID, \
22 	.func_id = (func), }
23 
24 #define PCMCIA_DEVICE_PROD_ID1(v1, vh1) { \
25 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1, \
26 	.prod_id = { (v1), NULL, NULL, NULL }, \
27 	.prod_id_hash = { (vh1), 0, 0, 0 }, }
28 
29 #define PCMCIA_DEVICE_PROD_ID2(v2, vh2) { \
30 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID2, \
31 	.prod_id = { NULL, (v2), NULL, NULL },  \
32 	.prod_id_hash = { 0, (vh2), 0, 0 }, }
33 
34 #define PCMCIA_DEVICE_PROD_ID3(v3, vh3) { \
35 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID3, \
36 	.prod_id = { NULL, NULL, (v3), NULL },  \
37 	.prod_id_hash = { 0, 0, (vh3), 0 }, }
38 
39 #define PCMCIA_DEVICE_PROD_ID12(v1, v2, vh1, vh2) { \
40 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
41 			PCMCIA_DEV_ID_MATCH_PROD_ID2, \
42 	.prod_id = { (v1), (v2), NULL, NULL }, \
43 	.prod_id_hash = { (vh1), (vh2), 0, 0 }, }
44 
45 #define PCMCIA_DEVICE_PROD_ID13(v1, v3, vh1, vh3) { \
46 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
47 			PCMCIA_DEV_ID_MATCH_PROD_ID3, \
48 	.prod_id = { (v1), NULL, (v3), NULL }, \
49 	.prod_id_hash = { (vh1), 0, (vh3), 0 }, }
50 
51 #define PCMCIA_DEVICE_PROD_ID14(v1, v4, vh1, vh4) { \
52 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
53 			PCMCIA_DEV_ID_MATCH_PROD_ID4, \
54 	.prod_id = { (v1), NULL, NULL, (v4) }, \
55 	.prod_id_hash = { (vh1), 0, 0, (vh4) }, }
56 
57 #define PCMCIA_DEVICE_PROD_ID123(v1, v2, v3, vh1, vh2, vh3) { \
58 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
59 			PCMCIA_DEV_ID_MATCH_PROD_ID2| \
60 			PCMCIA_DEV_ID_MATCH_PROD_ID3, \
61 	.prod_id = { (v1), (v2), (v3), NULL },\
62 	.prod_id_hash = { (vh1), (vh2), (vh3), 0 }, }
63 
64 #define PCMCIA_DEVICE_PROD_ID124(v1, v2, v4, vh1, vh2, vh4) { \
65 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
66 			PCMCIA_DEV_ID_MATCH_PROD_ID2| \
67 			PCMCIA_DEV_ID_MATCH_PROD_ID4, \
68 	.prod_id = { (v1), (v2), NULL, (v4) }, \
69 	.prod_id_hash = { (vh1), (vh2), 0, (vh4) }, }
70 
71 #define PCMCIA_DEVICE_PROD_ID134(v1, v3, v4, vh1, vh3, vh4) { \
72 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
73 			PCMCIA_DEV_ID_MATCH_PROD_ID3| \
74 			PCMCIA_DEV_ID_MATCH_PROD_ID4, \
75 	.prod_id = { (v1), NULL, (v3), (v4) }, \
76 	.prod_id_hash = { (vh1), 0, (vh3), (vh4) }, }
77 
78 #define PCMCIA_DEVICE_PROD_ID1234(v1, v2, v3, v4, vh1, vh2, vh3, vh4) { \
79 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
80 			PCMCIA_DEV_ID_MATCH_PROD_ID2| \
81 			PCMCIA_DEV_ID_MATCH_PROD_ID3| \
82 			PCMCIA_DEV_ID_MATCH_PROD_ID4, \
83 	.prod_id = { (v1), (v2), (v3), (v4) }, \
84 	.prod_id_hash = { (vh1), (vh2), (vh3), (vh4) }, }
85 
86 #define PCMCIA_DEVICE_MANF_CARD_PROD_ID1(manf, card, v1, vh1) { \
87 	.match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
88 			PCMCIA_DEV_ID_MATCH_CARD_ID| \
89 			PCMCIA_DEV_ID_MATCH_PROD_ID1, \
90 	.manf_id = (manf), \
91 	.card_id = (card), \
92 	.prod_id = { (v1), NULL, NULL, NULL }, \
93 	.prod_id_hash = { (vh1), 0, 0, 0 }, }
94 
95 #define PCMCIA_DEVICE_MANF_CARD_PROD_ID3(manf, card, v3, vh3) { \
96 	.match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
97 			PCMCIA_DEV_ID_MATCH_CARD_ID| \
98 			PCMCIA_DEV_ID_MATCH_PROD_ID3, \
99 	.manf_id = (manf), \
100 	.card_id = (card), \
101 	.prod_id = { NULL, NULL, (v3), NULL }, \
102 	.prod_id_hash = { 0, 0, (vh3), 0 }, }
103 
104 
105 /* multi-function devices */
106 
107 #define PCMCIA_MFC_DEVICE_MANF_CARD(mfc, manf, card) { \
108 	.match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
109 			PCMCIA_DEV_ID_MATCH_CARD_ID| \
110 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
111 	.manf_id = (manf), \
112 	.card_id = (card), \
113 	.function = (mfc), }
114 
115 #define PCMCIA_MFC_DEVICE_PROD_ID1(mfc, v1, vh1) { \
116 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
117 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
118 	.prod_id = { (v1), NULL, NULL, NULL }, \
119 	.prod_id_hash = { (vh1), 0, 0, 0 }, \
120 	.function = (mfc), }
121 
122 #define PCMCIA_MFC_DEVICE_PROD_ID2(mfc, v2, vh2) { \
123 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID2| \
124 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
125 	.prod_id = { NULL, (v2), NULL, NULL },  \
126 	.prod_id_hash = { 0, (vh2), 0, 0 }, \
127 	.function = (mfc), }
128 
129 #define PCMCIA_MFC_DEVICE_PROD_ID12(mfc, v1, v2, vh1, vh2) { \
130 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
131 			PCMCIA_DEV_ID_MATCH_PROD_ID2| \
132 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
133 	.prod_id = { (v1), (v2), NULL, NULL }, \
134 	.prod_id_hash = { (vh1), (vh2), 0, 0 }, \
135 	.function = (mfc), }
136 
137 #define PCMCIA_MFC_DEVICE_PROD_ID13(mfc, v1, v3, vh1, vh3) { \
138 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
139 			PCMCIA_DEV_ID_MATCH_PROD_ID3| \
140 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
141 	.prod_id = { (v1), NULL, (v3), NULL }, \
142 	.prod_id_hash = { (vh1), 0, (vh3), 0 }, \
143 	.function = (mfc), }
144 
145 #define PCMCIA_MFC_DEVICE_PROD_ID123(mfc, v1, v2, v3, vh1, vh2, vh3) { \
146 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
147 			PCMCIA_DEV_ID_MATCH_PROD_ID2| \
148 			PCMCIA_DEV_ID_MATCH_PROD_ID3| \
149 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
150 	.prod_id = { (v1), (v2), (v3), NULL },\
151 	.prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \
152 	.function = (mfc), }
153 
154 /* pseudo multi-function devices */
155 
156 #define PCMCIA_PFC_DEVICE_MANF_CARD(mfc, manf, card) { \
157 	.match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
158 			PCMCIA_DEV_ID_MATCH_CARD_ID| \
159 			PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
160 	.manf_id = (manf), \
161 	.card_id = (card), \
162 	.device_no = (mfc), }
163 
164 #define PCMCIA_PFC_DEVICE_PROD_ID1(mfc, v1, vh1) { \
165 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
166 			PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
167 	.prod_id = { (v1), NULL, NULL, NULL }, \
168 	.prod_id_hash = { (vh1), 0, 0, 0 }, \
169 	.device_no = (mfc), }
170 
171 #define PCMCIA_PFC_DEVICE_PROD_ID2(mfc, v2, vh2) { \
172 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID2| \
173 			PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
174 	.prod_id = { NULL, (v2), NULL, NULL },  \
175 	.prod_id_hash = { 0, (vh2), 0, 0 }, \
176 	.device_no = (mfc), }
177 
178 #define PCMCIA_PFC_DEVICE_PROD_ID12(mfc, v1, v2, vh1, vh2) { \
179 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
180 			PCMCIA_DEV_ID_MATCH_PROD_ID2| \
181 			PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
182 	.prod_id = { (v1), (v2), NULL, NULL }, \
183 	.prod_id_hash = { (vh1), (vh2), 0, 0 }, \
184 	.device_no = (mfc), }
185 
186 #define PCMCIA_PFC_DEVICE_PROD_ID13(mfc, v1, v3, vh1, vh3) { \
187 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
188 			PCMCIA_DEV_ID_MATCH_PROD_ID3| \
189 			PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
190 	.prod_id = { (v1), NULL, (v3), NULL }, \
191 	.prod_id_hash = { (vh1), 0, (vh3), 0 }, \
192 	.device_no = (mfc), }
193 
194 #define PCMCIA_PFC_DEVICE_PROD_ID123(mfc, v1, v2, v3, vh1, vh2, vh3) { \
195 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
196 			PCMCIA_DEV_ID_MATCH_PROD_ID2| \
197 			PCMCIA_DEV_ID_MATCH_PROD_ID3| \
198 			PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
199 	.prod_id = { (v1), (v2), (v3), NULL },\
200 	.prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \
201 	.device_no = (mfc), }
202 
203 /* cards needing a CIS override */
204 
205 #define PCMCIA_DEVICE_CIS_MANF_CARD(manf, card, _cisfile) { \
206 	.match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
207 			PCMCIA_DEV_ID_MATCH_MANF_ID| \
208 			PCMCIA_DEV_ID_MATCH_CARD_ID, \
209 	.manf_id = (manf), \
210 	.card_id = (card), \
211 	.cisfile = (_cisfile)}
212 
213 #define PCMCIA_DEVICE_CIS_PROD_ID12(v1, v2, vh1, vh2, _cisfile) { \
214 	.match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
215 			PCMCIA_DEV_ID_MATCH_PROD_ID1| \
216 			PCMCIA_DEV_ID_MATCH_PROD_ID2, \
217 	.prod_id = { (v1), (v2), NULL, NULL }, \
218 	.prod_id_hash = { (vh1), (vh2), 0, 0 }, \
219 	.cisfile = (_cisfile)}
220 
221 #define PCMCIA_DEVICE_CIS_PROD_ID123(v1, v2, v3, vh1, vh2, vh3, _cisfile) { \
222 	.match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
223 			PCMCIA_DEV_ID_MATCH_PROD_ID1| \
224 			PCMCIA_DEV_ID_MATCH_PROD_ID2| \
225 			PCMCIA_DEV_ID_MATCH_PROD_ID3, \
226 	.prod_id = { (v1), (v2), (v3), NULL },\
227 	.prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \
228 	.cisfile = (_cisfile)}
229 
230 
231 #define PCMCIA_DEVICE_CIS_PROD_ID2(v2, vh2, _cisfile) { \
232 	.match_flags =  PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
233 			PCMCIA_DEV_ID_MATCH_PROD_ID2, \
234 	.prod_id = { NULL, (v2), NULL, NULL },  \
235 	.prod_id_hash = { 0, (vh2), 0, 0 }, \
236 	.cisfile = (_cisfile)}
237 
238 #define PCMCIA_PFC_DEVICE_CIS_PROD_ID12(mfc, v1, v2, vh1, vh2, _cisfile) { \
239 	.match_flags =  PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
240 			PCMCIA_DEV_ID_MATCH_PROD_ID1| \
241 			PCMCIA_DEV_ID_MATCH_PROD_ID2| \
242 			PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
243 	.prod_id = { (v1), (v2), NULL, NULL }, \
244 	.prod_id_hash = { (vh1), (vh2), 0, 0 },\
245 	.device_no = (mfc), \
246 	.cisfile = (_cisfile)}
247 
248 #define PCMCIA_MFC_DEVICE_CIS_MANF_CARD(mfc, manf, card, _cisfile) { \
249 	.match_flags =  PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
250 			PCMCIA_DEV_ID_MATCH_MANF_ID| \
251 			PCMCIA_DEV_ID_MATCH_CARD_ID| \
252 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
253 	.manf_id = (manf), \
254 	.card_id = (card), \
255 	.function = (mfc), \
256 	.cisfile = (_cisfile)}
257 
258 #define PCMCIA_MFC_DEVICE_CIS_PROD_ID12(mfc, v1, v2, vh1, vh2, _cisfile) { \
259 	.match_flags =  PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
260 			PCMCIA_DEV_ID_MATCH_PROD_ID1| \
261 			PCMCIA_DEV_ID_MATCH_PROD_ID2| \
262 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
263 	.prod_id = { (v1), (v2), NULL, NULL }, \
264 	.prod_id_hash = { (vh1), (vh2), 0, 0 }, \
265 	.function = (mfc), \
266 	.cisfile = (_cisfile)}
267 
268 #define PCMCIA_MFC_DEVICE_CIS_PROD_ID4(mfc, v4, vh4, _cisfile) { \
269 	.match_flags =  PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
270 			PCMCIA_DEV_ID_MATCH_PROD_ID4| \
271 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
272 	.prod_id = { NULL, NULL, NULL, (v4) }, \
273 	.prod_id_hash = { 0, 0, 0, (vh4) }, \
274 	.function = (mfc), \
275 	.cisfile = (_cisfile)}
276 
277 
278 #define PCMCIA_DEVICE_NULL { .match_flags = 0, }
279 
280 #endif /* __KERNEL__ */
281 #endif /* _LINUX_PCMCIA_DEVICE_ID_H */
282