60c60
< * $FreeBSD: head/sys/dev/advansys/adv_pci.c 57679 2000-03-02 00:08:35Z gibbs $
---
> * $FreeBSD: head/sys/dev/advansys/adv_pci.c 59082 2000-04-07 11:32:42Z nyan $
68a69,71
> #include <machine/resource.h>
> #include <sys/bus.h>
> #include <sys/rman.h>
87,88c90,91
< static const char* advpciprobe(pcici_t tag, pcidi_t type);
< static void advpciattach(pcici_t config_id, int unit);
---
> static int adv_pci_probe(device_t);
> static int adv_pci_attach(device_t);
98,109c101,102
< static struct pci_device adv_pci_driver = {
< "adv",
< advpciprobe,
< advpciattach,
< &adv_unit,
< NULL
< };
<
< COMPAT_PCI_DRIVER (adv_pci, adv_pci_driver);
<
< static const char*
< advpciprobe(pcici_t tag, pcidi_t type)
---
> static int
> adv_pci_probe(device_t dev)
111c104
< int rev;
---
> int rev = pci_get_revid(dev);
113,114c106
< rev = pci_conf_read(tag, PCI_CLASS_REG) & PCI_REVISION_MASK;
< switch (type) {
---
> switch (pci_get_devid(dev)) {
116c108,109
< return ("AdvanSys ASC1200A SCSI controller");
---
> device_set_desc(dev, "AdvanSys ASC1200A SCSI controller");
> return 0;
118c111,112
< return ("AdvanSys ASC1200B SCSI controller");
---
> device_set_desc(dev, "AdvanSys ASC1200B SCSI controller");
> return 0;
120,125c114,125
< if (rev == PCI_DEVICE_REV_ADVANSYS_3150)
< return ("AdvanSys ASC3150 SCSI controller");
< else if (rev == PCI_DEVICE_REV_ADVANSYS_3050)
< return ("AdvanSys ASC3030/50 SCSI controller");
< else if (rev >= PCI_DEVICE_REV_ADVANSYS_3150)
< return ("Unknown AdvanSys controller");
---
> if (rev == PCI_DEVICE_REV_ADVANSYS_3150) {
> device_set_desc(dev,
> "AdvanSys ASC3150 SCSI controller");
> return 0;
> } else if (rev == PCI_DEVICE_REV_ADVANSYS_3050) {
> device_set_desc(dev,
> "AdvanSys ASC3030/50 SCSI controller");
> return 0;
> } else if (rev >= PCI_DEVICE_REV_ADVANSYS_3150) {
> device_set_desc(dev, "Unknown AdvanSys controller");
> return 0;
> }
130c130
< return (NULL);
---
> return ENXIO;
133,134c133,134
< static void
< advpciattach(pcici_t config_id, int unit)
---
> static int
> adv_pci_attach(device_t dev)
136d135
< u_int16_t io_port;
141c140,143
<
---
> int rid = 0;
> void *ih;
> struct resource *iores, *irqres;
>
145,146c147,148
< id = pci_cfgread(config_id, PCI_ID_REG, /*bytes*/4);
< command = pci_cfgread(config_id, PCIR_COMMAND, /*bytes*/1);
---
> id = pci_read_config(dev, PCI_ID_REG, /*bytes*/4);
> command = pci_read_config(dev, PCIR_COMMAND, /*bytes*/1);
156c158
< pci_cfgwrite(config_id, PCIR_COMMAND, command, /*bytes*/1);
---
> pci_write_config(dev, PCIR_COMMAND, command, /*bytes*/1);
164c166
< pci_cfgwrite(config_id, PCIR_LATTIMER, /*value*/0, /*bytes*/1);
---
> pci_write_config(dev, PCIR_LATTIMER, /*value*/0, /*bytes*/1);
166a169,172
> iores = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1,
> RF_ACTIVE);
> if (iores == NULL)
> return ENXIO;
168,169c174,176
< if (pci_map_port(config_id, PCI_BASEADR0, &io_port) == 0)
< return;
---
> if (adv_find_signature(rman_get_bustag(iores),
> rman_get_bushandle(iores)) == 0)
> return ENXIO;
171,174c178
< if (adv_find_signature(I386_BUS_SPACE_IO, io_port) == 0)
< return;
<
< adv = adv_alloc(unit, I386_BUS_SPACE_IO, io_port);
---
> adv = adv_alloc(dev, rman_get_bustag(iores), rman_get_bushandle(iores));
176c180
< return;
---
> return ENXIO;
195c199
< return;
---
> return ENXIO;
211c215
< return;
---
> return ENXIO;
220c224
< return;
---
> return ENXIO;
257c261
< return;
---
> return ENXIO;
280c284,287
< if ((pci_map_int(config_id, adv_intr, (void *)adv, &cam_imask)) == 0) {
---
> irqres = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
> RF_SHAREABLE | RF_ACTIVE);
> if (irqres == NULL ||
> bus_setup_intr(dev, irqres, INTR_TYPE_CAM, adv_intr, adv, &ih)) {
282c289
< return;
---
> return ENXIO;
284c291
<
---
>
285a293
> return 0;
286a295,308
>
> static device_method_t adv_pci_methods[] = {
> /* Device interface */
> DEVMETHOD(device_probe, adv_pci_probe),
> DEVMETHOD(device_attach, adv_pci_attach),
> { 0, 0 }
> };
>
> static driver_t adv_pci_driver = {
> "adv", adv_pci_methods, sizeof(struct adv_softc)
> };
>
> static devclass_t adv_pci_devclass;
> DRIVER_MODULE(adv, pci, adv_pci_driver, adv_pci_devclass, 0, 0);
< * $FreeBSD: head/sys/dev/advansys/adv_pci.c 57679 2000-03-02 00:08:35Z gibbs $
---
> * $FreeBSD: head/sys/dev/advansys/adv_pci.c 59082 2000-04-07 11:32:42Z nyan $
68a69,71
> #include <machine/resource.h>
> #include <sys/bus.h>
> #include <sys/rman.h>
87,88c90,91
< static const char* advpciprobe(pcici_t tag, pcidi_t type);
< static void advpciattach(pcici_t config_id, int unit);
---
> static int adv_pci_probe(device_t);
> static int adv_pci_attach(device_t);
98,109c101,102
< static struct pci_device adv_pci_driver = {
< "adv",
< advpciprobe,
< advpciattach,
< &adv_unit,
< NULL
< };
<
< COMPAT_PCI_DRIVER (adv_pci, adv_pci_driver);
<
< static const char*
< advpciprobe(pcici_t tag, pcidi_t type)
---
> static int
> adv_pci_probe(device_t dev)
111c104
< int rev;
---
> int rev = pci_get_revid(dev);
113,114c106
< rev = pci_conf_read(tag, PCI_CLASS_REG) & PCI_REVISION_MASK;
< switch (type) {
---
> switch (pci_get_devid(dev)) {
116c108,109
< return ("AdvanSys ASC1200A SCSI controller");
---
> device_set_desc(dev, "AdvanSys ASC1200A SCSI controller");
> return 0;
118c111,112
< return ("AdvanSys ASC1200B SCSI controller");
---
> device_set_desc(dev, "AdvanSys ASC1200B SCSI controller");
> return 0;
120,125c114,125
< if (rev == PCI_DEVICE_REV_ADVANSYS_3150)
< return ("AdvanSys ASC3150 SCSI controller");
< else if (rev == PCI_DEVICE_REV_ADVANSYS_3050)
< return ("AdvanSys ASC3030/50 SCSI controller");
< else if (rev >= PCI_DEVICE_REV_ADVANSYS_3150)
< return ("Unknown AdvanSys controller");
---
> if (rev == PCI_DEVICE_REV_ADVANSYS_3150) {
> device_set_desc(dev,
> "AdvanSys ASC3150 SCSI controller");
> return 0;
> } else if (rev == PCI_DEVICE_REV_ADVANSYS_3050) {
> device_set_desc(dev,
> "AdvanSys ASC3030/50 SCSI controller");
> return 0;
> } else if (rev >= PCI_DEVICE_REV_ADVANSYS_3150) {
> device_set_desc(dev, "Unknown AdvanSys controller");
> return 0;
> }
130c130
< return (NULL);
---
> return ENXIO;
133,134c133,134
< static void
< advpciattach(pcici_t config_id, int unit)
---
> static int
> adv_pci_attach(device_t dev)
136d135
< u_int16_t io_port;
141c140,143
<
---
> int rid = 0;
> void *ih;
> struct resource *iores, *irqres;
>
145,146c147,148
< id = pci_cfgread(config_id, PCI_ID_REG, /*bytes*/4);
< command = pci_cfgread(config_id, PCIR_COMMAND, /*bytes*/1);
---
> id = pci_read_config(dev, PCI_ID_REG, /*bytes*/4);
> command = pci_read_config(dev, PCIR_COMMAND, /*bytes*/1);
156c158
< pci_cfgwrite(config_id, PCIR_COMMAND, command, /*bytes*/1);
---
> pci_write_config(dev, PCIR_COMMAND, command, /*bytes*/1);
164c166
< pci_cfgwrite(config_id, PCIR_LATTIMER, /*value*/0, /*bytes*/1);
---
> pci_write_config(dev, PCIR_LATTIMER, /*value*/0, /*bytes*/1);
166a169,172
> iores = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1,
> RF_ACTIVE);
> if (iores == NULL)
> return ENXIO;
168,169c174,176
< if (pci_map_port(config_id, PCI_BASEADR0, &io_port) == 0)
< return;
---
> if (adv_find_signature(rman_get_bustag(iores),
> rman_get_bushandle(iores)) == 0)
> return ENXIO;
171,174c178
< if (adv_find_signature(I386_BUS_SPACE_IO, io_port) == 0)
< return;
<
< adv = adv_alloc(unit, I386_BUS_SPACE_IO, io_port);
---
> adv = adv_alloc(dev, rman_get_bustag(iores), rman_get_bushandle(iores));
176c180
< return;
---
> return ENXIO;
195c199
< return;
---
> return ENXIO;
211c215
< return;
---
> return ENXIO;
220c224
< return;
---
> return ENXIO;
257c261
< return;
---
> return ENXIO;
280c284,287
< if ((pci_map_int(config_id, adv_intr, (void *)adv, &cam_imask)) == 0) {
---
> irqres = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
> RF_SHAREABLE | RF_ACTIVE);
> if (irqres == NULL ||
> bus_setup_intr(dev, irqres, INTR_TYPE_CAM, adv_intr, adv, &ih)) {
282c289
< return;
---
> return ENXIO;
284c291
<
---
>
285a293
> return 0;
286a295,308
>
> static device_method_t adv_pci_methods[] = {
> /* Device interface */
> DEVMETHOD(device_probe, adv_pci_probe),
> DEVMETHOD(device_attach, adv_pci_attach),
> { 0, 0 }
> };
>
> static driver_t adv_pci_driver = {
> "adv", adv_pci_methods, sizeof(struct adv_softc)
> };
>
> static devclass_t adv_pci_devclass;
> DRIVER_MODULE(adv, pci, adv_pci_driver, adv_pci_devclass, 0, 0);