Lines Matching +full:i2c +full:- +full:alias
1 /* Simple code to turn various tables in an ELF file into alias definitions.
5 * Copyright 2002-2003 Rusty Russell, IBM Corporation
14 #include "devicetable-offsets.h"
63 int (*do_entry)(const char *filename, void *symval, char *alias);
66 /* Size of alias provided to do_entry functions */
73 typeof(((struct devid *)0)->f) f = TO_NATIVE(*(typeof(f) *)((m) + OFF_##devid##_##f))
80 typeof(((struct devid *)0)->f) *v = ((m) + OFF_##devid##_##f)
107 if (str[len - 1] != '*') in add_wildcard()
115 sprintf(str + len, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", in add_uuid()
126 sprintf(str + len, "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", in add_guid()
135 * in .o file. If in-consistent then userspace and kernel does not agree
153 if (*(uint8_t*)(symval+size-id_size+i)) { in device_id_check()
159 *(uint8_t*)(symval+size-id_size+i) ); in device_id_check()
174 char alias[500]; in do_usb_entry() local
187 strcpy(alias, "usb:"); in do_usb_entry()
188 ADD(alias, "v", match_flags&USB_DEVICE_ID_MATCH_VENDOR, in do_usb_entry()
190 ADD(alias, "p", match_flags&USB_DEVICE_ID_MATCH_PRODUCT, in do_usb_entry()
193 strcat(alias, "d"); in do_usb_entry()
195 sprintf(alias + strlen(alias), "%0*X", in do_usb_entry()
198 sprintf(alias + strlen(alias), "%X", range_lo); in do_usb_entry()
201 sprintf(alias + strlen(alias), in do_usb_entry()
202 "[%X-%X]", in do_usb_entry()
206 sprintf(alias + strlen(alias), in do_usb_entry()
207 range_lo < 0x9 ? "[%X-9" : "[%X", in do_usb_entry()
209 sprintf(alias + strlen(alias), in do_usb_entry()
210 range_hi > 0xA ? "A-%X]" : "%X]", in do_usb_entry()
214 if (bcdDevice_initial_digits < (sizeof(bcdDevice_lo) * 2 - 1)) in do_usb_entry()
215 strcat(alias, "*"); in do_usb_entry()
217 ADD(alias, "dc", match_flags&USB_DEVICE_ID_MATCH_DEV_CLASS, in do_usb_entry()
219 ADD(alias, "dsc", match_flags&USB_DEVICE_ID_MATCH_DEV_SUBCLASS, in do_usb_entry()
221 ADD(alias, "dp", match_flags&USB_DEVICE_ID_MATCH_DEV_PROTOCOL, in do_usb_entry()
223 ADD(alias, "ic", match_flags&USB_DEVICE_ID_MATCH_INT_CLASS, in do_usb_entry()
225 ADD(alias, "isc", match_flags&USB_DEVICE_ID_MATCH_INT_SUBCLASS, in do_usb_entry()
227 ADD(alias, "ip", match_flags&USB_DEVICE_ID_MATCH_INT_PROTOCOL, in do_usb_entry()
229 ADD(alias, "in", match_flags&USB_DEVICE_ID_MATCH_INT_NUMBER, in do_usb_entry()
232 add_wildcard(alias); in do_usb_entry()
233 buf_printf(&mod->dev_table_buf, in do_usb_entry()
234 "MODULE_ALIAS(\"%s\");\n", alias); in do_usb_entry()
238 /* Returns the previous value, so it works like i++ or i-- */
308 * run-time specification that results in catch-all alias in do_usb_entry_multi()
313 /* Convert numeric bcdDevice range into fnmatch-able pattern(s) */ in do_usb_entry_multi()
314 for (ndigits = sizeof(bcdDevice_lo) * 2 - 1; devlo <= devhi; ndigits--) { in do_usb_entry_multi()
335 incbcd(&devhi, -1, max, in do_usb_entry_multi()
347 device_id_check(mod->name, "usb", size, id_size, symval); in do_usb_table()
350 size -= id_size; in do_usb_table()
358 char alias[500]; in do_of_entry_multi() local
366 len = sprintf(alias, "of:N%sT%s", (*name)[0] ? *name : "*", in do_of_entry_multi()
370 sprintf(&alias[len], "%sC%s", (*type)[0] ? "*" : "", in do_of_entry_multi()
374 for (tmp = alias; tmp && *tmp; tmp++) in do_of_entry_multi()
378 buf_printf(&mod->dev_table_buf, "MODULE_ALIAS(\"%s\");\n", alias); in do_of_entry_multi()
379 strcat(alias, "C"); in do_of_entry_multi()
380 add_wildcard(alias); in do_of_entry_multi()
381 buf_printf(&mod->dev_table_buf, "MODULE_ALIAS(\"%s\");\n", alias); in do_of_entry_multi()
390 device_id_check(mod->name, "of", size, id_size, symval); in do_of_table()
393 size -= id_size; in do_of_table()
401 void *symval, char *alias) in do_hid_entry() argument
408 sprintf(alias, "hid:"); in do_hid_entry()
409 ADD(alias, "b", bus != HID_BUS_ANY, bus); in do_hid_entry()
410 ADD(alias, "g", group != HID_GROUP_ANY, group); in do_hid_entry()
411 ADD(alias, "v", vendor != HID_ANY_ID, vendor); in do_hid_entry()
412 ADD(alias, "p", product != HID_ANY_ID, product); in do_hid_entry()
419 void *symval, char *alias) in do_ieee1394_entry() argument
427 strcpy(alias, "ieee1394:"); in do_ieee1394_entry()
428 ADD(alias, "ven", match_flags & IEEE1394_MATCH_VENDOR_ID, in do_ieee1394_entry()
430 ADD(alias, "mo", match_flags & IEEE1394_MATCH_MODEL_ID, in do_ieee1394_entry()
432 ADD(alias, "sp", match_flags & IEEE1394_MATCH_SPECIFIER_ID, in do_ieee1394_entry()
434 ADD(alias, "ver", match_flags & IEEE1394_MATCH_VERSION, in do_ieee1394_entry()
437 add_wildcard(alias); in do_ieee1394_entry()
443 void *symval, char *alias) in do_pci_entry() argument
459 strcpy(alias, "pci:"); in do_pci_entry()
462 strcpy(alias, "vfio_pci:"); in do_pci_entry()
465 warn("Unknown PCI driver_override alias %08X\n", in do_pci_entry()
470 ADD(alias, "v", vendor != PCI_ANY_ID, vendor); in do_pci_entry()
471 ADD(alias, "d", device != PCI_ANY_ID, device); in do_pci_entry()
472 ADD(alias, "sv", subvendor != PCI_ANY_ID, subvendor); in do_pci_entry()
473 ADD(alias, "sd", subdevice != PCI_ANY_ID, subdevice); in do_pci_entry()
490 ADD(alias, "bc", baseclass_mask == 0xFF, baseclass); in do_pci_entry()
491 ADD(alias, "sc", subclass_mask == 0xFF, subclass); in do_pci_entry()
492 ADD(alias, "i", interface_mask == 0xFF, interface); in do_pci_entry()
493 add_wildcard(alias); in do_pci_entry()
499 void *symval, char *alias) in do_ccw_entry() argument
507 strcpy(alias, "ccw:"); in do_ccw_entry()
508 ADD(alias, "t", match_flags&CCW_DEVICE_ID_MATCH_CU_TYPE, in do_ccw_entry()
510 ADD(alias, "m", match_flags&CCW_DEVICE_ID_MATCH_CU_MODEL, in do_ccw_entry()
512 ADD(alias, "dt", match_flags&CCW_DEVICE_ID_MATCH_DEVICE_TYPE, in do_ccw_entry()
514 ADD(alias, "dm", match_flags&CCW_DEVICE_ID_MATCH_DEVICE_MODEL, in do_ccw_entry()
516 add_wildcard(alias); in do_ccw_entry()
522 void *symval, char *alias) in do_ap_entry() argument
526 sprintf(alias, "ap:t%02X*", dev_type); in do_ap_entry()
532 void *symval, char *alias) in do_css_entry() argument
536 sprintf(alias, "css:t%01X", type); in do_css_entry()
542 void *symval, char *alias) in do_serio_entry() argument
549 strcpy(alias, "serio:"); in do_serio_entry()
550 ADD(alias, "ty", type != SERIO_ANY, type); in do_serio_entry()
551 ADD(alias, "pr", proto != SERIO_ANY, proto); in do_serio_entry()
552 ADD(alias, "id", id != SERIO_ANY, id); in do_serio_entry()
553 ADD(alias, "ex", extra != SERIO_ANY, extra); in do_serio_entry()
555 add_wildcard(alias); in do_serio_entry()
560 * "acpi:bbsspp" (bb=base-class, ss=sub-class, pp=prog-if)
567 void *symval, char *alias) in do_acpi_entry() argument
574 sprintf(alias, "acpi*:%s:*", *id); in do_acpi_entry()
579 sprintf(&alias[cnt], "acpi*:"); in do_acpi_entry()
582 byte_shift = 8 * (3-i); in do_acpi_entry()
585 sprintf(&alias[cnt], "%02x", in do_acpi_entry()
588 sprintf(&alias[cnt], "??"); in do_acpi_entry()
591 sprintf(&alias[cnt], ":*"); in do_acpi_entry()
601 const unsigned int count = (size / id_size)-1; in do_pnp_device_entry()
604 device_id_check(mod->name, "pnp", size, id_size, symval); in do_pnp_device_entry()
611 buf_printf(&mod->dev_table_buf, in do_pnp_device_entry()
617 buf_printf(&mod->dev_table_buf, in do_pnp_device_entry()
627 const unsigned int count = (size / id_size)-1; in do_pnp_card_entries()
630 device_id_check(mod->name, "pnp", size, id_size, symval); in do_pnp_card_entries()
664 /* add an individual alias for every device entry */ in do_pnp_card_entries()
669 buf_printf(&mod->dev_table_buf, in do_pnp_card_entries()
675 buf_printf(&mod->dev_table_buf, in do_pnp_card_entries()
684 void *symval, char *alias) in do_pcmcia_entry() argument
699 strcpy(alias, "pcmcia:"); in do_pcmcia_entry()
700 ADD(alias, "m", match_flags & PCMCIA_DEV_ID_MATCH_MANF_ID, in do_pcmcia_entry()
702 ADD(alias, "c", match_flags & PCMCIA_DEV_ID_MATCH_CARD_ID, in do_pcmcia_entry()
704 ADD(alias, "f", match_flags & PCMCIA_DEV_ID_MATCH_FUNC_ID, in do_pcmcia_entry()
706 ADD(alias, "fn", match_flags & PCMCIA_DEV_ID_MATCH_FUNCTION, in do_pcmcia_entry()
708 ADD(alias, "pfn", match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO, in do_pcmcia_entry()
710 ADD(alias, "pa", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID1, (*prod_id_hash)[0]); in do_pcmcia_entry()
711 ADD(alias, "pb", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID2, (*prod_id_hash)[1]); in do_pcmcia_entry()
712 ADD(alias, "pc", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID3, (*prod_id_hash)[2]); in do_pcmcia_entry()
713 ADD(alias, "pd", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID4, (*prod_id_hash)[3]); in do_pcmcia_entry()
715 add_wildcard(alias); in do_pcmcia_entry()
720 char *alias) in do_vio_entry() argument
726 sprintf(alias, "vio:T%sS%s", (*type)[0] ? *type : "*", in do_vio_entry()
730 for (tmp = alias; tmp && *tmp; tmp++) in do_vio_entry()
734 add_wildcard(alias); in do_vio_entry()
738 static void do_input(char *alias, in do_input() argument
747 sprintf(alias + strlen(alias), "%X,*", i); in do_input()
750 /* input:b0v0p0e0-eXkXrXaXmXlXsXfXwX where X is comma-separated %02X. */
752 char *alias) in do_input_entry() argument
769 sprintf(alias, "input:"); in do_input_entry()
771 ADD(alias, "b", flags & INPUT_DEVICE_ID_MATCH_BUS, bustype); in do_input_entry()
772 ADD(alias, "v", flags & INPUT_DEVICE_ID_MATCH_VENDOR, vendor); in do_input_entry()
773 ADD(alias, "p", flags & INPUT_DEVICE_ID_MATCH_PRODUCT, product); in do_input_entry()
774 ADD(alias, "e", flags & INPUT_DEVICE_ID_MATCH_VERSION, version); in do_input_entry()
776 sprintf(alias + strlen(alias), "-e*"); in do_input_entry()
778 do_input(alias, *evbit, 0, INPUT_DEVICE_ID_EV_MAX); in do_input_entry()
779 sprintf(alias + strlen(alias), "k*"); in do_input_entry()
781 do_input(alias, *keybit, in do_input_entry()
784 sprintf(alias + strlen(alias), "r*"); in do_input_entry()
786 do_input(alias, *relbit, 0, INPUT_DEVICE_ID_REL_MAX); in do_input_entry()
787 sprintf(alias + strlen(alias), "a*"); in do_input_entry()
789 do_input(alias, *absbit, 0, INPUT_DEVICE_ID_ABS_MAX); in do_input_entry()
790 sprintf(alias + strlen(alias), "m*"); in do_input_entry()
792 do_input(alias, *mscbit, 0, INPUT_DEVICE_ID_MSC_MAX); in do_input_entry()
793 sprintf(alias + strlen(alias), "l*"); in do_input_entry()
795 do_input(alias, *ledbit, 0, INPUT_DEVICE_ID_LED_MAX); in do_input_entry()
796 sprintf(alias + strlen(alias), "s*"); in do_input_entry()
798 do_input(alias, *sndbit, 0, INPUT_DEVICE_ID_SND_MAX); in do_input_entry()
799 sprintf(alias + strlen(alias), "f*"); in do_input_entry()
801 do_input(alias, *ffbit, 0, INPUT_DEVICE_ID_FF_MAX); in do_input_entry()
802 sprintf(alias + strlen(alias), "w*"); in do_input_entry()
804 do_input(alias, *swbit, 0, INPUT_DEVICE_ID_SW_MAX); in do_input_entry()
809 char *alias) in do_eisa_entry() argument
813 sprintf(alias, EISA_DEVICE_MODALIAS_FMT "*", *sig); in do_eisa_entry()
815 strcat(alias, "*"); in do_eisa_entry()
821 char *alias) in do_parisc_entry() argument
828 strcpy(alias, "parisc:"); in do_parisc_entry()
829 ADD(alias, "t", hw_type != PA_HWTYPE_ANY_ID, hw_type); in do_parisc_entry()
830 ADD(alias, "hv", hversion != PA_HVERSION_ANY_ID, hversion); in do_parisc_entry()
831 ADD(alias, "rev", hversion_rev != PA_HVERSION_REV_ANY_ID, hversion_rev); in do_parisc_entry()
832 ADD(alias, "sv", sversion != PA_SVERSION_ANY_ID, sversion); in do_parisc_entry()
834 add_wildcard(alias); in do_parisc_entry()
840 void *symval, char *alias) in do_sdio_entry() argument
846 strcpy(alias, "sdio:"); in do_sdio_entry()
847 ADD(alias, "c", class != (__u8)SDIO_ANY_ID, class); in do_sdio_entry()
848 ADD(alias, "v", vendor != (__u16)SDIO_ANY_ID, vendor); in do_sdio_entry()
849 ADD(alias, "d", device != (__u16)SDIO_ANY_ID, device); in do_sdio_entry()
850 add_wildcard(alias); in do_sdio_entry()
856 void *symval, char *alias) in do_ssb_entry() argument
862 strcpy(alias, "ssb:"); in do_ssb_entry()
863 ADD(alias, "v", vendor != SSB_ANY_VENDOR, vendor); in do_ssb_entry()
864 ADD(alias, "id", coreid != SSB_ANY_ID, coreid); in do_ssb_entry()
865 ADD(alias, "rev", revision != SSB_ANY_REV, revision); in do_ssb_entry()
866 add_wildcard(alias); in do_ssb_entry()
872 void *symval, char *alias) in do_bcma_entry() argument
879 strcpy(alias, "bcma:"); in do_bcma_entry()
880 ADD(alias, "m", manuf != BCMA_ANY_MANUF, manuf); in do_bcma_entry()
881 ADD(alias, "id", id != BCMA_ANY_ID, id); in do_bcma_entry()
882 ADD(alias, "rev", rev != BCMA_ANY_REV, rev); in do_bcma_entry()
883 ADD(alias, "cl", class != BCMA_ANY_CLASS, class); in do_bcma_entry()
884 add_wildcard(alias); in do_bcma_entry()
890 char *alias) in do_virtio_entry() argument
895 strcpy(alias, "virtio:"); in do_virtio_entry()
896 ADD(alias, "d", device != VIRTIO_DEV_ANY_ID, device); in do_virtio_entry()
897 ADD(alias, "v", vendor != VIRTIO_DEV_ANY_ID, vendor); in do_virtio_entry()
899 add_wildcard(alias); in do_virtio_entry()
910 char *alias) in do_vmbus_entry() argument
917 sprintf(&guid_name[i], "%02x", TO_NATIVE((guid->b)[i/2])); in do_vmbus_entry()
919 strcpy(alias, "vmbus:"); in do_vmbus_entry()
920 strcat(alias, guid_name); in do_vmbus_entry()
927 char *alias) in do_rpmsg_entry() argument
930 sprintf(alias, RPMSG_DEVICE_MODALIAS_FMT, *name); in do_rpmsg_entry()
935 /* Looks like: i2c:S */
937 char *alias) in do_i2c_entry() argument
940 sprintf(alias, I2C_MODULE_PREFIX "%s", *name); in do_i2c_entry()
946 char *alias) in do_i3c_entry() argument
954 strcpy(alias, "i3c:"); in do_i3c_entry()
955 ADD(alias, "dcr", match_flags & I3C_MATCH_DCR, dcr); in do_i3c_entry()
956 ADD(alias, "manuf", match_flags & I3C_MATCH_MANUF, manuf_id); in do_i3c_entry()
957 ADD(alias, "part", match_flags & I3C_MATCH_PART, part_id); in do_i3c_entry()
958 ADD(alias, "ext", match_flags & I3C_MATCH_EXTRA_INFO, extra_info); in do_i3c_entry()
963 static int do_slim_entry(const char *filename, void *symval, char *alias) in do_slim_entry() argument
968 sprintf(alias, "slim:%x:%x:*", manf_id, prod_code); in do_slim_entry()
975 char *alias) in do_spi_entry() argument
978 sprintf(alias, SPI_MODULE_PREFIX "%s", *name); in do_spi_entry()
1016 char *alias) in do_dmi_entry() argument
1020 sprintf(alias, "dmi*"); in do_dmi_entry()
1026 sprintf(alias + strlen(alias), ":%s*", in do_dmi_entry()
1028 dmi_ascii_filter(alias + strlen(alias), in do_dmi_entry()
1030 strcat(alias, "*"); in do_dmi_entry()
1035 strcat(alias, ":"); in do_dmi_entry()
1040 void *symval, char *alias) in do_platform_entry() argument
1043 sprintf(alias, PLATFORM_MODULE_PREFIX "%s", *name); in do_platform_entry()
1048 void *symval, char *alias) in do_mdio_entry() argument
1054 alias += sprintf(alias, MDIO_MODULE_PREFIX); in do_mdio_entry()
1057 if (!((phy_id_mask >> (31-i)) & 1)) in do_mdio_entry()
1058 *(alias++) = '?'; in do_mdio_entry()
1059 else if ((phy_id >> (31-i)) & 1) in do_mdio_entry()
1060 *(alias++) = '1'; in do_mdio_entry()
1062 *(alias++) = '0'; in do_mdio_entry()
1066 *alias = 0; in do_mdio_entry()
1073 char *alias) in do_zorro_entry() argument
1076 strcpy(alias, "zorro:"); in do_zorro_entry()
1077 ADD(alias, "i", id != ZORRO_WILDCARD, id); in do_zorro_entry()
1083 void *symval, char *alias) in do_isapnp_entry() argument
1087 sprintf(alias, "pnp:d%c%c%c%x%x%x%x*", in do_isapnp_entry()
1088 'A' + ((vendor >> 2) & 0x3f) - 1, in do_isapnp_entry()
1089 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1, in do_isapnp_entry()
1090 'A' + ((vendor >> 8) & 0x1f) - 1, in do_isapnp_entry()
1098 void *symval, char *alias) in do_ipack_entry() argument
1103 strcpy(alias, "ipack:"); in do_ipack_entry()
1104 ADD(alias, "f", format != IPACK_ANY_FORMAT, format); in do_ipack_entry()
1105 ADD(alias, "v", vendor != IPACK_ANY_ID, vendor); in do_ipack_entry()
1106 ADD(alias, "d", device != IPACK_ANY_ID, device); in do_ipack_entry()
1107 add_wildcard(alias); in do_ipack_entry()
1146 /* Ensure that the string remains NUL-terminated: */ in append_nibble_mask()
1149 /* Advance the caller's end-of-string pointer: */ in append_nibble_mask()
1156 * N is exactly 8 digits, where each is an upper-case hex digit, or
1160 void *symval, char *alias) in do_amba_entry() argument
1163 char *p = alias; in do_amba_entry()
1168 …fatal("%s: Masked-off bit(s) of AMBA device ID are non-zero: id=0x%08X, mask=0x%08X. Please fix t… in do_amba_entry()
1171 p += sprintf(alias, "amba:d"); in do_amba_entry()
1174 (id >> (4 * (7 - digit))) & 0xf, in do_amba_entry()
1175 (mask >> (4 * (7 - digit))) & 0xf); in do_amba_entry()
1183 * N is exactly 2 digits, where each is an upper-case hex digit, or
1187 void *symval, char *alias) in do_mips_cdmm_entry() argument
1191 sprintf(alias, "mipscdmm:t%02X*", type); in do_mips_cdmm_entry()
1202 char *alias) in do_x86cpu_entry() argument
1209 strcpy(alias, "cpu:type:x86,"); in do_x86cpu_entry()
1210 ADD(alias, "ven", vendor != X86_VENDOR_ANY, vendor); in do_x86cpu_entry()
1211 ADD(alias, "fam", family != X86_FAMILY_ANY, family); in do_x86cpu_entry()
1212 ADD(alias, "mod", model != X86_MODEL_ANY, model); in do_x86cpu_entry()
1213 strcat(alias, ":feature:*"); in do_x86cpu_entry()
1215 sprintf(alias + strlen(alias), "%04X*", feature); in do_x86cpu_entry()
1220 static int do_cpu_entry(const char *filename, void *symval, char *alias) in do_cpu_entry() argument
1224 sprintf(alias, "cpu:type:*:feature:*%04X*", feature); in do_cpu_entry()
1230 char *alias) in do_mei_entry() argument
1236 sprintf(alias, MEI_CL_MODULE_PREFIX); in do_mei_entry()
1237 sprintf(alias + strlen(alias), "%s:", (*name)[0] ? *name : "*"); in do_mei_entry()
1238 add_uuid(alias, *uuid); in do_mei_entry()
1239 ADD(alias, ":", version != MEI_CL_VERSION_ANY, version); in do_mei_entry()
1241 strcat(alias, ":*"); in do_mei_entry()
1248 void *symval, char *alias) in do_rio_entry() argument
1255 strcpy(alias, "rapidio:"); in do_rio_entry()
1256 ADD(alias, "v", vid != RIO_ANY_ID, vid); in do_rio_entry()
1257 ADD(alias, "d", did != RIO_ANY_ID, did); in do_rio_entry()
1258 ADD(alias, "av", asm_vid != RIO_ANY_ID, asm_vid); in do_rio_entry()
1259 ADD(alias, "ad", asm_did != RIO_ANY_ID, asm_did); in do_rio_entry()
1261 add_wildcard(alias); in do_rio_entry()
1267 char *alias) in do_ulpi_entry() argument
1272 sprintf(alias, "ulpi:v%04xp%04x", vendor, product); in do_ulpi_entry()
1278 static int do_hda_entry(const char *filename, void *symval, char *alias) in do_hda_entry() argument
1284 strcpy(alias, "hdaudio:"); in do_hda_entry()
1285 ADD(alias, "v", vendor_id != 0, vendor_id); in do_hda_entry()
1286 ADD(alias, "r", rev_id != 0, rev_id); in do_hda_entry()
1287 ADD(alias, "a", api_version != 0, api_version); in do_hda_entry()
1289 add_wildcard(alias); in do_hda_entry()
1294 static int do_sdw_entry(const char *filename, void *symval, char *alias) in do_sdw_entry() argument
1301 strcpy(alias, "sdw:"); in do_sdw_entry()
1302 ADD(alias, "m", mfg_id != 0, mfg_id); in do_sdw_entry()
1303 ADD(alias, "p", part_id != 0, part_id); in do_sdw_entry()
1304 ADD(alias, "v", sdw_version != 0, sdw_version); in do_sdw_entry()
1305 ADD(alias, "c", class_id != 0, class_id); in do_sdw_entry()
1307 add_wildcard(alias); in do_sdw_entry()
1311 /* Looks like: fsl-mc:vNdN */
1313 char *alias) in do_fsl_mc_entry() argument
1318 sprintf(alias, "fsl-mc:v%08Xd%s", vendor, *obj_type); in do_fsl_mc_entry()
1323 static int do_tbsvc_entry(const char *filename, void *symval, char *alias) in do_tbsvc_entry() argument
1331 strcpy(alias, "tbsvc:"); in do_tbsvc_entry()
1333 sprintf(alias + strlen(alias), "k%s", *protocol_key); in do_tbsvc_entry()
1335 strcat(alias + strlen(alias), "k*"); in do_tbsvc_entry()
1336 ADD(alias, "p", match_flags & TBSVC_MATCH_PROTOCOL_ID, protocol_id); in do_tbsvc_entry()
1337 ADD(alias, "v", match_flags & TBSVC_MATCH_PROTOCOL_VERSION, in do_tbsvc_entry()
1339 ADD(alias, "r", match_flags & TBSVC_MATCH_PROTOCOL_REVISION, in do_tbsvc_entry()
1342 add_wildcard(alias); in do_tbsvc_entry()
1347 static int do_typec_entry(const char *filename, void *symval, char *alias) in do_typec_entry() argument
1352 sprintf(alias, "typec:id%04X", svid); in do_typec_entry()
1353 ADD(alias, "m", mode != TYPEC_ANY_MODE, mode); in do_typec_entry()
1359 static int do_tee_entry(const char *filename, void *symval, char *alias) in do_tee_entry() argument
1363 sprintf(alias, "tee:%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", in do_tee_entry()
1364 uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4], in do_tee_entry()
1365 uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9], in do_tee_entry()
1366 uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14], in do_tee_entry()
1367 uuid->b[15]); in do_tee_entry()
1369 add_wildcard(alias); in do_tee_entry()
1374 static int do_wmi_entry(const char *filename, void *symval, char *alias) in do_wmi_entry() argument
1385 len = snprintf(alias, ALIAS_SIZE, WMI_MODULE_PREFIX "%s", *guid_string); in do_wmi_entry()
1395 static int do_mhi_entry(const char *filename, void *symval, char *alias) in do_mhi_entry() argument
1398 sprintf(alias, MHI_DEVICE_MODALIAS_FMT, *chan); in do_mhi_entry()
1403 static int do_mhi_ep_entry(const char *filename, void *symval, char *alias) in do_mhi_ep_entry() argument
1406 sprintf(alias, MHI_EP_DEVICE_MODALIAS_FMT, *chan); in do_mhi_ep_entry()
1412 static int do_ishtp_entry(const char *filename, void *symval, char *alias) in do_ishtp_entry() argument
1416 strcpy(alias, ISHTP_MODULE_PREFIX "{"); in do_ishtp_entry()
1417 add_guid(alias, *guid); in do_ishtp_entry()
1418 strcat(alias, "}"); in do_ishtp_entry()
1423 static int do_auxiliary_entry(const char *filename, void *symval, char *alias) in do_auxiliary_entry() argument
1426 sprintf(alias, AUXILIARY_MODULE_PREFIX "%s", *name); in do_auxiliary_entry()
1434 * N is exactly 2 digits, where each is an upper-case hex digit.
1436 static int do_ssam_entry(const char *filename, void *symval, char *alias) in do_ssam_entry() argument
1445 sprintf(alias, "ssam:d%02Xc%02X", domain, category); in do_ssam_entry()
1446 ADD(alias, "t", match_flags & SSAM_MATCH_TARGET, target); in do_ssam_entry()
1447 ADD(alias, "i", match_flags & SSAM_MATCH_INSTANCE, instance); in do_ssam_entry()
1448 ADD(alias, "f", match_flags & SSAM_MATCH_FUNCTION, function); in do_ssam_entry()
1454 static int do_dfl_entry(const char *filename, void *symval, char *alias) in do_dfl_entry() argument
1459 sprintf(alias, "dfl:t%04Xf%04X", type, feature_id); in do_dfl_entry()
1461 add_wildcard(alias); in do_dfl_entry()
1467 char *alias) in do_cdx_entry() argument
1479 strcpy(alias, "cdx:"); in do_cdx_entry()
1482 strcpy(alias, "vfio_cdx:"); in do_cdx_entry()
1485 warn("Unknown CDX driver_override alias %08X\n", in do_cdx_entry()
1490 ADD(alias, "v", vendor != CDX_ANY_ID, vendor); in do_cdx_entry()
1491 ADD(alias, "d", device != CDX_ANY_ID, device); in do_cdx_entry()
1492 ADD(alias, "sv", subvendor != CDX_ANY_ID, subvendor); in do_cdx_entry()
1493 ADD(alias, "sd", subdevice != CDX_ANY_ID, subdevice); in do_cdx_entry()
1494 ADD(alias, "c", class_mask == 0xFFFFFF, class); in do_cdx_entry()
1499 static int do_vchiq_entry(const char *filename, void *symval, char *alias) in do_vchiq_entry() argument
1502 sprintf(alias, "vchiq:%s", *name); in do_vchiq_entry()
1508 static int do_coreboot_entry(const char *filename, void *symval, char *alias) in do_coreboot_entry() argument
1511 sprintf(alias, "coreboot:t%08X", tag); in do_coreboot_entry()
1528 int (*do_entry)(const char *filename, void *symval, char *alias), in do_table() argument
1532 char alias[ALIAS_SIZE]; in do_table() local
1534 device_id_check(mod->name, device_id, size, id_size, symval); in do_table()
1536 size -= id_size; in do_table()
1539 if (do_entry(mod->name, symval+i, alias)) { in do_table()
1540 buf_printf(&mod->dev_table_buf, in do_table()
1541 "MODULE_ALIAS(\"%s\");\n", alias); in do_table()
1566 {"i2c", SIZE_i2c_device_id, do_i2c_entry},
1603 * so we write into the mod->dev_table_buf buffer. */
1613 if (!sym->st_shndx || get_secindex(info, sym) >= info->num_sections) in handle_moddevtable()
1617 if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT) in handle_moddevtable()
1627 if (strcmp(name + namelen - strlen("_device_table"), "_device_table")) in handle_moddevtable()
1632 namelen = identifier - name; in handle_moddevtable()
1634 /* Handle all-NULL symbols allocated into .bss */ in handle_moddevtable()
1635 if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) { in handle_moddevtable()
1636 zeros = calloc(1, sym->st_size); in handle_moddevtable()
1644 do_usb_table(symval, sym->st_size, mod); in handle_moddevtable()
1646 do_of_table(symval, sym->st_size, mod); in handle_moddevtable()
1648 do_pnp_device_entry(symval, sym->st_size, mod); in handle_moddevtable()
1650 do_pnp_card_entries(symval, sym->st_size, mod); in handle_moddevtable()
1657 if (sym_is(name, namelen, p->device_id)) { in handle_moddevtable()
1658 do_table(symval, sym->st_size, p->id_size, in handle_moddevtable()
1659 p->device_id, p->do_entry, mod); in handle_moddevtable()
1671 buf_write(buf, mod->dev_table_buf.p, mod->dev_table_buf.pos); in add_moddevtable()
1672 free(mod->dev_table_buf.p); in add_moddevtable()