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