linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: arvidjaar@mail.ru
Cc: linux-kernel@vger.kernel.org, rusty@rustcorp.com.au
Subject: Re: modules.pnpmap output support
Date: Mon, 17 Nov 2003 15:05:36 +0100	[thread overview]
Message-ID: <s5hoevbjdjj.wl@alsa2.suse.de> (raw)
In-Reply-To: <s5hptfrjezz.wl@alsa2.suse.de>

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]

At Mon, 17 Nov 2003 14:34:08 +0100,
I wrote:
> 
> at first i'll try to add the support of old isapnp format for
> compatibility, so that old programs can work as they are.

done.

Rusty, could you check whether it's ok?

--
Takashi Iwai <tiwai@suse.de>		ALSA Developer - www.alsa-project.org

[-- Attachment #2: module-init-tools-0.9.15-pre3-pnp2.dif --]
[-- Type: application/octet-stream, Size: 5088 bytes --]

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-17 14:43:09.000000000 +0100
@@ -594,6 +594,7 @@
 	{ "modules.usbmap", output_usb_table },
 	{ "modules.ccwmap", output_ccw_table },
 	{ "modules.ieee1394map", output_ieee1394_table },
+	{ "modules.isapnpmap", output_isapnp_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-17 15:03:44.000000000 +0100
@@ -1,5 +1,6 @@
 #include <string.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include "depmod.h"
 #include "tables.h"
 
@@ -158,3 +159,60 @@
 			output_ccw_entry(e, shortname, out);
 	}
 }
+
+#define ISAPNP_VENDOR(a,b,c)	(((((a)-'A'+1)&0x3f)<<2)|\
+				((((b)-'A'+1)&0x18)>>3)|((((b)-'A'+1)&7)<<13)|\
+				((((c)-'A'+1)&0x1f)<<8))
+#define ISAPNP_DEVICE(x)	((((x)&0xf000)>>8)|\
+				 (((x)&0x0f00)>>8)|\
+				 (((x)&0x00f0)<<8)|\
+				 (((x)&0x000f)<<8))
+
+static void put_isapnp_id(FILE *out, const char *id)
+{
+	unsigned short vendor, device;
+
+	vendor = ISAPNP_VENDOR(id[0], id[1], id[2]);
+	device = (unsigned short)strtol(&id[3], NULL, 16);
+	device = ISAPNP_DEVICE(device);
+	fprintf(out, " 0x%04x     0x%04x    ", vendor, device);
+}
+
+void output_isapnp_table(struct module *modules, FILE *out)
+{
+	struct module *i;
+
+	fprintf(out, "# isapnp module      ");
+	fprintf(out, "cardvendor carddevice driver_data vendor     function   ...\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);
+				fprintf(out, " 0xffff     0xffff    ");
+				fprintf(out, " 0x00000000 "); /* driver_data */
+				put_isapnp_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_isapnp_id(out, id->id);
+				fprintf(out, " 0x00000000 "); /* driver_data */
+				for (idx = 0; idx < 8; idx++) {
+					if (! id->devid[idx][0])
+						break;
+					put_isapnp_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-17 15:04:23.000000000 +0100
@@ -55,11 +55,27 @@
 #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];
+	unsigned long  driver_data;
+};
+#define PNP_DEVICE_SIZE32 (8 + sizeof(long))
+#define PNP_DEVICE_SIZE64 (8 + sizeof(long))
+
+struct pnp_card_device_id {
+	char id[8];
+	unsigned long  driver_data;
+	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_isapnp_table(struct module *modules, FILE *out);
 
 #endif /* MODINITTOOLS_TABLES_H */

  reply	other threads:[~2003-11-17 14:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-17 12:37 modules.pnpmap output support "Andrey Borzenkov" 
2003-11-17 13:34 ` Takashi Iwai
2003-11-17 14:05   ` Takashi Iwai [this message]
2003-11-20  4:35     ` Rusty Russell
2003-11-20  9:40       ` Takashi Iwai
2003-11-17 15:07   ` "Andrey Borzenkov" 
2003-11-17 15:37     ` Takashi Iwai
2003-11-20 21:23       ` Adam Belay
2003-11-21 11:44         ` Takashi Iwai
2003-11-23 22:07           ` Adam Belay
2003-11-25 10:29             ` Takashi Iwai
2003-11-27 14:41         ` file2alias for pnp (Re: modules.pnpmap output support) Takashi Iwai
2003-11-27 18:58           ` Andrey Borzenkov
2003-11-28 12:11             ` Takashi Iwai
2003-12-02 22:31               ` Adam Belay
2003-12-03 11:31                 ` Takashi Iwai
2003-11-18  3:07 ` modules.pnpmap output support Rusty Russell
  -- strict thread matches above, loose matches on Subject: below --
2003-11-14 14:07 Takashi Iwai
2003-11-17  3:46 ` Rusty Russell
2003-11-17 11:19   ` Takashi Iwai
2003-11-18  3:01     ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hoevbjdjj.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=arvidjaar@mail.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).