28c28
< * $Id: ata-all.c,v 1.6 1999/04/10 18:53:35 sos Exp $
---
> * $Id: ata-all.c,v 1.7 1999/04/16 21:21:52 peter Exp $
35a36
> #include "opt_global.h"
40a42,43
> #include <sys/module.h>
> #include <sys/bus.h>
45a49,51
> #include <machine/resource.h>
> #include <machine/bus.h>
> #include <sys/rman.h>
52,56c58
< #ifdef __i386__
< #include <i386/isa/icu.h>
< #include <i386/isa/isa.h>
< #include <i386/isa/isa_device.h>
< #else
---
> #include <isa/isavar.h>
58d59
< #endif
66c67
< #if NSMP == 0
---
> #if SMP == 0
71,74d71
< #if NISA > 0 && defined(__i386__)
< static int32_t ata_isaprobe(struct isa_device *);
< static int32_t ata_isaattach(struct isa_device *);
< #endif
76,77d72
< static const char *ata_pciprobe(pcici_t, pcidi_t);
< static void ata_pciattach(pcici_t, int32_t);
80c75
< static int32_t ata_probe(int32_t, int32_t, int32_t, pcici_t, int32_t *);
---
> static int32_t ata_probe(int32_t, int32_t, int32_t, device_t, int32_t *);
82a78,80
> /*
> * Ought to be handled by the devclass.
> */
86,87c84
< #if NISA > 0 && defined(__i386__)
< struct isa_driver atadriver = { ata_isaprobe, ata_isaattach, "ata" };
---
> static devclass_t ata_devclass;
89,90c86,89
< static int32_t
< ata_isaprobe(struct isa_device *devp)
---
> #if NISA > 0
>
> static int
> ata_isaprobe(device_t dev)
91a91,92
> struct resource *port;
> int rid;
93c94,101
<
---
> int unit;
>
> /* Allocate the port range */
> rid = 0;
> port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1, RF_ACTIVE);
> if (!port)
> return (ENOMEM);
>
95c103
< if (atadevices[ctlr]->ioaddr == devp->id_iobase) {
---
> if (atadevices[ctlr]->ioaddr == rman_get_start(port)) {
97,98c105,107
< devp->id_unit, ctlr);
< return 0;
---
> device_get_unit(dev), ctlr);
> bus_release_resource(dev, SYS_RES_IOPORT, 0, port);
> return ENXIO;
101,105c110,127
< res = ata_probe(devp->id_iobase, devp->id_iobase + ATA_ALTPORT, 0, 0,
< &devp->id_unit);
< if (res)
< devp->id_intr = (inthand2_t *)ataintr;
< return res;
---
>
> /*
> * XXX not sure what to do with the unit. The new bus code will
> * automatically assign unit numbers for both pci and isa. For
> * now, store it in the softc.
> */
> res = ata_probe(rman_get_start(port), rman_get_start(port) + ATA_ALTPORT,
> 0, dev, &unit);
> *(int *) device_get_softc(dev) = unit;
>
> bus_release_resource(dev, SYS_RES_IOPORT, 0, port);
>
> if (res) {
> isa_set_portsize(dev, res);
> return 0;
> }
>
> return ENXIO;
108,109c130,131
< static int32_t
< ata_isaattach(struct isa_device *devp)
---
> static int
> ata_isaattach(device_t dev)
111c133,157
< return 1;
---
> struct resource *port;
> struct resource *irq;
> int rid, unit;
> void *ih;
>
> /* Allocate the port range and interrupt */
> rid = 0;
> port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1, RF_ACTIVE);
> if (!port)
> return (ENOMEM);
>
> rid = 0;
> irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, RF_ACTIVE);
> if (!irq) {
> bus_release_resource(dev, SYS_RES_IOPORT, 0, port);
> return (ENOMEM);
> }
>
> /*
> * The interrupt code could be changed to take the ata_softc as
> * its argument directly.
> */
> unit = *(int *) device_get_softc(dev);
> return bus_setup_intr(dev, irq, (driver_intr_t *) ataintr,
> (void*)(uintptr_t) unit, &ih);
113d158
< #endif
115,118c160,164
< #if NPCI > 0
< static u_long ata_pcicount;
< static struct pci_device ata_pcidevice = {
< "ata-pci", ata_pciprobe, ata_pciattach, &ata_pcicount, 0
---
> static device_method_t ata_isa_methods[] = {
> /* Device interface */
> DEVMETHOD(device_probe, ata_isaprobe),
> DEVMETHOD(device_attach, ata_isaattach),
> { 0, 0 }
121c167,172
< DATA_SET(pcidevice_set, ata_pcidevice);
---
> static driver_t ata_isa_driver = {
> "ata",
> ata_isa_methods,
> DRIVER_TYPE_BIO,
> sizeof(int),
> };
122a174,179
> DRIVER_MODULE(ata, isa, ata_isa_driver, ata_devclass, 0, 0);
>
> #endif
>
> #if NPCI > 0
>
124c181
< ata_pciprobe(pcici_t tag, pcidi_t type)
---
> ata_pcimatch(device_t dev)
128,132c185,189
< data = pci_conf_read(tag, PCI_CLASS_REG);
< if ((data & PCI_CLASS_MASK) == PCI_CLASS_MASS_STORAGE &&
< ((data & PCI_SUBCLASS_MASK) == 0x00010000 ||
< ((data & PCI_SUBCLASS_MASK) == 0x00040000))) {
< switch (type) {
---
> data = pci_read_config(dev, PCI_CLASS_REG, 4);
> if (pci_get_class(dev) == PCIC_STORAGE &&
> (pci_get_subclass(dev) == PCIS_STORAGE_IDE ||
> pci_get_subclass(dev) == PCIS_STORAGE_RAID)) {
> switch (pci_get_devid(dev)) {
142a200,202
> #if 0
> case 0x05711106:
> return "VIA Apollo IDE controller";
147,149c207,208
< #if 0
< case 0x05711106:
< return "VIA Apollo IDE controller";
---
> case 0xc6931080:
> return "Cypress 82C693 IDE controller";
160,161c219,220
< static void
< ata_pciattach(pcici_t tag, int32_t unit)
---
> static int
> ata_pciprobe(device_t dev)
163c222,237
< pcidi_t type, class, cmd;
---
> const char *desc = ata_pcimatch(dev);
> if (desc) {
> device_set_desc(dev, desc);
> return 0;
> }
> else
> return ENXIO;
> }
>
> static int
> ata_pciattach(device_t dev)
> {
> int unit = device_get_unit(dev);
> u_int32_t type;
> u_int8_t class, subclass;
> u_int32_t cmd;
169,171c243,246
< type = pci_conf_read(tag, PCI_ID_REG);
< class = pci_conf_read(tag, PCI_CLASS_REG);
< cmd = pci_conf_read(tag, PCI_COMMAND_STATUS_REG);
---
> type = pci_get_devid(dev);
> class = pci_get_class(dev);
> subclass = pci_get_subclass(dev);
> cmd = pci_read_config(dev, PCIR_COMMAND, 4);
174c249,250
< printf("ata%d: type=%08x class=%08x cmd=%08x\n", unit, type, class, cmd);
---
> printf("ata%d: type=%08x class=%02x subclass=%02x cmd=%08x\n",
> unit, type, class, subclass, cmd);
179,184c255,260
< iobase_1 = pci_conf_read(tag, 0x10) & 0xfffc;
< altiobase_1 = pci_conf_read(tag, 0x14) & 0xfffc;
< iobase_2 = pci_conf_read(tag, 0x18) & 0xfffc;
< altiobase_2 = pci_conf_read(tag, 0x1c) & 0xfffc;
< irq1 = irq2 = pci_conf_read(tag, PCI_INTERRUPT_REG) & 0xff;
< bmaddr_1 = pci_conf_read(tag, 0x20) & 0xfffc;
---
> iobase_1 = pci_read_config(dev, 0x10, 4) & 0xfffc;
> altiobase_1 = pci_read_config(dev, 0x14, 4) & 0xfffc;
> iobase_2 = pci_read_config(dev, 0x18, 4) & 0xfffc;
> altiobase_2 = pci_read_config(dev, 0x1c, 4) & 0xfffc;
> irq1 = irq2 = pci_read_config(dev, PCI_INTERRUPT_REG, 4) & 0xff;
> bmaddr_1 = pci_read_config(dev, 0x20, 4) & 0xfffc;
186c262
< sysctrl = (pci_conf_read(tag, 0x20) & 0xfffc) + 0x1c;
---
> sysctrl = (pci_read_config(dev, 0x20, 4) & 0xfffc) + 0x1c;
192c268,269
< if ((class & 0x100) == 0) {
---
> if ((unit == 0) &&
> (pci_get_progif(dev) & PCIP_STORAGE_IDE_MODEPRIM) == 0) {
198,200c275,277
< iobase_1 = pci_conf_read(tag, 0x10) & 0xfffc;
< altiobase_1 = pci_conf_read(tag, 0x14) & 0xfffc;
< irq1 = pci_conf_read(tag, PCI_INTERRUPT_REG) & 0xff;
---
> iobase_1 = pci_read_config(dev, 0x10, 4) & 0xfffc;
> altiobase_1 = pci_read_config(dev, 0x14, 4) & 0xfffc;
> irq1 = pci_read_config(dev, PCI_INTERRUPT_REG, 4) & 0xff;
202c279,280
< if ((class & 0x400) == 0) {
---
> if ((unit == 0) &&
> (pci_get_progif(dev) & PCIP_STORAGE_IDE_MODESEC) == 0) {
208,210c286,288
< iobase_2 = pci_conf_read(tag, 0x18) & 0xfffc;
< altiobase_2 = pci_conf_read(tag, 0x1c) & 0xfffc;
< irq2 = pci_conf_read(tag, PCI_INTERRUPT_REG) & 0xff;
---
> iobase_2 = pci_read_config(dev, 0x18, 4) & 0xfffc;
> altiobase_2 = pci_read_config(dev, 0x1c, 4) & 0xfffc;
> irq2 = pci_read_config(dev, PCI_INTERRUPT_REG, 4) & 0xff;
214c292
< if (pci_conf_read(tag, PCI_CLASS_REG) & 0x8000) {
---
> if (pci_get_progif(dev) & PCIP_STORAGE_IDE_MASTERDEV) {
216c294
< if ((pci_conf_read(tag, PCI_COMMAND_STATUS_REG) & 5) == 5) {
---
> if ((pci_read_config(dev, PCI_COMMAND_STATUS_REG, 4) & 5) == 5) {
218c296
< if ((bmaddr_1 = pci_conf_read(tag, 0x20) & 0xfffc)) {
---
> if ((bmaddr_1 = pci_read_config(dev, 0x20, 4) & 0xfffc)) {
234c312
< if (ata_probe(iobase_1, altiobase_1, bmaddr_1, tag, &lun)) {
---
> if (ata_probe(iobase_1, altiobase_1, bmaddr_1, dev, &lun)) {
237,239c315,317
< register_intr(irq1, (int)"", 0, (inthand2_t *)ataintr,
< &bio_imask, lun);
< #else
---
> register_intr(irq1,(int)"",0,(inthand2_t *)ataintr,&bio_imask,lun);
> #endif
> #ifdef __alpha__
242a321,325
> struct resource *irq;
> int rid = 0;
> void *ih;
>
> irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0,1,RF_ACTIVE);
244,245c327,328
< pci_map_int(tag, (inthand2_t *)promise_intr,
< (void *)(intptr_t)lun, &bio_imask);
---
> bus_setup_intr(dev, irq, (driver_intr_t *)promise_intr,
> (void *)lun, &ih);
247c330,331
< pci_map_int(tag, (inthand2_t *)ataintr, (void *)(intptr_t)lun,&bio_imask);
---
> bus_setup_intr(dev, irq, (driver_intr_t *)ataintr,
> (void *)lun, &ih);
253c337
< if (ata_probe(iobase_2, altiobase_2, bmaddr_2, tag, &lun)) {
---
> if (ata_probe(iobase_2, altiobase_2, bmaddr_2, dev, &lun)) {
256,258c340,342
< register_intr(irq2, (int)"", 0, (inthand2_t *)ataintr,
< &bio_imask, lun);
< #else
---
> register_intr(irq2,(int)"",0,(inthand2_t *)ataintr,&bio_imask,lun);
> #endif
> #ifdef __alpha__
261a346,350
> struct resource *irq;
> int rid = 0;
> void *ih;
>
> irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0,1,RF_ACTIVE);
263c352,353
< pci_map_int(tag, (inthand2_t *)ataintr, (void *)(intptr_t)lun,&bio_imask);
---
> bus_setup_intr(dev, irq, (driver_intr_t *)ataintr,
> (void *)lun, &ih);
267a358
> return 0;
269a361,376
> static device_method_t ata_pci_methods[] = {
> /* Device interface */
> DEVMETHOD(device_probe, ata_pciprobe),
> DEVMETHOD(device_attach, ata_pciattach),
> { 0, 0 }
> };
>
> static driver_t ata_pci_driver = {
> "ata",
> ata_pci_methods,
> DRIVER_TYPE_BIO,
> sizeof(int),
> };
>
> DRIVER_MODULE(ata, pci, ata_pci_driver, ata_devclass, 0, 0);
>
274c381
< int32_t channel = inl((pci_conf_read(scp->tag, 0x20) & 0xfffc) + 0x1c);
---
> int32_t channel = inl((pci_read_config(scp->dev, 0x20, 4) & 0xfffc) + 0x1c);
286c393
< pcici_t tag, int32_t *unit)
---
> device_t dev, int32_t *unit)
433c540
< scp->tag = tag;
---
> scp->dev = dev;
440d546
< outb(scp->ioaddr + ATA_DRIVE, ATA_D_IBM | ATA_MASTER);
< * $Id: ata-all.c,v 1.6 1999/04/10 18:53:35 sos Exp $
---
> * $Id: ata-all.c,v 1.7 1999/04/16 21:21:52 peter Exp $
35a36
> #include "opt_global.h"
40a42,43
> #include <sys/module.h>
> #include <sys/bus.h>
45a49,51
> #include <machine/resource.h>
> #include <machine/bus.h>
> #include <sys/rman.h>
52,56c58
< #ifdef __i386__
< #include <i386/isa/icu.h>
< #include <i386/isa/isa.h>
< #include <i386/isa/isa_device.h>
< #else
---
> #include <isa/isavar.h>
58d59
< #endif
66c67
< #if NSMP == 0
---
> #if SMP == 0
71,74d71
< #if NISA > 0 && defined(__i386__)
< static int32_t ata_isaprobe(struct isa_device *);
< static int32_t ata_isaattach(struct isa_device *);
< #endif
76,77d72
< static const char *ata_pciprobe(pcici_t, pcidi_t);
< static void ata_pciattach(pcici_t, int32_t);
80c75
< static int32_t ata_probe(int32_t, int32_t, int32_t, pcici_t, int32_t *);
---
> static int32_t ata_probe(int32_t, int32_t, int32_t, device_t, int32_t *);
82a78,80
> /*
> * Ought to be handled by the devclass.
> */
86,87c84
< #if NISA > 0 && defined(__i386__)
< struct isa_driver atadriver = { ata_isaprobe, ata_isaattach, "ata" };
---
> static devclass_t ata_devclass;
89,90c86,89
< static int32_t
< ata_isaprobe(struct isa_device *devp)
---
> #if NISA > 0
>
> static int
> ata_isaprobe(device_t dev)
91a91,92
> struct resource *port;
> int rid;
93c94,101
<
---
> int unit;
>
> /* Allocate the port range */
> rid = 0;
> port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1, RF_ACTIVE);
> if (!port)
> return (ENOMEM);
>
95c103
< if (atadevices[ctlr]->ioaddr == devp->id_iobase) {
---
> if (atadevices[ctlr]->ioaddr == rman_get_start(port)) {
97,98c105,107
< devp->id_unit, ctlr);
< return 0;
---
> device_get_unit(dev), ctlr);
> bus_release_resource(dev, SYS_RES_IOPORT, 0, port);
> return ENXIO;
101,105c110,127
< res = ata_probe(devp->id_iobase, devp->id_iobase + ATA_ALTPORT, 0, 0,
< &devp->id_unit);
< if (res)
< devp->id_intr = (inthand2_t *)ataintr;
< return res;
---
>
> /*
> * XXX not sure what to do with the unit. The new bus code will
> * automatically assign unit numbers for both pci and isa. For
> * now, store it in the softc.
> */
> res = ata_probe(rman_get_start(port), rman_get_start(port) + ATA_ALTPORT,
> 0, dev, &unit);
> *(int *) device_get_softc(dev) = unit;
>
> bus_release_resource(dev, SYS_RES_IOPORT, 0, port);
>
> if (res) {
> isa_set_portsize(dev, res);
> return 0;
> }
>
> return ENXIO;
108,109c130,131
< static int32_t
< ata_isaattach(struct isa_device *devp)
---
> static int
> ata_isaattach(device_t dev)
111c133,157
< return 1;
---
> struct resource *port;
> struct resource *irq;
> int rid, unit;
> void *ih;
>
> /* Allocate the port range and interrupt */
> rid = 0;
> port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1, RF_ACTIVE);
> if (!port)
> return (ENOMEM);
>
> rid = 0;
> irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, RF_ACTIVE);
> if (!irq) {
> bus_release_resource(dev, SYS_RES_IOPORT, 0, port);
> return (ENOMEM);
> }
>
> /*
> * The interrupt code could be changed to take the ata_softc as
> * its argument directly.
> */
> unit = *(int *) device_get_softc(dev);
> return bus_setup_intr(dev, irq, (driver_intr_t *) ataintr,
> (void*)(uintptr_t) unit, &ih);
113d158
< #endif
115,118c160,164
< #if NPCI > 0
< static u_long ata_pcicount;
< static struct pci_device ata_pcidevice = {
< "ata-pci", ata_pciprobe, ata_pciattach, &ata_pcicount, 0
---
> static device_method_t ata_isa_methods[] = {
> /* Device interface */
> DEVMETHOD(device_probe, ata_isaprobe),
> DEVMETHOD(device_attach, ata_isaattach),
> { 0, 0 }
121c167,172
< DATA_SET(pcidevice_set, ata_pcidevice);
---
> static driver_t ata_isa_driver = {
> "ata",
> ata_isa_methods,
> DRIVER_TYPE_BIO,
> sizeof(int),
> };
122a174,179
> DRIVER_MODULE(ata, isa, ata_isa_driver, ata_devclass, 0, 0);
>
> #endif
>
> #if NPCI > 0
>
124c181
< ata_pciprobe(pcici_t tag, pcidi_t type)
---
> ata_pcimatch(device_t dev)
128,132c185,189
< data = pci_conf_read(tag, PCI_CLASS_REG);
< if ((data & PCI_CLASS_MASK) == PCI_CLASS_MASS_STORAGE &&
< ((data & PCI_SUBCLASS_MASK) == 0x00010000 ||
< ((data & PCI_SUBCLASS_MASK) == 0x00040000))) {
< switch (type) {
---
> data = pci_read_config(dev, PCI_CLASS_REG, 4);
> if (pci_get_class(dev) == PCIC_STORAGE &&
> (pci_get_subclass(dev) == PCIS_STORAGE_IDE ||
> pci_get_subclass(dev) == PCIS_STORAGE_RAID)) {
> switch (pci_get_devid(dev)) {
142a200,202
> #if 0
> case 0x05711106:
> return "VIA Apollo IDE controller";
147,149c207,208
< #if 0
< case 0x05711106:
< return "VIA Apollo IDE controller";
---
> case 0xc6931080:
> return "Cypress 82C693 IDE controller";
160,161c219,220
< static void
< ata_pciattach(pcici_t tag, int32_t unit)
---
> static int
> ata_pciprobe(device_t dev)
163c222,237
< pcidi_t type, class, cmd;
---
> const char *desc = ata_pcimatch(dev);
> if (desc) {
> device_set_desc(dev, desc);
> return 0;
> }
> else
> return ENXIO;
> }
>
> static int
> ata_pciattach(device_t dev)
> {
> int unit = device_get_unit(dev);
> u_int32_t type;
> u_int8_t class, subclass;
> u_int32_t cmd;
169,171c243,246
< type = pci_conf_read(tag, PCI_ID_REG);
< class = pci_conf_read(tag, PCI_CLASS_REG);
< cmd = pci_conf_read(tag, PCI_COMMAND_STATUS_REG);
---
> type = pci_get_devid(dev);
> class = pci_get_class(dev);
> subclass = pci_get_subclass(dev);
> cmd = pci_read_config(dev, PCIR_COMMAND, 4);
174c249,250
< printf("ata%d: type=%08x class=%08x cmd=%08x\n", unit, type, class, cmd);
---
> printf("ata%d: type=%08x class=%02x subclass=%02x cmd=%08x\n",
> unit, type, class, subclass, cmd);
179,184c255,260
< iobase_1 = pci_conf_read(tag, 0x10) & 0xfffc;
< altiobase_1 = pci_conf_read(tag, 0x14) & 0xfffc;
< iobase_2 = pci_conf_read(tag, 0x18) & 0xfffc;
< altiobase_2 = pci_conf_read(tag, 0x1c) & 0xfffc;
< irq1 = irq2 = pci_conf_read(tag, PCI_INTERRUPT_REG) & 0xff;
< bmaddr_1 = pci_conf_read(tag, 0x20) & 0xfffc;
---
> iobase_1 = pci_read_config(dev, 0x10, 4) & 0xfffc;
> altiobase_1 = pci_read_config(dev, 0x14, 4) & 0xfffc;
> iobase_2 = pci_read_config(dev, 0x18, 4) & 0xfffc;
> altiobase_2 = pci_read_config(dev, 0x1c, 4) & 0xfffc;
> irq1 = irq2 = pci_read_config(dev, PCI_INTERRUPT_REG, 4) & 0xff;
> bmaddr_1 = pci_read_config(dev, 0x20, 4) & 0xfffc;
186c262
< sysctrl = (pci_conf_read(tag, 0x20) & 0xfffc) + 0x1c;
---
> sysctrl = (pci_read_config(dev, 0x20, 4) & 0xfffc) + 0x1c;
192c268,269
< if ((class & 0x100) == 0) {
---
> if ((unit == 0) &&
> (pci_get_progif(dev) & PCIP_STORAGE_IDE_MODEPRIM) == 0) {
198,200c275,277
< iobase_1 = pci_conf_read(tag, 0x10) & 0xfffc;
< altiobase_1 = pci_conf_read(tag, 0x14) & 0xfffc;
< irq1 = pci_conf_read(tag, PCI_INTERRUPT_REG) & 0xff;
---
> iobase_1 = pci_read_config(dev, 0x10, 4) & 0xfffc;
> altiobase_1 = pci_read_config(dev, 0x14, 4) & 0xfffc;
> irq1 = pci_read_config(dev, PCI_INTERRUPT_REG, 4) & 0xff;
202c279,280
< if ((class & 0x400) == 0) {
---
> if ((unit == 0) &&
> (pci_get_progif(dev) & PCIP_STORAGE_IDE_MODESEC) == 0) {
208,210c286,288
< iobase_2 = pci_conf_read(tag, 0x18) & 0xfffc;
< altiobase_2 = pci_conf_read(tag, 0x1c) & 0xfffc;
< irq2 = pci_conf_read(tag, PCI_INTERRUPT_REG) & 0xff;
---
> iobase_2 = pci_read_config(dev, 0x18, 4) & 0xfffc;
> altiobase_2 = pci_read_config(dev, 0x1c, 4) & 0xfffc;
> irq2 = pci_read_config(dev, PCI_INTERRUPT_REG, 4) & 0xff;
214c292
< if (pci_conf_read(tag, PCI_CLASS_REG) & 0x8000) {
---
> if (pci_get_progif(dev) & PCIP_STORAGE_IDE_MASTERDEV) {
216c294
< if ((pci_conf_read(tag, PCI_COMMAND_STATUS_REG) & 5) == 5) {
---
> if ((pci_read_config(dev, PCI_COMMAND_STATUS_REG, 4) & 5) == 5) {
218c296
< if ((bmaddr_1 = pci_conf_read(tag, 0x20) & 0xfffc)) {
---
> if ((bmaddr_1 = pci_read_config(dev, 0x20, 4) & 0xfffc)) {
234c312
< if (ata_probe(iobase_1, altiobase_1, bmaddr_1, tag, &lun)) {
---
> if (ata_probe(iobase_1, altiobase_1, bmaddr_1, dev, &lun)) {
237,239c315,317
< register_intr(irq1, (int)"", 0, (inthand2_t *)ataintr,
< &bio_imask, lun);
< #else
---
> register_intr(irq1,(int)"",0,(inthand2_t *)ataintr,&bio_imask,lun);
> #endif
> #ifdef __alpha__
242a321,325
> struct resource *irq;
> int rid = 0;
> void *ih;
>
> irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0,1,RF_ACTIVE);
244,245c327,328
< pci_map_int(tag, (inthand2_t *)promise_intr,
< (void *)(intptr_t)lun, &bio_imask);
---
> bus_setup_intr(dev, irq, (driver_intr_t *)promise_intr,
> (void *)lun, &ih);
247c330,331
< pci_map_int(tag, (inthand2_t *)ataintr, (void *)(intptr_t)lun,&bio_imask);
---
> bus_setup_intr(dev, irq, (driver_intr_t *)ataintr,
> (void *)lun, &ih);
253c337
< if (ata_probe(iobase_2, altiobase_2, bmaddr_2, tag, &lun)) {
---
> if (ata_probe(iobase_2, altiobase_2, bmaddr_2, dev, &lun)) {
256,258c340,342
< register_intr(irq2, (int)"", 0, (inthand2_t *)ataintr,
< &bio_imask, lun);
< #else
---
> register_intr(irq2,(int)"",0,(inthand2_t *)ataintr,&bio_imask,lun);
> #endif
> #ifdef __alpha__
261a346,350
> struct resource *irq;
> int rid = 0;
> void *ih;
>
> irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0,1,RF_ACTIVE);
263c352,353
< pci_map_int(tag, (inthand2_t *)ataintr, (void *)(intptr_t)lun,&bio_imask);
---
> bus_setup_intr(dev, irq, (driver_intr_t *)ataintr,
> (void *)lun, &ih);
267a358
> return 0;
269a361,376
> static device_method_t ata_pci_methods[] = {
> /* Device interface */
> DEVMETHOD(device_probe, ata_pciprobe),
> DEVMETHOD(device_attach, ata_pciattach),
> { 0, 0 }
> };
>
> static driver_t ata_pci_driver = {
> "ata",
> ata_pci_methods,
> DRIVER_TYPE_BIO,
> sizeof(int),
> };
>
> DRIVER_MODULE(ata, pci, ata_pci_driver, ata_devclass, 0, 0);
>
274c381
< int32_t channel = inl((pci_conf_read(scp->tag, 0x20) & 0xfffc) + 0x1c);
---
> int32_t channel = inl((pci_read_config(scp->dev, 0x20, 4) & 0xfffc) + 0x1c);
286c393
< pcici_t tag, int32_t *unit)
---
> device_t dev, int32_t *unit)
433c540
< scp->tag = tag;
---
> scp->dev = dev;
440d546
< outb(scp->ioaddr + ATA_DRIVE, ATA_D_IBM | ATA_MASTER);