Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jun 2003 13:14:17 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        sos@spider.deepcore.dk
Cc:        sos@FreeBSD.ORG
Subject:   Re: Heads up: checking in change to ata-card.c
Message-ID:  <20030626.131417.101814768.imp@bsdimp.com>
In-Reply-To: <200306261903.h5QJ3Guv019672@spider.deepcore.dk>
References:  <20030626184848.46DB137B401@hub.freebsd.org> <200306261903.h5QJ3Guv019672@spider.deepcore.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
Here's a better patch, basesd on wpaul's input.  Bill, can you try it
an see if it works for you?  If so, i would be better to commit this
one.  If not, I'll work with you to fix it. 

If you are uninterested in working with us to get things in, then your
patch will not lasts the evening as such an approach is unacceptibe.

Warner

Index: ata-card.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-card.c,v
retrieving revision 1.14
diff -u -r1.14 ata-card.c
--- ata-card.c	17 Jun 2003 12:33:53 -0000	1.14
+++ ata-card.c	26 Jun 2003 19:12:34 -0000
@@ -44,17 +44,26 @@
 #include <dev/pccard/pccardvar.h>
 #include <dev/pccard/pccarddevs.h>
 
-static const struct pccard_product ata_pccard_products[] = {
+struct ata_pccard_product 
+{
+    struct pccard_product p;
+    u_int	flags;
+#define ONE_REGION 1
+};
+
+
+
+static const struct ata_pccard_product ata_pccard_products[] = {
 	/* NetBSD has a few others that need to migrate into pccarddevs */
 	/* XXX */
-	PCMCIA_CARD(FREECOM, PCCARDIDE, 0),
-	PCMCIA_CARD(EXP, EXPMULTIMEDIA, 0),
-	PCMCIA_CARD(IODATA, CBIDE2, 0),
-	PCMCIA_CARD(OEM2, CDROM1, 0),
-	PCMCIA_CARD(OEM2, IDE, 0),
-	PCMCIA_CARD(PANASONIC, KXLC005, 0),
-	PCMCIA_CARD(TEAC, IDECARDII, 0),
-	{NULL}
+	{ PCMCIA_CARD(FREECOM, PCCARDIDE, 0), 0 },
+	{ PCMCIA_CARD(EXP, EXPMULTIMEDIA, 0), 0 },
+	{ PCMCIA_CARD(IODATA, CBIDE2, 0), 0 },
+	{ PCMCIA_CARD(OEM2, CDROM1, 0), 0 },
+	{ PCMCIA_CARD(OEM2, IDE, 0), 0 },
+	{ PCMCIA_CARD(PANASONIC, KXLC005, 0), 0 },
+	{ PCMCIA_CARD(TEAC, IDECARDII, 0), ONE_REGION},
+	{ {NULL}, 0}
 };
 
 static int
@@ -73,7 +82,7 @@
 	return (0);
 
     /* Match other devices here, primarily cdrom/dvd rom */
-    if ((pp = pccard_product_lookup(dev, ata_pccard_products,
+    if ((pp = pccard_product_lookup(dev, &ata_pccard_products[0].p,
       sizeof(ata_pccard_products[0]), NULL)) != NULL) {
 	if (pp->pp_name)
 	    device_set_desc(dev, pp->pp_name);
@@ -96,6 +105,7 @@
 static int
 ata_pccard_probe(device_t dev)
 {
+    const struct ata_pccard_product *ap;
     struct ata_channel *ch = device_get_softc(dev);
     struct resource *io, *altio;
     int i, rid, len, start, end;
@@ -116,12 +126,16 @@
     io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
 			    start, end, ATA_IOSIZE, RF_ACTIVE);
 
+    ap = (const struct ata_pccard_product *)pccard_product_lookup(dev,
+	    &ata_pccard_products[0].p, sizeof(ata_pccard_products[0]), NULL);
+
     /* 
      * if we got more than the default ATA_IOSIZE ports, this is likely
      * a pccard system where the altio ports are located at offset 14
      * otherwise its the normal altio offset
      */
-    if (bus_get_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID, &tmp, &tmp)) {
+    if ((ap == NULL || (ap->flags & ONE_REGION) != 0) &&
+      bus_get_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID, &tmp, &tmp)) {
 	if (len > ATA_IOSIZE) {
 	    bus_set_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID,
 			     start + ATA_PCCARD_ALTOFFSET, ATA_ALTIOSIZE);



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