diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2005-06-27 19:28:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-27 21:03:06 -0400 |
commit | 1ad275e3e7d253d44f03868e85977c908e334fed (patch) | |
tree | 82f0a1fc070f32c015be14596c50c681d90d4c1a /include/pcmcia | |
parent | 3ee13937525f6044d769b1a84d5db5669ac1959e (diff) |
[PATCH] pcmcia: device and driver matching
The actual matching of pcmcia drivers and pcmcia devices. The original
version of this was written by David Woodhouse.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/pcmcia')
-rw-r--r-- | include/pcmcia/device_id.h | 175 | ||||
-rw-r--r-- | include/pcmcia/ds.h | 7 |
2 files changed, 181 insertions, 1 deletions
diff --git a/include/pcmcia/device_id.h b/include/pcmcia/device_id.h new file mode 100644 index 000000000000..acf68656de3c --- /dev/null +++ b/include/pcmcia/device_id.h | |||
@@ -0,0 +1,175 @@ | |||
1 | /* | ||
2 | * Copyright (2003-2004) Dominik Brodowski <linux@brodo.de> | ||
3 | * David Woodhouse | ||
4 | * | ||
5 | * License: GPL v2 | ||
6 | */ | ||
7 | |||
8 | #define PCMCIA_DEVICE_MANF_CARD(manf, card) { \ | ||
9 | .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \ | ||
10 | PCMCIA_DEV_ID_MATCH_CARD_ID, \ | ||
11 | .manf_id = (manf), \ | ||
12 | .card_id = (card), } | ||
13 | |||
14 | #define PCMCIA_DEVICE_FUNC_ID(func) { \ | ||
15 | .match_flags = PCMCIA_DEV_ID_MATCH_FUNC_ID, \ | ||
16 | .func_id = (func), } | ||
17 | |||
18 | #define PCMCIA_DEVICE_PROD_ID1(v1, vh1) { \ | ||
19 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1, \ | ||
20 | .prod_id = { (v1), NULL, NULL, NULL }, \ | ||
21 | .prod_id_hash = { (vh1), 0, 0, 0 }, } | ||
22 | |||
23 | #define PCMCIA_DEVICE_PROD_ID2(v2, vh2) { \ | ||
24 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID2, \ | ||
25 | .prod_id = { NULL, (v2), NULL, NULL }, \ | ||
26 | .prod_id_hash = { 0, (vh2), 0, 0 }, } | ||
27 | |||
28 | #define PCMCIA_DEVICE_PROD_ID12(v1, v2, vh1, vh2) { \ | ||
29 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
30 | PCMCIA_DEV_ID_MATCH_PROD_ID2, \ | ||
31 | .prod_id = { (v1), (v2), NULL, NULL }, \ | ||
32 | .prod_id_hash = { (vh1), (vh2), 0, 0 }, } | ||
33 | |||
34 | #define PCMCIA_DEVICE_PROD_ID13(v1, v3, vh1, vh3) { \ | ||
35 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
36 | PCMCIA_DEV_ID_MATCH_PROD_ID3, \ | ||
37 | .prod_id = { (v1), NULL, (v3), NULL }, \ | ||
38 | .prod_id_hash = { (vh1), 0, (vh3), 0 }, } | ||
39 | |||
40 | #define PCMCIA_DEVICE_PROD_ID14(v1, v4, vh1, vh4) { \ | ||
41 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
42 | PCMCIA_DEV_ID_MATCH_PROD_ID4, \ | ||
43 | .prod_id = { (v1), NULL, NULL, (v4) }, \ | ||
44 | .prod_id_hash = { (vh1), 0, 0, (vh4) }, } | ||
45 | |||
46 | #define PCMCIA_DEVICE_PROD_ID123(v1, v2, v3, vh1, vh2, vh3) { \ | ||
47 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
48 | PCMCIA_DEV_ID_MATCH_PROD_ID2| \ | ||
49 | PCMCIA_DEV_ID_MATCH_PROD_ID3, \ | ||
50 | .prod_id = { (v1), (v2), (v3), NULL },\ | ||
51 | .prod_id_hash = { (vh1), (vh2), (vh3), 0 }, } | ||
52 | |||
53 | #define PCMCIA_DEVICE_PROD_ID124(v1, v2, v4, vh1, vh2, vh4) { \ | ||
54 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
55 | PCMCIA_DEV_ID_MATCH_PROD_ID2| \ | ||
56 | PCMCIA_DEV_ID_MATCH_PROD_ID4, \ | ||
57 | .prod_id = { (v1), (v2), NULL, (v4) }, \ | ||
58 | .prod_id_hash = { (vh1), (vh2), 0, (vh4) }, } | ||
59 | |||
60 | #define PCMCIA_DEVICE_PROD_ID134(v1, v3, v4, vh1, vh3, vh4) { \ | ||
61 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
62 | PCMCIA_DEV_ID_MATCH_PROD_ID3| \ | ||
63 | PCMCIA_DEV_ID_MATCH_PROD_ID4, \ | ||
64 | .prod_id = { (v1), NULL, (v3), (v4) }, \ | ||
65 | .prod_id_hash = { (vh1), 0, (vh3), (vh4) }, } | ||
66 | |||
67 | #define PCMCIA_DEVICE_PROD_ID1234(v1, v2, v3, v4, vh1, vh2, vh3, vh4) { \ | ||
68 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
69 | PCMCIA_DEV_ID_MATCH_PROD_ID2| \ | ||
70 | PCMCIA_DEV_ID_MATCH_PROD_ID3| \ | ||
71 | PCMCIA_DEV_ID_MATCH_PROD_ID4, \ | ||
72 | .prod_id = { (v1), (v2), (v3), (v4) }, \ | ||
73 | .prod_id_hash = { (vh1), (vh2), (vh3), (vh4) }, } | ||
74 | |||
75 | |||
76 | /* multi-function devices */ | ||
77 | |||
78 | #define PCMCIA_MFC_DEVICE_MANF_CARD(mfc, manf, card) { \ | ||
79 | .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \ | ||
80 | PCMCIA_DEV_ID_MATCH_CARD_ID| \ | ||
81 | PCMCIA_DEV_ID_MATCH_FUNCTION, \ | ||
82 | .manf_id = (manf), \ | ||
83 | .card_id = (card), \ | ||
84 | .function = (mfc), } | ||
85 | |||
86 | #define PCMCIA_MFC_DEVICE_PROD_ID1(mfc, v1, vh1) { \ | ||
87 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
88 | PCMCIA_DEV_ID_MATCH_FUNCTION, \ | ||
89 | .prod_id = { (v1), NULL, NULL, NULL }, \ | ||
90 | .prod_id_hash = { (vh1), 0, 0, 0 }, \ | ||
91 | .function = (mfc), } | ||
92 | |||
93 | #define PCMCIA_MFC_DEVICE_PROD_ID2(mfc, v2, vh2) { \ | ||
94 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID2| \ | ||
95 | PCMCIA_DEV_ID_MATCH_FUNCTION, \ | ||
96 | .prod_id = { NULL, (v2), NULL, NULL }, \ | ||
97 | .prod_id_hash = { 0, (vh2), 0, 0 }, \ | ||
98 | .function = (mfc), } | ||
99 | |||
100 | #define PCMCIA_MFC_DEVICE_PROD_ID12(mfc, v1, v2, vh1, vh2) { \ | ||
101 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
102 | PCMCIA_DEV_ID_MATCH_PROD_ID2| \ | ||
103 | PCMCIA_DEV_ID_MATCH_FUNCTION, \ | ||
104 | .prod_id = { (v1), (v2), NULL, NULL }, \ | ||
105 | .prod_id_hash = { (vh1), (vh2), 0, 0 }, \ | ||
106 | .function = (mfc), } | ||
107 | |||
108 | #define PCMCIA_MFC_DEVICE_PROD_ID13(mfc, v1, v3, vh1, vh3) { \ | ||
109 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
110 | PCMCIA_DEV_ID_MATCH_PROD_ID3| \ | ||
111 | PCMCIA_DEV_ID_MATCH_FUNCTION, \ | ||
112 | .prod_id = { (v1), NULL, (v3), NULL }, \ | ||
113 | .prod_id_hash = { (vh1), 0, (vh3), 0 }, \ | ||
114 | .function = (mfc), } | ||
115 | |||
116 | #define PCMCIA_MFC_DEVICE_PROD_ID123(mfc, v1, v2, v3, vh1, vh2, vh3) { \ | ||
117 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
118 | PCMCIA_DEV_ID_MATCH_PROD_ID2| \ | ||
119 | PCMCIA_DEV_ID_MATCH_PROD_ID3| \ | ||
120 | PCMCIA_DEV_ID_MATCH_FUNCTION, \ | ||
121 | .prod_id = { (v1), (v2), (v3), NULL },\ | ||
122 | .prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \ | ||
123 | .function = (mfc), } | ||
124 | |||
125 | /* pseudo multi-function devices */ | ||
126 | |||
127 | #define PCMCIA_PFC_DEVICE_MANF_CARD(mfc, manf, card) { \ | ||
128 | .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \ | ||
129 | PCMCIA_DEV_ID_MATCH_CARD_ID| \ | ||
130 | PCMCIA_DEV_ID_MATCH_DEVICE_NO, \ | ||
131 | .manf_id = (manf), \ | ||
132 | .card_id = (card), \ | ||
133 | .device_no = (mfc), } | ||
134 | |||
135 | #define PCMCIA_PFC_DEVICE_PROD_ID1(mfc, v1, vh1) { \ | ||
136 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
137 | PCMCIA_DEV_ID_MATCH_DEVICE_NO, \ | ||
138 | .prod_id = { (v1), NULL, NULL, NULL }, \ | ||
139 | .prod_id_hash = { (vh1), 0, 0, 0 }, \ | ||
140 | .device_no = (mfc), } | ||
141 | |||
142 | #define PCMCIA_PFC_DEVICE_PROD_ID2(mfc, v2, vh2) { \ | ||
143 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID2| \ | ||
144 | PCMCIA_DEV_ID_MATCH_DEVICE_NO, \ | ||
145 | .prod_id = { NULL, (v2), NULL, NULL }, \ | ||
146 | .prod_id_hash = { 0, (vh2), 0, 0 }, \ | ||
147 | .device_no = (mfc), } | ||
148 | |||
149 | #define PCMCIA_PFC_DEVICE_PROD_ID12(mfc, v1, v2, vh1, vh2) { \ | ||
150 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
151 | PCMCIA_DEV_ID_MATCH_PROD_ID2| \ | ||
152 | PCMCIA_DEV_ID_MATCH_DEVICE_NO, \ | ||
153 | .prod_id = { (v1), (v2), NULL, NULL }, \ | ||
154 | .prod_id_hash = { (vh1), (vh2), 0, 0 }, \ | ||
155 | .device_no = (mfc), } | ||
156 | |||
157 | #define PCMCIA_PFC_DEVICE_PROD_ID13(mfc, v1, v3, vh1, vh3) { \ | ||
158 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
159 | PCMCIA_DEV_ID_MATCH_PROD_ID3| \ | ||
160 | PCMCIA_DEV_ID_MATCH_DEVICE_NO, \ | ||
161 | .prod_id = { (v1), NULL, (v3), NULL }, \ | ||
162 | .prod_id_hash = { (vh1), 0, (vh3), 0 }, \ | ||
163 | .device_no = (mfc), } | ||
164 | |||
165 | #define PCMCIA_PFC_DEVICE_PROD_ID123(mfc, v1, v2, v3, vh1, vh2, vh3) { \ | ||
166 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
167 | PCMCIA_DEV_ID_MATCH_PROD_ID2| \ | ||
168 | PCMCIA_DEV_ID_MATCH_PROD_ID3| \ | ||
169 | PCMCIA_DEV_ID_MATCH_DEVICE_NO, \ | ||
170 | .prod_id = { (v1), (v2), (v3), NULL },\ | ||
171 | .prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \ | ||
172 | .device_no = (mfc), } | ||
173 | |||
174 | |||
175 | #define PCMCIA_DEVICE_NULL { .match_flags = 0, } | ||
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 312fd958c901..c267edde9d0c 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h | |||
@@ -18,6 +18,8 @@ | |||
18 | 18 | ||
19 | #include <pcmcia/bulkmem.h> | 19 | #include <pcmcia/bulkmem.h> |
20 | #include <pcmcia/cs_types.h> | 20 | #include <pcmcia/cs_types.h> |
21 | #include <pcmcia/device_id.h> | ||
22 | #include <linux/mod_devicetable.h> | ||
21 | 23 | ||
22 | typedef struct tuple_parse_t { | 24 | typedef struct tuple_parse_t { |
23 | tuple_t tuple; | 25 | tuple_t tuple; |
@@ -135,6 +137,7 @@ struct pcmcia_driver { | |||
135 | dev_link_t *(*attach)(void); | 137 | dev_link_t *(*attach)(void); |
136 | void (*detach)(dev_link_t *); | 138 | void (*detach)(dev_link_t *); |
137 | struct module *owner; | 139 | struct module *owner; |
140 | struct pcmcia_device_id *id_table; | ||
138 | struct device_driver drv; | 141 | struct device_driver drv; |
139 | }; | 142 | }; |
140 | 143 | ||
@@ -173,7 +176,9 @@ struct pcmcia_device { | |||
173 | u8 has_manf_id:1; | 176 | u8 has_manf_id:1; |
174 | u8 has_card_id:1; | 177 | u8 has_card_id:1; |
175 | u8 has_func_id:1; | 178 | u8 has_func_id:1; |
176 | u8 reserved:5; | 179 | |
180 | u8 allow_func_id_match:1; | ||
181 | u8 reserved:4; | ||
177 | 182 | ||
178 | u8 func_id; | 183 | u8 func_id; |
179 | u16 manf_id; | 184 | u16 manf_id; |