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 
99 /* multi-function devices */
100 
101 #define PCMCIA_MFC_DEVICE_MANF_CARD(mfc, manf, card) { \
102 	.match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
103 			PCMCIA_DEV_ID_MATCH_CARD_ID| \
104 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
105 	.manf_id = (manf), \
106 	.card_id = (card), \
107 	.function = (mfc), }
108 
109 #define PCMCIA_MFC_DEVICE_PROD_ID1(mfc, v1, vh1) { \
110 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
111 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
112 	.prod_id = { (v1), NULL, NULL, NULL }, \
113 	.prod_id_hash = { (vh1), 0, 0, 0 }, \
114 	.function = (mfc), }
115 
116 #define PCMCIA_MFC_DEVICE_PROD_ID2(mfc, v2, vh2) { \
117 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID2| \
118 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
119 	.prod_id = { NULL, (v2), NULL, NULL },  \
120 	.prod_id_hash = { 0, (vh2), 0, 0 }, \
121 	.function = (mfc), }
122 
123 #define PCMCIA_MFC_DEVICE_PROD_ID12(mfc, v1, v2, vh1, vh2) { \
124 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
125 			PCMCIA_DEV_ID_MATCH_PROD_ID2| \
126 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
127 	.prod_id = { (v1), (v2), NULL, NULL }, \
128 	.prod_id_hash = { (vh1), (vh2), 0, 0 }, \
129 	.function = (mfc), }
130 
131 #define PCMCIA_MFC_DEVICE_PROD_ID13(mfc, v1, v3, vh1, vh3) { \
132 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
133 			PCMCIA_DEV_ID_MATCH_PROD_ID3| \
134 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
135 	.prod_id = { (v1), NULL, (v3), NULL }, \
136 	.prod_id_hash = { (vh1), 0, (vh3), 0 }, \
137 	.function = (mfc), }
138 
139 #define PCMCIA_MFC_DEVICE_PROD_ID123(mfc, v1, v2, v3, vh1, vh2, vh3) { \
140 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
141 			PCMCIA_DEV_ID_MATCH_PROD_ID2| \
142 			PCMCIA_DEV_ID_MATCH_PROD_ID3| \
143 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
144 	.prod_id = { (v1), (v2), (v3), NULL },\
145 	.prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \
146 	.function = (mfc), }
147 
148 /* pseudo multi-function devices */
149 
150 #define PCMCIA_PFC_DEVICE_MANF_CARD(mfc, manf, card) { \
151 	.match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
152 			PCMCIA_DEV_ID_MATCH_CARD_ID| \
153 			PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
154 	.manf_id = (manf), \
155 	.card_id = (card), \
156 	.device_no = (mfc), }
157 
158 #define PCMCIA_PFC_DEVICE_PROD_ID1(mfc, v1, vh1) { \
159 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
160 			PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
161 	.prod_id = { (v1), NULL, NULL, NULL }, \
162 	.prod_id_hash = { (vh1), 0, 0, 0 }, \
163 	.device_no = (mfc), }
164 
165 #define PCMCIA_PFC_DEVICE_PROD_ID2(mfc, v2, vh2) { \
166 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID2| \
167 			PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
168 	.prod_id = { NULL, (v2), NULL, NULL },  \
169 	.prod_id_hash = { 0, (vh2), 0, 0 }, \
170 	.device_no = (mfc), }
171 
172 #define PCMCIA_PFC_DEVICE_PROD_ID12(mfc, v1, v2, vh1, vh2) { \
173 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
174 			PCMCIA_DEV_ID_MATCH_PROD_ID2| \
175 			PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
176 	.prod_id = { (v1), (v2), NULL, NULL }, \
177 	.prod_id_hash = { (vh1), (vh2), 0, 0 }, \
178 	.device_no = (mfc), }
179 
180 #define PCMCIA_PFC_DEVICE_PROD_ID13(mfc, v1, v3, vh1, vh3) { \
181 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
182 			PCMCIA_DEV_ID_MATCH_PROD_ID3| \
183 			PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
184 	.prod_id = { (v1), NULL, (v3), NULL }, \
185 	.prod_id_hash = { (vh1), 0, (vh3), 0 }, \
186 	.device_no = (mfc), }
187 
188 #define PCMCIA_PFC_DEVICE_PROD_ID123(mfc, v1, v2, v3, vh1, vh2, vh3) { \
189 	.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
190 			PCMCIA_DEV_ID_MATCH_PROD_ID2| \
191 			PCMCIA_DEV_ID_MATCH_PROD_ID3| \
192 			PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
193 	.prod_id = { (v1), (v2), (v3), NULL },\
194 	.prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \
195 	.device_no = (mfc), }
196 
197 /* cards needing a CIS override */
198 
199 #define PCMCIA_DEVICE_CIS_MANF_CARD(manf, card, _cisfile) { \
200 	.match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
201 			PCMCIA_DEV_ID_MATCH_MANF_ID| \
202 			PCMCIA_DEV_ID_MATCH_CARD_ID, \
203 	.manf_id = (manf), \
204 	.card_id = (card), \
205 	.cisfile = (_cisfile)}
206 
207 #define PCMCIA_DEVICE_CIS_PROD_ID12(v1, v2, vh1, vh2, _cisfile) { \
208 	.match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
209 			PCMCIA_DEV_ID_MATCH_PROD_ID1| \
210 			PCMCIA_DEV_ID_MATCH_PROD_ID2, \
211 	.prod_id = { (v1), (v2), NULL, NULL }, \
212 	.prod_id_hash = { (vh1), (vh2), 0, 0 }, \
213 	.cisfile = (_cisfile)}
214 
215 #define PCMCIA_DEVICE_CIS_PROD_ID123(v1, v2, v3, vh1, vh2, vh3, _cisfile) { \
216 	.match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
217 			PCMCIA_DEV_ID_MATCH_PROD_ID1| \
218 			PCMCIA_DEV_ID_MATCH_PROD_ID2| \
219 			PCMCIA_DEV_ID_MATCH_PROD_ID3, \
220 	.prod_id = { (v1), (v2), (v3), NULL },\
221 	.prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \
222 	.cisfile = (_cisfile)}
223 
224 
225 #define PCMCIA_DEVICE_CIS_PROD_ID2(v2, vh2, _cisfile) { \
226 	.match_flags =  PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
227 			PCMCIA_DEV_ID_MATCH_PROD_ID2, \
228 	.prod_id = { NULL, (v2), NULL, NULL },  \
229 	.prod_id_hash = { 0, (vh2), 0, 0 }, \
230 	.cisfile = (_cisfile)}
231 
232 #define PCMCIA_PFC_DEVICE_CIS_PROD_ID12(mfc, v1, v2, vh1, vh2, _cisfile) { \
233 	.match_flags =  PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
234 			PCMCIA_DEV_ID_MATCH_PROD_ID1| \
235 			PCMCIA_DEV_ID_MATCH_PROD_ID2| \
236 			PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
237 	.prod_id = { (v1), (v2), NULL, NULL }, \
238 	.prod_id_hash = { (vh1), (vh2), 0, 0 },\
239 	.device_no = (mfc), \
240 	.cisfile = (_cisfile)}
241 
242 #define PCMCIA_MFC_DEVICE_CIS_MANF_CARD(mfc, manf, card, _cisfile) { \
243 	.match_flags =  PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
244 			PCMCIA_DEV_ID_MATCH_MANF_ID| \
245 			PCMCIA_DEV_ID_MATCH_CARD_ID| \
246 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
247 	.manf_id = (manf), \
248 	.card_id = (card), \
249 	.function = (mfc), \
250 	.cisfile = (_cisfile)}
251 
252 #define PCMCIA_MFC_DEVICE_CIS_PROD_ID12(mfc, v1, v2, vh1, vh2, _cisfile) { \
253 	.match_flags =  PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
254 			PCMCIA_DEV_ID_MATCH_PROD_ID1| \
255 			PCMCIA_DEV_ID_MATCH_PROD_ID2| \
256 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
257 	.prod_id = { (v1), (v2), NULL, NULL }, \
258 	.prod_id_hash = { (vh1), (vh2), 0, 0 }, \
259 	.function = (mfc), \
260 	.cisfile = (_cisfile)}
261 
262 #define PCMCIA_MFC_DEVICE_CIS_PROD_ID4(mfc, v4, vh4, _cisfile) { \
263 	.match_flags =  PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
264 			PCMCIA_DEV_ID_MATCH_PROD_ID4| \
265 			PCMCIA_DEV_ID_MATCH_FUNCTION, \
266 	.prod_id = { NULL, NULL, NULL, (v4) }, \
267 	.prod_id_hash = { 0, 0, 0, (vh4) }, \
268 	.function = (mfc), \
269 	.cisfile = (_cisfile)}
270 
271 
272 #define PCMCIA_DEVICE_NULL { .match_flags = 0, }
273 
274 #endif /* __KERNEL__ */
275 #endif /* _LINUX_PCMCIA_DEVICE_ID_H */
276