summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/ata-pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ata/ata-pci.c')
-rw-r--r--sys/dev/ata/ata-pci.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c
index cbec410..d05d0b5 100644
--- a/sys/dev/ata/ata-pci.c
+++ b/sys/dev/ata/ata-pci.c
@@ -99,8 +99,7 @@ ata_pci_attach(device_t dev)
else
ctlr->channels = 1;
ctlr->ichannels = -1;
- ctlr->allocate = ata_pci_allocate;
- ctlr->dmainit = ata_pci_dmainit;
+ ctlr->ch_attach = ata_pci_ch_attach;
ctlr->dev = dev;
/* if needed try to enable busmastering */
@@ -344,7 +343,7 @@ ata_generic_chipinit(device_t dev)
}
int
-ata_pci_allocate(device_t dev)
+ata_pci_ch_attach(device_t dev)
{
struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
struct ata_channel *ch = device_get_softc(dev);
@@ -361,6 +360,8 @@ ata_pci_allocate(device_t dev)
return ENXIO;
}
+ ata_pci_dmainit(dev);
+
for (i = ATA_DATA; i <= ATA_COMMAND; i ++) {
ch->r_io[i].res = io;
ch->r_io[i].offset = i;
@@ -532,10 +533,7 @@ ata_pcichannel_attach(device_t dev)
ch->unit = (intptr_t)device_get_ivars(dev);
- if (ctlr->dmainit)
- ctlr->dmainit(dev);
-
- if ((error = ctlr->allocate(dev)))
+ if ((error = ctlr->ch_attach(dev)))
return error;
return ata_attach(dev);
@@ -544,14 +542,16 @@ ata_pcichannel_attach(device_t dev)
static int
ata_pcichannel_detach(device_t dev)
{
+ struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
int error;
if ((error = ata_detach(dev)))
return error;
- /* XXX SOS free resources for io and ctlio ?? */
+ if (ctlr->ch_detach)
+ return (ctlr->ch_detach(dev));
- return 0;
+ return (0);
}
static int
OpenPOWER on IntegriCloud