mirror of
https://github.com/qemu/qemu.git
synced 2024-11-25 11:53:39 +08:00
pci: add a pci_vga_init() function
This function create a PCI VGA device according to the value of vga_interface_type. It returns a PCIDevice (and not a DeviceState). Cc: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
parent
3605ded557
commit
129d42fb84
18
hw/pci.c
18
hw/pci.c
@ -1474,6 +1474,24 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, const char *default_model,
|
||||
return res;
|
||||
}
|
||||
|
||||
PCIDevice *pci_vga_init(PCIBus *bus)
|
||||
{
|
||||
switch (vga_interface_type) {
|
||||
case VGA_CIRRUS:
|
||||
return pci_create_simple(bus, -1, "cirrus-vga");
|
||||
case VGA_QXL:
|
||||
return pci_create_simple(bus, -1, "qxl-vga");
|
||||
case VGA_STD:
|
||||
return pci_create_simple(bus, -1, "VGA");
|
||||
case VGA_VMWARE:
|
||||
return pci_create_simple(bus, -1, "vmware-svga");
|
||||
case VGA_NONE:
|
||||
default: /* Other non-PCI types. Checking for unsupported types is already
|
||||
done in vl.c. */
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Whether a given bus number is in range of the secondary
|
||||
* bus of the given bridge device. */
|
||||
static bool pci_secondary_bus_in_range(PCIDevice *dev, int bus_num)
|
||||
|
3
hw/pci.h
3
hw/pci.h
@ -334,6 +334,9 @@ PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model,
|
||||
const char *default_devaddr);
|
||||
PCIDevice *pci_nic_init_nofail(NICInfo *nd, const char *default_model,
|
||||
const char *default_devaddr);
|
||||
|
||||
PCIDevice *pci_vga_init(PCIBus *bus);
|
||||
|
||||
int pci_bus_num(PCIBus *s);
|
||||
void pci_for_each_device(PCIBus *bus, int bus_num,
|
||||
void (*fn)(PCIBus *bus, PCIDevice *d, void *opaque),
|
||||
|
Loading…
Reference in New Issue
Block a user