Skip to content

Commit 6f32099

Browse files
committed
PCI: Move pci_read_bridge_windows() below individual window accessors
Move pci_read_bridge_windows() below the functions that read the I/O, memory, and prefetchable memory windows, so pci_read_bridge_windows() can use them in the future. No functional change intended. Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent dc4e6f2 commit 6f32099

File tree

1 file changed

+51
-51
lines changed

1 file changed

+51
-51
lines changed

drivers/pci/probe.c

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -344,57 +344,6 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
344344
}
345345
}
346346

347-
static void pci_read_bridge_windows(struct pci_dev *bridge)
348-
{
349-
u16 io;
350-
u32 pmem, tmp;
351-
352-
pci_read_config_word(bridge, PCI_IO_BASE, &io);
353-
if (!io) {
354-
pci_write_config_word(bridge, PCI_IO_BASE, 0xe0f0);
355-
pci_read_config_word(bridge, PCI_IO_BASE, &io);
356-
pci_write_config_word(bridge, PCI_IO_BASE, 0x0);
357-
}
358-
if (io)
359-
bridge->io_window = 1;
360-
361-
/*
362-
* DECchip 21050 pass 2 errata: the bridge may miss an address
363-
* disconnect boundary by one PCI data phase. Workaround: do not
364-
* use prefetching on this device.
365-
*/
366-
if (bridge->vendor == PCI_VENDOR_ID_DEC && bridge->device == 0x0001)
367-
return;
368-
369-
pci_read_config_dword(bridge, PCI_PREF_MEMORY_BASE, &pmem);
370-
if (!pmem) {
371-
pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE,
372-
0xffe0fff0);
373-
pci_read_config_dword(bridge, PCI_PREF_MEMORY_BASE, &pmem);
374-
pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, 0x0);
375-
}
376-
if (!pmem)
377-
return;
378-
379-
bridge->pref_window = 1;
380-
381-
if ((pmem & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) {
382-
383-
/*
384-
* Bridge claims to have a 64-bit prefetchable memory
385-
* window; verify that the upper bits are actually
386-
* writable.
387-
*/
388-
pci_read_config_dword(bridge, PCI_PREF_BASE_UPPER32, &pmem);
389-
pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32,
390-
0xffffffff);
391-
pci_read_config_dword(bridge, PCI_PREF_BASE_UPPER32, &tmp);
392-
pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32, pmem);
393-
if (tmp)
394-
bridge->pref_64_window = 1;
395-
}
396-
}
397-
398347
static void pci_read_bridge_io(struct pci_bus *child)
399348
{
400349
struct pci_dev *dev = child->self;
@@ -510,6 +459,57 @@ static void pci_read_bridge_mmio_pref(struct pci_bus *child)
510459
}
511460
}
512461

462+
static void pci_read_bridge_windows(struct pci_dev *bridge)
463+
{
464+
u16 io;
465+
u32 pmem, tmp;
466+
467+
pci_read_config_word(bridge, PCI_IO_BASE, &io);
468+
if (!io) {
469+
pci_write_config_word(bridge, PCI_IO_BASE, 0xe0f0);
470+
pci_read_config_word(bridge, PCI_IO_BASE, &io);
471+
pci_write_config_word(bridge, PCI_IO_BASE, 0x0);
472+
}
473+
if (io)
474+
bridge->io_window = 1;
475+
476+
/*
477+
* DECchip 21050 pass 2 errata: the bridge may miss an address
478+
* disconnect boundary by one PCI data phase. Workaround: do not
479+
* use prefetching on this device.
480+
*/
481+
if (bridge->vendor == PCI_VENDOR_ID_DEC && bridge->device == 0x0001)
482+
return;
483+
484+
pci_read_config_dword(bridge, PCI_PREF_MEMORY_BASE, &pmem);
485+
if (!pmem) {
486+
pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE,
487+
0xffe0fff0);
488+
pci_read_config_dword(bridge, PCI_PREF_MEMORY_BASE, &pmem);
489+
pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, 0x0);
490+
}
491+
if (!pmem)
492+
return;
493+
494+
bridge->pref_window = 1;
495+
496+
if ((pmem & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) {
497+
498+
/*
499+
* Bridge claims to have a 64-bit prefetchable memory
500+
* window; verify that the upper bits are actually
501+
* writable.
502+
*/
503+
pci_read_config_dword(bridge, PCI_PREF_BASE_UPPER32, &pmem);
504+
pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32,
505+
0xffffffff);
506+
pci_read_config_dword(bridge, PCI_PREF_BASE_UPPER32, &tmp);
507+
pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32, pmem);
508+
if (tmp)
509+
bridge->pref_64_window = 1;
510+
}
511+
}
512+
513513
void pci_read_bridge_bases(struct pci_bus *child)
514514
{
515515
struct pci_dev *dev = child->self;

0 commit comments

Comments
 (0)