1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Device tables which are exported to userspace via
4 * scripts/mod/file2alias.c. You must keep that file in sync with this
8 #ifndef LINUX_MOD_DEVICETABLE_H
9 #define LINUX_MOD_DEVICETABLE_H
12 #include <linux/types.h>
13 #include <linux/uuid.h>
14 typedef unsigned long kernel_ulong_t;
17 #define PCI_ANY_ID (~0)
19 struct pci_device_id {
20 __u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/
21 __u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
22 __u32 class, class_mask; /* (class,subclass,prog-if) triplet */
23 kernel_ulong_t driver_data; /* Data private to the driver */
27 #define IEEE1394_MATCH_VENDOR_ID 0x0001
28 #define IEEE1394_MATCH_MODEL_ID 0x0002
29 #define IEEE1394_MATCH_SPECIFIER_ID 0x0004
30 #define IEEE1394_MATCH_VERSION 0x0008
32 struct ieee1394_device_id {
38 kernel_ulong_t driver_data;
43 * Device table entry for "new style" table-driven USB drivers.
44 * User mode code can read these tables to choose which modules to load.
45 * Declare the table as a MODULE_DEVICE_TABLE.
47 * A probe() parameter will point to a matching entry from this table.
48 * Use the driver_info field for each match to hold information tied
49 * to that match: device quirks, etc.
51 * Terminate the driver's table with an all-zeroes entry.
52 * Use the flag values to control which fields are compared.
56 * struct usb_device_id - identifies USB devices for probing and hotplugging
57 * @match_flags: Bit mask controlling which of the other fields are used to
58 * match against new devices. Any field except for driver_info may be
59 * used, although some only make sense in conjunction with other fields.
60 * This is usually set by a USB_DEVICE_*() macro, which sets all
61 * other fields in this structure except for driver_info.
62 * @idVendor: USB vendor ID for a device; numbers are assigned
63 * by the USB forum to its members.
64 * @idProduct: Vendor-assigned product ID.
65 * @bcdDevice_lo: Low end of range of vendor-assigned product version numbers.
66 * This is also used to identify individual product versions, for
67 * a range consisting of a single device.
68 * @bcdDevice_hi: High end of version number range. The range of product
69 * versions is inclusive.
70 * @bDeviceClass: Class of device; numbers are assigned
71 * by the USB forum. Products may choose to implement classes,
72 * or be vendor-specific. Device classes specify behavior of all
73 * the interfaces on a device.
74 * @bDeviceSubClass: Subclass of device; associated with bDeviceClass.
75 * @bDeviceProtocol: Protocol of device; associated with bDeviceClass.
76 * @bInterfaceClass: Class of interface; numbers are assigned
77 * by the USB forum. Products may choose to implement classes,
78 * or be vendor-specific. Interface classes specify behavior only
79 * of a given interface; other interfaces may support other classes.
80 * @bInterfaceSubClass: Subclass of interface; associated with bInterfaceClass.
81 * @bInterfaceProtocol: Protocol of interface; associated with bInterfaceClass.
82 * @bInterfaceNumber: Number of interface; composite devices may use
83 * fixed interface numbers to differentiate between vendor-specific
85 * @driver_info: Holds information used by the driver. Usually it holds
86 * a pointer to a descriptor understood by the driver, or perhaps
89 * In most cases, drivers will create a table of device IDs by using
90 * USB_DEVICE(), or similar macros designed for that purpose.
91 * They will then export it to userspace using MODULE_DEVICE_TABLE(),
92 * and provide it to the USB core through their usb_driver structure.
94 * See the usb_match_id() function for information about how matches are
95 * performed. Briefly, you will normally use one of several macros to help
96 * construct these entries. Each entry you provide will either identify
97 * one or more specific products, or will identify a class of products
98 * which have agreed to behave the same. You should put the more specific
99 * matches towards the beginning of your table, so that driver_info can
100 * record quirks of specific products.
102 struct usb_device_id {
103 /* which fields to match against? */
106 /* Used for product specific matches; range is inclusive */
112 /* Used for device class matches */
114 __u8 bDeviceSubClass;
115 __u8 bDeviceProtocol;
117 /* Used for interface class matches */
118 __u8 bInterfaceClass;
119 __u8 bInterfaceSubClass;
120 __u8 bInterfaceProtocol;
122 /* Used for vendor-specific interface matches */
123 __u8 bInterfaceNumber;
125 /* not matched against */
126 kernel_ulong_t driver_info
127 __attribute__((aligned(sizeof(kernel_ulong_t))));
130 /* Some useful macros to use to create struct usb_device_id */
131 #define USB_DEVICE_ID_MATCH_VENDOR 0x0001
132 #define USB_DEVICE_ID_MATCH_PRODUCT 0x0002
133 #define USB_DEVICE_ID_MATCH_DEV_LO 0x0004
134 #define USB_DEVICE_ID_MATCH_DEV_HI 0x0008
135 #define USB_DEVICE_ID_MATCH_DEV_CLASS 0x0010
136 #define USB_DEVICE_ID_MATCH_DEV_SUBCLASS 0x0020
137 #define USB_DEVICE_ID_MATCH_DEV_PROTOCOL 0x0040
138 #define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080
139 #define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
140 #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
141 #define USB_DEVICE_ID_MATCH_INT_NUMBER 0x0400
143 #define HID_ANY_ID (~0)
144 #define HID_BUS_ANY 0xffff
145 #define HID_GROUP_ANY 0x0000
147 struct hid_device_id {
152 kernel_ulong_t driver_data;
155 /* s390 CCW devices */
156 struct ccw_device_id {
157 __u16 match_flags; /* which fields to match against */
159 __u16 cu_type; /* control unit type */
160 __u16 dev_type; /* device type */
161 __u8 cu_model; /* control unit model */
162 __u8 dev_model; /* device model */
164 kernel_ulong_t driver_info;
167 #define CCW_DEVICE_ID_MATCH_CU_TYPE 0x01
168 #define CCW_DEVICE_ID_MATCH_CU_MODEL 0x02
169 #define CCW_DEVICE_ID_MATCH_DEVICE_TYPE 0x04
170 #define CCW_DEVICE_ID_MATCH_DEVICE_MODEL 0x08
172 /* s390 AP bus devices */
173 struct ap_device_id {
174 __u16 match_flags; /* which fields to match against */
175 __u8 dev_type; /* device type */
176 kernel_ulong_t driver_info;
179 #define AP_DEVICE_ID_MATCH_CARD_TYPE 0x01
180 #define AP_DEVICE_ID_MATCH_QUEUE_TYPE 0x02
182 /* s390 css bus devices (subchannels) */
183 struct css_device_id {
185 __u8 type; /* subchannel type */
186 kernel_ulong_t driver_data;
189 #define ACPI_ID_LEN 9
191 struct acpi_device_id {
192 __u8 id[ACPI_ID_LEN];
193 kernel_ulong_t driver_data;
199 #define PNP_MAX_DEVICES 8
201 struct pnp_device_id {
203 kernel_ulong_t driver_data;
206 struct pnp_card_device_id {
208 kernel_ulong_t driver_data;
211 } devs[PNP_MAX_DEVICES];
215 #define SERIO_ANY 0xff
217 struct serio_device_id {
224 struct hda_device_id {
229 unsigned long driver_data;
233 * Struct used for matching a device
235 struct of_device_id {
238 char compatible[128];
243 struct vio_device_id {
250 struct pcmcia_device_id {
258 /* for real multi-function devices */
261 /* for pseudo multi-function devices */
264 __u32 prod_id_hash[4];
266 /* not matched against in kernelspace */
267 const char * prod_id[4];
269 /* not matched against */
270 kernel_ulong_t driver_info;
274 #define PCMCIA_DEV_ID_MATCH_MANF_ID 0x0001
275 #define PCMCIA_DEV_ID_MATCH_CARD_ID 0x0002
276 #define PCMCIA_DEV_ID_MATCH_FUNC_ID 0x0004
277 #define PCMCIA_DEV_ID_MATCH_FUNCTION 0x0008
278 #define PCMCIA_DEV_ID_MATCH_PROD_ID1 0x0010
279 #define PCMCIA_DEV_ID_MATCH_PROD_ID2 0x0020
280 #define PCMCIA_DEV_ID_MATCH_PROD_ID3 0x0040
281 #define PCMCIA_DEV_ID_MATCH_PROD_ID4 0x0080
282 #define PCMCIA_DEV_ID_MATCH_DEVICE_NO 0x0100
283 #define PCMCIA_DEV_ID_MATCH_FAKE_CIS 0x0200
284 #define PCMCIA_DEV_ID_MATCH_ANONYMOUS 0x0400
287 #define INPUT_DEVICE_ID_EV_MAX 0x1f
288 #define INPUT_DEVICE_ID_KEY_MIN_INTERESTING 0x71
289 #define INPUT_DEVICE_ID_KEY_MAX 0x2ff
290 #define INPUT_DEVICE_ID_REL_MAX 0x0f
291 #define INPUT_DEVICE_ID_ABS_MAX 0x3f
292 #define INPUT_DEVICE_ID_MSC_MAX 0x07
293 #define INPUT_DEVICE_ID_LED_MAX 0x0f
294 #define INPUT_DEVICE_ID_SND_MAX 0x07
295 #define INPUT_DEVICE_ID_FF_MAX 0x7f
296 #define INPUT_DEVICE_ID_SW_MAX 0x10
297 #define INPUT_DEVICE_ID_PROP_MAX 0x1f
299 #define INPUT_DEVICE_ID_MATCH_BUS 1
300 #define INPUT_DEVICE_ID_MATCH_VENDOR 2
301 #define INPUT_DEVICE_ID_MATCH_PRODUCT 4
302 #define INPUT_DEVICE_ID_MATCH_VERSION 8
304 #define INPUT_DEVICE_ID_MATCH_EVBIT 0x0010
305 #define INPUT_DEVICE_ID_MATCH_KEYBIT 0x0020
306 #define INPUT_DEVICE_ID_MATCH_RELBIT 0x0040
307 #define INPUT_DEVICE_ID_MATCH_ABSBIT 0x0080
308 #define INPUT_DEVICE_ID_MATCH_MSCIT 0x0100
309 #define INPUT_DEVICE_ID_MATCH_LEDBIT 0x0200
310 #define INPUT_DEVICE_ID_MATCH_SNDBIT 0x0400
311 #define INPUT_DEVICE_ID_MATCH_FFBIT 0x0800
312 #define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000
313 #define INPUT_DEVICE_ID_MATCH_PROPBIT 0x2000
315 struct input_device_id {
317 kernel_ulong_t flags;
324 kernel_ulong_t evbit[INPUT_DEVICE_ID_EV_MAX / BITS_PER_LONG + 1];
325 kernel_ulong_t keybit[INPUT_DEVICE_ID_KEY_MAX / BITS_PER_LONG + 1];
326 kernel_ulong_t relbit[INPUT_DEVICE_ID_REL_MAX / BITS_PER_LONG + 1];
327 kernel_ulong_t absbit[INPUT_DEVICE_ID_ABS_MAX / BITS_PER_LONG + 1];
328 kernel_ulong_t mscbit[INPUT_DEVICE_ID_MSC_MAX / BITS_PER_LONG + 1];
329 kernel_ulong_t ledbit[INPUT_DEVICE_ID_LED_MAX / BITS_PER_LONG + 1];
330 kernel_ulong_t sndbit[INPUT_DEVICE_ID_SND_MAX / BITS_PER_LONG + 1];
331 kernel_ulong_t ffbit[INPUT_DEVICE_ID_FF_MAX / BITS_PER_LONG + 1];
332 kernel_ulong_t swbit[INPUT_DEVICE_ID_SW_MAX / BITS_PER_LONG + 1];
333 kernel_ulong_t propbit[INPUT_DEVICE_ID_PROP_MAX / BITS_PER_LONG + 1];
335 kernel_ulong_t driver_info;
340 #define EISA_SIG_LEN 8
342 /* The EISA signature, in ASCII form, null terminated */
343 struct eisa_device_id {
344 char sig[EISA_SIG_LEN];
345 kernel_ulong_t driver_data;
348 #define EISA_DEVICE_MODALIAS_FMT "eisa:s%s"
350 struct parisc_device_id {
351 __u8 hw_type; /* 5 bits used */
352 __u8 hversion_rev; /* 4 bits */
353 __u16 hversion; /* 12 bits */
354 __u32 sversion; /* 20 bits */
357 #define PA_HWTYPE_ANY_ID 0xff
358 #define PA_HVERSION_REV_ANY_ID 0xff
359 #define PA_HVERSION_ANY_ID 0xffff
360 #define PA_SVERSION_ANY_ID 0xffffffff
364 #define SDIO_ANY_ID (~0)
366 struct sdio_device_id {
367 __u8 class; /* Standard interface or SDIO_ANY_ID */
368 __u16 vendor; /* Vendor or SDIO_ANY_ID */
369 __u16 device; /* Device ID or SDIO_ANY_ID */
370 kernel_ulong_t driver_data; /* Data private to the driver */
373 /* SSB core, see drivers/ssb/ */
374 struct ssb_device_id {
379 } __attribute__((packed, aligned(2)));
380 #define SSB_DEVICE(_vendor, _coreid, _revision) \
381 { .vendor = _vendor, .coreid = _coreid, .revision = _revision, }
383 #define SSB_ANY_VENDOR 0xFFFF
384 #define SSB_ANY_ID 0xFFFF
385 #define SSB_ANY_REV 0xFF
387 /* Broadcom's specific AMBA core, see drivers/bcma/ */
388 struct bcma_device_id {
393 } __attribute__((packed,aligned(2)));
394 #define BCMA_CORE(_manuf, _id, _rev, _class) \
395 { .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, }
397 #define BCMA_ANY_MANUF 0xFFFF
398 #define BCMA_ANY_ID 0xFFFF
399 #define BCMA_ANY_REV 0xFF
400 #define BCMA_ANY_CLASS 0xFF
402 struct virtio_device_id {
406 #define VIRTIO_DEV_ANY_ID 0xffffffff
409 * For Hyper-V devices we use the device guid as the id.
411 struct hv_vmbus_device_id {
413 kernel_ulong_t driver_data; /* Data private to the driver */
418 #define RPMSG_NAME_SIZE 32
419 #define RPMSG_DEVICE_MODALIAS_FMT "rpmsg:%s"
421 struct rpmsg_device_id {
422 char name[RPMSG_NAME_SIZE];
427 #define I2C_NAME_SIZE 20
428 #define I2C_MODULE_PREFIX "i2c:"
430 struct i2c_device_id {
431 char name[I2C_NAME_SIZE];
432 kernel_ulong_t driver_data; /* Data private to the driver */
437 #define PCI_EPF_NAME_SIZE 20
438 #define PCI_EPF_MODULE_PREFIX "pci_epf:"
440 struct pci_epf_device_id {
441 char name[PCI_EPF_NAME_SIZE];
442 kernel_ulong_t driver_data;
447 #define SPI_NAME_SIZE 32
448 #define SPI_MODULE_PREFIX "spi:"
450 struct spi_device_id {
451 char name[SPI_NAME_SIZE];
452 kernel_ulong_t driver_data; /* Data private to the driver */
455 #define SPMI_NAME_SIZE 32
456 #define SPMI_MODULE_PREFIX "spmi:"
458 struct spmi_device_id {
459 char name[SPMI_NAME_SIZE];
460 kernel_ulong_t driver_data; /* Data private to the driver */
484 DMI_CHASSIS_ASSET_TAG,
488 struct dmi_strmatch {
489 unsigned char slot:7;
490 unsigned char exact_match:1;
494 struct dmi_system_id {
495 int (*callback)(const struct dmi_system_id *);
497 struct dmi_strmatch matches[4];
501 * struct dmi_device_id appears during expansion of
502 * "MODULE_DEVICE_TABLE(dmi, x)". Compiler doesn't look inside it
503 * but this is enough for gcc 3.4.6 to error out:
504 * error: storage size of '__mod_dmi_device_table' isn't known
506 #define dmi_device_id dmi_system_id
508 #define DMI_MATCH(a, b) { .slot = a, .substr = b }
509 #define DMI_EXACT_MATCH(a, b) { .slot = a, .substr = b, .exact_match = 1 }
511 #define PLATFORM_NAME_SIZE 20
512 #define PLATFORM_MODULE_PREFIX "platform:"
514 struct platform_device_id {
515 char name[PLATFORM_NAME_SIZE];
516 kernel_ulong_t driver_data;
519 #define MDIO_NAME_SIZE 32
520 #define MDIO_MODULE_PREFIX "mdio:"
522 #define MDIO_ID_FMT "%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u"
523 #define MDIO_ID_ARGS(_id) \
524 ((_id)>>31) & 1, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \
525 ((_id)>>27) & 1, ((_id)>>26) & 1, ((_id)>>25) & 1, ((_id)>>24) & 1, \
526 ((_id)>>23) & 1, ((_id)>>22) & 1, ((_id)>>21) & 1, ((_id)>>20) & 1, \
527 ((_id)>>19) & 1, ((_id)>>18) & 1, ((_id)>>17) & 1, ((_id)>>16) & 1, \
528 ((_id)>>15) & 1, ((_id)>>14) & 1, ((_id)>>13) & 1, ((_id)>>12) & 1, \
529 ((_id)>>11) & 1, ((_id)>>10) & 1, ((_id)>>9) & 1, ((_id)>>8) & 1, \
530 ((_id)>>7) & 1, ((_id)>>6) & 1, ((_id)>>5) & 1, ((_id)>>4) & 1, \
531 ((_id)>>3) & 1, ((_id)>>2) & 1, ((_id)>>1) & 1, (_id) & 1
534 * struct mdio_device_id - identifies PHY devices on an MDIO/MII bus
535 * @phy_id: The result of
536 * (mdio_read(&MII_PHYSID1) << 16 | mdio_read(&PHYSID2)) & @phy_id_mask
538 * @phy_id_mask: Defines the significant bits of @phy_id. A value of 0
539 * is used to terminate an array of struct mdio_device_id.
541 struct mdio_device_id {
546 struct zorro_device_id {
547 __u32 id; /* Device ID or ZORRO_WILDCARD */
548 kernel_ulong_t driver_data; /* Data private to the driver */
551 #define ZORRO_WILDCARD (0xffffffff) /* not official */
553 #define ZORRO_DEVICE_MODALIAS_FMT "zorro:i%08X"
555 #define ISAPNP_ANY_ID 0xffff
556 struct isapnp_device_id {
557 unsigned short card_vendor, card_device;
558 unsigned short vendor, function;
559 kernel_ulong_t driver_data; /* data private to the driver */
563 * struct amba_id - identifies a device on an AMBA bus
564 * @id: The significant bits if the hardware device ID
565 * @mask: Bitmask specifying which bits of the id field are significant when
566 * matching. A driver binds to a device when ((hardware device ID) & mask)
568 * @data: Private data used by the driver.
577 * struct mips_cdmm_device_id - identifies devices in MIPS CDMM bus
578 * @type: Device type identifier.
580 struct mips_cdmm_device_id {
585 * Match x86 CPUs for CPU specific drivers.
586 * See documentation of "x86_match_cpu" for details.
590 * MODULE_DEVICE_TABLE expects this struct to be called x86cpu_device_id.
591 * Although gcc seems to ignore this error, clang fails without this define.
593 * Note: The ordering of the struct is different from upstream because the
594 * static initializers in kernels < 5.7 still use C89 style while upstream
595 * has been converted to proper C99 initializers.
597 #define x86cpu_device_id x86_cpu_id
602 __u16 feature; /* bit index */
603 kernel_ulong_t driver_data;
607 /* Wild cards for x86_cpu_id::vendor, family, model and feature */
608 #define X86_VENDOR_ANY 0xffff
609 #define X86_FAMILY_ANY 0
610 #define X86_MODEL_ANY 0
611 #define X86_STEPPING_ANY 0
612 #define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */
615 * Generic table type for matching CPU features.
616 * @feature: the bit number of the feature (0 - 65535)
623 #define IPACK_ANY_FORMAT 0xff
624 #define IPACK_ANY_ID (~0)
625 struct ipack_device_id {
626 __u8 format; /* Format version or IPACK_ANY_ID */
627 __u32 vendor; /* Vendor ID or IPACK_ANY_ID */
628 __u32 device; /* Device ID or IPACK_ANY_ID */
631 #define MEI_CL_MODULE_PREFIX "mei:"
632 #define MEI_CL_NAME_SIZE 32
633 #define MEI_CL_VERSION_ANY 0xff
636 * struct mei_cl_device_id - MEI client device identifier
639 * @version: client protocol version
640 * @driver_info: information used by the driver.
642 * identifies mei client device by uuid and name
644 struct mei_cl_device_id {
645 char name[MEI_CL_NAME_SIZE];
648 kernel_ulong_t driver_info;
653 #define RIO_ANY_ID 0xffff
656 * struct rio_device_id - RIO device identifier
657 * @did: RapidIO device ID
658 * @vid: RapidIO vendor ID
659 * @asm_did: RapidIO assembly device ID
660 * @asm_vid: RapidIO assembly vendor ID
662 * Identifies a RapidIO device based on both the device/vendor IDs and
663 * the assembly device/vendor IDs.
665 struct rio_device_id {
667 __u16 asm_did, asm_vid;
670 struct mcb_device_id {
672 kernel_ulong_t driver_data;
675 struct ulpi_device_id {
678 kernel_ulong_t driver_data;
682 * struct fsl_mc_device_id - MC object device identifier
684 * @obj_type: MC object type
686 * Type of entries in the "device Id" table for MC object devices supported by
687 * a MC object device driver. The last entry of the table has vendor set to 0x0
689 struct fsl_mc_device_id {
691 const char obj_type[16];
695 #endif /* LINUX_MOD_DEVICETABLE_H */