Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Feb 2003 13:18:49 +0100 (CET)
From:      Michal Mertl <mime@traveller.cz>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        freebsd-mobile@freebsd.org
Subject:   Re: Problems with serial port on Xircom RBEM56G
Message-ID:  <20030216130905.V91057@prg.traveller.cz>
In-Reply-To: <20030216113756.J84326@prg.traveller.cz>
References:  <00fc01c2d56a$0054c3c0$0a00a8c0@casa> <20030215.230132.67883547.imp@bsdimp.com> <20030216113756.J84326@prg.traveller.cz>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
> I've just tried my luck on modem part myself. It's working (I'm currently
> connected with it). There's only problem with detach (card removal) - I
> guess sio doesn't detach so the resources aren't freed and machine panics
> on next insertion.
>

Sorry, the patch was bogus. I diffed just obtained reveision 1.32 to rev
1.31 with my changes.

The new patch (attached) should apply to both 1.31 and 1.32.

With last changes to /sys/dev/pci/pci.c 1.208, /sys/dev/pci/pci_private.h
1.5 /sys/dev/cardbus/cardbus.c 1.34 and /sys/dev/cardbus/cardbus_cis.c
1.32 my machine panics on card insertion (or on boot).

The panic happens even without my mod so I expect it will work again.

Panic acktrace or core available.

-- 
Michal Mertl
mime@traveller.cz
[-- Attachment #2 --]
--- cardbus_cis.c.1.32	Sun Feb 16 11:38:19 2003
+++ cardbus_cis.c	Sun Feb 16 12:03:16 2003
@@ -147,11 +147,14 @@
 	uint32_t devid;	/* Vendor/device of the card */
 	int	type;
 #define	CARDBUS_QUIRK_MAP_REG	1 /* PCI map register in weird place */
+#define	CARDBUS_QUIRK_RID_COUNT 2 /* RID arg1 should have arg2 count */
 	int	arg1;
 	int	arg2;
 };
 
 struct cardbus_quirk cardbus_quirks[] = {
+	/* Xircom CBEM56G modem (incorrect length on modem io-port range) */
+	{ 0x0103115d, CARDBUS_QUIRK_RID_COUNT, 0x10, 0x8 },
 	{ 0 }
 };
 
@@ -1041,6 +1044,7 @@
 {
 	struct cardbus_devinfo *dinfo = device_get_ivars(child);
 	struct cardbus_quirk *q;
+	struct resource_list_entry *rle;
 	int reg;
 
 	/*
@@ -1054,10 +1058,30 @@
 	}
 
 	for (q = &cardbus_quirks[0]; q->devid; q++) {
-		if (q->devid == ((dinfo->pci.cfg.device << 16) | dinfo->pci.cfg.vendor)
-		    && q->type == CARDBUS_QUIRK_MAP_REG) {
-			cardbus_add_map(cbdev, child, q->arg1);
-		}
+		if (q->devid == ((dinfo->pci.cfg.device << 16)
+		    | dinfo->pci.cfg.vendor)) {
+			switch (q->type) {
+			case CARDBUS_QUIRK_MAP_REG:
+				cardbus_add_map(cbdev, child, q->arg1);
+				break;
+			case CARDBUS_QUIRK_RID_COUNT:
+				reg = 0;
+				SLIST_FOREACH(rle, &dinfo->pci.resources,
+				    link) {
+					if (rle->rid == q->arg1) {
+						DEVPRINTF((cbdev, "Applying "
+						    "quirk: type=%d, arg1=0x%x"
+						    ", arg2=0x%x\n", q->type,
+						    q->arg1, q->arg2));
+						rle->count = q->arg2;
+						break;
+					}
+				}
+				break;
+			default:
+				panic("Cardbus quirk bad type");
+			}
+ 		}
 	}
 }
 

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030216130905.V91057>