ANDROID: Revert "PCI: Probe bridge window attributes once at enumeration-time"
This reverts commit 54a7a9d75c
which is
commit 51c48b310183ab6ba5419edfc6a8de889cc04521 as it breaks the api for
struct pci_dev for an issue that should not be relevant for Android
systems.
Bug: 161946584
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I3fdf5ce243cbc2c4956decf773e057b7ce9a480a
This commit is contained in:
parent
369c9d2963
commit
7bce156524
3 changed files with 41 additions and 59 deletions
|
@ -348,57 +348,6 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
|
|||
}
|
||||
}
|
||||
|
||||
static void pci_read_bridge_windows(struct pci_dev *bridge)
|
||||
{
|
||||
u16 io;
|
||||
u32 pmem, tmp;
|
||||
|
||||
pci_read_config_word(bridge, PCI_IO_BASE, &io);
|
||||
if (!io) {
|
||||
pci_write_config_word(bridge, PCI_IO_BASE, 0xe0f0);
|
||||
pci_read_config_word(bridge, PCI_IO_BASE, &io);
|
||||
pci_write_config_word(bridge, PCI_IO_BASE, 0x0);
|
||||
}
|
||||
if (io)
|
||||
bridge->io_window = 1;
|
||||
|
||||
/*
|
||||
* DECchip 21050 pass 2 errata: the bridge may miss an address
|
||||
* disconnect boundary by one PCI data phase. Workaround: do not
|
||||
* use prefetching on this device.
|
||||
*/
|
||||
if (bridge->vendor == PCI_VENDOR_ID_DEC && bridge->device == 0x0001)
|
||||
return;
|
||||
|
||||
pci_read_config_dword(bridge, PCI_PREF_MEMORY_BASE, &pmem);
|
||||
if (!pmem) {
|
||||
pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE,
|
||||
0xffe0fff0);
|
||||
pci_read_config_dword(bridge, PCI_PREF_MEMORY_BASE, &pmem);
|
||||
pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, 0x0);
|
||||
}
|
||||
if (!pmem)
|
||||
return;
|
||||
|
||||
bridge->pref_window = 1;
|
||||
|
||||
if ((pmem & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) {
|
||||
|
||||
/*
|
||||
* Bridge claims to have a 64-bit prefetchable memory
|
||||
* window; verify that the upper bits are actually
|
||||
* writable.
|
||||
*/
|
||||
pci_read_config_dword(bridge, PCI_PREF_BASE_UPPER32, &pmem);
|
||||
pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32,
|
||||
0xffffffff);
|
||||
pci_read_config_dword(bridge, PCI_PREF_BASE_UPPER32, &tmp);
|
||||
pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32, pmem);
|
||||
if (tmp)
|
||||
bridge->pref_64_window = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void pci_read_bridge_io(struct pci_bus *child)
|
||||
{
|
||||
struct pci_dev *dev = child->self;
|
||||
|
@ -1763,7 +1712,6 @@ int pci_setup_device(struct pci_dev *dev)
|
|||
pci_read_irq(dev);
|
||||
dev->transparent = ((dev->class & 0xff) == 1);
|
||||
pci_read_bases(dev, 2, PCI_ROM_ADDRESS1);
|
||||
pci_read_bridge_windows(dev);
|
||||
set_pcie_hotplug_bridge(dev);
|
||||
pos = pci_find_capability(dev, PCI_CAP_ID_SSVID);
|
||||
if (pos) {
|
||||
|
|
|
@ -735,21 +735,58 @@ int pci_claim_bridge_resource(struct pci_dev *bridge, int i)
|
|||
base/limit registers must be read-only and read as 0. */
|
||||
static void pci_bridge_check_ranges(struct pci_bus *bus)
|
||||
{
|
||||
u16 io;
|
||||
u32 pmem;
|
||||
struct pci_dev *bridge = bus->self;
|
||||
struct resource *b_res = &bridge->resource[PCI_BRIDGE_RESOURCES];
|
||||
struct resource *b_res;
|
||||
|
||||
b_res = &bridge->resource[PCI_BRIDGE_RESOURCES];
|
||||
b_res[1].flags |= IORESOURCE_MEM;
|
||||
|
||||
if (bridge->io_window)
|
||||
pci_read_config_word(bridge, PCI_IO_BASE, &io);
|
||||
if (!io) {
|
||||
pci_write_config_word(bridge, PCI_IO_BASE, 0xe0f0);
|
||||
pci_read_config_word(bridge, PCI_IO_BASE, &io);
|
||||
pci_write_config_word(bridge, PCI_IO_BASE, 0x0);
|
||||
}
|
||||
if (io)
|
||||
b_res[0].flags |= IORESOURCE_IO;
|
||||
|
||||
if (bridge->pref_window) {
|
||||
/* DECchip 21050 pass 2 errata: the bridge may miss an address
|
||||
disconnect boundary by one PCI data phase.
|
||||
Workaround: do not use prefetching on this device. */
|
||||
if (bridge->vendor == PCI_VENDOR_ID_DEC && bridge->device == 0x0001)
|
||||
return;
|
||||
|
||||
pci_read_config_dword(bridge, PCI_PREF_MEMORY_BASE, &pmem);
|
||||
if (!pmem) {
|
||||
pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE,
|
||||
0xffe0fff0);
|
||||
pci_read_config_dword(bridge, PCI_PREF_MEMORY_BASE, &pmem);
|
||||
pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, 0x0);
|
||||
}
|
||||
if (pmem) {
|
||||
b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH;
|
||||
if (bridge->pref_64_window) {
|
||||
if ((pmem & PCI_PREF_RANGE_TYPE_MASK) ==
|
||||
PCI_PREF_RANGE_TYPE_64) {
|
||||
b_res[2].flags |= IORESOURCE_MEM_64;
|
||||
b_res[2].flags |= PCI_PREF_RANGE_TYPE_64;
|
||||
}
|
||||
}
|
||||
|
||||
/* double check if bridge does support 64 bit pref */
|
||||
if (b_res[2].flags & IORESOURCE_MEM_64) {
|
||||
u32 mem_base_hi, tmp;
|
||||
pci_read_config_dword(bridge, PCI_PREF_BASE_UPPER32,
|
||||
&mem_base_hi);
|
||||
pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32,
|
||||
0xffffffff);
|
||||
pci_read_config_dword(bridge, PCI_PREF_BASE_UPPER32, &tmp);
|
||||
if (!tmp)
|
||||
b_res[2].flags &= ~IORESOURCE_MEM_64;
|
||||
pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32,
|
||||
mem_base_hi);
|
||||
}
|
||||
}
|
||||
|
||||
/* Helper function for sizing routines: find first available
|
||||
|
|
|
@ -375,9 +375,6 @@ struct pci_dev {
|
|||
bool match_driver; /* Skip attaching driver */
|
||||
|
||||
unsigned int transparent:1; /* Subtractive decode bridge */
|
||||
unsigned int io_window:1; /* Bridge has I/O window */
|
||||
unsigned int pref_window:1; /* Bridge has pref mem window */
|
||||
unsigned int pref_64_window:1; /* Pref mem window is 64-bit */
|
||||
unsigned int multifunction:1; /* Multi-function device */
|
||||
|
||||
unsigned int is_busmaster:1; /* Is busmaster */
|
||||
|
|
Loading…
Add table
Reference in a new issue