Re: Heads up: checking in change to ata-card.c

From: M. Warner Losh <imp_at_bsdimp.com>
Date: Thu, 26 Jun 2003 13:14:17 -0600 (MDT)
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
_at__at_ -44,17 +44,26 _at__at_
 #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
_at__at_ -73,7 +82,7 _at__at_
 	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);
_at__at_ -96,6 +105,7 _at__at_
 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;
_at__at_ -116,12 +126,16 _at__at_
     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);
Received on Thu Jun 26 2003 - 10:14:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:13 UTC