From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262603AbTKNOHR (ORCPT ); Fri, 14 Nov 2003 09:07:17 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262608AbTKNOHR (ORCPT ); Fri, 14 Nov 2003 09:07:17 -0500 Received: from ns.suse.de ([195.135.220.2]:44514 "EHLO Cantor.suse.de") by vger.kernel.org with ESMTP id S262603AbTKNOHE (ORCPT ); Fri, 14 Nov 2003 09:07:04 -0500 Date: Fri, 14 Nov 2003 15:07:03 +0100 Message-ID: From: Takashi Iwai To: Rusty Russell Cc: linux-kernel@vger.kernel.org Subject: modules.pnpmap output support User-Agent: Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.5 (Demachiyanagi) APEL/10.6 MULE XEmacs/21.4 (patch 13) (Rational FORTRAN) (i386-suse-linux) MIME-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Hi Rusty, The attached patch makes depmod to output modules.pnpmap file generated from the pnp device table. The output format is not compatible with the old modules.isapnpmap. The new format shows the pnp id string (e.g. CTL0301) while the old format uses the hex numbers. I don't think it's worthy to keep the compatibility for this (since the new one is more intuitive), but it'd be easy to follow the old style. ciao, -- Takashi Iwai ALSA Developer - www.alsa-project.org diff -ru module-init-tools-0.9.15-pre3/depmod.c module-init-tools-0.9.15-pre3-pnp/depmod.c --- module-init-tools-0.9.15-pre3/depmod.c 2003-09-15 03:44:02.000000000 +0200 +++ module-init-tools-0.9.15-pre3-pnp/depmod.c 2003-11-14 12:59:04.000000000 +0100 @@ -594,6 +594,7 @@ { "modules.usbmap", output_usb_table }, { "modules.ccwmap", output_ccw_table }, { "modules.ieee1394map", output_ieee1394_table }, + { "modules.pnpmap", output_pnp_table }, { "modules.alias", output_aliases }, { "modules.symbols", output_symbols }, }; diff -ru module-init-tools-0.9.15-pre3/depmod.h module-init-tools-0.9.15-pre3-pnp/depmod.h --- module-init-tools-0.9.15-pre3/depmod.h 2003-08-15 16:21:02.000000000 +0200 +++ module-init-tools-0.9.15-pre3-pnp/depmod.h 2003-11-14 14:46:30.000000000 +0100 @@ -40,6 +40,10 @@ void *ieee1394_table; unsigned int ccw_size; void *ccw_table; + unsigned int pnp_size; + void *pnp_table; + unsigned int pnp_card_size; + void *pnp_card_table; /* File contents and length. */ void *data; diff -ru module-init-tools-0.9.15-pre3/moduleops_core.c module-init-tools-0.9.15-pre3-pnp/moduleops_core.c --- module-init-tools-0.9.15-pre3/moduleops_core.c 2003-10-01 01:17:42.000000000 +0200 +++ module-init-tools-0.9.15-pre3-pnp/moduleops_core.c 2003-11-14 14:46:24.000000000 +0100 @@ -179,6 +179,14 @@ module->ieee1394_size = PERBIT(IEEE1394_DEVICE_SIZE); module->ieee1394_table = PERBIT(deref_sym)(module->data, "__mod_ieee1394_device_table"); + + module->pnp_size = PERBIT(PNP_DEVICE_SIZE); + module->pnp_table = PERBIT(deref_sym)(module->data, + "__mod_pnp_device_table"); + + module->pnp_card_size = PERBIT(PNP_CARD_DEVICE_SIZE); + module->pnp_card_table = PERBIT(deref_sym)(module->data, + "__mod_pnp_card_device_table"); } struct module_ops PERBIT(mod_ops) = { diff -ru module-init-tools-0.9.15-pre3/tables.c module-init-tools-0.9.15-pre3-pnp/tables.c --- module-init-tools-0.9.15-pre3/tables.c 2003-08-19 12:07:46.000000000 +0200 +++ module-init-tools-0.9.15-pre3-pnp/tables.c 2003-11-14 14:52:43.000000000 +0100 @@ -158,3 +158,47 @@ output_ccw_entry(e, shortname, out); } } + +static void put_pnp_id(FILE *out, const char *id) +{ + int i; + putc(' ', out); + for (i = 0; i < 8 && *id; i++, id++) + putc(*id, out); +} + +void output_pnp_table(struct module *modules, FILE *out) +{ + struct module *i; + + fprintf(out, "# pnp module "); + fprintf(out, "id device ...\n"); + + for (i = modules; i; i = i->next) { + char shortname[strlen(i->pathname) + 1]; + + if (i->pnp_table) { + struct pnp_device_id *id; + make_shortname(shortname, i->pathname); + for (id = i->pnp_table; id->id[0]; id++) { + fprintf(out, "%-20s", shortname); + put_pnp_id(out, id->id); + fprintf(out, "\n"); + } + } else if (i->pnp_card_table) { + struct pnp_card_device_id *id; + make_shortname(shortname, i->pathname); + for (id = i->pnp_card_table; id->id[0]; id++) { + int idx; + fprintf(out, "%-20s", shortname); + put_pnp_id(out, id->id); + for (idx = 0; idx < 8; idx++) { + if (! id->devid[idx][0]) + break; + put_pnp_id(out, id->devid[idx]); + } + fprintf(out, "\n"); + } + } + } +} diff -ru module-init-tools-0.9.15-pre3/tables.h module-init-tools-0.9.15-pre3-pnp/tables.h --- module-init-tools-0.9.15-pre3/tables.h 2003-05-02 08:28:01.000000000 +0200 +++ module-init-tools-0.9.15-pre3-pnp/tables.h 2003-11-14 14:47:05.000000000 +0100 @@ -55,11 +55,26 @@ #define CCW_DEVICE_SIZE32 (3 * 2 + 2 * 1 + 4) #define CCW_DEVICE_SIZE64 (3 * 2 + 2 * 1 + 8) +struct pnp_device_id { + char id[8]; /* id string (always 8 letter) */ +}; +#define PNP_DEVICE_SIZE32 8 +#define PNP_DEVICE_SIZE64 8 + +struct pnp_card_device_id { + char id[8]; /* id string (always 8 letter) */ + unsigned long driver_data; /* grrr... */ + char devid[8][8]; +}; +#define PNP_CARD_DEVICE_SIZE32 (8 + sizeof(long) + 8 * 8) +#define PNP_CARD_DEVICE_SIZE64 (8 + sizeof(long) + 8 * 8) + /* Functions provided by tables.c */ struct module; void output_usb_table(struct module *modules, FILE *out); void output_ieee1394_table(struct module *modules, FILE *out); void output_pci_table(struct module *modules, FILE *out); void output_ccw_table(struct module *modules, FILE *out); +void output_pnp_table(struct module *modules, FILE *out); #endif /* MODINITTOOLS_TABLES_H */