diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-02-03 00:47:27 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-02-03 10:38:42 -0500 |
commit | 62ff9d5f649c6ce0d8cbea5d90080afc9870f54a (patch) | |
tree | be689c87bf0ef9e6b23ad3153e507374df65fdff /src/fw | |
parent | 7b67300f7d9db7dcf855e201db2f0da8f318e40d (diff) | |
download | seabios-62ff9d5f649c6ce0d8cbea5d90080afc9870f54a.tar.gz |
pci: Move code in pci.c that is specific to pciinit.c to pciinit.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/fw')
-rw-r--r-- | src/fw/mtrr.c | 1 | ||||
-rw-r--r-- | src/fw/pciinit.c | 37 |
2 files changed, 37 insertions, 1 deletions
diff --git a/src/fw/mtrr.c b/src/fw/mtrr.c index 913580e7..3e799cea 100644 --- a/src/fw/mtrr.c +++ b/src/fw/mtrr.c @@ -5,7 +5,6 @@ // This file may be distributed under the terms of the GNU LGPLv3 license. #include "config.h" // CONFIG_* -#include "hw/pci.h" // pcimem_start #include "output.h" // dprintf #include "paravirt.h" // RamSize #include "util.h" // mtrr_setup diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c index 8e6716d2..ead2c1a3 100644 --- a/src/fw/pciinit.c +++ b/src/fw/pciinit.c @@ -27,6 +27,17 @@ #define PCI_BRIDGE_MEM_MIN (1<<21) // 2M == hugepage size #define PCI_BRIDGE_IO_MIN 0x1000 // mandated by pci bridge spec +#define PCI_ROM_SLOT 6 +#define PCI_NUM_REGIONS 7 +#define PCI_BRIDGE_NUM_REGIONS 2 + +enum pci_region_type { + PCI_REGION_TYPE_IO, + PCI_REGION_TYPE_MEM, + PCI_REGION_TYPE_PREFMEM, + PCI_REGION_TYPE_COUNT, +}; + static const char *region_type_name[] = { [ PCI_REGION_TYPE_IO ] = "io", [ PCI_REGION_TYPE_MEM ] = "mem", @@ -667,6 +678,32 @@ static int pci_bus_hotplug_support(struct pci_bus *bus, u8 pcie_cap) return !!shpc_cap; } +/* Test whether bridge support forwarding of transactions + * of a specific type. + * Note: disables bridge's window registers as a side effect. + */ +static int pci_bridge_has_region(struct pci_device *pci, + enum pci_region_type region_type) +{ + u8 base; + + switch (region_type) { + case PCI_REGION_TYPE_IO: + base = PCI_IO_BASE; + break; + case PCI_REGION_TYPE_PREFMEM: + base = PCI_PREF_MEMORY_BASE; + break; + default: + /* Regular memory support is mandatory */ + return 1; + } + + pci_config_writeb(pci->bdf, base, 0xFF); + + return pci_config_readb(pci->bdf, base) != 0; +} + static int pci_bios_check_devices(struct pci_bus *busses) { dprintf(1, "PCI: check devices\n"); |