diff options
-rw-r--r-- | sys/dev/ata/ata-pci.c | 3 | ||||
-rw-r--r-- | sys/dev/ata/ata-pci.h | 1 | ||||
-rw-r--r-- | sys/dev/ata/chipsets/ata-ahci.c | 8 |
3 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c index 62d41d0..68c209f 100644 --- a/sys/dev/ata/ata-pci.c +++ b/sys/dev/ata/ata-pci.c @@ -98,6 +98,7 @@ ata_pci_attach(device_t dev) ctlr->channels = 2; else ctlr->channels = 1; + ctlr->ichannels = -1; ctlr->allocate = ata_pci_allocate; ctlr->dmainit = ata_pci_dmainit; ctlr->dev = dev; @@ -122,6 +123,8 @@ ata_pci_attach(device_t dev) /* attach all channels on this controller */ for (unit = 0; unit < ctlr->channels; unit++) { + if ((ctlr->ichannels & (1 << unit)) == 0) + continue; child = device_add_child(dev, "ata", ((unit == 0 || unit == 1) && ctlr->legacy) ? unit : devclass_find_free_unit(ata_devclass, 2)); diff --git a/sys/dev/ata/ata-pci.h b/sys/dev/ata/ata-pci.h index a31f30e..bd5104f 100644 --- a/sys/dev/ata/ata-pci.h +++ b/sys/dev/ata/ata-pci.h @@ -51,6 +51,7 @@ struct ata_pci_controller { struct ata_chip_id *chip; int legacy; int channels; + int ichannels; int (*chipinit)(device_t); int (*suspend)(device_t); int (*resume)(device_t); diff --git a/sys/dev/ata/chipsets/ata-ahci.c b/sys/dev/ata/chipsets/ata-ahci.c index b5a5c74..6e14db1d 100644 --- a/sys/dev/ata/chipsets/ata-ahci.c +++ b/sys/dev/ata/chipsets/ata-ahci.c @@ -122,8 +122,9 @@ ata_ahci_chipinit(device_t dev) }; /* get the number of HW channels */ + ctlr->ichannels = ATA_INL(ctlr->r_res2, ATA_AHCI_PI); ctlr->channels = - MAX(flsl(ATA_INL(ctlr->r_res2, ATA_AHCI_PI)), + MAX(flsl(ctlr->ichannels), (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_NPMASK) + 1); ctlr->reset = ata_ahci_reset; @@ -667,11 +668,6 @@ ata_ahci_reset(device_t dev) u_int32_t signature; int offset = ch->unit << 7; - if (!(ATA_INL(ctlr->r_res2, ATA_AHCI_PI) & (1 << ch->unit))) { - device_printf(dev, "port not implemented\n"); - return; - } - /* setup work areas */ work = ch->dma.work_bus + ATA_AHCI_CL_OFFSET; ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CLB + offset, work & 0xffffffff); |