mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
pci: Add PCI VGA helpers
Allow devices to register VGA memory regions for handling PCI spec defined VGA I/O port and MMIO areas. PCI will attach these to the bus address spaces and enable them according to the device command register value. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
a38b2c49bf
commit
e01fd68718
2 changed files with 82 additions and 0 deletions
21
hw/pci/pci.h
21
hw/pci/pci.h
|
@ -108,6 +108,20 @@ typedef struct PCIIORegion {
|
|||
#define PCI_ROM_SLOT 6
|
||||
#define PCI_NUM_REGIONS 7
|
||||
|
||||
enum {
|
||||
QEMU_PCI_VGA_MEM,
|
||||
QEMU_PCI_VGA_IO_LO,
|
||||
QEMU_PCI_VGA_IO_HI,
|
||||
QEMU_PCI_VGA_NUM_REGIONS,
|
||||
};
|
||||
|
||||
#define QEMU_PCI_VGA_MEM_BASE 0xa0000
|
||||
#define QEMU_PCI_VGA_MEM_SIZE 0x20000
|
||||
#define QEMU_PCI_VGA_IO_LO_BASE 0x3b0
|
||||
#define QEMU_PCI_VGA_IO_LO_SIZE 0xc
|
||||
#define QEMU_PCI_VGA_IO_HI_BASE 0x3c0
|
||||
#define QEMU_PCI_VGA_IO_HI_SIZE 0x20
|
||||
|
||||
#include "hw/pci/pci_regs.h"
|
||||
|
||||
/* PCI HEADER_TYPE */
|
||||
|
@ -234,6 +248,10 @@ struct PCIDevice {
|
|||
/* IRQ objects for the INTA-INTD pins. */
|
||||
qemu_irq *irq;
|
||||
|
||||
/* Legacy PCI VGA regions */
|
||||
MemoryRegion *vga_regions[QEMU_PCI_VGA_NUM_REGIONS];
|
||||
bool has_vga;
|
||||
|
||||
/* Current IRQ levels. Used internally by the generic PCI code. */
|
||||
uint8_t irq_state;
|
||||
|
||||
|
@ -287,6 +305,9 @@ struct PCIDevice {
|
|||
|
||||
void pci_register_bar(PCIDevice *pci_dev, int region_num,
|
||||
uint8_t attr, MemoryRegion *memory);
|
||||
void pci_register_vga(PCIDevice *pci_dev, MemoryRegion *mem,
|
||||
MemoryRegion *io_lo, MemoryRegion *io_hi);
|
||||
void pci_unregister_vga(PCIDevice *pci_dev);
|
||||
pcibus_t pci_get_bar_addr(PCIDevice *pci_dev, int region_num);
|
||||
|
||||
int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue