Deleted Added
full compact
28c28
< * $FreeBSD: head/sys/dev/ata/ata-all.c 57325 2000-02-18 20:57:33Z sos $
---
> * $FreeBSD: head/sys/dev/ata/ata-all.c 57477 2000-02-25 09:48:23Z sos $
78c78
< #define ATA_ALTIOADDR_RID 1
---
> #define ATA_ALTADDR_RID 1
164,165c164
< int rid;
< u_long tmp;
---
> int rid, len;
169,170c168,169
< port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
< ATA_IOSIZE, RF_ACTIVE);
---
> len = bus_get_resource_count(dev, SYS_RES_IOPORT, rid);
> port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, len, RF_ACTIVE);
174,178c173,180
< /* alloctate the altport range */
< if (bus_get_resource(dev, SYS_RES_IOPORT, 1, &tmp, &tmp)) {
< bus_set_resource(dev, SYS_RES_IOPORT, 1,
< rman_get_start(port) + ATA_ALTPORT_PCCARD,
< ATA_ALTIOSIZE);
---
> /*
> * if we got more than the default ATA_IOSIZE ports, this is likely
> * a pccard system where the altio ports are located just after the
> * normal io ports, so no need to allocate them.
> */
> if (len <= ATA_IOSIZE) {
> bus_set_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID,
> rman_get_start(port) + ATA_ALTPORT, ATA_ALTIOSIZE);
191d192
< DEVMETHOD(device_resume, ata_resume),
278a280,284
> case 0xc6931080:
> if (pci_get_subclass(dev) == PCIS_STORAGE_IDE)
> return "Cypress 82C693 ATA controller";
> break;
>
299,303d304
< case 0xc6931080:
< if (pci_get_subclass(dev) == PCIS_STORAGE_IDE)
< return "Cypress 82C693 ATA controller (generic mode)";
< break;
<
333d333
< int lun;
336,343c336,343
< if (pci_get_progif(dev) & PCIP_STORAGE_IDE_MASTERDEV)
< lun = unit;
< else
< lun = -1;
<
< if (!(child = device_add_child(dev, "ata", lun)))
< return ENOMEM;
<
---
> if (pci_get_progif(dev) & PCIP_STORAGE_IDE_MASTERDEV) {
> if (!(child = device_add_child(dev, "ata", unit)))
> return ENOMEM;
> }
> else {
> if (!(child = device_add_child(dev, "ata", 2)))
> return ENOMEM;
> }
438a439,448
> /*
> * the Cypress chip is a mess, it contains two ATA functions, but
> * both channels are visible on the first one.
> * simply ignore the second function for now, as the right
> * solution (ignoring the second channel on the first function)
> * doesn't work with the crappy ATA interrupt setup on the alpha.
> */
> if (pci_get_devid(dev) == 0xc6931080 && pci_get_function(dev) > 1)
> return 0;
>
488c498
< case ATA_ALTIOADDR_RID:
---
> case ATA_ALTADDR_RID:
575c585
< case ATA_ALTIOADDR_RID:
---
> case ATA_ALTADDR_RID:
740c750,751
< io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1, RF_ACTIVE);
---
> io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
> ATA_IOSIZE, RF_ACTIVE);
745,749c756,762
< rid = ATA_ALTIOADDR_RID;
< altio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1, RF_ACTIVE);
< if (!altio)
< goto failure;
< altioaddr = rman_get_start(altio);
---
> rid = ATA_ALTADDR_RID;
> altio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
> ATA_ALTIOSIZE, RF_ACTIVE);
> if (altio)
> altioaddr = rman_get_start(altio);
> else
> altioaddr = ioaddr + ATA_IOSIZE;
839c852
< bus_release_resource(dev, SYS_RES_IOPORT, ATA_ALTIOADDR_RID, altio);
---
> bus_release_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID, altio);
851,852c864
< int rid = 0;
< void *ih;
---
> int error, rid = 0;
863c875,877
< bus_setup_intr(dev, scp->r_irq, INTR_TYPE_BIO, ata_intr, scp, &ih);
---
> if ((error = bus_setup_intr(dev, scp->r_irq, INTR_TYPE_BIO, ata_intr,
> scp, &scp->ih)))
> return error;
929a944
> bus_teardown_intr(dev, scp->r_irq, scp->ih);
931,932c946,949
< bus_release_resource(dev, SYS_RES_IOPORT, ATA_BMADDR_RID, scp->r_bmio);
< bus_release_resource(dev, SYS_RES_IOPORT, ATA_ALTIOADDR_RID, scp->r_altio);
---
> if (scp->r_bmio)
> bus_release_resource(dev, SYS_RES_IOPORT, ATA_BMADDR_RID, scp->r_bmio);
> if (scp->r_altio)
> bus_release_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID,scp->r_altio);