diff -u modutils-2.3.22/include/config.h modutils/include/config.h --- modutils-2.3.22/include/config.h Sun Dec 10 07:20:45 2000 +++ modutils/include/config.h Tue Dec 12 22:02:02 2000 @@ -91,6 +91,7 @@ GEN_PCIMAPFILE, GEN_ISAPNPMAPFILE, GEN_USBMAPFILE, + GEN_PARPTMAPFILE, GEN_DEPFILE, }; diff -u modutils-2.3.22/util/alias.h modutils/util/alias.h --- modutils-2.3.22/util/alias.h Sun Dec 10 07:20:39 2000 +++ modutils/util/alias.h Tue Dec 12 22:24:07 2000 @@ -215,6 +215,7 @@ "modules.pcimap", "modules.isapnpmap", "modules.usbmap", + "modules.parptmap", "System.map", ".config", "build", /* symlink to source tree */ diff -u modutils-2.3.22/util/config.c modutils/util/config.c --- modutils-2.3.22/util/config.c Sun Dec 10 07:20:39 2000 +++ modutils/util/config.c Tue Dec 12 21:44:03 2000 @@ -115,6 +115,7 @@ {"pcimap", NULL, 0}, {"isapnpmap", NULL, 0}, {"usbmap", NULL, 0}, + {"parptmap", NULL, 0}, {"dep", NULL, 0}, }; diff -u modutils-2.3.22/depmod/depmod.c modutils/depmod/depmod.c --- modutils-2.3.22/depmod/depmod.c Sun Dec 10 07:20:50 2000 +++ modutils/depmod/depmod.c Fri Dec 15 12:52:38 2000 @@ -102,6 +102,11 @@ }; /* Extracted from 2.4.0-test10-pre3 + David Brownell usb-device_id patch 2 */ + +struct parport_device_id { + const char *pattern; +}; + #ifndef __u16 #define __u16 u_int16_t #endif @@ -169,6 +174,8 @@ int n_isapnp_card; struct usb_device_id *usb_device; int n_usb_device; + struct parport_device_id *parpt_device; + int n_parpt_device; /* string length */ } MODULE; typedef enum SYM_STATUS { @@ -519,6 +526,40 @@ } /* + * Extract any usb_device_table from the module. + * Note: assumes same machine and arch for depmod and module. + */ +static void extract_parport_device_id(struct obj_file *f, void *image, unsigned long m_size, MODULE *mod) +{ + struct parport_device_id parpt_device; + ElfW(Addr) ref_parpt, ref_ref_parpt; + unsigned tgt_long parpt_device_size; + ref_parpt = obj_symbol_final_value(f, obj_find_symbol(f, "__module_parport_device_size")); + if (!in_range(f, m_size, ref_parpt, sizeof(parpt_device_size))) + return; + memcpy(&parpt_device_size, (char *)image + ref_parpt - f->baseaddr, sizeof(parpt_device_size)); + if (parpt_device_size != sizeof(parpt_device)) { + error("Unexpected value (%" tgt_long_fmt "d) in '%s' for parpt_device_size%s", + parpt_device_size, f->filename, has_kernel_changed); + exit(-1); + } + ref_ref_parpt = obj_symbol_final_value(f, obj_find_symbol(f, "__module_parport_device_table")); + if (!in_range(f, m_size, ref_ref_parpt, sizeof(ref_parpt))) + return; + memcpy(&ref_parpt, (char *)image + ref_ref_parpt - f->baseaddr, sizeof(ref_parpt)); + while (in_range(f, m_size, ref_parpt, sizeof(parpt_device))) { + memcpy(&parpt_device, (char *)image + ref_parpt - f->baseaddr, sizeof(parpt_device)); + if (parpt_device.pattern != NULL) + parpt_device.pattern = strdup((char*)image + ((int)parpt_device.pattern) + - f->baseaddr); + ref_parpt += sizeof(parpt_device); + mod->parpt_device = xrealloc(mod->parpt_device, ++(mod->n_parpt_device)*sizeof(*(mod->parpt_device))); + mod->parpt_device[mod->n_parpt_device-1] = parpt_device; + if (parpt_device.pattern == NULL) + break; + } +} + +/* * Read the symbols in an object and register them in the symbol table. * Return -1 if there is an error. */ @@ -695,6 +736,7 @@ extract_isapnp_device_id(f, image, m_size, mod); extract_isapnp_card_id(f, image, m_size, mod); extract_usb_device_id(f, image, m_size, mod); + extract_parport_device_id(f, image, m_size, mod); free(image); obj_free(f); @@ -885,6 +927,7 @@ FILE *pcimap = stdout; FILE *isapnpmap = stdout; FILE *usbmap = stdout; + FILE *parptmap = stdout; MODULE **tbdep; MODULE *ptmod; int i; @@ -896,6 +939,7 @@ pcimap = gen_file_open(gen_file+GEN_PCIMAPFILE); isapnpmap = gen_file_open(gen_file+GEN_ISAPNPMAPFILE); usbmap = gen_file_open(gen_file+GEN_USBMAPFILE); + parptmap = gen_file_open(gen_file+GEN_PARPTMAPFILE); } skipchars = strlen(base_dir); @@ -1043,7 +1087,20 @@ 2*sizeof(usb_device->driver_info), usb_device->driver_info); } } - + + ptmod = modules; + fprintf(parptmap, "# module regexp.\n"); + for (i = 0; i < n_modules; i++, ptmod++) { + int j; + if (!ptmod->n_parpt_device) + continue; + for (j = 0; ptmod->parpt_device[j].pattern != NULL; j++) { + fprintf(parptmap, "%-20s %s\n", + shortname(ptmod->name), + ptmod->parpt_device[j].pattern); + } + } + if (generic_string != stdout) fclose(generic_string); if (pcimap != stdout) @@ -1052,6 +1109,8 @@ fclose(isapnpmap); if (usbmap != stdout) fclose(usbmap); + if (parptmap != stdout) + fclose(parptmap); /* Close depfile last, it's timestamp is critical */ if (dep != stdout) fclose(dep);