It seems Hajimu UMEMOTO wrote: > Hi, > > I have Panasonic KXLC005 CDROM drive which is connected via PC-CARD. > Unfortunately, it requires extra initialization, and is not recognized > by current ATA driver. So, I made a patch. Please review it. There must be a cleaner way of doing this. if I read it right the only thing you want to have done is to write 0x81 to ALTIO+1 and wait a bit is that correct ? -Søren > Index: sys/dev/ata/ata-card.c > diff -u -p sys/dev/ata/ata-card.c.orig sys/dev/ata/ata-card.c > --- sys/dev/ata/ata-card.c.orig Thu Jan 15 15:47:27 2004 > +++ sys/dev/ata/ata-card.c Wed Jan 21 23:14:44 2004 > _at__at_ -49,15 +49,22 _at__at_ __FBSDID("$FreeBSD: src/sys/dev/ata/ata- > #include <dev/pccard/pccardreg.h> > #include <dev/pccard/pccardvar.h> > > -static const struct pccard_product ata_pccard_products[] = { > - 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} > +#define KME_IO 0x1 > +#define KME_TIMEOUT (hz / 5) > + > +static const struct ata_pccard_product { > + struct pccard_product prod; > + int flags; > +} ata_pccard_products[] = { > + { 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), KME_IO }, > + { PCMCIA_CARD(PANASONIC, KXLC005_1, 0), KME_IO }, > + { PCMCIA_CARD(TEAC, IDECARDII, 0), 0 }, > + { {NULL}, 0 } > }; > > MALLOC_DECLARE(M_ATA); > _at__at_ -65,7 +72,7 _at__at_ MALLOC_DECLARE(M_ATA); > static int > ata_pccard_match(device_t dev) > { > - const struct pccard_product *pp; > + const struct ata_pccard_product *pp; > u_int32_t fcn = PCCARD_FUNCTION_UNSPEC; > int error = 0; > > _at__at_ -78,10 +85,13 _at__at_ ata_pccard_match(device_t dev) > return (0); > > /* match other devices here, primarily cdrom/dvd rom */ > - if ((pp = pccard_product_lookup(dev, ata_pccard_products, > - sizeof(ata_pccard_products[0]), NULL))) { > - if (pp->pp_name) > - device_set_desc(dev, pp->pp_name); > + if ((pp = (const struct ata_pccard_product *)pccard_product_lookup(dev, > + (const struct pccard_product *)ata_pccard_products, > + sizeof(ata_pccard_products[0]), NULL))) { > + if (pp->prod.pp_name) > + device_set_desc(dev, pp->prod.pp_name); > + if (pp->flags == KME_IO) > + device_set_flags(dev, KME_IO); > return (0); > } > return(ENXIO); > _at__at_ -103,7 +113,7 _at__at_ ata_pccard_probe(device_t dev) > { > struct ata_channel *ch = device_get_softc(dev); > struct resource *io, *altio; > - int i, rid, len; > + int i, rid, len, ts; > > /* allocate the io range to get start and length */ > rid = ATA_IOADDR_RID; > _at__at_ -129,8 +139,11 _at__at_ ata_pccard_probe(device_t dev) > } > else { > rid = ATA_ALTADDR_RID; > - altio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, > - ATA_ALTIOSIZE, RF_ACTIVE); > + len = ATA_ALTIOSIZE; > + if (device_get_flags(dev) == KME_IO) > + ++len; > + altio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, len, > + RF_ACTIVE); > if (!altio) { > bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io); > for (i = ATA_DATA; i < ATA_MAX_RES; i++) > _at__at_ -139,6 +152,12 _at__at_ ata_pccard_probe(device_t dev) > } > ch->r_io[ATA_ALTSTAT].res = altio; > ch->r_io[ATA_ALTSTAT].offset = 0; > + if (device_get_flags(dev) == KME_IO) { > + bus_space_write_1(rman_get_bustag(altio), > + rman_get_bushandle(altio), 1, 0x81); > + if (!cold) > + tsleep(&ts, PRIBIO, "atacard", KME_TIMEOUT); > + } > } > > /* initialize softc for this channel */Received on Mon Jan 26 2004 - 23:08:55 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:40 UTC