[Patch] Sedlbauer PnP-Card SpeedWin

Martin Tessun martin.tessun en class.de
Dom Ene 23 04:08:22 CST 2000


Hi,

attached is a patch which adds PnP-support for the
sedlbauer-SpeedWin-Card. Others are easily implemented, but I didnt know
their ISAPNP_FUNCTIONS.

Although the patch is a bit ugly, it works for me. (I only needed to
exclude IRQ 12 (PS/2-Mouse) in the isa-pnp-module.)

Perhaps someone, who has more time than me can make a better
implementation. This should be done for all ISDN-ISAPnP-Cards for the
new kernel.

Bye the way. The patch is against kernel-version 2.3.40

Bye
Martin
------------ próxima parte ------------
--- sedlbauer.c.orig	Sat Jan 22 18:00:14 2000
+++ sedlbauer.c	Sat Jan 22 19:37:36 2000
@@ -107,6 +107,7 @@
 #include "isar.h"
 #include "isdnl1.h"
 #include <linux/pci.h>
+#include <linux/isapnp.h>
 
 extern const char *CardType[];
 
@@ -177,6 +178,16 @@
 
 #define SEDL_RESET      0x3	/* same as DOS driver */
 
+/* ISAPNP only for SpeedWin PnP (because I know the funtion */
+#warning fixme: Add other Cards beside ISAPnP
+static struct {
+	unsigned short vendor, function;
+	char *name;
+} isapnp_list[] __initdata = {
+	{ ISAPNP_VENDOR('S','A','G'), ISAPNP_FUNCTION(0x0001), "Sedlbauer SpeedWin" },
+	{ 0, }
+};
+
 static inline u_char
 readreg(unsigned int ale, unsigned int adr, u_char off)
 {
@@ -625,6 +636,37 @@
 			bytecnt = 16;
 		}
 	} else {
+		/* Could be a PnP-Card */
+		if (isapnp_present()) {
+			int i;
+
+			for (i = 0; isapnp_list[i].vendor != 0; i++) {
+				struct pci_dev *isadev = NULL;
+
+				while ((isadev = isapnp_find_dev(NULL, isapnp_list[i].vendor, isapnp_list[i].function, isadev))) {
+					/* Avoid already found cards from previous cards (from ne.c) */
+					if (isadev->prepare(isadev))
+						continue;
+					if (isadev->activate(isadev))
+						continue;
+					
+					cs->irq = isadev->irq_resource[0].start;
+					/* No irq -> search next card */
+					if (!cs->irq)
+						continue;
+					/* We got it! */
+					break;
+				}
+				if (!isadev)
+					continue;
+				cs->hw.sedl.cfg_reg = isadev->resource[0].start;
+				printk(KERN_INFO "Sedlbauer: ISAPnP reports %s at IO %#x, IRQ %d.\n",isapnp_list[i].name, cs->hw.sedl.cfg_reg, cs->irq);
+				goto out;
+			}
+		} else {
+			printk(KERN_WARNING "Sedlbauer: PnP not enabled\n");
+			return (0);
+		}
 /* Probe for Sedlbauer speed pci */
 #if SEDLBAUER_PCI
 #if CONFIG_PCI
@@ -689,7 +731,7 @@
        	/* In case of the sedlbauer pcmcia card, this region is in use,
            reserved for us by the card manager. So we do not check it
            here, it would fail. */
-	if (cs->hw.sedl.bus != SEDL_BUS_PCMCIA &&
+out:	if (cs->hw.sedl.bus != SEDL_BUS_PCMCIA &&
 		check_region((cs->hw.sedl.cfg_reg), bytecnt)) {
 		printk(KERN_WARNING
 			"HiSax: %s config port %x-%x already in use\n",



Más información sobre la lista de distribución Ayuda