2 * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
4 * SPDX-License-Identifier: GPL-2.0+
11 DECLARE_GLOBAL_DATA_PTR;
13 void board_pci_setup_hose(struct pci_controller *hose)
15 hose->first_busno = 0;
18 /* PCI memory space */
19 pci_set_region(hose->regions + 0,
26 pci_set_region(hose->regions + 1,
32 pci_set_region(hose->regions + 2,
38 pci_set_region(hose->regions + 3,
42 PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
44 hose->region_count = 4;
47 int board_pci_post_scan(struct pci_controller *hose)
52 struct pci_device_id graphic_card[] = { { 0x1234, 0x1111 } };
55 * QEMU emulated graphic card shows in the PCI configuration space with
56 * PCI vendor id and device id as an artificial pair 0x1234:0x1111.
57 * It is on PCI bus 0, function 0, but device number is not consistent
58 * for the two x86 targets it supports. For i440FX and PIIX chipset
59 * board, it shows as device 2, while for Q35 and ICH9 chipset board,
60 * it shows as device 1. Here we locate its bdf at run-time based on
61 * its vendor id and device id pair so we can support both boards.
63 bdf = pci_find_devices(graphic_card, 0);
66 ret = pci_run_vga_bios(bdf, NULL, PCI_ROM_USE_NATIVE);
67 debug("BIOS ran in %lums\n", get_timer(start));