aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Schmidt <sos@FreeBSD.org>2007-02-17 16:56:39 +0000
committerSøren Schmidt <sos@FreeBSD.org>2007-02-17 16:56:39 +0000
commitcfaed55fd51f32cf208c42895ffac09c78f9ff85 (patch)
tree31424ae52139540ad3eabf13397afd2881b3526c
parentba20889705fa9bb44a3612b886254ebc7869befe (diff)
Notes
-rw-r--r--sys/dev/ata/ata-pci.c18
-rw-r--r--sys/dev/pci/pci.c4
2 files changed, 12 insertions, 10 deletions
diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c
index fc3585ad1242..1acd68d179ec 100644
--- a/sys/dev/ata/ata-pci.c
+++ b/sys/dev/ata/ata-pci.c
@@ -59,10 +59,14 @@ static MALLOC_DEFINE(M_ATAPCI, "ata_pci", "ATA driver PCI");
int
ata_legacy(device_t dev)
{
- return ((pci_read_config(dev, PCIR_PROGIF, 1)&PCIP_STORAGE_IDE_MASTERDEV) &&
- ((pci_read_config(dev, PCIR_PROGIF, 1) &
- (PCIP_STORAGE_IDE_MODEPRIM | PCIP_STORAGE_IDE_MODESEC)) !=
- (PCIP_STORAGE_IDE_MODEPRIM | PCIP_STORAGE_IDE_MODESEC)));
+ return (((pci_read_config(dev, PCIR_PROGIF, 1)&PCIP_STORAGE_IDE_MASTERDEV)&&
+ ((pci_read_config(dev, PCIR_PROGIF, 1) &
+ (PCIP_STORAGE_IDE_MODEPRIM | PCIP_STORAGE_IDE_MODESEC)) !=
+ (PCIP_STORAGE_IDE_MODEPRIM | PCIP_STORAGE_IDE_MODESEC))) ||
+ (!pci_read_config(dev, PCIR_BAR(0), 4) &&
+ !pci_read_config(dev, PCIR_BAR(1), 4) &&
+ !pci_read_config(dev, PCIR_BAR(2), 4) &&
+ !pci_read_config(dev, PCIR_BAR(3), 4)));
}
int
@@ -211,11 +215,7 @@ ata_pci_attach(device_t dev)
/* attach all channels on this controller */
for (unit = 0; unit < ctlr->channels; unit++) {
- if (unit == 0 && (pci_get_progif(dev) & 0x81) == 0x80) {
- device_add_child(dev, "ata", unit);
- continue;
- }
- if (unit == 1 && (pci_get_progif(dev) & 0x84) == 0x80) {
+ if ((unit == 0 || unit == 1) && ata_legacy(dev)) {
device_add_child(dev, "ata", unit);
continue;
}
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index fae9ba2295f7..dd55f1697a9e 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -2231,7 +2231,9 @@ pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask)
/* ATA devices needs special map treatment */
if ((pci_get_class(dev) == PCIC_STORAGE) &&
(pci_get_subclass(dev) == PCIS_STORAGE_IDE) &&
- (pci_get_progif(dev) & PCIP_STORAGE_IDE_MASTERDEV))
+ ((pci_get_progif(dev) & PCIP_STORAGE_IDE_MASTERDEV) ||
+ (!pci_read_config(dev, PCIR_BAR(0), 4) &&
+ !pci_read_config(dev, PCIR_BAR(2), 4))) )
pci_ata_maps(pcib, bus, dev, b, s, f, rl, force, prefetchmask);
else
for (i = 0; i < cfg->nummaps;)