blob: 4c2ddd0941a7514e3b30adbb3211db90c9c39aab [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
3 * Device tables which are exported to userspace via
Stephen Rothwellfb120da2005-08-17 16:42:59 +10004 * scripts/mod/file2alias.c. You must keep that file in sync with this
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 * header.
6 */
7
8#ifndef LINUX_MOD_DEVICETABLE_H
9#define LINUX_MOD_DEVICETABLE_H
10
11#ifdef __KERNEL__
12#include <linux/types.h>
Samuel Ortize5354102013-03-27 17:29:53 +020013#include <linux/uuid.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014typedef unsigned long kernel_ulong_t;
15#endif
16
17#define PCI_ANY_ID (~0)
18
Changbin Du229b4e02019-05-14 22:47:24 +080019/**
20 * struct pci_device_id - PCI device ID structure
21 * @vendor: Vendor ID to match (or PCI_ANY_ID)
22 * @device: Device ID to match (or PCI_ANY_ID)
23 * @subvendor: Subsystem vendor ID to match (or PCI_ANY_ID)
24 * @subdevice: Subsystem device ID to match (or PCI_ANY_ID)
25 * @class: Device class, subclass, and "interface" to match.
26 * See Appendix D of the PCI Local Bus Spec or
27 * include/linux/pci_ids.h for a full list of classes.
28 * Most drivers do not need to specify class/class_mask
29 * as vendor/device is normally sufficient.
30 * @class_mask: Limit which sub-fields of the class field are compared.
31 * See drivers/scsi/sym53c8xx_2/ for example of usage.
32 * @driver_data: Data private to the driver.
33 * Most drivers don't need to use driver_data field.
34 * Best practice is to use driver_data as an index
35 * into a static list of equivalent device types,
36 * instead of using it as a pointer.
37 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070038struct pci_device_id {
39 __u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/
40 __u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
41 __u32 class, class_mask; /* (class,subclass,prog-if) triplet */
42 kernel_ulong_t driver_data; /* Data private to the driver */
43};
44
45
46#define IEEE1394_MATCH_VENDOR_ID 0x0001
47#define IEEE1394_MATCH_MODEL_ID 0x0002
48#define IEEE1394_MATCH_SPECIFIER_ID 0x0004
49#define IEEE1394_MATCH_VERSION 0x0008
50
51struct ieee1394_device_id {
52 __u32 match_flags;
53 __u32 vendor_id;
54 __u32 model_id;
55 __u32 specifier_id;
56 __u32 version;
Andreas Schwab6543bec2013-01-20 17:58:47 +010057 kernel_ulong_t driver_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -070058};
59
60
61/*
62 * Device table entry for "new style" table-driven USB drivers.
63 * User mode code can read these tables to choose which modules to load.
64 * Declare the table as a MODULE_DEVICE_TABLE.
65 *
66 * A probe() parameter will point to a matching entry from this table.
67 * Use the driver_info field for each match to hold information tied
68 * to that match: device quirks, etc.
69 *
70 * Terminate the driver's table with an all-zeroes entry.
71 * Use the flag values to control which fields are compared.
72 */
73
74/**
75 * struct usb_device_id - identifies USB devices for probing and hotplugging
Sharon Dvir32357602015-01-22 12:15:25 +020076 * @match_flags: Bit mask controlling which of the other fields are used to
77 * match against new devices. Any field except for driver_info may be
78 * used, although some only make sense in conjunction with other fields.
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 * This is usually set by a USB_DEVICE_*() macro, which sets all
80 * other fields in this structure except for driver_info.
81 * @idVendor: USB vendor ID for a device; numbers are assigned
82 * by the USB forum to its members.
83 * @idProduct: Vendor-assigned product ID.
84 * @bcdDevice_lo: Low end of range of vendor-assigned product version numbers.
85 * This is also used to identify individual product versions, for
86 * a range consisting of a single device.
87 * @bcdDevice_hi: High end of version number range. The range of product
88 * versions is inclusive.
89 * @bDeviceClass: Class of device; numbers are assigned
90 * by the USB forum. Products may choose to implement classes,
91 * or be vendor-specific. Device classes specify behavior of all
Michael Opdenackerde869912014-10-02 06:45:38 +020092 * the interfaces on a device.
Linus Torvalds1da177e2005-04-16 15:20:36 -070093 * @bDeviceSubClass: Subclass of device; associated with bDeviceClass.
94 * @bDeviceProtocol: Protocol of device; associated with bDeviceClass.
95 * @bInterfaceClass: Class of interface; numbers are assigned
96 * by the USB forum. Products may choose to implement classes,
97 * or be vendor-specific. Interface classes specify behavior only
98 * of a given interface; other interfaces may support other classes.
99 * @bInterfaceSubClass: Subclass of interface; associated with bInterfaceClass.
100 * @bInterfaceProtocol: Protocol of interface; associated with bInterfaceClass.
Bjørn Mork81df2d52012-05-18 21:27:43 +0200101 * @bInterfaceNumber: Number of interface; composite devices may use
102 * fixed interface numbers to differentiate between vendor-specific
103 * interfaces.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104 * @driver_info: Holds information used by the driver. Usually it holds
105 * a pointer to a descriptor understood by the driver, or perhaps
106 * device flags.
107 *
108 * In most cases, drivers will create a table of device IDs by using
109 * USB_DEVICE(), or similar macros designed for that purpose.
110 * They will then export it to userspace using MODULE_DEVICE_TABLE(),
111 * and provide it to the USB core through their usb_driver structure.
112 *
113 * See the usb_match_id() function for information about how matches are
114 * performed. Briefly, you will normally use one of several macros to help
115 * construct these entries. Each entry you provide will either identify
116 * one or more specific products, or will identify a class of products
117 * which have agreed to behave the same. You should put the more specific
118 * matches towards the beginning of your table, so that driver_info can
119 * record quirks of specific products.
120 */
121struct usb_device_id {
122 /* which fields to match against? */
123 __u16 match_flags;
124
125 /* Used for product specific matches; range is inclusive */
126 __u16 idVendor;
127 __u16 idProduct;
128 __u16 bcdDevice_lo;
129 __u16 bcdDevice_hi;
130
131 /* Used for device class matches */
132 __u8 bDeviceClass;
133 __u8 bDeviceSubClass;
134 __u8 bDeviceProtocol;
135
136 /* Used for interface class matches */
137 __u8 bInterfaceClass;
138 __u8 bInterfaceSubClass;
139 __u8 bInterfaceProtocol;
140
Bjørn Mork81df2d52012-05-18 21:27:43 +0200141 /* Used for vendor-specific interface matches */
142 __u8 bInterfaceNumber;
143
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144 /* not matched against */
Greg Kroah-Hartmanfec18682012-06-18 15:38:22 -0700145 kernel_ulong_t driver_info
146 __attribute__((aligned(sizeof(kernel_ulong_t))));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147};
148
149/* Some useful macros to use to create struct usb_device_id */
150#define USB_DEVICE_ID_MATCH_VENDOR 0x0001
151#define USB_DEVICE_ID_MATCH_PRODUCT 0x0002
152#define USB_DEVICE_ID_MATCH_DEV_LO 0x0004
153#define USB_DEVICE_ID_MATCH_DEV_HI 0x0008
154#define USB_DEVICE_ID_MATCH_DEV_CLASS 0x0010
155#define USB_DEVICE_ID_MATCH_DEV_SUBCLASS 0x0020
156#define USB_DEVICE_ID_MATCH_DEV_PROTOCOL 0x0040
157#define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080
158#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
159#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
Bjørn Mork81df2d52012-05-18 21:27:43 +0200160#define USB_DEVICE_ID_MATCH_INT_NUMBER 0x0400
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161
Jiri Slabye8c84f92008-05-19 15:50:01 +0200162#define HID_ANY_ID (~0)
Henrik Rydberg7431fb72012-04-23 12:07:04 +0200163#define HID_BUS_ANY 0xffff
Henrik Rydberg4d53b802012-04-23 12:07:02 +0200164#define HID_GROUP_ANY 0x0000
Jiri Slabye8c84f92008-05-19 15:50:01 +0200165
166struct hid_device_id {
167 __u16 bus;
Henrik Rydberg4d53b802012-04-23 12:07:02 +0200168 __u16 group;
Jiri Slabye8c84f92008-05-19 15:50:01 +0200169 __u32 vendor;
170 __u32 product;
Andreas Schwab6543bec2013-01-20 17:58:47 +0100171 kernel_ulong_t driver_data;
Jiri Slabye8c84f92008-05-19 15:50:01 +0200172};
173
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174/* s390 CCW devices */
175struct ccw_device_id {
176 __u16 match_flags; /* which fields to match against */
177
178 __u16 cu_type; /* control unit type */
179 __u16 dev_type; /* device type */
180 __u8 cu_model; /* control unit model */
181 __u8 dev_model; /* device model */
182
183 kernel_ulong_t driver_info;
184};
185
186#define CCW_DEVICE_ID_MATCH_CU_TYPE 0x01
187#define CCW_DEVICE_ID_MATCH_CU_MODEL 0x02
188#define CCW_DEVICE_ID_MATCH_DEVICE_TYPE 0x04
189#define CCW_DEVICE_ID_MATCH_DEVICE_MODEL 0x08
190
Martin Schwidefsky1534c382006-09-20 15:58:25 +0200191/* s390 AP bus devices */
192struct ap_device_id {
193 __u16 match_flags; /* which fields to match against */
194 __u8 dev_type; /* device type */
Martin Schwidefsky1534c382006-09-20 15:58:25 +0200195 kernel_ulong_t driver_info;
196};
197
Ingo Tuchscherere28d2af2016-08-25 11:16:03 +0200198#define AP_DEVICE_ID_MATCH_CARD_TYPE 0x01
199#define AP_DEVICE_ID_MATCH_QUEUE_TYPE 0x02
Martin Schwidefsky1534c382006-09-20 15:58:25 +0200200
Cornelia Huck7e9db9e2008-07-14 09:58:44 +0200201/* s390 css bus devices (subchannels) */
202struct css_device_id {
Cornelia Huckf08adc02008-07-14 09:59:03 +0200203 __u8 match_flags;
Cornelia Huck7e9db9e2008-07-14 09:58:44 +0200204 __u8 type; /* subchannel type */
Cornelia Huck7e9db9e2008-07-14 09:58:44 +0200205 kernel_ulong_t driver_data;
206};
207
Andreas Schwab6543bec2013-01-20 17:58:47 +0100208#define ACPI_ID_LEN 9
Thomas Renninger29b71a12007-07-23 14:43:51 +0200209
210struct acpi_device_id {
211 __u8 id[ACPI_ID_LEN];
212 kernel_ulong_t driver_data;
Suthikulpanit, Suravee26095a02015-07-07 01:55:20 +0200213 __u32 cls;
214 __u32 cls_msk;
Thomas Renninger29b71a12007-07-23 14:43:51 +0200215};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216
217#define PNP_ID_LEN 8
218#define PNP_MAX_DEVICES 8
219
220struct pnp_device_id {
221 __u8 id[PNP_ID_LEN];
222 kernel_ulong_t driver_data;
223};
224
225struct pnp_card_device_id {
226 __u8 id[PNP_ID_LEN];
227 kernel_ulong_t driver_data;
228 struct {
229 __u8 id[PNP_ID_LEN];
230 } devs[PNP_MAX_DEVICES];
231};
232
233
234#define SERIO_ANY 0xff
235
236struct serio_device_id {
237 __u8 type;
238 __u8 extra;
239 __u8 id;
240 __u8 proto;
241};
242
Subhransu S. Prustyda23ac12015-09-29 13:56:10 +0530243struct hda_device_id {
244 __u32 vendor_id;
245 __u32 rev_id;
246 __u8 api_version;
247 const char *name;
248 unsigned long driver_data;
249};
250
Vinod Koul92513452017-12-14 11:19:33 +0530251struct sdw_device_id {
252 __u16 mfg_id;
253 __u16 part_id;
254 kernel_ulong_t driver_data;
255};
256
Jeff Mahoney5e655772005-07-06 15:44:41 -0400257/*
258 * Struct used for matching a device
259 */
Daniel Thompson851c63e2015-01-05 15:43:39 +0000260struct of_device_id {
Jeff Mahoney5e655772005-07-06 15:44:41 -0400261 char name[32];
262 char type[32];
263 char compatible[128];
Uwe Kleine-Königd7c9a532012-06-07 12:20:14 +0200264 const void *data;
Jeff Mahoney5e655772005-07-06 15:44:41 -0400265};
266
Stephen Rothwellfb120da2005-08-17 16:42:59 +1000267/* VIO */
268struct vio_device_id {
269 char type[32];
270 char compat[32];
271};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272
Dominik Brodowski1ad275e2005-06-27 16:28:06 -0700273/* PCMCIA */
274
275struct pcmcia_device_id {
276 __u16 match_flags;
277
278 __u16 manf_id;
Changbin Du229b4e02019-05-14 22:47:24 +0800279 __u16 card_id;
Dominik Brodowski1ad275e2005-06-27 16:28:06 -0700280
Changbin Du229b4e02019-05-14 22:47:24 +0800281 __u8 func_id;
Dominik Brodowski1ad275e2005-06-27 16:28:06 -0700282
283 /* for real multi-function devices */
Changbin Du229b4e02019-05-14 22:47:24 +0800284 __u8 function;
Dominik Brodowski1ad275e2005-06-27 16:28:06 -0700285
Kars de Jong4fb7edc2005-09-25 14:39:46 +0200286 /* for pseudo multi-function devices */
Changbin Du229b4e02019-05-14 22:47:24 +0800287 __u8 device_no;
Dominik Brodowski1ad275e2005-06-27 16:28:06 -0700288
Changbin Du229b4e02019-05-14 22:47:24 +0800289 __u32 prod_id_hash[4];
Dominik Brodowski1ad275e2005-06-27 16:28:06 -0700290
Frans Klaver99d49e32014-09-04 00:58:23 +0200291 /* not matched against in kernelspace */
Dominik Brodowskiaecab272005-06-27 16:28:56 -0700292 const char * prod_id[4];
Dominik Brodowskiaecab272005-06-27 16:28:56 -0700293
Dominik Brodowski1ad275e2005-06-27 16:28:06 -0700294 /* not matched against */
295 kernel_ulong_t driver_info;
Dominik Brodowskiea7b3882005-06-27 16:28:07 -0700296 char * cisfile;
Dominik Brodowski1ad275e2005-06-27 16:28:06 -0700297};
298
299#define PCMCIA_DEV_ID_MATCH_MANF_ID 0x0001
300#define PCMCIA_DEV_ID_MATCH_CARD_ID 0x0002
301#define PCMCIA_DEV_ID_MATCH_FUNC_ID 0x0004
302#define PCMCIA_DEV_ID_MATCH_FUNCTION 0x0008
303#define PCMCIA_DEV_ID_MATCH_PROD_ID1 0x0010
304#define PCMCIA_DEV_ID_MATCH_PROD_ID2 0x0020
305#define PCMCIA_DEV_ID_MATCH_PROD_ID3 0x0040
306#define PCMCIA_DEV_ID_MATCH_PROD_ID4 0x0080
307#define PCMCIA_DEV_ID_MATCH_DEVICE_NO 0x0100
Dominik Brodowskiea7b3882005-06-27 16:28:07 -0700308#define PCMCIA_DEV_ID_MATCH_FAKE_CIS 0x0200
Dominik Brodowskif602ff72005-06-27 16:28:09 -0700309#define PCMCIA_DEV_ID_MATCH_ANONYMOUS 0x0400
Dominik Brodowski1ad275e2005-06-27 16:28:06 -0700310
Dmitry Torokhovddc5d342006-04-26 00:14:19 -0400311/* Input */
312#define INPUT_DEVICE_ID_EV_MAX 0x1f
Sam Ravnborgdc24f0e2007-03-09 19:59:06 +0100313#define INPUT_DEVICE_ID_KEY_MIN_INTERESTING 0x71
Dmitry Torokhov03bac962008-06-23 10:47:34 -0400314#define INPUT_DEVICE_ID_KEY_MAX 0x2ff
Dmitry Torokhovddc5d342006-04-26 00:14:19 -0400315#define INPUT_DEVICE_ID_REL_MAX 0x0f
Linus Torvaldsb04c99e2013-09-07 09:48:41 -0700316#define INPUT_DEVICE_ID_ABS_MAX 0x3f
Dmitry Torokhovddc5d342006-04-26 00:14:19 -0400317#define INPUT_DEVICE_ID_MSC_MAX 0x07
318#define INPUT_DEVICE_ID_LED_MAX 0x0f
319#define INPUT_DEVICE_ID_SND_MAX 0x07
320#define INPUT_DEVICE_ID_FF_MAX 0x7f
321#define INPUT_DEVICE_ID_SW_MAX 0x0f
Dmitry Torokhov8724ecb2017-10-09 12:01:14 -0700322#define INPUT_DEVICE_ID_PROP_MAX 0x1f
Dmitry Torokhovddc5d342006-04-26 00:14:19 -0400323
324#define INPUT_DEVICE_ID_MATCH_BUS 1
325#define INPUT_DEVICE_ID_MATCH_VENDOR 2
326#define INPUT_DEVICE_ID_MATCH_PRODUCT 4
327#define INPUT_DEVICE_ID_MATCH_VERSION 8
328
329#define INPUT_DEVICE_ID_MATCH_EVBIT 0x0010
330#define INPUT_DEVICE_ID_MATCH_KEYBIT 0x0020
331#define INPUT_DEVICE_ID_MATCH_RELBIT 0x0040
332#define INPUT_DEVICE_ID_MATCH_ABSBIT 0x0080
333#define INPUT_DEVICE_ID_MATCH_MSCIT 0x0100
334#define INPUT_DEVICE_ID_MATCH_LEDBIT 0x0200
335#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x0400
336#define INPUT_DEVICE_ID_MATCH_FFBIT 0x0800
337#define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000
Dmitry Torokhov8724ecb2017-10-09 12:01:14 -0700338#define INPUT_DEVICE_ID_MATCH_PROPBIT 0x2000
Dmitry Torokhovddc5d342006-04-26 00:14:19 -0400339
340struct input_device_id {
341
342 kernel_ulong_t flags;
343
344 __u16 bustype;
345 __u16 vendor;
346 __u16 product;
347 __u16 version;
348
349 kernel_ulong_t evbit[INPUT_DEVICE_ID_EV_MAX / BITS_PER_LONG + 1];
350 kernel_ulong_t keybit[INPUT_DEVICE_ID_KEY_MAX / BITS_PER_LONG + 1];
351 kernel_ulong_t relbit[INPUT_DEVICE_ID_REL_MAX / BITS_PER_LONG + 1];
352 kernel_ulong_t absbit[INPUT_DEVICE_ID_ABS_MAX / BITS_PER_LONG + 1];
353 kernel_ulong_t mscbit[INPUT_DEVICE_ID_MSC_MAX / BITS_PER_LONG + 1];
354 kernel_ulong_t ledbit[INPUT_DEVICE_ID_LED_MAX / BITS_PER_LONG + 1];
355 kernel_ulong_t sndbit[INPUT_DEVICE_ID_SND_MAX / BITS_PER_LONG + 1];
356 kernel_ulong_t ffbit[INPUT_DEVICE_ID_FF_MAX / BITS_PER_LONG + 1];
357 kernel_ulong_t swbit[INPUT_DEVICE_ID_SW_MAX / BITS_PER_LONG + 1];
Dmitry Torokhov8724ecb2017-10-09 12:01:14 -0700358 kernel_ulong_t propbit[INPUT_DEVICE_ID_PROP_MAX / BITS_PER_LONG + 1];
Dmitry Torokhovddc5d342006-04-26 00:14:19 -0400359
360 kernel_ulong_t driver_info;
361};
362
Michael Tokarev07563c72006-09-27 01:50:56 -0700363/* EISA */
364
365#define EISA_SIG_LEN 8
366
367/* The EISA signature, in ASCII form, null terminated */
368struct eisa_device_id {
369 char sig[EISA_SIG_LEN];
370 kernel_ulong_t driver_data;
371};
372
373#define EISA_DEVICE_MODALIAS_FMT "eisa:s%s"
374
Kyle McMartinf2439b22007-01-13 14:57:25 -0500375struct parisc_device_id {
376 __u8 hw_type; /* 5 bits used */
377 __u8 hversion_rev; /* 4 bits */
378 __u16 hversion; /* 12 bits */
379 __u32 sversion; /* 20 bits */
380};
381
Kyle McMartinf354ef82007-01-13 15:02:09 -0500382#define PA_HWTYPE_ANY_ID 0xff
383#define PA_HVERSION_REV_ANY_ID 0xff
384#define PA_HVERSION_ANY_ID 0xffff
385#define PA_SVERSION_ANY_ID 0xffffffff
Kyle McMartinf2439b22007-01-13 14:57:25 -0500386
Pierre Ossman3b38bea2007-06-16 15:54:55 +0200387/* SDIO */
388
389#define SDIO_ANY_ID (~0)
390
391struct sdio_device_id {
392 __u8 class; /* Standard interface or SDIO_ANY_ID */
393 __u16 vendor; /* Vendor or SDIO_ANY_ID */
394 __u16 device; /* Device ID or SDIO_ANY_ID */
Andreas Schwab6543bec2013-01-20 17:58:47 +0100395 kernel_ulong_t driver_data; /* Data private to the driver */
Pierre Ossman3b38bea2007-06-16 15:54:55 +0200396};
397
Michael Buesch61e115a2007-09-18 15:12:50 -0400398/* SSB core, see drivers/ssb/ */
399struct ssb_device_id {
400 __u16 vendor;
401 __u16 coreid;
402 __u8 revision;
Arnd Bergmannb01a60b2013-07-05 17:43:56 +0200403 __u8 __pad;
404} __attribute__((packed, aligned(2)));
Michael Buesch61e115a2007-09-18 15:12:50 -0400405#define SSB_DEVICE(_vendor, _coreid, _revision) \
406 { .vendor = _vendor, .coreid = _coreid, .revision = _revision, }
Michael Buesch61e115a2007-09-18 15:12:50 -0400407
408#define SSB_ANY_VENDOR 0xFFFF
409#define SSB_ANY_ID 0xFFFF
410#define SSB_ANY_REV 0xFF
411
Rafał Miłecki8369ae32011-05-09 18:56:46 +0200412/* Broadcom's specific AMBA core, see drivers/bcma/ */
413struct bcma_device_id {
414 __u16 manuf;
415 __u16 id;
416 __u8 rev;
417 __u8 class;
Arnd Bergmannb01a60b2013-07-05 17:43:56 +0200418} __attribute__((packed,aligned(2)));
Rafał Miłecki8369ae32011-05-09 18:56:46 +0200419#define BCMA_CORE(_manuf, _id, _rev, _class) \
420 { .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, }
Rafał Miłecki8369ae32011-05-09 18:56:46 +0200421
422#define BCMA_ANY_MANUF 0xFFFF
423#define BCMA_ANY_ID 0xFFFF
424#define BCMA_ANY_REV 0xFF
425#define BCMA_ANY_CLASS 0xFF
426
Rusty Russellec3d41c2007-10-22 11:03:36 +1000427struct virtio_device_id {
428 __u32 device;
429 __u32 vendor;
430};
431#define VIRTIO_DEV_ANY_ID 0xffffffff
432
K. Y. Srinivasan17be18c2011-08-25 09:48:29 -0700433/*
434 * For Hyper-V devices we use the device guid as the id.
435 */
436struct hv_vmbus_device_id {
K. Y. Srinivasanaf3ff642015-12-14 16:01:43 -0800437 uuid_le guid;
Andreas Schwab6543bec2013-01-20 17:58:47 +0100438 kernel_ulong_t driver_data; /* Data private to the driver */
K. Y. Srinivasan17be18c2011-08-25 09:48:29 -0700439};
440
Ohad Ben-Cohenbcabbcc2011-10-20 21:10:55 +0200441/* rpmsg */
442
443#define RPMSG_NAME_SIZE 32
444#define RPMSG_DEVICE_MODALIAS_FMT "rpmsg:%s"
445
446struct rpmsg_device_id {
447 char name[RPMSG_NAME_SIZE];
448};
449
Jean Delvared2653e92008-04-29 23:11:39 +0200450/* i2c */
451
452#define I2C_NAME_SIZE 20
453#define I2C_MODULE_PREFIX "i2c:"
454
455struct i2c_device_id {
456 char name[I2C_NAME_SIZE];
Andreas Schwab6543bec2013-01-20 17:58:47 +0100457 kernel_ulong_t driver_data; /* Data private to the driver */
Jean Delvared2653e92008-04-29 23:11:39 +0200458};
459
Kishon Vijay Abraham I5e8cb402017-04-10 19:25:10 +0530460/* pci_epf */
461
462#define PCI_EPF_NAME_SIZE 20
463#define PCI_EPF_MODULE_PREFIX "pci_epf:"
464
465struct pci_epf_device_id {
466 char name[PCI_EPF_NAME_SIZE];
467 kernel_ulong_t driver_data;
468};
469
Boris Brezillon3a379bb2017-07-19 11:52:29 +0200470/* i3c */
471
472#define I3C_MATCH_DCR 0x1
473#define I3C_MATCH_MANUF 0x2
474#define I3C_MATCH_PART 0x4
475#define I3C_MATCH_EXTRA_INFO 0x8
476
477struct i3c_device_id {
478 __u8 match_flags;
479 __u8 dcr;
480 __u16 manuf_id;
481 __u16 part_id;
482 __u16 extra_info;
483
484 const void *data;
485};
486
Anton Vorontsov75368bf2009-09-22 16:46:04 -0700487/* spi */
488
489#define SPI_NAME_SIZE 32
Anton Vorontsove0626e32009-09-22 16:46:08 -0700490#define SPI_MODULE_PREFIX "spi:"
Anton Vorontsov75368bf2009-09-22 16:46:04 -0700491
492struct spi_device_id {
493 char name[SPI_NAME_SIZE];
Andreas Schwab6543bec2013-01-20 17:58:47 +0100494 kernel_ulong_t driver_data; /* Data private to the driver */
Anton Vorontsov75368bf2009-09-22 16:46:04 -0700495};
496
Sagar Dharia3648e782017-12-11 23:42:57 +0000497/* SLIMbus */
498
499#define SLIMBUS_NAME_SIZE 32
500#define SLIMBUS_MODULE_PREFIX "slim:"
501
502struct slim_device_id {
503 __u16 manf_id, prod_code;
504 __u16 dev_index, instance;
505
506 /* Data private to the driver */
507 kernel_ulong_t driver_data;
508};
509
Srinivas Kandagatla6adba212018-05-09 13:56:13 +0100510#define APR_NAME_SIZE 32
511#define APR_MODULE_PREFIX "apr:"
512
513struct apr_device_id {
514 char name[APR_NAME_SIZE];
515 __u32 domain_id;
516 __u32 svc_id;
517 __u32 svc_version;
518 kernel_ulong_t driver_data; /* Data private to the driver */
519};
520
Kenneth Heitke5a86bf32014-02-12 13:44:22 -0600521#define SPMI_NAME_SIZE 32
522#define SPMI_MODULE_PREFIX "spmi:"
523
524struct spmi_device_id {
525 char name[SPMI_NAME_SIZE];
526 kernel_ulong_t driver_data; /* Data private to the driver */
527};
528
David Woodhoused945b692008-09-16 16:23:28 -0700529/* dmi */
530enum dmi_field {
531 DMI_NONE,
532 DMI_BIOS_VENDOR,
533 DMI_BIOS_VERSION,
534 DMI_BIOS_DATE,
535 DMI_SYS_VENDOR,
536 DMI_PRODUCT_NAME,
537 DMI_PRODUCT_VERSION,
538 DMI_PRODUCT_SERIAL,
539 DMI_PRODUCT_UUID,
Simon Glassb23908d2018-06-17 14:09:42 +0200540 DMI_PRODUCT_SKU,
Mika Westerbergc61872c2017-05-17 13:25:12 +0300541 DMI_PRODUCT_FAMILY,
David Woodhoused945b692008-09-16 16:23:28 -0700542 DMI_BOARD_VENDOR,
543 DMI_BOARD_NAME,
544 DMI_BOARD_VERSION,
545 DMI_BOARD_SERIAL,
546 DMI_BOARD_ASSET_TAG,
547 DMI_CHASSIS_VENDOR,
548 DMI_CHASSIS_TYPE,
549 DMI_CHASSIS_VERSION,
550 DMI_CHASSIS_SERIAL,
551 DMI_CHASSIS_ASSET_TAG,
552 DMI_STRING_MAX,
Alex Hungde40614d2018-04-13 15:37:59 +0200553 DMI_OEM_STRING, /* special case - will not be in dmi_ident */
David Woodhoused945b692008-09-16 16:23:28 -0700554};
555
556struct dmi_strmatch {
Jani Nikula5017b282013-07-03 15:05:02 -0700557 unsigned char slot:7;
558 unsigned char exact_match:1;
David Woodhoused945b692008-09-16 16:23:28 -0700559 char substr[79];
560};
561
David Woodhoused945b692008-09-16 16:23:28 -0700562struct dmi_system_id {
563 int (*callback)(const struct dmi_system_id *);
564 const char *ident;
565 struct dmi_strmatch matches[4];
566 void *driver_data;
567};
Alexey Dobriyan40413dc2009-01-22 01:58:36 +0300568/*
569 * struct dmi_device_id appears during expansion of
570 * "MODULE_DEVICE_TABLE(dmi, x)". Compiler doesn't look inside it
571 * but this is enough for gcc 3.4.6 to error out:
572 * error: storage size of '__mod_dmi_device_table' isn't known
573 */
574#define dmi_device_id dmi_system_id
David Woodhoused945b692008-09-16 16:23:28 -0700575
Jani Nikula5017b282013-07-03 15:05:02 -0700576#define DMI_MATCH(a, b) { .slot = a, .substr = b }
577#define DMI_EXACT_MATCH(a, b) { .slot = a, .substr = b, .exact_match = 1 }
Jean Delvared2653e92008-04-29 23:11:39 +0200578
Eric Miao57fee4a2009-02-04 11:52:40 +0800579#define PLATFORM_NAME_SIZE 20
580#define PLATFORM_MODULE_PREFIX "platform:"
581
582struct platform_device_id {
583 char name[PLATFORM_NAME_SIZE];
Andreas Schwab6543bec2013-01-20 17:58:47 +0100584 kernel_ulong_t driver_data;
Eric Miao57fee4a2009-02-04 11:52:40 +0800585};
586
Florian Fainelli648ea012017-02-04 13:02:44 -0800587#define MDIO_NAME_SIZE 32
David Woodhouse8626d3b2010-04-02 01:05:27 +0000588#define MDIO_MODULE_PREFIX "mdio:"
589
Russell Kingd2ed49c2019-12-19 23:24:47 +0000590#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"
David Woodhouse8626d3b2010-04-02 01:05:27 +0000591#define MDIO_ID_ARGS(_id) \
Russell Kingd2ed49c2019-12-19 23:24:47 +0000592 ((_id)>>31) & 1, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \
David Woodhouse8626d3b2010-04-02 01:05:27 +0000593 ((_id)>>27) & 1, ((_id)>>26) & 1, ((_id)>>25) & 1, ((_id)>>24) & 1, \
594 ((_id)>>23) & 1, ((_id)>>22) & 1, ((_id)>>21) & 1, ((_id)>>20) & 1, \
595 ((_id)>>19) & 1, ((_id)>>18) & 1, ((_id)>>17) & 1, ((_id)>>16) & 1, \
596 ((_id)>>15) & 1, ((_id)>>14) & 1, ((_id)>>13) & 1, ((_id)>>12) & 1, \
597 ((_id)>>11) & 1, ((_id)>>10) & 1, ((_id)>>9) & 1, ((_id)>>8) & 1, \
598 ((_id)>>7) & 1, ((_id)>>6) & 1, ((_id)>>5) & 1, ((_id)>>4) & 1, \
599 ((_id)>>3) & 1, ((_id)>>2) & 1, ((_id)>>1) & 1, (_id) & 1
600
601/**
602 * struct mdio_device_id - identifies PHY devices on an MDIO/MII bus
603 * @phy_id: The result of
Robert P. J. Day15c6d8e2018-12-13 15:00:11 -0500604 * (mdio_read(&MII_PHYSID1) << 16 | mdio_read(&MII_PHYSID2)) & @phy_id_mask
David Woodhouse8626d3b2010-04-02 01:05:27 +0000605 * for this PHY type
606 * @phy_id_mask: Defines the significant bits of @phy_id. A value of 0
607 * is used to terminate an array of struct mdio_device_id.
608 */
609struct mdio_device_id {
610 __u32 phy_id;
611 __u32 phy_id_mask;
612};
613
Geert Uytterhoevenbf54a2b2008-11-18 21:13:53 +0100614struct zorro_device_id {
615 __u32 id; /* Device ID or ZORRO_WILDCARD */
616 kernel_ulong_t driver_data; /* Data private to the driver */
617};
618
619#define ZORRO_WILDCARD (0xffffffff) /* not official */
620
621#define ZORRO_DEVICE_MODALIAS_FMT "zorro:i%08X"
622
Rusty Russell90def622010-05-19 17:33:38 -0600623#define ISAPNP_ANY_ID 0xffff
624struct isapnp_device_id {
625 unsigned short card_vendor, card_device;
626 unsigned short vendor, function;
627 kernel_ulong_t driver_data; /* data private to the driver */
628};
629
Dave Martin1e5f9a22011-10-05 14:40:59 +0100630/**
631 * struct amba_id - identifies a device on an AMBA bus
632 * @id: The significant bits if the hardware device ID
633 * @mask: Bitmask specifying which bits of the id field are significant when
634 * matching. A driver binds to a device when ((hardware device ID) & mask)
635 * == id.
636 * @data: Private data used by the driver.
637 */
638struct amba_id {
639 unsigned int id;
640 unsigned int mask;
Dave Martin1e5f9a22011-10-05 14:40:59 +0100641 void *data;
Dave Martin1e5f9a22011-10-05 14:40:59 +0100642};
643
James Hogan8286ae02015-03-25 15:39:50 +0000644/**
645 * struct mips_cdmm_device_id - identifies devices in MIPS CDMM bus
646 * @type: Device type identifier.
647 */
648struct mips_cdmm_device_id {
649 __u8 type;
650};
651
Andi Kleen644e9cb2012-01-26 00:09:05 +0100652/*
653 * Match x86 CPUs for CPU specific drivers.
654 * See documentation of "x86_match_cpu" for details.
655 */
656
Behan Websterc4586252014-02-13 12:21:48 -0800657/*
658 * MODULE_DEVICE_TABLE expects this struct to be called x86cpu_device_id.
659 * Although gcc seems to ignore this error, clang fails without this define.
660 */
661#define x86cpu_device_id x86_cpu_id
Andi Kleen644e9cb2012-01-26 00:09:05 +0100662struct x86_cpu_id {
663 __u16 vendor;
664 __u16 family;
665 __u16 model;
666 __u16 feature; /* bit index */
667 kernel_ulong_t driver_data;
668};
669
Thomas Gleixnerba5bade2020-03-20 14:13:46 +0100670/* Wild cards for x86_cpu_id::vendor, family, model and feature */
Andi Kleen644e9cb2012-01-26 00:09:05 +0100671#define X86_VENDOR_ANY 0xffff
672#define X86_FAMILY_ANY 0
673#define X86_MODEL_ANY 0
674#define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */
675
Ard Biesheuvel67bad2f2014-02-08 13:34:09 +0100676/*
677 * Generic table type for matching CPU features.
678 * @feature: the bit number of the feature (0 - 65535)
679 */
680
681struct cpu_feature {
682 __u16 feature;
683};
684
Jens Taprogge5948ae22012-09-07 10:29:19 +0200685#define IPACK_ANY_FORMAT 0xff
Jens Taprogge849e0ad2012-09-04 17:01:13 +0200686#define IPACK_ANY_ID (~0)
687struct ipack_device_id {
688 __u8 format; /* Format version or IPACK_ANY_ID */
689 __u32 vendor; /* Vendor ID or IPACK_ANY_ID */
690 __u32 device; /* Device ID or IPACK_ANY_ID */
691};
692
Samuel Ortize5354102013-03-27 17:29:53 +0200693#define MEI_CL_MODULE_PREFIX "mei:"
694#define MEI_CL_NAME_SIZE 32
Tomas Winklerb26864c2015-09-10 10:18:01 +0300695#define MEI_CL_VERSION_ANY 0xff
Samuel Ortize5354102013-03-27 17:29:53 +0200696
Tomas Winklerc93b76b2015-05-07 15:54:02 +0300697/**
698 * struct mei_cl_device_id - MEI client device identifier
699 * @name: helper name
700 * @uuid: client uuid
Tomas Winklerb26864c2015-09-10 10:18:01 +0300701 * @version: client protocol version
Tomas Winklerc93b76b2015-05-07 15:54:02 +0300702 * @driver_info: information used by the driver.
703 *
704 * identifies mei client device by uuid and name
705 */
Samuel Ortize5354102013-03-27 17:29:53 +0200706struct mei_cl_device_id {
707 char name[MEI_CL_NAME_SIZE];
Greg Kroah-Hartmanb144ce22015-05-27 17:17:27 -0700708 uuid_le uuid;
Tomas Winklerb26864c2015-09-10 10:18:01 +0300709 __u8 version;
Samuel Ortize5354102013-03-27 17:29:53 +0200710 kernel_ulong_t driver_info;
711};
712
Alexandre Bounine3bdbb622013-07-03 15:08:58 -0700713/* RapidIO */
714
715#define RIO_ANY_ID 0xffff
716
717/**
718 * struct rio_device_id - RIO device identifier
719 * @did: RapidIO device ID
720 * @vid: RapidIO vendor ID
721 * @asm_did: RapidIO assembly device ID
722 * @asm_vid: RapidIO assembly vendor ID
723 *
724 * Identifies a RapidIO device based on both the device/vendor IDs and
725 * the assembly device/vendor IDs.
726 */
727struct rio_device_id {
728 __u16 did, vid;
729 __u16 asm_did, asm_vid;
730};
731
Johannes Thumshirn3764e822014-02-26 17:29:05 +0100732struct mcb_device_id {
733 __u16 device;
734 kernel_ulong_t driver_data;
735};
736
Heikki Krogerus289fcff2015-05-13 15:26:42 +0300737struct ulpi_device_id {
738 __u16 vendor;
739 __u16 product;
740 kernel_ulong_t driver_data;
741};
742
Stuart Yoder0afef452016-06-22 16:40:45 -0500743/**
744 * struct fsl_mc_device_id - MC object device identifier
745 * @vendor: vendor ID
746 * @obj_type: MC object type
Stuart Yoder0afef452016-06-22 16:40:45 -0500747 *
748 * Type of entries in the "device Id" table for MC object devices supported by
749 * a MC object device driver. The last entry of the table has vendor set to 0x0
750 */
751struct fsl_mc_device_id {
752 __u16 vendor;
753 const char obj_type[16];
754};
755
Mika Westerbergd1ff7022017-10-02 13:38:34 +0300756/**
757 * struct tb_service_id - Thunderbolt service identifiers
758 * @match_flags: Flags used to match the structure
759 * @protocol_key: Protocol key the service supports
760 * @protocol_id: Protocol id the service supports
761 * @protocol_version: Version of the protocol
762 * @protocol_revision: Revision of the protocol software
763 * @driver_data: Driver specific data
764 *
765 * Thunderbolt XDomain services are exposed as devices where each device
766 * carries the protocol information the service supports. Thunderbolt
767 * XDomain service drivers match against that information.
768 */
769struct tb_service_id {
770 __u32 match_flags;
771 char protocol_key[8 + 1];
772 __u32 protocol_id;
773 __u32 protocol_version;
774 __u32 protocol_revision;
775 kernel_ulong_t driver_data;
776};
777
778#define TBSVC_MATCH_PROTOCOL_KEY 0x0001
779#define TBSVC_MATCH_PROTOCOL_ID 0x0002
780#define TBSVC_MATCH_PROTOCOL_VERSION 0x0004
781#define TBSVC_MATCH_PROTOCOL_REVISION 0x0008
Stuart Yoder0afef452016-06-22 16:40:45 -0500782
Heikki Krogerus8a37d872018-06-27 18:19:50 +0300783/* USB Type-C Alternate Modes */
784
785#define TYPEC_ANY_MODE 0x7
786
787/**
788 * struct typec_device_id - USB Type-C alternate mode identifiers
789 * @svid: Standard or Vendor ID
790 * @mode: Mode index
Randy Dunlapd23df2d2018-09-03 12:51:59 -0700791 * @driver_data: Driver specific data
Heikki Krogerus8a37d872018-06-27 18:19:50 +0300792 */
793struct typec_device_id {
794 __u16 svid;
795 __u8 mode;
796 kernel_ulong_t driver_data;
797};
798
Sumit Garg0fc1db92019-01-29 11:19:35 +0530799/**
800 * struct tee_client_device_id - tee based device identifier
801 * @uuid: For TEE based client devices we use the device uuid as
802 * the identifier.
803 */
804struct tee_client_device_id {
805 uuid_t uuid;
806};
807
Mattias Jacobssoneacc95e2019-02-19 20:59:49 +0100808/* WMI */
809
810#define WMI_MODULE_PREFIX "wmi:"
811
812/**
813 * struct wmi_device_id - WMI device identifier
814 * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
Mattias Jacobsson8732d852019-07-19 19:51:45 +0200815 * @context: pointer to driver specific data
Mattias Jacobssoneacc95e2019-02-19 20:59:49 +0100816 */
817struct wmi_device_id {
818 const char guid_string[UUID_STRING_LEN+1];
Mattias Jacobssona48e2332019-05-27 18:21:29 +0200819 const void *context;
Mattias Jacobssoneacc95e2019-02-19 20:59:49 +0100820};
821
Manivannan Sadhasivame6b0de462020-02-20 15:28:50 +0530822#define MHI_DEVICE_MODALIAS_FMT "mhi:%s"
Manivannan Sadhasivam0cbf2602020-02-20 15:28:40 +0530823#define MHI_NAME_SIZE 32
824
825/**
826 * struct mhi_device_id - MHI device identification
827 * @chan: MHI channel name
828 * @driver_data: driver data;
829 */
830struct mhi_device_id {
831 const char chan[MHI_NAME_SIZE];
832 kernel_ulong_t driver_data;
833};
834
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835#endif /* LINUX_MOD_DEVICETABLE_H */