This prevents lockups when trying to allocate PCI resources on an
ISA-only system like QEMU can emulate.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
struct pci_device *PCIDevices;
int MaxPCIBus VAR16VISIBLE;
struct pci_device *PCIDevices;
int MaxPCIBus VAR16VISIBLE;
+// Check if PCI is available at all
+int
+pci_probe_host(void)
+{
+ outl(0x80000000, PORT_PCI_CMD);
+ if (inl(PORT_PCI_CMD) != 0x80000000) {
+ dprintf(1, "Detected non-PCI system\n");
+ return -1;
+ }
+ return 0;
+}
+
// Find all PCI devices and populate PCIDevices linked list.
void
// Find all PCI devices and populate PCIDevices linked list.
void
{
dprintf(3, "PCI probe\n");
struct pci_device *busdevs[256];
{
dprintf(3, "PCI probe\n");
struct pci_device *busdevs[256];
};
extern struct pci_device *PCIDevices;
extern int MaxPCIBus;
};
extern struct pci_device *PCIDevices;
extern int MaxPCIBus;
+int pci_probe_host(void);
+void pci_probe_devices(void);
static inline u32 pci_classprog(struct pci_device *pci) {
return (pci->class << 8) | pci->prog_if;
}
static inline u32 pci_classprog(struct pci_device *pci) {
return (pci->class << 8) | pci->prog_if;
}
{
if (CONFIG_COREBOOT || usingXen()) {
// PCI setup already done by coreboot or Xen - just do probe.
{
if (CONFIG_COREBOOT || usingXen()) {
// PCI setup already done by coreboot or Xen - just do probe.
u32 end = BUILD_PCIMEM_END;
dprintf(1, "=== PCI bus & bridge init ===\n");
u32 end = BUILD_PCIMEM_END;
dprintf(1, "=== PCI bus & bridge init ===\n");
+ if (pci_probe_host() != 0) {
+ return;
+ }
pci_bios_init_bus();
dprintf(1, "=== PCI device probing ===\n");
pci_bios_init_bus();
dprintf(1, "=== PCI device probing ===\n");
dprintf(1, "=== PCI new allocation pass #1 ===\n");
busses = malloc_tmp(sizeof(*busses) * busses_count);
dprintf(1, "=== PCI new allocation pass #1 ===\n");
busses = malloc_tmp(sizeof(*busses) * busses_count);