device_id.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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. #ifndef _LINUX_PCMCIA_DEVICE_ID_H
  12. #define _LINUX_PCMCIA_DEVICE_ID_H
  13. #ifdef __KERNEL__
  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. #define PCMCIA_DEVICE_FUNC_ID(func) { \
  20. .match_flags = PCMCIA_DEV_ID_MATCH_FUNC_ID, \
  21. .func_id = (func), }
  22. #define PCMCIA_DEVICE_PROD_ID1(v1, vh1) { \
  23. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1, \
  24. .prod_id = { (v1), NULL, NULL, NULL }, \
  25. .prod_id_hash = { (vh1), 0, 0, 0 }, }
  26. #define PCMCIA_DEVICE_PROD_ID2(v2, vh2) { \
  27. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID2, \
  28. .prod_id = { NULL, (v2), NULL, NULL }, \
  29. .prod_id_hash = { 0, (vh2), 0, 0 }, }
  30. #define PCMCIA_DEVICE_PROD_ID3(v3, vh3) { \
  31. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID3, \
  32. .prod_id = { NULL, NULL, (v3), NULL }, \
  33. .prod_id_hash = { 0, 0, (vh3), 0 }, }
  34. #define PCMCIA_DEVICE_PROD_ID12(v1, v2, vh1, vh2) { \
  35. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
  36. PCMCIA_DEV_ID_MATCH_PROD_ID2, \
  37. .prod_id = { (v1), (v2), NULL, NULL }, \
  38. .prod_id_hash = { (vh1), (vh2), 0, 0 }, }
  39. #define PCMCIA_DEVICE_PROD_ID13(v1, v3, vh1, vh3) { \
  40. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
  41. PCMCIA_DEV_ID_MATCH_PROD_ID3, \
  42. .prod_id = { (v1), NULL, (v3), NULL }, \
  43. .prod_id_hash = { (vh1), 0, (vh3), 0 }, }
  44. #define PCMCIA_DEVICE_PROD_ID14(v1, v4, vh1, vh4) { \
  45. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
  46. PCMCIA_DEV_ID_MATCH_PROD_ID4, \
  47. .prod_id = { (v1), NULL, NULL, (v4) }, \
  48. .prod_id_hash = { (vh1), 0, 0, (vh4) }, }
  49. #define PCMCIA_DEVICE_PROD_ID123(v1, v2, v3, vh1, vh2, vh3) { \
  50. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
  51. PCMCIA_DEV_ID_MATCH_PROD_ID2| \
  52. PCMCIA_DEV_ID_MATCH_PROD_ID3, \
  53. .prod_id = { (v1), (v2), (v3), NULL },\
  54. .prod_id_hash = { (vh1), (vh2), (vh3), 0 }, }
  55. #define PCMCIA_DEVICE_PROD_ID124(v1, v2, v4, vh1, vh2, vh4) { \
  56. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
  57. PCMCIA_DEV_ID_MATCH_PROD_ID2| \
  58. PCMCIA_DEV_ID_MATCH_PROD_ID4, \
  59. .prod_id = { (v1), (v2), NULL, (v4) }, \
  60. .prod_id_hash = { (vh1), (vh2), 0, (vh4) }, }
  61. #define PCMCIA_DEVICE_PROD_ID134(v1, v3, v4, vh1, vh3, vh4) { \
  62. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
  63. PCMCIA_DEV_ID_MATCH_PROD_ID3| \
  64. PCMCIA_DEV_ID_MATCH_PROD_ID4, \
  65. .prod_id = { (v1), NULL, (v3), (v4) }, \
  66. .prod_id_hash = { (vh1), 0, (vh3), (vh4) }, }
  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. #define PCMCIA_DEVICE_MANF_CARD_PROD_ID1(manf, card, v1, vh1) { \
  75. .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
  76. PCMCIA_DEV_ID_MATCH_CARD_ID| \
  77. PCMCIA_DEV_ID_MATCH_PROD_ID1, \
  78. .manf_id = (manf), \
  79. .card_id = (card), \
  80. .prod_id = { (v1), NULL, NULL, NULL }, \
  81. .prod_id_hash = { (vh1), 0, 0, 0 }, }
  82. /* multi-function devices */
  83. #define PCMCIA_MFC_DEVICE_MANF_CARD(mfc, manf, card) { \
  84. .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
  85. PCMCIA_DEV_ID_MATCH_CARD_ID| \
  86. PCMCIA_DEV_ID_MATCH_FUNCTION, \
  87. .manf_id = (manf), \
  88. .card_id = (card), \
  89. .function = (mfc), }
  90. #define PCMCIA_MFC_DEVICE_PROD_ID1(mfc, v1, vh1) { \
  91. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
  92. PCMCIA_DEV_ID_MATCH_FUNCTION, \
  93. .prod_id = { (v1), NULL, NULL, NULL }, \
  94. .prod_id_hash = { (vh1), 0, 0, 0 }, \
  95. .function = (mfc), }
  96. #define PCMCIA_MFC_DEVICE_PROD_ID2(mfc, v2, vh2) { \
  97. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID2| \
  98. PCMCIA_DEV_ID_MATCH_FUNCTION, \
  99. .prod_id = { NULL, (v2), NULL, NULL }, \
  100. .prod_id_hash = { 0, (vh2), 0, 0 }, \
  101. .function = (mfc), }
  102. #define PCMCIA_MFC_DEVICE_PROD_ID12(mfc, v1, v2, vh1, vh2) { \
  103. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
  104. PCMCIA_DEV_ID_MATCH_PROD_ID2| \
  105. PCMCIA_DEV_ID_MATCH_FUNCTION, \
  106. .prod_id = { (v1), (v2), NULL, NULL }, \
  107. .prod_id_hash = { (vh1), (vh2), 0, 0 }, \
  108. .function = (mfc), }
  109. #define PCMCIA_MFC_DEVICE_PROD_ID13(mfc, v1, v3, vh1, vh3) { \
  110. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
  111. PCMCIA_DEV_ID_MATCH_PROD_ID3| \
  112. PCMCIA_DEV_ID_MATCH_FUNCTION, \
  113. .prod_id = { (v1), NULL, (v3), NULL }, \
  114. .prod_id_hash = { (vh1), 0, (vh3), 0 }, \
  115. .function = (mfc), }
  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. /* pseudo multi-function devices */
  125. #define PCMCIA_PFC_DEVICE_MANF_CARD(mfc, manf, card) { \
  126. .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
  127. PCMCIA_DEV_ID_MATCH_CARD_ID| \
  128. PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
  129. .manf_id = (manf), \
  130. .card_id = (card), \
  131. .device_no = (mfc), }
  132. #define PCMCIA_PFC_DEVICE_PROD_ID1(mfc, v1, vh1) { \
  133. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
  134. PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
  135. .prod_id = { (v1), NULL, NULL, NULL }, \
  136. .prod_id_hash = { (vh1), 0, 0, 0 }, \
  137. .device_no = (mfc), }
  138. #define PCMCIA_PFC_DEVICE_PROD_ID2(mfc, v2, vh2) { \
  139. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID2| \
  140. PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
  141. .prod_id = { NULL, (v2), NULL, NULL }, \
  142. .prod_id_hash = { 0, (vh2), 0, 0 }, \
  143. .device_no = (mfc), }
  144. #define PCMCIA_PFC_DEVICE_PROD_ID12(mfc, v1, v2, vh1, vh2) { \
  145. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
  146. PCMCIA_DEV_ID_MATCH_PROD_ID2| \
  147. PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
  148. .prod_id = { (v1), (v2), NULL, NULL }, \
  149. .prod_id_hash = { (vh1), (vh2), 0, 0 }, \
  150. .device_no = (mfc), }
  151. #define PCMCIA_PFC_DEVICE_PROD_ID13(mfc, v1, v3, vh1, vh3) { \
  152. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
  153. PCMCIA_DEV_ID_MATCH_PROD_ID3| \
  154. PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
  155. .prod_id = { (v1), NULL, (v3), NULL }, \
  156. .prod_id_hash = { (vh1), 0, (vh3), 0 }, \
  157. .device_no = (mfc), }
  158. #define PCMCIA_PFC_DEVICE_PROD_ID123(mfc, v1, v2, v3, vh1, vh2, vh3) { \
  159. .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
  160. PCMCIA_DEV_ID_MATCH_PROD_ID2| \
  161. PCMCIA_DEV_ID_MATCH_PROD_ID3| \
  162. PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
  163. .prod_id = { (v1), (v2), (v3), NULL },\
  164. .prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \
  165. .device_no = (mfc), }
  166. /* cards needing a CIS override */
  167. #define PCMCIA_DEVICE_CIS_MANF_CARD(manf, card, _cisfile) { \
  168. .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
  169. PCMCIA_DEV_ID_MATCH_MANF_ID| \
  170. PCMCIA_DEV_ID_MATCH_CARD_ID, \
  171. .manf_id = (manf), \
  172. .card_id = (card), \
  173. .cisfile = (_cisfile)}
  174. #define PCMCIA_DEVICE_CIS_PROD_ID12(v1, v2, vh1, vh2, _cisfile) { \
  175. .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
  176. PCMCIA_DEV_ID_MATCH_PROD_ID1| \
  177. PCMCIA_DEV_ID_MATCH_PROD_ID2, \
  178. .prod_id = { (v1), (v2), NULL, NULL }, \
  179. .prod_id_hash = { (vh1), (vh2), 0, 0 }, \
  180. .cisfile = (_cisfile)}
  181. #define PCMCIA_DEVICE_CIS_PROD_ID123(v1, v2, v3, vh1, vh2, vh3, _cisfile) { \
  182. .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
  183. PCMCIA_DEV_ID_MATCH_PROD_ID1| \
  184. PCMCIA_DEV_ID_MATCH_PROD_ID2| \
  185. PCMCIA_DEV_ID_MATCH_PROD_ID3, \
  186. .prod_id = { (v1), (v2), (v3), NULL },\
  187. .prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \
  188. .cisfile = (_cisfile)}
  189. #define PCMCIA_DEVICE_CIS_PROD_ID2(v2, vh2, _cisfile) { \
  190. .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
  191. PCMCIA_DEV_ID_MATCH_PROD_ID2, \
  192. .prod_id = { NULL, (v2), NULL, NULL }, \
  193. .prod_id_hash = { 0, (vh2), 0, 0 }, \
  194. .cisfile = (_cisfile)}
  195. #define PCMCIA_PFC_DEVICE_CIS_PROD_ID12(mfc, v1, v2, vh1, vh2, _cisfile) { \
  196. .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
  197. PCMCIA_DEV_ID_MATCH_PROD_ID1| \
  198. PCMCIA_DEV_ID_MATCH_PROD_ID2| \
  199. PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
  200. .prod_id = { (v1), (v2), NULL, NULL }, \
  201. .prod_id_hash = { (vh1), (vh2), 0, 0 },\
  202. .device_no = (mfc), \
  203. .cisfile = (_cisfile)}
  204. #define PCMCIA_MFC_DEVICE_CIS_MANF_CARD(mfc, manf, card, _cisfile) { \
  205. .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
  206. PCMCIA_DEV_ID_MATCH_MANF_ID| \
  207. PCMCIA_DEV_ID_MATCH_CARD_ID| \
  208. PCMCIA_DEV_ID_MATCH_FUNCTION, \
  209. .manf_id = (manf), \
  210. .card_id = (card), \
  211. .function = (mfc), \
  212. .cisfile = (_cisfile)}
  213. #define PCMCIA_MFC_DEVICE_CIS_PROD_ID12(mfc, 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. PCMCIA_DEV_ID_MATCH_FUNCTION, \
  218. .prod_id = { (v1), (v2), NULL, NULL }, \
  219. .prod_id_hash = { (vh1), (vh2), 0, 0 }, \
  220. .function = (mfc), \
  221. .cisfile = (_cisfile)}
  222. #define PCMCIA_MFC_DEVICE_CIS_PROD_ID4(mfc, v4, vh4, _cisfile) { \
  223. .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
  224. PCMCIA_DEV_ID_MATCH_PROD_ID4| \
  225. PCMCIA_DEV_ID_MATCH_FUNCTION, \
  226. .prod_id = { NULL, NULL, NULL, (v4) }, \
  227. .prod_id_hash = { 0, 0, 0, (vh4) }, \
  228. .function = (mfc), \
  229. .cisfile = (_cisfile)}
  230. #define PCMCIA_DEVICE_NULL { .match_flags = 0, }
  231. #endif /* __KERNEL__ */
  232. #endif /* _LINUX_PCMCIA_DEVICE_ID_H */