1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

Add support for chipsets that has NULL'd BAR's for legacy ports.

This allows DMA to be used on a fine little geode system I got here and
most like on lots of older systems like that.

HW donated by:  Paul Ghering
This commit is contained in:
Søren Schmidt 2007-02-17 16:56:39 +00:00
parent ba20889705
commit cfaed55fd5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=166802
2 changed files with 12 additions and 10 deletions

View File

@ -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) &&
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)));
(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;
}

View File

@ -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;)