Re: Problems with serial port on Xircom RBEM56G

Michal Mertl <[email protected]>
Newsgroups gmane.os.freebsd.devel.mobile
Message-ID <[email protected]>
> 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
[email protected]
cardbus_cis.c.1.32.diff (text/plain, 1.6 KB)
--- 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");
+			}
+ 		}
 	}
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.