mod_devicetable.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. /*
  2. * Device tables which are exported to userspace via
  3. * scripts/mod/file2alias.c. You must keep that file in sync with this
  4. * header.
  5. */
  6. #ifndef LINUX_MOD_DEVICETABLE_H
  7. #define LINUX_MOD_DEVICETABLE_H
  8. #ifdef __KERNEL__
  9. #include <linux/types.h>
  10. typedef unsigned long kernel_ulong_t;
  11. #endif
  12. #define PCI_ANY_ID (~0)
  13. struct pci_device_id {
  14. __u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/
  15. __u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
  16. __u32 class, class_mask; /* (class,subclass,prog-if) triplet */
  17. kernel_ulong_t driver_data; /* Data private to the driver */
  18. };
  19. #define IEEE1394_MATCH_VENDOR_ID 0x0001
  20. #define IEEE1394_MATCH_MODEL_ID 0x0002
  21. #define IEEE1394_MATCH_SPECIFIER_ID 0x0004
  22. #define IEEE1394_MATCH_VERSION 0x0008
  23. struct ieee1394_device_id {
  24. __u32 match_flags;
  25. __u32 vendor_id;
  26. __u32 model_id;
  27. __u32 specifier_id;
  28. __u32 version;
  29. kernel_ulong_t driver_data
  30. __attribute__((aligned(sizeof(kernel_ulong_t))));
  31. };
  32. /*
  33. * Device table entry for "new style" table-driven USB drivers.
  34. * User mode code can read these tables to choose which modules to load.
  35. * Declare the table as a MODULE_DEVICE_TABLE.
  36. *
  37. * A probe() parameter will point to a matching entry from this table.
  38. * Use the driver_info field for each match to hold information tied
  39. * to that match: device quirks, etc.
  40. *
  41. * Terminate the driver's table with an all-zeroes entry.
  42. * Use the flag values to control which fields are compared.
  43. */
  44. /**
  45. * struct usb_device_id - identifies USB devices for probing and hotplugging
  46. * @match_flags: Bit mask controlling of the other fields are used to match
  47. * against new devices. Any field except for driver_info may be used,
  48. * although some only make sense in conjunction with other fields.
  49. * This is usually set by a USB_DEVICE_*() macro, which sets all
  50. * other fields in this structure except for driver_info.
  51. * @idVendor: USB vendor ID for a device; numbers are assigned
  52. * by the USB forum to its members.
  53. * @idProduct: Vendor-assigned product ID.
  54. * @bcdDevice_lo: Low end of range of vendor-assigned product version numbers.
  55. * This is also used to identify individual product versions, for
  56. * a range consisting of a single device.
  57. * @bcdDevice_hi: High end of version number range. The range of product
  58. * versions is inclusive.
  59. * @bDeviceClass: Class of device; numbers are assigned
  60. * by the USB forum. Products may choose to implement classes,
  61. * or be vendor-specific. Device classes specify behavior of all
  62. * the interfaces on a devices.
  63. * @bDeviceSubClass: Subclass of device; associated with bDeviceClass.
  64. * @bDeviceProtocol: Protocol of device; associated with bDeviceClass.
  65. * @bInterfaceClass: Class of interface; numbers are assigned
  66. * by the USB forum. Products may choose to implement classes,
  67. * or be vendor-specific. Interface classes specify behavior only
  68. * of a given interface; other interfaces may support other classes.
  69. * @bInterfaceSubClass: Subclass of interface; associated with bInterfaceClass.
  70. * @bInterfaceProtocol: Protocol of interface; associated with bInterfaceClass.
  71. * @driver_info: Holds information used by the driver. Usually it holds
  72. * a pointer to a descriptor understood by the driver, or perhaps
  73. * device flags.
  74. *
  75. * In most cases, drivers will create a table of device IDs by using
  76. * USB_DEVICE(), or similar macros designed for that purpose.
  77. * They will then export it to userspace using MODULE_DEVICE_TABLE(),
  78. * and provide it to the USB core through their usb_driver structure.
  79. *
  80. * See the usb_match_id() function for information about how matches are
  81. * performed. Briefly, you will normally use one of several macros to help
  82. * construct these entries. Each entry you provide will either identify
  83. * one or more specific products, or will identify a class of products
  84. * which have agreed to behave the same. You should put the more specific
  85. * matches towards the beginning of your table, so that driver_info can
  86. * record quirks of specific products.
  87. */
  88. struct usb_device_id {
  89. /* which fields to match against? */
  90. __u16 match_flags;
  91. /* Used for product specific matches; range is inclusive */
  92. __u16 idVendor;
  93. __u16 idProduct;
  94. __u16 bcdDevice_lo;
  95. __u16 bcdDevice_hi;
  96. /* Used for device class matches */
  97. __u8 bDeviceClass;
  98. __u8 bDeviceSubClass;
  99. __u8 bDeviceProtocol;
  100. /* Used for interface class matches */
  101. __u8 bInterfaceClass;
  102. __u8 bInterfaceSubClass;
  103. __u8 bInterfaceProtocol;
  104. /* not matched against */
  105. kernel_ulong_t driver_info;
  106. };
  107. /* Some useful macros to use to create struct usb_device_id */
  108. #define USB_DEVICE_ID_MATCH_VENDOR 0x0001
  109. #define USB_DEVICE_ID_MATCH_PRODUCT 0x0002
  110. #define USB_DEVICE_ID_MATCH_DEV_LO 0x0004
  111. #define USB_DEVICE_ID_MATCH_DEV_HI 0x0008
  112. #define USB_DEVICE_ID_MATCH_DEV_CLASS 0x0010
  113. #define USB_DEVICE_ID_MATCH_DEV_SUBCLASS 0x0020
  114. #define USB_DEVICE_ID_MATCH_DEV_PROTOCOL 0x0040
  115. #define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080
  116. #define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
  117. #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
  118. /* s390 CCW devices */
  119. struct ccw_device_id {
  120. __u16 match_flags; /* which fields to match against */
  121. __u16 cu_type; /* control unit type */
  122. __u16 dev_type; /* device type */
  123. __u8 cu_model; /* control unit model */
  124. __u8 dev_model; /* device model */
  125. kernel_ulong_t driver_info;
  126. };
  127. #define CCW_DEVICE_ID_MATCH_CU_TYPE 0x01
  128. #define CCW_DEVICE_ID_MATCH_CU_MODEL 0x02
  129. #define CCW_DEVICE_ID_MATCH_DEVICE_TYPE 0x04
  130. #define CCW_DEVICE_ID_MATCH_DEVICE_MODEL 0x08
  131. /* s390 AP bus devices */
  132. struct ap_device_id {
  133. __u16 match_flags; /* which fields to match against */
  134. __u8 dev_type; /* device type */
  135. __u8 pad1;
  136. __u32 pad2;
  137. kernel_ulong_t driver_info;
  138. };
  139. #define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01
  140. #define ACPI_ID_LEN 16 /* only 9 bytes needed here, 16 bytes are used */
  141. /* to workaround crosscompile issues */
  142. struct acpi_device_id {
  143. __u8 id[ACPI_ID_LEN];
  144. kernel_ulong_t driver_data;
  145. };
  146. #define PNP_ID_LEN 8
  147. #define PNP_MAX_DEVICES 8
  148. struct pnp_device_id {
  149. __u8 id[PNP_ID_LEN];
  150. kernel_ulong_t driver_data;
  151. };
  152. struct pnp_card_device_id {
  153. __u8 id[PNP_ID_LEN];
  154. kernel_ulong_t driver_data;
  155. struct {
  156. __u8 id[PNP_ID_LEN];
  157. } devs[PNP_MAX_DEVICES];
  158. };
  159. #define SERIO_ANY 0xff
  160. struct serio_device_id {
  161. __u8 type;
  162. __u8 extra;
  163. __u8 id;
  164. __u8 proto;
  165. };
  166. /*
  167. * Struct used for matching a device
  168. */
  169. struct of_device_id
  170. {
  171. char name[32];
  172. char type[32];
  173. char compatible[128];
  174. #ifdef __KERNEL__
  175. void *data;
  176. #else
  177. kernel_ulong_t data;
  178. #endif
  179. };
  180. /* VIO */
  181. struct vio_device_id {
  182. char type[32];
  183. char compat[32];
  184. };
  185. /* PCMCIA */
  186. struct pcmcia_device_id {
  187. __u16 match_flags;
  188. __u16 manf_id;
  189. __u16 card_id;
  190. __u8 func_id;
  191. /* for real multi-function devices */
  192. __u8 function;
  193. /* for pseudo multi-function devices */
  194. __u8 device_no;
  195. __u32 prod_id_hash[4]
  196. __attribute__((aligned(sizeof(__u32))));
  197. /* not matched against in kernelspace*/
  198. #ifdef __KERNEL__
  199. const char * prod_id[4];
  200. #else
  201. kernel_ulong_t prod_id[4]
  202. __attribute__((aligned(sizeof(kernel_ulong_t))));
  203. #endif
  204. /* not matched against */
  205. kernel_ulong_t driver_info;
  206. #ifdef __KERNEL__
  207. char * cisfile;
  208. #else
  209. kernel_ulong_t cisfile;
  210. #endif
  211. };
  212. #define PCMCIA_DEV_ID_MATCH_MANF_ID 0x0001
  213. #define PCMCIA_DEV_ID_MATCH_CARD_ID 0x0002
  214. #define PCMCIA_DEV_ID_MATCH_FUNC_ID 0x0004
  215. #define PCMCIA_DEV_ID_MATCH_FUNCTION 0x0008
  216. #define PCMCIA_DEV_ID_MATCH_PROD_ID1 0x0010
  217. #define PCMCIA_DEV_ID_MATCH_PROD_ID2 0x0020
  218. #define PCMCIA_DEV_ID_MATCH_PROD_ID3 0x0040
  219. #define PCMCIA_DEV_ID_MATCH_PROD_ID4 0x0080
  220. #define PCMCIA_DEV_ID_MATCH_DEVICE_NO 0x0100
  221. #define PCMCIA_DEV_ID_MATCH_FAKE_CIS 0x0200
  222. #define PCMCIA_DEV_ID_MATCH_ANONYMOUS 0x0400
  223. /* Input */
  224. #define INPUT_DEVICE_ID_EV_MAX 0x1f
  225. #define INPUT_DEVICE_ID_KEY_MIN_INTERESTING 0x71
  226. #define INPUT_DEVICE_ID_KEY_MAX 0x1ff
  227. #define INPUT_DEVICE_ID_REL_MAX 0x0f
  228. #define INPUT_DEVICE_ID_ABS_MAX 0x3f
  229. #define INPUT_DEVICE_ID_MSC_MAX 0x07
  230. #define INPUT_DEVICE_ID_LED_MAX 0x0f
  231. #define INPUT_DEVICE_ID_SND_MAX 0x07
  232. #define INPUT_DEVICE_ID_FF_MAX 0x7f
  233. #define INPUT_DEVICE_ID_SW_MAX 0x0f
  234. #define INPUT_DEVICE_ID_MATCH_BUS 1
  235. #define INPUT_DEVICE_ID_MATCH_VENDOR 2
  236. #define INPUT_DEVICE_ID_MATCH_PRODUCT 4
  237. #define INPUT_DEVICE_ID_MATCH_VERSION 8
  238. #define INPUT_DEVICE_ID_MATCH_EVBIT 0x0010
  239. #define INPUT_DEVICE_ID_MATCH_KEYBIT 0x0020
  240. #define INPUT_DEVICE_ID_MATCH_RELBIT 0x0040
  241. #define INPUT_DEVICE_ID_MATCH_ABSBIT 0x0080
  242. #define INPUT_DEVICE_ID_MATCH_MSCIT 0x0100
  243. #define INPUT_DEVICE_ID_MATCH_LEDBIT 0x0200
  244. #define INPUT_DEVICE_ID_MATCH_SNDBIT 0x0400
  245. #define INPUT_DEVICE_ID_MATCH_FFBIT 0x0800
  246. #define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000
  247. struct input_device_id {
  248. kernel_ulong_t flags;
  249. __u16 bustype;
  250. __u16 vendor;
  251. __u16 product;
  252. __u16 version;
  253. kernel_ulong_t evbit[INPUT_DEVICE_ID_EV_MAX / BITS_PER_LONG + 1];
  254. kernel_ulong_t keybit[INPUT_DEVICE_ID_KEY_MAX / BITS_PER_LONG + 1];
  255. kernel_ulong_t relbit[INPUT_DEVICE_ID_REL_MAX / BITS_PER_LONG + 1];
  256. kernel_ulong_t absbit[INPUT_DEVICE_ID_ABS_MAX / BITS_PER_LONG + 1];
  257. kernel_ulong_t mscbit[INPUT_DEVICE_ID_MSC_MAX / BITS_PER_LONG + 1];
  258. kernel_ulong_t ledbit[INPUT_DEVICE_ID_LED_MAX / BITS_PER_LONG + 1];
  259. kernel_ulong_t sndbit[INPUT_DEVICE_ID_SND_MAX / BITS_PER_LONG + 1];
  260. kernel_ulong_t ffbit[INPUT_DEVICE_ID_FF_MAX / BITS_PER_LONG + 1];
  261. kernel_ulong_t swbit[INPUT_DEVICE_ID_SW_MAX / BITS_PER_LONG + 1];
  262. kernel_ulong_t driver_info;
  263. };
  264. /* EISA */
  265. #define EISA_SIG_LEN 8
  266. /* The EISA signature, in ASCII form, null terminated */
  267. struct eisa_device_id {
  268. char sig[EISA_SIG_LEN];
  269. kernel_ulong_t driver_data;
  270. };
  271. #define EISA_DEVICE_MODALIAS_FMT "eisa:s%s"
  272. struct parisc_device_id {
  273. __u8 hw_type; /* 5 bits used */
  274. __u8 hversion_rev; /* 4 bits */
  275. __u16 hversion; /* 12 bits */
  276. __u32 sversion; /* 20 bits */
  277. };
  278. #define PA_HWTYPE_ANY_ID 0xff
  279. #define PA_HVERSION_REV_ANY_ID 0xff
  280. #define PA_HVERSION_ANY_ID 0xffff
  281. #define PA_SVERSION_ANY_ID 0xffffffff
  282. /* SDIO */
  283. #define SDIO_ANY_ID (~0)
  284. struct sdio_device_id {
  285. __u8 class; /* Standard interface or SDIO_ANY_ID */
  286. __u16 vendor; /* Vendor or SDIO_ANY_ID */
  287. __u16 device; /* Device ID or SDIO_ANY_ID */
  288. kernel_ulong_t driver_data; /* Data private to the driver */
  289. };
  290. /* SSB core, see drivers/ssb/ */
  291. struct ssb_device_id {
  292. __u16 vendor;
  293. __u16 coreid;
  294. __u8 revision;
  295. };
  296. #define SSB_DEVICE(_vendor, _coreid, _revision) \
  297. { .vendor = _vendor, .coreid = _coreid, .revision = _revision, }
  298. #define SSB_DEVTABLE_END \
  299. { 0, },
  300. #define SSB_ANY_VENDOR 0xFFFF
  301. #define SSB_ANY_ID 0xFFFF
  302. #define SSB_ANY_REV 0xFF
  303. struct virtio_device_id {
  304. __u32 device;
  305. __u32 vendor;
  306. };
  307. #define VIRTIO_DEV_ANY_ID 0xffffffff
  308. #endif /* LINUX_MOD_DEVICETABLE_H */