--- ata-card.c.orig Thu Jun 26 12:55:15 2003 +++ ata-card.c Thu Jun 26 13:27:07 2003 @@ -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,24 +126,30 @@ 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 (len > ATA_IOSIZE) { - bus_set_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID, - start + ATA_PCCARD_ALTOFFSET, ATA_ALTIOSIZE); + if ((ap == NULL || (ap->flags & ONE_REGION) == 0)) { + if (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); + } + else { + bus_set_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID, + start + ATA_ALTOFFSET, ATA_ALTIOSIZE); + } } else { - bus_set_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID, - start + ATA_ALTOFFSET, ATA_ALTIOSIZE); + bus_release_resource(dev, SYS_RES_IOPORT, rid, io); + return ENXIO; } - } - else { - bus_release_resource(dev, SYS_RES_IOPORT, rid, io); - return ENXIO; } /* allocate the altport range */