mod_devicetable.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /*
  2. * Device tables which are exported to userspace via
  3. * scripts/table2alias.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. };
  31. /*
  32. * Device table entry for "new style" table-driven USB drivers.
  33. * User mode code can read these tables to choose which modules to load.
  34. * Declare the table as a MODULE_DEVICE_TABLE.
  35. *
  36. * A probe() parameter will point to a matching entry from this table.
  37. * Use the driver_info field for each match to hold information tied
  38. * to that match: device quirks, etc.
  39. *
  40. * Terminate the driver's table with an all-zeroes entry.
  41. * Use the flag values to control which fields are compared.
  42. */
  43. /**
  44. * struct usb_device_id - identifies USB devices for probing and hotplugging
  45. * @match_flags: Bit mask controlling of the other fields are used to match
  46. * against new devices. Any field except for driver_info may be used,
  47. * although some only make sense in conjunction with other fields.
  48. * This is usually set by a USB_DEVICE_*() macro, which sets all
  49. * other fields in this structure except for driver_info.
  50. * @idVendor: USB vendor ID for a device; numbers are assigned
  51. * by the USB forum to its members.
  52. * @idProduct: Vendor-assigned product ID.
  53. * @bcdDevice_lo: Low end of range of vendor-assigned product version numbers.
  54. * This is also used to identify individual product versions, for
  55. * a range consisting of a single device.
  56. * @bcdDevice_hi: High end of version number range. The range of product
  57. * versions is inclusive.
  58. * @bDeviceClass: Class of device; numbers are assigned
  59. * by the USB forum. Products may choose to implement classes,
  60. * or be vendor-specific. Device classes specify behavior of all
  61. * the interfaces on a devices.
  62. * @bDeviceSubClass: Subclass of device; associated with bDeviceClass.
  63. * @bDeviceProtocol: Protocol of device; associated with bDeviceClass.
  64. * @bInterfaceClass: Class of interface; numbers are assigned
  65. * by the USB forum. Products may choose to implement classes,
  66. * or be vendor-specific. Interface classes specify behavior only
  67. * of a given interface; other interfaces may support other classes.
  68. * @bInterfaceSubClass: Subclass of interface; associated with bInterfaceClass.
  69. * @bInterfaceProtocol: Protocol of interface; associated with bInterfaceClass.
  70. * @driver_info: Holds information used by the driver. Usually it holds
  71. * a pointer to a descriptor understood by the driver, or perhaps
  72. * device flags.
  73. *
  74. * In most cases, drivers will create a table of device IDs by using
  75. * USB_DEVICE(), or similar macros designed for that purpose.
  76. * They will then export it to userspace using MODULE_DEVICE_TABLE(),
  77. * and provide it to the USB core through their usb_driver structure.
  78. *
  79. * See the usb_match_id() function for information about how matches are
  80. * performed. Briefly, you will normally use one of several macros to help
  81. * construct these entries. Each entry you provide will either identify
  82. * one or more specific products, or will identify a class of products
  83. * which have agreed to behave the same. You should put the more specific
  84. * matches towards the beginning of your table, so that driver_info can
  85. * record quirks of specific products.
  86. */
  87. struct usb_device_id {
  88. /* which fields to match against? */
  89. __u16 match_flags;
  90. /* Used for product specific matches; range is inclusive */
  91. __u16 idVendor;
  92. __u16 idProduct;
  93. __u16 bcdDevice_lo;
  94. __u16 bcdDevice_hi;
  95. /* Used for device class matches */
  96. __u8 bDeviceClass;
  97. __u8 bDeviceSubClass;
  98. __u8 bDeviceProtocol;
  99. /* Used for interface class matches */
  100. __u8 bInterfaceClass;
  101. __u8 bInterfaceSubClass;
  102. __u8 bInterfaceProtocol;
  103. /* not matched against */
  104. kernel_ulong_t driver_info;
  105. };
  106. /* Some useful macros to use to create struct usb_device_id */
  107. #define USB_DEVICE_ID_MATCH_VENDOR 0x0001
  108. #define USB_DEVICE_ID_MATCH_PRODUCT 0x0002
  109. #define USB_DEVICE_ID_MATCH_DEV_LO 0x0004
  110. #define USB_DEVICE_ID_MATCH_DEV_HI 0x0008
  111. #define USB_DEVICE_ID_MATCH_DEV_CLASS 0x0010
  112. #define USB_DEVICE_ID_MATCH_DEV_SUBCLASS 0x0020
  113. #define USB_DEVICE_ID_MATCH_DEV_PROTOCOL 0x0040
  114. #define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080
  115. #define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
  116. #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
  117. /* s390 CCW devices */
  118. struct ccw_device_id {
  119. __u16 match_flags; /* which fields to match against */
  120. __u16 cu_type; /* control unit type */
  121. __u16 dev_type; /* device type */
  122. __u8 cu_model; /* control unit model */
  123. __u8 dev_model; /* device model */
  124. kernel_ulong_t driver_info;
  125. };
  126. #define CCW_DEVICE_ID_MATCH_CU_TYPE 0x01
  127. #define CCW_DEVICE_ID_MATCH_CU_MODEL 0x02
  128. #define CCW_DEVICE_ID_MATCH_DEVICE_TYPE 0x04
  129. #define CCW_DEVICE_ID_MATCH_DEVICE_MODEL 0x08
  130. #define PNP_ID_LEN 8
  131. #define PNP_MAX_DEVICES 8
  132. struct pnp_device_id {
  133. __u8 id[PNP_ID_LEN];
  134. kernel_ulong_t driver_data;
  135. };
  136. struct pnp_card_device_id {
  137. __u8 id[PNP_ID_LEN];
  138. kernel_ulong_t driver_data;
  139. struct {
  140. __u8 id[PNP_ID_LEN];
  141. } devs[PNP_MAX_DEVICES];
  142. };
  143. #define SERIO_ANY 0xff
  144. struct serio_device_id {
  145. __u8 type;
  146. __u8 extra;
  147. __u8 id;
  148. __u8 proto;
  149. };
  150. /* PCMCIA */
  151. struct pcmcia_device_id {
  152. __u16 match_flags;
  153. __u16 manf_id;
  154. __u16 card_id;
  155. __u8 func_id;
  156. /* for real multi-function devices */
  157. __u8 function;
  158. /* for pseude multi-function devices */
  159. __u8 device_no;
  160. __u32 prod_id_hash[4];
  161. /* not matched against in kernelspace*/
  162. #ifdef __KERNEL__
  163. const char * prod_id[4];
  164. #else
  165. kernel_ulong_t prod_id[4];
  166. #endif
  167. /* not matched against */
  168. kernel_ulong_t driver_info;
  169. #ifdef __KERNEL__
  170. char * cisfile;
  171. #else
  172. kernel_ulong_t cisfile;
  173. #endif
  174. };
  175. #define PCMCIA_DEV_ID_MATCH_MANF_ID 0x0001
  176. #define PCMCIA_DEV_ID_MATCH_CARD_ID 0x0002
  177. #define PCMCIA_DEV_ID_MATCH_FUNC_ID 0x0004
  178. #define PCMCIA_DEV_ID_MATCH_FUNCTION 0x0008
  179. #define PCMCIA_DEV_ID_MATCH_PROD_ID1 0x0010
  180. #define PCMCIA_DEV_ID_MATCH_PROD_ID2 0x0020
  181. #define PCMCIA_DEV_ID_MATCH_PROD_ID3 0x0040
  182. #define PCMCIA_DEV_ID_MATCH_PROD_ID4 0x0080
  183. #define PCMCIA_DEV_ID_MATCH_DEVICE_NO 0x0100
  184. #define PCMCIA_DEV_ID_MATCH_FAKE_CIS 0x0200
  185. #define PCMCIA_DEV_ID_MATCH_ANONYMOUS 0x0400
  186. #endif /* LINUX_MOD_DEVICETABLE_H */