1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Device tables which are exported to userspace via
4  * scripts/mod/file2alias.c.  You must keep that file in sync with this
5  * header.
6  */
7 
8 #ifndef LINUX_MOD_DEVICETABLE_H
9 #define LINUX_MOD_DEVICETABLE_H
10 
11 #ifdef __KERNEL__
12 #include <linux/types.h>
13 #include <linux/uuid.h>
14 typedef unsigned long kernel_ulong_t;
15 #endif
16 
17 #define PCI_ANY_ID (~0)
18 
19 /**
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  * @override_only:	Match only when dev->driver_override is this driver.
38  */
39 struct pci_device_id {
40 	__u32 vendor, device;		/* Vendor and device ID or PCI_ANY_ID*/
41 	__u32 subvendor, subdevice;	/* Subsystem ID's or PCI_ANY_ID */
42 	__u32 class, class_mask;	/* (class,subclass,prog-if) triplet */
43 	kernel_ulong_t driver_data;	/* Data private to the driver */
44 	__u32 override_only;
45 };
46 
47 
48 #define IEEE1394_MATCH_VENDOR_ID	0x0001
49 #define IEEE1394_MATCH_MODEL_ID		0x0002
50 #define IEEE1394_MATCH_SPECIFIER_ID	0x0004
51 #define IEEE1394_MATCH_VERSION		0x0008
52 
53 struct ieee1394_device_id {
54 	__u32 match_flags;
55 	__u32 vendor_id;
56 	__u32 model_id;
57 	__u32 specifier_id;
58 	__u32 version;
59 	kernel_ulong_t driver_data;
60 };
61 
62 
63 /*
64  * Device table entry for "new style" table-driven USB drivers.
65  * User mode code can read these tables to choose which modules to load.
66  * Declare the table as a MODULE_DEVICE_TABLE.
67  *
68  * A probe() parameter will point to a matching entry from this table.
69  * Use the driver_info field for each match to hold information tied
70  * to that match:  device quirks, etc.
71  *
72  * Terminate the driver's table with an all-zeroes entry.
73  * Use the flag values to control which fields are compared.
74  */
75 
76 /**
77  * struct usb_device_id - identifies USB devices for probing and hotplugging
78  * @match_flags: Bit mask controlling which of the other fields are used to
79  *	match against new devices. Any field except for driver_info may be
80  *	used, although some only make sense in conjunction with other fields.
81  *	This is usually set by a USB_DEVICE_*() macro, which sets all
82  *	other fields in this structure except for driver_info.
83  * @idVendor: USB vendor ID for a device; numbers are assigned
84  *	by the USB forum to its members.
85  * @idProduct: Vendor-assigned product ID.
86  * @bcdDevice_lo: Low end of range of vendor-assigned product version numbers.
87  *	This is also used to identify individual product versions, for
88  *	a range consisting of a single device.
89  * @bcdDevice_hi: High end of version number range.  The range of product
90  *	versions is inclusive.
91  * @bDeviceClass: Class of device; numbers are assigned
92  *	by the USB forum.  Products may choose to implement classes,
93  *	or be vendor-specific.  Device classes specify behavior of all
94  *	the interfaces on a device.
95  * @bDeviceSubClass: Subclass of device; associated with bDeviceClass.
96  * @bDeviceProtocol: Protocol of device; associated with bDeviceClass.
97  * @bInterfaceClass: Class of interface; numbers are assigned
98  *	by the USB forum.  Products may choose to implement classes,
99  *	or be vendor-specific.  Interface classes specify behavior only
100  *	of a given interface; other interfaces may support other classes.
101  * @bInterfaceSubClass: Subclass of interface; associated with bInterfaceClass.
102  * @bInterfaceProtocol: Protocol of interface; associated with bInterfaceClass.
103  * @bInterfaceNumber: Number of interface; composite devices may use
104  *	fixed interface numbers to differentiate between vendor-specific
105  *	interfaces.
106  * @driver_info: Holds information used by the driver.  Usually it holds
107  *	a pointer to a descriptor understood by the driver, or perhaps
108  *	device flags.
109  *
110  * In most cases, drivers will create a table of device IDs by using
111  * USB_DEVICE(), or similar macros designed for that purpose.
112  * They will then export it to userspace using MODULE_DEVICE_TABLE(),
113  * and provide it to the USB core through their usb_driver structure.
114  *
115  * See the usb_match_id() function for information about how matches are
116  * performed.  Briefly, you will normally use one of several macros to help
117  * construct these entries.  Each entry you provide will either identify
118  * one or more specific products, or will identify a class of products
119  * which have agreed to behave the same.  You should put the more specific
120  * matches towards the beginning of your table, so that driver_info can
121  * record quirks of specific products.
122  */
123 struct usb_device_id {
124 	/* which fields to match against? */
125 	__u16		match_flags;
126 
127 	/* Used for product specific matches; range is inclusive */
128 	__u16		idVendor;
129 	__u16		idProduct;
130 	__u16		bcdDevice_lo;
131 	__u16		bcdDevice_hi;
132 
133 	/* Used for device class matches */
134 	__u8		bDeviceClass;
135 	__u8		bDeviceSubClass;
136 	__u8		bDeviceProtocol;
137 
138 	/* Used for interface class matches */
139 	__u8		bInterfaceClass;
140 	__u8		bInterfaceSubClass;
141 	__u8		bInterfaceProtocol;
142 
143 	/* Used for vendor-specific interface matches */
144 	__u8		bInterfaceNumber;
145 
146 	/* not matched against */
147 	kernel_ulong_t	driver_info
148 		__attribute__((aligned(sizeof(kernel_ulong_t))));
149 };
150 
151 /* Some useful macros to use to create struct usb_device_id */
152 #define USB_DEVICE_ID_MATCH_VENDOR		0x0001
153 #define USB_DEVICE_ID_MATCH_PRODUCT		0x0002
154 #define USB_DEVICE_ID_MATCH_DEV_LO		0x0004
155 #define USB_DEVICE_ID_MATCH_DEV_HI		0x0008
156 #define USB_DEVICE_ID_MATCH_DEV_CLASS		0x0010
157 #define USB_DEVICE_ID_MATCH_DEV_SUBCLASS	0x0020
158 #define USB_DEVICE_ID_MATCH_DEV_PROTOCOL	0x0040
159 #define USB_DEVICE_ID_MATCH_INT_CLASS		0x0080
160 #define USB_DEVICE_ID_MATCH_INT_SUBCLASS	0x0100
161 #define USB_DEVICE_ID_MATCH_INT_PROTOCOL	0x0200
162 #define USB_DEVICE_ID_MATCH_INT_NUMBER		0x0400
163 
164 #define HID_ANY_ID				(~0)
165 #define HID_BUS_ANY				0xffff
166 #define HID_GROUP_ANY				0x0000
167 
168 struct hid_device_id {
169 	__u16 bus;
170 	__u16 group;
171 	__u32 vendor;
172 	__u32 product;
173 	kernel_ulong_t driver_data;
174 };
175 
176 /* s390 CCW devices */
177 struct ccw_device_id {
178 	__u16	match_flags;	/* which fields to match against */
179 
180 	__u16	cu_type;	/* control unit type     */
181 	__u16	dev_type;	/* device type           */
182 	__u8	cu_model;	/* control unit model    */
183 	__u8	dev_model;	/* device model          */
184 
185 	kernel_ulong_t driver_info;
186 };
187 
188 #define CCW_DEVICE_ID_MATCH_CU_TYPE		0x01
189 #define CCW_DEVICE_ID_MATCH_CU_MODEL		0x02
190 #define CCW_DEVICE_ID_MATCH_DEVICE_TYPE		0x04
191 #define CCW_DEVICE_ID_MATCH_DEVICE_MODEL	0x08
192 
193 /* s390 AP bus devices */
194 struct ap_device_id {
195 	__u16 match_flags;	/* which fields to match against */
196 	__u8 dev_type;		/* device type */
197 	kernel_ulong_t driver_info;
198 };
199 
200 #define AP_DEVICE_ID_MATCH_CARD_TYPE		0x01
201 #define AP_DEVICE_ID_MATCH_QUEUE_TYPE		0x02
202 
203 /* s390 css bus devices (subchannels) */
204 struct css_device_id {
205 	__u8 match_flags;
206 	__u8 type; /* subchannel type */
207 	kernel_ulong_t driver_data;
208 };
209 
210 #define ACPI_ID_LEN	9
211 
212 struct acpi_device_id {
213 	__u8 id[ACPI_ID_LEN];
214 	kernel_ulong_t driver_data;
215 	__u32 cls;
216 	__u32 cls_msk;
217 };
218 
219 #define PNP_ID_LEN	8
220 #define PNP_MAX_DEVICES	8
221 
222 struct pnp_device_id {
223 	__u8 id[PNP_ID_LEN];
224 	kernel_ulong_t driver_data;
225 };
226 
227 struct pnp_card_device_id {
228 	__u8 id[PNP_ID_LEN];
229 	kernel_ulong_t driver_data;
230 	struct {
231 		__u8 id[PNP_ID_LEN];
232 	} devs[PNP_MAX_DEVICES];
233 };
234 
235 
236 #define SERIO_ANY	0xff
237 
238 struct serio_device_id {
239 	__u8 type;
240 	__u8 extra;
241 	__u8 id;
242 	__u8 proto;
243 };
244 
245 struct hda_device_id {
246 	__u32 vendor_id;
247 	__u32 rev_id;
248 	__u8 api_version;
249 	const char *name;
250 	unsigned long driver_data;
251 };
252 
253 struct sdw_device_id {
254 	__u16 mfg_id;
255 	__u16 part_id;
256 	__u8  sdw_version;
257 	__u8  class_id;
258 	kernel_ulong_t driver_data;
259 };
260 
261 /*
262  * Struct used for matching a device
263  */
264 struct of_device_id {
265 	char	name[32];
266 	char	type[32];
267 	char	compatible[128];
268 	const void *data;
269 };
270 
271 /* VIO */
272 struct vio_device_id {
273 	char type[32];
274 	char compat[32];
275 };
276 
277 /* PCMCIA */
278 
279 struct pcmcia_device_id {
280 	__u16		match_flags;
281 
282 	__u16		manf_id;
283 	__u16		card_id;
284 
285 	__u8		func_id;
286 
287 	/* for real multi-function devices */
288 	__u8		function;
289 
290 	/* for pseudo multi-function devices */
291 	__u8		device_no;
292 
293 	__u32		prod_id_hash[4];
294 
295 	/* not matched against in kernelspace */
296 	const char *	prod_id[4];
297 
298 	/* not matched against */
299 	kernel_ulong_t	driver_info;
300 	char *		cisfile;
301 };
302 
303 #define PCMCIA_DEV_ID_MATCH_MANF_ID	0x0001
304 #define PCMCIA_DEV_ID_MATCH_CARD_ID	0x0002
305 #define PCMCIA_DEV_ID_MATCH_FUNC_ID	0x0004
306 #define PCMCIA_DEV_ID_MATCH_FUNCTION	0x0008
307 #define PCMCIA_DEV_ID_MATCH_PROD_ID1	0x0010
308 #define PCMCIA_DEV_ID_MATCH_PROD_ID2	0x0020
309 #define PCMCIA_DEV_ID_MATCH_PROD_ID3	0x0040
310 #define PCMCIA_DEV_ID_MATCH_PROD_ID4	0x0080
311 #define PCMCIA_DEV_ID_MATCH_DEVICE_NO	0x0100
312 #define PCMCIA_DEV_ID_MATCH_FAKE_CIS	0x0200
313 #define PCMCIA_DEV_ID_MATCH_ANONYMOUS	0x0400
314 
315 /* Input */
316 #define INPUT_DEVICE_ID_EV_MAX		0x1f
317 #define INPUT_DEVICE_ID_KEY_MIN_INTERESTING	0x71
318 #define INPUT_DEVICE_ID_KEY_MAX		0x2ff
319 #define INPUT_DEVICE_ID_REL_MAX		0x0f
320 #define INPUT_DEVICE_ID_ABS_MAX		0x3f
321 #define INPUT_DEVICE_ID_MSC_MAX		0x07
322 #define INPUT_DEVICE_ID_LED_MAX		0x0f
323 #define INPUT_DEVICE_ID_SND_MAX		0x07
324 #define INPUT_DEVICE_ID_FF_MAX		0x7f
325 #define INPUT_DEVICE_ID_SW_MAX		0x10
326 #define INPUT_DEVICE_ID_PROP_MAX	0x1f
327 
328 #define INPUT_DEVICE_ID_MATCH_BUS	1
329 #define INPUT_DEVICE_ID_MATCH_VENDOR	2
330 #define INPUT_DEVICE_ID_MATCH_PRODUCT	4
331 #define INPUT_DEVICE_ID_MATCH_VERSION	8
332 
333 #define INPUT_DEVICE_ID_MATCH_EVBIT	0x0010
334 #define INPUT_DEVICE_ID_MATCH_KEYBIT	0x0020
335 #define INPUT_DEVICE_ID_MATCH_RELBIT	0x0040
336 #define INPUT_DEVICE_ID_MATCH_ABSBIT	0x0080
337 #define INPUT_DEVICE_ID_MATCH_MSCIT	0x0100
338 #define INPUT_DEVICE_ID_MATCH_LEDBIT	0x0200
339 #define INPUT_DEVICE_ID_MATCH_SNDBIT	0x0400
340 #define INPUT_DEVICE_ID_MATCH_FFBIT	0x0800
341 #define INPUT_DEVICE_ID_MATCH_SWBIT	0x1000
342 #define INPUT_DEVICE_ID_MATCH_PROPBIT	0x2000
343 
344 struct input_device_id {
345 
346 	kernel_ulong_t flags;
347 
348 	__u16 bustype;
349 	__u16 vendor;
350 	__u16 product;
351 	__u16 version;
352 
353 	kernel_ulong_t evbit[INPUT_DEVICE_ID_EV_MAX / BITS_PER_LONG + 1];
354 	kernel_ulong_t keybit[INPUT_DEVICE_ID_KEY_MAX / BITS_PER_LONG + 1];
355 	kernel_ulong_t relbit[INPUT_DEVICE_ID_REL_MAX / BITS_PER_LONG + 1];
356 	kernel_ulong_t absbit[INPUT_DEVICE_ID_ABS_MAX / BITS_PER_LONG + 1];
357 	kernel_ulong_t mscbit[INPUT_DEVICE_ID_MSC_MAX / BITS_PER_LONG + 1];
358 	kernel_ulong_t ledbit[INPUT_DEVICE_ID_LED_MAX / BITS_PER_LONG + 1];
359 	kernel_ulong_t sndbit[INPUT_DEVICE_ID_SND_MAX / BITS_PER_LONG + 1];
360 	kernel_ulong_t ffbit[INPUT_DEVICE_ID_FF_MAX / BITS_PER_LONG + 1];
361 	kernel_ulong_t swbit[INPUT_DEVICE_ID_SW_MAX / BITS_PER_LONG + 1];
362 	kernel_ulong_t propbit[INPUT_DEVICE_ID_PROP_MAX / BITS_PER_LONG + 1];
363 
364 	kernel_ulong_t driver_info;
365 };
366 
367 /* EISA */
368 
369 #define EISA_SIG_LEN   8
370 
371 /* The EISA signature, in ASCII form, null terminated */
372 struct eisa_device_id {
373 	char          sig[EISA_SIG_LEN];
374 	kernel_ulong_t driver_data;
375 };
376 
377 #define EISA_DEVICE_MODALIAS_FMT "eisa:s%s"
378 
379 struct parisc_device_id {
380 	__u8	hw_type;	/* 5 bits used */
381 	__u8	hversion_rev;	/* 4 bits */
382 	__u16	hversion;	/* 12 bits */
383 	__u32	sversion;	/* 20 bits */
384 };
385 
386 #define PA_HWTYPE_ANY_ID	0xff
387 #define PA_HVERSION_REV_ANY_ID	0xff
388 #define PA_HVERSION_ANY_ID	0xffff
389 #define PA_SVERSION_ANY_ID	0xffffffff
390 
391 /* SDIO */
392 
393 #define SDIO_ANY_ID (~0)
394 
395 struct sdio_device_id {
396 	__u8	class;			/* Standard interface or SDIO_ANY_ID */
397 	__u16	vendor;			/* Vendor or SDIO_ANY_ID */
398 	__u16	device;			/* Device ID or SDIO_ANY_ID */
399 	kernel_ulong_t driver_data;	/* Data private to the driver */
400 };
401 
402 /* SSB core, see drivers/ssb/ */
403 struct ssb_device_id {
404 	__u16	vendor;
405 	__u16	coreid;
406 	__u8	revision;
407 	__u8	__pad;
408 } __attribute__((packed, aligned(2)));
409 #define SSB_DEVICE(_vendor, _coreid, _revision)  \
410 	{ .vendor = _vendor, .coreid = _coreid, .revision = _revision, }
411 
412 #define SSB_ANY_VENDOR		0xFFFF
413 #define SSB_ANY_ID		0xFFFF
414 #define SSB_ANY_REV		0xFF
415 
416 /* Broadcom's specific AMBA core, see drivers/bcma/ */
417 struct bcma_device_id {
418 	__u16	manuf;
419 	__u16	id;
420 	__u8	rev;
421 	__u8	class;
422 } __attribute__((packed,aligned(2)));
423 #define BCMA_CORE(_manuf, _id, _rev, _class)  \
424 	{ .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, }
425 
426 #define BCMA_ANY_MANUF		0xFFFF
427 #define BCMA_ANY_ID		0xFFFF
428 #define BCMA_ANY_REV		0xFF
429 #define BCMA_ANY_CLASS		0xFF
430 
431 struct virtio_device_id {
432 	__u32 device;
433 	__u32 vendor;
434 };
435 #define VIRTIO_DEV_ANY_ID	0xffffffff
436 
437 /*
438  * For Hyper-V devices we use the device guid as the id.
439  */
440 struct hv_vmbus_device_id {
441 	guid_t guid;
442 	kernel_ulong_t driver_data;	/* Data private to the driver */
443 };
444 
445 /* rpmsg */
446 
447 #define RPMSG_NAME_SIZE			32
448 #define RPMSG_DEVICE_MODALIAS_FMT	"rpmsg:%s"
449 
450 struct rpmsg_device_id {
451 	char name[RPMSG_NAME_SIZE];
452 	kernel_ulong_t driver_data;
453 };
454 
455 /* i2c */
456 
457 #define I2C_NAME_SIZE	20
458 #define I2C_MODULE_PREFIX "i2c:"
459 
460 struct i2c_device_id {
461 	char name[I2C_NAME_SIZE];
462 	kernel_ulong_t driver_data;	/* Data private to the driver */
463 };
464 
465 /* pci_epf */
466 
467 #define PCI_EPF_NAME_SIZE	20
468 #define PCI_EPF_MODULE_PREFIX	"pci_epf:"
469 
470 struct pci_epf_device_id {
471 	char name[PCI_EPF_NAME_SIZE];
472 	kernel_ulong_t driver_data;
473 };
474 
475 /* i3c */
476 
477 #define I3C_MATCH_DCR			0x1
478 #define I3C_MATCH_MANUF			0x2
479 #define I3C_MATCH_PART			0x4
480 #define I3C_MATCH_EXTRA_INFO		0x8
481 
482 struct i3c_device_id {
483 	__u8 match_flags;
484 	__u8 dcr;
485 	__u16 manuf_id;
486 	__u16 part_id;
487 	__u16 extra_info;
488 
489 	const void *data;
490 };
491 
492 /* spi */
493 
494 #define SPI_NAME_SIZE	32
495 #define SPI_MODULE_PREFIX "spi:"
496 
497 struct spi_device_id {
498 	char name[SPI_NAME_SIZE];
499 	kernel_ulong_t driver_data;	/* Data private to the driver */
500 };
501 
502 /* SLIMbus */
503 
504 #define SLIMBUS_NAME_SIZE	32
505 #define SLIMBUS_MODULE_PREFIX	"slim:"
506 
507 struct slim_device_id {
508 	__u16 manf_id, prod_code;
509 	__u16 dev_index, instance;
510 
511 	/* Data private to the driver */
512 	kernel_ulong_t driver_data;
513 };
514 
515 #define APR_NAME_SIZE	32
516 #define APR_MODULE_PREFIX "apr:"
517 
518 struct apr_device_id {
519 	char name[APR_NAME_SIZE];
520 	__u32 domain_id;
521 	__u32 svc_id;
522 	__u32 svc_version;
523 	kernel_ulong_t driver_data;	/* Data private to the driver */
524 };
525 
526 #define SPMI_NAME_SIZE	32
527 #define SPMI_MODULE_PREFIX "spmi:"
528 
529 struct spmi_device_id {
530 	char name[SPMI_NAME_SIZE];
531 	kernel_ulong_t driver_data;	/* Data private to the driver */
532 };
533 
534 /* dmi */
535 enum dmi_field {
536 	DMI_NONE,
537 	DMI_BIOS_VENDOR,
538 	DMI_BIOS_VERSION,
539 	DMI_BIOS_DATE,
540 	DMI_BIOS_RELEASE,
541 	DMI_EC_FIRMWARE_RELEASE,
542 	DMI_SYS_VENDOR,
543 	DMI_PRODUCT_NAME,
544 	DMI_PRODUCT_VERSION,
545 	DMI_PRODUCT_SERIAL,
546 	DMI_PRODUCT_UUID,
547 	DMI_PRODUCT_SKU,
548 	DMI_PRODUCT_FAMILY,
549 	DMI_BOARD_VENDOR,
550 	DMI_BOARD_NAME,
551 	DMI_BOARD_VERSION,
552 	DMI_BOARD_SERIAL,
553 	DMI_BOARD_ASSET_TAG,
554 	DMI_CHASSIS_VENDOR,
555 	DMI_CHASSIS_TYPE,
556 	DMI_CHASSIS_VERSION,
557 	DMI_CHASSIS_SERIAL,
558 	DMI_CHASSIS_ASSET_TAG,
559 	DMI_STRING_MAX,
560 	DMI_OEM_STRING,	/* special case - will not be in dmi_ident */
561 };
562 
563 struct dmi_strmatch {
564 	unsigned char slot:7;
565 	unsigned char exact_match:1;
566 	char substr[79];
567 };
568 
569 struct dmi_system_id {
570 	int (*callback)(const struct dmi_system_id *);
571 	const char *ident;
572 	struct dmi_strmatch matches[4];
573 	void *driver_data;
574 };
575 /*
576  * struct dmi_device_id appears during expansion of
577  * "MODULE_DEVICE_TABLE(dmi, x)". Compiler doesn't look inside it
578  * but this is enough for gcc 3.4.6 to error out:
579  *	error: storage size of '__mod_dmi_device_table' isn't known
580  */
581 #define dmi_device_id dmi_system_id
582 
583 #define DMI_MATCH(a, b)	{ .slot = a, .substr = b }
584 #define DMI_EXACT_MATCH(a, b)	{ .slot = a, .substr = b, .exact_match = 1 }
585 
586 #define PLATFORM_NAME_SIZE	20
587 #define PLATFORM_MODULE_PREFIX	"platform:"
588 
589 struct platform_device_id {
590 	char name[PLATFORM_NAME_SIZE];
591 	kernel_ulong_t driver_data;
592 };
593 
594 #define MDIO_NAME_SIZE		32
595 #define MDIO_MODULE_PREFIX	"mdio:"
596 
597 #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"
598 #define MDIO_ID_ARGS(_id) \
599 	((_id)>>31) & 1, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \
600 	((_id)>>27) & 1, ((_id)>>26) & 1, ((_id)>>25) & 1, ((_id)>>24) & 1, \
601 	((_id)>>23) & 1, ((_id)>>22) & 1, ((_id)>>21) & 1, ((_id)>>20) & 1, \
602 	((_id)>>19) & 1, ((_id)>>18) & 1, ((_id)>>17) & 1, ((_id)>>16) & 1, \
603 	((_id)>>15) & 1, ((_id)>>14) & 1, ((_id)>>13) & 1, ((_id)>>12) & 1, \
604 	((_id)>>11) & 1, ((_id)>>10) & 1, ((_id)>>9) & 1, ((_id)>>8) & 1, \
605 	((_id)>>7) & 1, ((_id)>>6) & 1, ((_id)>>5) & 1, ((_id)>>4) & 1, \
606 	((_id)>>3) & 1, ((_id)>>2) & 1, ((_id)>>1) & 1, (_id) & 1
607 
608 /**
609  * struct mdio_device_id - identifies PHY devices on an MDIO/MII bus
610  * @phy_id: The result of
611  *     (mdio_read(&MII_PHYSID1) << 16 | mdio_read(&MII_PHYSID2)) & @phy_id_mask
612  *     for this PHY type
613  * @phy_id_mask: Defines the significant bits of @phy_id.  A value of 0
614  *     is used to terminate an array of struct mdio_device_id.
615  */
616 struct mdio_device_id {
617 	__u32 phy_id;
618 	__u32 phy_id_mask;
619 };
620 
621 struct zorro_device_id {
622 	__u32 id;			/* Device ID or ZORRO_WILDCARD */
623 	kernel_ulong_t driver_data;	/* Data private to the driver */
624 };
625 
626 #define ZORRO_WILDCARD			(0xffffffff)	/* not official */
627 
628 #define ZORRO_DEVICE_MODALIAS_FMT	"zorro:i%08X"
629 
630 #define ISAPNP_ANY_ID		0xffff
631 struct isapnp_device_id {
632 	unsigned short card_vendor, card_device;
633 	unsigned short vendor, function;
634 	kernel_ulong_t driver_data;	/* data private to the driver */
635 };
636 
637 /**
638  * struct amba_id - identifies a device on an AMBA bus
639  * @id: The significant bits if the hardware device ID
640  * @mask: Bitmask specifying which bits of the id field are significant when
641  *	matching.  A driver binds to a device when ((hardware device ID) & mask)
642  *	== id.
643  * @data: Private data used by the driver.
644  */
645 struct amba_id {
646 	unsigned int		id;
647 	unsigned int		mask;
648 	void			*data;
649 };
650 
651 /**
652  * struct mips_cdmm_device_id - identifies devices in MIPS CDMM bus
653  * @type:	Device type identifier.
654  */
655 struct mips_cdmm_device_id {
656 	__u8	type;
657 };
658 
659 /*
660  * Match x86 CPUs for CPU specific drivers.
661  * See documentation of "x86_match_cpu" for details.
662  */
663 
664 /*
665  * MODULE_DEVICE_TABLE expects this struct to be called x86cpu_device_id.
666  * Although gcc seems to ignore this error, clang fails without this define.
667  */
668 #define x86cpu_device_id x86_cpu_id
669 struct x86_cpu_id {
670 	__u16 vendor;
671 	__u16 family;
672 	__u16 model;
673 	__u16 steppings;
674 	__u16 feature;	/* bit index */
675 	kernel_ulong_t driver_data;
676 };
677 
678 /* Wild cards for x86_cpu_id::vendor, family, model and feature */
679 #define X86_VENDOR_ANY 0xffff
680 #define X86_FAMILY_ANY 0
681 #define X86_MODEL_ANY  0
682 #define X86_STEPPING_ANY 0
683 #define X86_FEATURE_ANY 0	/* Same as FPU, you can't test for that */
684 
685 /*
686  * Generic table type for matching CPU features.
687  * @feature:	the bit number of the feature (0 - 65535)
688  */
689 
690 struct cpu_feature {
691 	__u16	feature;
692 };
693 
694 #define IPACK_ANY_FORMAT 0xff
695 #define IPACK_ANY_ID (~0)
696 struct ipack_device_id {
697 	__u8  format;			/* Format version or IPACK_ANY_ID */
698 	__u32 vendor;			/* Vendor ID or IPACK_ANY_ID */
699 	__u32 device;			/* Device ID or IPACK_ANY_ID */
700 };
701 
702 #define MEI_CL_MODULE_PREFIX "mei:"
703 #define MEI_CL_NAME_SIZE 32
704 #define MEI_CL_VERSION_ANY 0xff
705 
706 /**
707  * struct mei_cl_device_id - MEI client device identifier
708  * @name: helper name
709  * @uuid: client uuid
710  * @version: client protocol version
711  * @driver_info: information used by the driver.
712  *
713  * identifies mei client device by uuid and name
714  */
715 struct mei_cl_device_id {
716 	char name[MEI_CL_NAME_SIZE];
717 	uuid_le uuid;
718 	__u8    version;
719 	kernel_ulong_t driver_info;
720 };
721 
722 /* RapidIO */
723 
724 #define RIO_ANY_ID	0xffff
725 
726 /**
727  * struct rio_device_id - RIO device identifier
728  * @did: RapidIO device ID
729  * @vid: RapidIO vendor ID
730  * @asm_did: RapidIO assembly device ID
731  * @asm_vid: RapidIO assembly vendor ID
732  *
733  * Identifies a RapidIO device based on both the device/vendor IDs and
734  * the assembly device/vendor IDs.
735  */
736 struct rio_device_id {
737 	__u16 did, vid;
738 	__u16 asm_did, asm_vid;
739 };
740 
741 struct mcb_device_id {
742 	__u16 device;
743 	kernel_ulong_t driver_data;
744 };
745 
746 struct ulpi_device_id {
747 	__u16 vendor;
748 	__u16 product;
749 	kernel_ulong_t driver_data;
750 };
751 
752 /**
753  * struct fsl_mc_device_id - MC object device identifier
754  * @vendor: vendor ID
755  * @obj_type: MC object type
756  *
757  * Type of entries in the "device Id" table for MC object devices supported by
758  * a MC object device driver. The last entry of the table has vendor set to 0x0
759  */
760 struct fsl_mc_device_id {
761 	__u16 vendor;
762 	const char obj_type[16];
763 };
764 
765 /**
766  * struct tb_service_id - Thunderbolt service identifiers
767  * @match_flags: Flags used to match the structure
768  * @protocol_key: Protocol key the service supports
769  * @protocol_id: Protocol id the service supports
770  * @protocol_version: Version of the protocol
771  * @protocol_revision: Revision of the protocol software
772  * @driver_data: Driver specific data
773  *
774  * Thunderbolt XDomain services are exposed as devices where each device
775  * carries the protocol information the service supports. Thunderbolt
776  * XDomain service drivers match against that information.
777  */
778 struct tb_service_id {
779 	__u32 match_flags;
780 	char protocol_key[8 + 1];
781 	__u32 protocol_id;
782 	__u32 protocol_version;
783 	__u32 protocol_revision;
784 	kernel_ulong_t driver_data;
785 };
786 
787 #define TBSVC_MATCH_PROTOCOL_KEY	0x0001
788 #define TBSVC_MATCH_PROTOCOL_ID		0x0002
789 #define TBSVC_MATCH_PROTOCOL_VERSION	0x0004
790 #define TBSVC_MATCH_PROTOCOL_REVISION	0x0008
791 
792 /* USB Type-C Alternate Modes */
793 
794 #define TYPEC_ANY_MODE	0x7
795 
796 /**
797  * struct typec_device_id - USB Type-C alternate mode identifiers
798  * @svid: Standard or Vendor ID
799  * @mode: Mode index
800  * @driver_data: Driver specific data
801  */
802 struct typec_device_id {
803 	__u16 svid;
804 	__u8 mode;
805 	kernel_ulong_t driver_data;
806 };
807 
808 /**
809  * struct tee_client_device_id - tee based device identifier
810  * @uuid: For TEE based client devices we use the device uuid as
811  *        the identifier.
812  */
813 struct tee_client_device_id {
814 	uuid_t uuid;
815 };
816 
817 /* WMI */
818 
819 #define WMI_MODULE_PREFIX	"wmi:"
820 
821 /**
822  * struct wmi_device_id - WMI device identifier
823  * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
824  * @context: pointer to driver specific data
825  */
826 struct wmi_device_id {
827 	const char guid_string[UUID_STRING_LEN+1];
828 	const void *context;
829 };
830 
831 #define MHI_DEVICE_MODALIAS_FMT "mhi:%s"
832 #define MHI_NAME_SIZE 32
833 
834 /**
835  * struct mhi_device_id - MHI device identification
836  * @chan: MHI channel name
837  * @driver_data: driver data;
838  */
839 struct mhi_device_id {
840 	const char chan[MHI_NAME_SIZE];
841 	kernel_ulong_t driver_data;
842 };
843 
844 #define AUXILIARY_NAME_SIZE 32
845 #define AUXILIARY_MODULE_PREFIX "auxiliary:"
846 
847 struct auxiliary_device_id {
848 	char name[AUXILIARY_NAME_SIZE];
849 	kernel_ulong_t driver_data;
850 };
851 
852 /* Surface System Aggregator Module */
853 
854 #define SSAM_MATCH_TARGET	0x1
855 #define SSAM_MATCH_INSTANCE	0x2
856 #define SSAM_MATCH_FUNCTION	0x4
857 
858 struct ssam_device_id {
859 	__u8 match_flags;
860 
861 	__u8 domain;
862 	__u8 category;
863 	__u8 target;
864 	__u8 instance;
865 	__u8 function;
866 
867 	kernel_ulong_t driver_data;
868 };
869 
870 /*
871  * DFL (Device Feature List)
872  *
873  * DFL defines a linked list of feature headers within the device MMIO space to
874  * provide an extensible way of adding features. Software can walk through these
875  * predefined data structures to enumerate features. It is now used in the FPGA.
876  * See Documentation/fpga/dfl.rst for more information.
877  *
878  * The dfl bus type is introduced to match the individual feature devices (dfl
879  * devices) for specific dfl drivers.
880  */
881 
882 /**
883  * struct dfl_device_id -  dfl device identifier
884  * @type: DFL FIU type of the device. See enum dfl_id_type.
885  * @feature_id: feature identifier local to its DFL FIU type.
886  * @driver_data: driver specific data.
887  */
888 struct dfl_device_id {
889 	__u16 type;
890 	__u16 feature_id;
891 	kernel_ulong_t driver_data;
892 };
893 
894 #endif /* LINUX_MOD_DEVICETABLE_H */
895