From owner-freebsd-current@FreeBSD.ORG Thu Jun 26 12:14:26 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9B0A937B401; Thu, 26 Jun 2003 12:14:26 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 844BB43FAF; Thu, 26 Jun 2003 12:14:25 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (harmony.village.org [10.0.0.6]) by harmony.village.org (8.12.8/8.12.3) with ESMTP id h5QJENE1065987; Thu, 26 Jun 2003 13:14:24 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 26 Jun 2003 13:14:17 -0600 (MDT) Message-Id: <20030626.131417.101814768.imp@bsdimp.com> To: sos@spider.deepcore.dk From: "M. Warner Losh" In-Reply-To: <200306261903.h5QJ3Guv019672@spider.deepcore.dk> References: <20030626184848.46DB137B401@hub.freebsd.org> <200306261903.h5QJ3Guv019672@spider.deepcore.dk> X-Mailer: Mew version 2.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: wpaul@FreeBSD.ORG cc: current@FreeBSD.ORG cc: sos@FreeBSD.ORG Subject: Re: Heads up: checking in change to ata-card.c X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jun 2003 19:14:26 -0000 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 #include -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);