*** ata-card.c.orig Wed Jun 25 21:12:00 2003 --- ata-card.c Thu Jun 26 11:04:24 2003 *************** *** 98,103 **** --- 98,109 ---- struct resource *io, *altio; int i, rid, len, start, end; u_long tmp; + char *prodstr; + int error = 0; + + error = pccard_get_product_str(dev, &prodstr); + if (error) + return (error); /* allocate the io range to get start and length */ rid = ATA_IOADDR_RID; *************** *** 118,137 **** * 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); } else { ! bus_set_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID, ! start + ATA_ALTOFFSET, ATA_ALTIOSIZE); } - } - else { - bus_release_resource(dev, SYS_RES_IOPORT, rid, io); - return ENXIO; } /* allocate the altport range */ --- 124,155 ---- * 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 + * + * NOTE: do _NOT_ do this for the Teac 'NinjaATA-' controller, + * which is found attached to many PCMCIA CD-ROM drives, including + * those made by Sony. You don't have to do this for these devices, + * and if we try, we will bail for no reason. Do _NOT_ touch this + * code without consulting with wpaul@FreeBSD.ORG first. I mean it. + * My CD-ROM drive hasn't worked right for the last 6 releases + * because people keep mucking with this stuff. Go away. Scram. + * Beat it. Trespassers will be shot. */ ! if (strcmp (prodstr, "NinjaATA-")) { ! 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_release_resource(dev, SYS_RES_IOPORT, rid, io); ! return ENXIO; } } /* allocate the altport range */