From: Avi Kivity <avi@redhat.com> To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org Subject: [RFC v5 85/86] vga: drop get_system_memory() from vga devices and derivatives Date: Wed, 20 Jul 2011 19:50:35 +0300 [thread overview] Message-ID: <1311180636-17012-86-git-send-email-avi@redhat.com> (raw) In-Reply-To: <1311180636-17012-1-git-send-email-avi@redhat.com> Instead, use the bus accessors, or get the address space directly from the board constructor. Signed-off-by: Avi Kivity <avi@redhat.com> --- hw/cirrus_vga.c | 13 ++++++------- hw/mips_jazz.c | 4 +++- hw/pc.c | 4 +++- hw/pc.h | 5 +++-- hw/qxl.c | 2 +- hw/vga-isa-mm.c | 16 ++++++++-------- hw/vga-isa.c | 6 ++---- hw/vga-pci.c | 4 ++-- hw/vga.c | 10 ++++------ hw/vga_int.h | 4 ++-- hw/vmware_vga.c | 9 +++++---- 11 files changed, 39 insertions(+), 38 deletions(-) diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c index 0b0fdad..e367052 100644 --- a/hw/cirrus_vga.c +++ b/hw/cirrus_vga.c @@ -2365,8 +2365,6 @@ static const MemoryRegionOps cirrus_linear_bitblt_io_ops = { }, }; -#include "exec-memory.h" - static void unmap_bank(CirrusVGAState *s, unsigned bank) { if (s->cirrus_bank[bank]) { @@ -2804,7 +2802,8 @@ static const MemoryRegionOps cirrus_linear_io_ops = { }, }; -static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci) +static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci, + MemoryRegion *system_memory) { int i; static int inited; @@ -2857,7 +2856,7 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci) memory_region_init_io(&s->low_mem, &cirrus_vga_mem_ops, s, "cirrus-low-memory", 0x20000); memory_region_add_subregion(&s->low_mem_container, 0, &s->low_mem); - memory_region_add_subregion_overlap(get_system_memory(), + memory_region_add_subregion_overlap(system_memory, isa_mem_base + 0x000a0000, &s->low_mem_container, 1); @@ -2900,14 +2899,14 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci) * ***************************************/ -void isa_cirrus_vga_init(void) +void isa_cirrus_vga_init(MemoryRegion *system_memory) { CirrusVGAState *s; s = qemu_mallocz(sizeof(CirrusVGAState)); vga_common_init(&s->vga, VGA_RAM_SIZE); - cirrus_init_common(s, CIRRUS_ID_CLGD5430, 0); + cirrus_init_common(s, CIRRUS_ID_CLGD5430, 0, system_memory); s->vga.ds = graphic_console_init(s->vga.update, s->vga.invalidate, s->vga.screen_dump, s->vga.text_update, &s->vga); @@ -2931,7 +2930,7 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev) /* setup VGA */ vga_common_init(&s->vga, VGA_RAM_SIZE); - cirrus_init_common(s, device_id, 1); + cirrus_init_common(s, device_id, 1, pci_address_space(dev)); s->vga.ds = graphic_console_init(s->vga.update, s->vga.invalidate, s->vga.screen_dump, s->vga.text_update, &s->vga); diff --git a/hw/mips_jazz.c b/hw/mips_jazz.c index a100394..a64339f 100644 --- a/hw/mips_jazz.c +++ b/hw/mips_jazz.c @@ -102,6 +102,8 @@ static void cpu_request_exit(void *opaque, int irq, int level) } } +#include "exec-memory.h" + static void mips_jazz_init (ram_addr_t ram_size, const char *cpu_model, @@ -194,7 +196,7 @@ void mips_jazz_init (ram_addr_t ram_size, g364fb_mm_init(0x40000000, 0x60000000, 0, rc4030[3]); break; case JAZZ_PICA61: - isa_vga_mm_init(0x40000000, 0x60000000, 0); + isa_vga_mm_init(0x40000000, 0x60000000, 0, get_system_memory()); break; default: break; diff --git a/hw/pc.c b/hw/pc.c index 1c9d89a..f920001 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -1060,13 +1060,15 @@ qemu_irq *pc_allocate_cpu_irq(void) return qemu_allocate_irqs(pic_irq_request, NULL, 1); } +#include "exec-memory.h" + void pc_vga_init(PCIBus *pci_bus) { if (cirrus_vga_enabled) { if (pci_bus) { pci_cirrus_vga_init(pci_bus); } else { - isa_cirrus_vga_init(); + isa_cirrus_vga_init(get_system_memory()); } } else if (vmsvga_enabled) { if (pci_bus) { diff --git a/hw/pc.h b/hw/pc.h index ec34db7..d871fd8 100644 --- a/hw/pc.h +++ b/hw/pc.h @@ -212,11 +212,12 @@ static inline int isa_vga_init(void) int pci_vga_init(PCIBus *bus); int isa_vga_mm_init(target_phys_addr_t vram_base, - target_phys_addr_t ctrl_base, int it_shift); + target_phys_addr_t ctrl_base, int it_shift, + MemoryRegion *address_space); /* cirrus_vga.c */ void pci_cirrus_vga_init(PCIBus *bus); -void isa_cirrus_vga_init(void); +void isa_cirrus_vga_init(MemoryRegion *address_space); /* ne2000.c */ static inline bool isa_ne2000_init(int base, int irq, NICInfo *nd) diff --git a/hw/qxl.c b/hw/qxl.c index 854ffa9..c0a119d 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -1270,7 +1270,7 @@ static int qxl_init_primary(PCIDevice *dev) ram_size = 32 * 1024 * 1024; } vga_common_init(vga, ram_size); - vga_init(vga); + vga_init(vga, pci_address_space(dev)); register_ioport_write(0x3c0, 16, 1, qxl_vga_ioport_write, vga); register_ioport_write(0x3b4, 2, 1, qxl_vga_ioport_write, vga); register_ioport_write(0x3d4, 2, 1, qxl_vga_ioport_write, vga); diff --git a/hw/vga-isa-mm.c b/hw/vga-isa-mm.c index baa1e92..3fe23dd 100644 --- a/hw/vga-isa-mm.c +++ b/hw/vga-isa-mm.c @@ -95,10 +95,9 @@ static const MemoryRegionOps vga_mm_ctrl_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -#include "exec-memory.h" - static void vga_mm_init(ISAVGAMMState *s, target_phys_addr_t vram_base, - target_phys_addr_t ctrl_base, int it_shift) + target_phys_addr_t ctrl_base, int it_shift, + MemoryRegion *address_space) { MemoryRegion *s_ioport_ctrl, *vga_io_memory; @@ -114,26 +113,27 @@ static void vga_mm_init(ISAVGAMMState *s, target_phys_addr_t vram_base, vmstate_register(NULL, 0, &vmstate_vga_common, s); - memory_region_add_subregion(get_system_memory(), ctrl_base, s_ioport_ctrl); + memory_region_add_subregion(address_space, ctrl_base, s_ioport_ctrl); s->vga.bank_offset = 0; - memory_region_add_subregion(get_system_memory(), + memory_region_add_subregion(address_space, vram_base + 0x000a0000, vga_io_memory); memory_region_set_coalescing(vga_io_memory); } int isa_vga_mm_init(target_phys_addr_t vram_base, - target_phys_addr_t ctrl_base, int it_shift) + target_phys_addr_t ctrl_base, int it_shift, + MemoryRegion *address_space) { ISAVGAMMState *s; s = qemu_mallocz(sizeof(*s)); vga_common_init(&s->vga, VGA_RAM_SIZE); - vga_mm_init(s, vram_base, ctrl_base, it_shift); + vga_mm_init(s, vram_base, ctrl_base, it_shift, address_space); s->vga.ds = graphic_console_init(s->vga.update, s->vga.invalidate, s->vga.screen_dump, s->vga.text_update, s); - vga_init_vbe(&s->vga); + vga_init_vbe(&s->vga, address_space); return 0; } diff --git a/hw/vga-isa.c b/hw/vga-isa.c index 518cecc..0d19901 100644 --- a/hw/vga-isa.c +++ b/hw/vga-isa.c @@ -42,8 +42,6 @@ static void vga_reset_isa(DeviceState *dev) vga_common_reset(s); } -#include "exec-memory.h" - static int vga_initfn(ISADevice *dev) { ISAVGAState *d = DO_UPCAST(ISAVGAState, dev, dev); @@ -52,7 +50,7 @@ static int vga_initfn(ISADevice *dev) vga_common_init(s, VGA_RAM_SIZE); vga_io_memory = vga_init_io(s); - memory_region_add_subregion_overlap(get_system_memory(), + memory_region_add_subregion_overlap(isa_address_space(dev), isa_mem_base + 0x000a0000, vga_io_memory, 1); memory_region_set_coalescing(vga_io_memory); @@ -69,7 +67,7 @@ static int vga_initfn(ISADevice *dev) s->ds = graphic_console_init(s->update, s->invalidate, s->screen_dump, s->text_update, s); - vga_init_vbe(s); + vga_init_vbe(s, isa_address_space(dev)); /* ROM BIOS */ rom_add_vga(VGABIOS_FILENAME); return 0; diff --git a/hw/vga-pci.c b/hw/vga-pci.c index c67be0a..3c8bcb0 100644 --- a/hw/vga-pci.c +++ b/hw/vga-pci.c @@ -54,7 +54,7 @@ static int pci_vga_initfn(PCIDevice *dev) // vga + console init vga_common_init(s, VGA_RAM_SIZE); - vga_init(s); + vga_init(s, pci_address_space(dev)); s->ds = graphic_console_init(s->update, s->invalidate, s->screen_dump, s->text_update, s); @@ -64,7 +64,7 @@ static int pci_vga_initfn(PCIDevice *dev) if (!dev->rom_bar) { /* compatibility with pc-0.13 and older */ - vga_init_vbe(s); + vga_init_vbe(s, pci_address_space(dev)); } return 0; diff --git a/hw/vga.c b/hw/vga.c index df47a05..5a78b71 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -2239,9 +2239,7 @@ MemoryRegion *vga_init_io(VGACommonState *s) return vga_mem; } -#include "exec-memory.h" - -void vga_init(VGACommonState *s) +void vga_init(VGACommonState *s, MemoryRegion *address_space) { MemoryRegion *vga_io_memory; @@ -2250,18 +2248,18 @@ void vga_init(VGACommonState *s) s->bank_offset = 0; vga_io_memory = vga_init_io(s); - memory_region_add_subregion_overlap(get_system_memory(), + memory_region_add_subregion_overlap(address_space, isa_mem_base + 0x000a0000, vga_io_memory, 1); memory_region_set_coalescing(vga_io_memory); } -void vga_init_vbe(VGACommonState *s) +void vga_init_vbe(VGACommonState *s, MemoryRegion *system_memory) { #ifdef CONFIG_BOCHS_VBE /* XXX: use optimized standard vga accesses */ - memory_region_add_subregion(get_system_memory(), + memory_region_add_subregion(system_memory, VBE_DISPI_LFB_PHYSICAL_ADDRESS, &s->vram); s->vbe_mapped = 1; diff --git a/hw/vga_int.h b/hw/vga_int.h index aba2e98..176bf40 100644 --- a/hw/vga_int.h +++ b/hw/vga_int.h @@ -186,7 +186,7 @@ static inline int c6_to_8(int v) } void vga_common_init(VGACommonState *s, int vga_ram_size); -void vga_init(VGACommonState *s); +void vga_init(VGACommonState *s, MemoryRegion *address_space); MemoryRegion *vga_init_io(VGACommonState *s); void vga_common_reset(VGACommonState *s); @@ -216,7 +216,7 @@ void vga_draw_cursor_line_32(uint8_t *d1, const uint8_t *src1, unsigned int color_xor); int vga_ioport_invalid(VGACommonState *s, uint32_t addr); -void vga_init_vbe(VGACommonState *s); +void vga_init_vbe(VGACommonState *s, MemoryRegion *address_space); extern const uint8_t sr_mask[8]; extern const uint8_t gr_mask[16]; diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c index d5cfa70..dded3f6 100644 --- a/hw/vmware_vga.c +++ b/hw/vmware_vga.c @@ -1207,7 +1207,8 @@ static const VMStateDescription vmstate_vmware_vga = { } }; -static void vmsvga_init(struct vmsvga_state_s *s, int vga_ram_size) +static void vmsvga_init(struct vmsvga_state_s *s, int vga_ram_size, + MemoryRegion *address_space) { s->scratch_size = SVGA_SCRATCH_SIZE; s->scratch = qemu_malloc(s->scratch_size * 4); @@ -1223,7 +1224,7 @@ static void vmsvga_init(struct vmsvga_state_s *s, int vga_ram_size) s->fifo_ptr = memory_region_get_ram_ptr(&s->fifo_ram); vga_common_init(&s->vga, vga_ram_size); - vga_init(&s->vga); + vga_init(&s->vga, address_space); vmstate_register(NULL, 0, &vmstate_vga_common, &s->vga); vmsvga_reset(s); @@ -1293,7 +1294,7 @@ static int pci_vmsvga_initfn(PCIDevice *dev) "vmsvga-io", 0x10); pci_register_bar(&s->card, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_bar); - vmsvga_init(&s->chip, VGA_RAM_SIZE); + vmsvga_init(&s->chip, VGA_RAM_SIZE, pci_address_space(dev)); pci_register_bar(&s->card, 1, PCI_BASE_ADDRESS_MEM_PREFETCH, iomem); pci_register_bar(&s->card, 2, PCI_BASE_ADDRESS_MEM_PREFETCH, @@ -1301,7 +1302,7 @@ static int pci_vmsvga_initfn(PCIDevice *dev) if (!dev->rom_bar) { /* compatibility with pc-0.13 and older */ - vga_init_vbe(&s->chip.vga); + vga_init_vbe(&s->chip.vga, pci_address_space(dev)); } return 0; -- 1.7.5.3
WARNING: multiple messages have this Message-ID (diff)
From: Avi Kivity <avi@redhat.com> To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org Subject: [Qemu-devel] [RFC v5 85/86] vga: drop get_system_memory() from vga devices and derivatives Date: Wed, 20 Jul 2011 19:50:35 +0300 [thread overview] Message-ID: <1311180636-17012-86-git-send-email-avi@redhat.com> (raw) In-Reply-To: <1311180636-17012-1-git-send-email-avi@redhat.com> Instead, use the bus accessors, or get the address space directly from the board constructor. Signed-off-by: Avi Kivity <avi@redhat.com> --- hw/cirrus_vga.c | 13 ++++++------- hw/mips_jazz.c | 4 +++- hw/pc.c | 4 +++- hw/pc.h | 5 +++-- hw/qxl.c | 2 +- hw/vga-isa-mm.c | 16 ++++++++-------- hw/vga-isa.c | 6 ++---- hw/vga-pci.c | 4 ++-- hw/vga.c | 10 ++++------ hw/vga_int.h | 4 ++-- hw/vmware_vga.c | 9 +++++---- 11 files changed, 39 insertions(+), 38 deletions(-) diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c index 0b0fdad..e367052 100644 --- a/hw/cirrus_vga.c +++ b/hw/cirrus_vga.c @@ -2365,8 +2365,6 @@ static const MemoryRegionOps cirrus_linear_bitblt_io_ops = { }, }; -#include "exec-memory.h" - static void unmap_bank(CirrusVGAState *s, unsigned bank) { if (s->cirrus_bank[bank]) { @@ -2804,7 +2802,8 @@ static const MemoryRegionOps cirrus_linear_io_ops = { }, }; -static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci) +static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci, + MemoryRegion *system_memory) { int i; static int inited; @@ -2857,7 +2856,7 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci) memory_region_init_io(&s->low_mem, &cirrus_vga_mem_ops, s, "cirrus-low-memory", 0x20000); memory_region_add_subregion(&s->low_mem_container, 0, &s->low_mem); - memory_region_add_subregion_overlap(get_system_memory(), + memory_region_add_subregion_overlap(system_memory, isa_mem_base + 0x000a0000, &s->low_mem_container, 1); @@ -2900,14 +2899,14 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci) * ***************************************/ -void isa_cirrus_vga_init(void) +void isa_cirrus_vga_init(MemoryRegion *system_memory) { CirrusVGAState *s; s = qemu_mallocz(sizeof(CirrusVGAState)); vga_common_init(&s->vga, VGA_RAM_SIZE); - cirrus_init_common(s, CIRRUS_ID_CLGD5430, 0); + cirrus_init_common(s, CIRRUS_ID_CLGD5430, 0, system_memory); s->vga.ds = graphic_console_init(s->vga.update, s->vga.invalidate, s->vga.screen_dump, s->vga.text_update, &s->vga); @@ -2931,7 +2930,7 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev) /* setup VGA */ vga_common_init(&s->vga, VGA_RAM_SIZE); - cirrus_init_common(s, device_id, 1); + cirrus_init_common(s, device_id, 1, pci_address_space(dev)); s->vga.ds = graphic_console_init(s->vga.update, s->vga.invalidate, s->vga.screen_dump, s->vga.text_update, &s->vga); diff --git a/hw/mips_jazz.c b/hw/mips_jazz.c index a100394..a64339f 100644 --- a/hw/mips_jazz.c +++ b/hw/mips_jazz.c @@ -102,6 +102,8 @@ static void cpu_request_exit(void *opaque, int irq, int level) } } +#include "exec-memory.h" + static void mips_jazz_init (ram_addr_t ram_size, const char *cpu_model, @@ -194,7 +196,7 @@ void mips_jazz_init (ram_addr_t ram_size, g364fb_mm_init(0x40000000, 0x60000000, 0, rc4030[3]); break; case JAZZ_PICA61: - isa_vga_mm_init(0x40000000, 0x60000000, 0); + isa_vga_mm_init(0x40000000, 0x60000000, 0, get_system_memory()); break; default: break; diff --git a/hw/pc.c b/hw/pc.c index 1c9d89a..f920001 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -1060,13 +1060,15 @@ qemu_irq *pc_allocate_cpu_irq(void) return qemu_allocate_irqs(pic_irq_request, NULL, 1); } +#include "exec-memory.h" + void pc_vga_init(PCIBus *pci_bus) { if (cirrus_vga_enabled) { if (pci_bus) { pci_cirrus_vga_init(pci_bus); } else { - isa_cirrus_vga_init(); + isa_cirrus_vga_init(get_system_memory()); } } else if (vmsvga_enabled) { if (pci_bus) { diff --git a/hw/pc.h b/hw/pc.h index ec34db7..d871fd8 100644 --- a/hw/pc.h +++ b/hw/pc.h @@ -212,11 +212,12 @@ static inline int isa_vga_init(void) int pci_vga_init(PCIBus *bus); int isa_vga_mm_init(target_phys_addr_t vram_base, - target_phys_addr_t ctrl_base, int it_shift); + target_phys_addr_t ctrl_base, int it_shift, + MemoryRegion *address_space); /* cirrus_vga.c */ void pci_cirrus_vga_init(PCIBus *bus); -void isa_cirrus_vga_init(void); +void isa_cirrus_vga_init(MemoryRegion *address_space); /* ne2000.c */ static inline bool isa_ne2000_init(int base, int irq, NICInfo *nd) diff --git a/hw/qxl.c b/hw/qxl.c index 854ffa9..c0a119d 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -1270,7 +1270,7 @@ static int qxl_init_primary(PCIDevice *dev) ram_size = 32 * 1024 * 1024; } vga_common_init(vga, ram_size); - vga_init(vga); + vga_init(vga, pci_address_space(dev)); register_ioport_write(0x3c0, 16, 1, qxl_vga_ioport_write, vga); register_ioport_write(0x3b4, 2, 1, qxl_vga_ioport_write, vga); register_ioport_write(0x3d4, 2, 1, qxl_vga_ioport_write, vga); diff --git a/hw/vga-isa-mm.c b/hw/vga-isa-mm.c index baa1e92..3fe23dd 100644 --- a/hw/vga-isa-mm.c +++ b/hw/vga-isa-mm.c @@ -95,10 +95,9 @@ static const MemoryRegionOps vga_mm_ctrl_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -#include "exec-memory.h" - static void vga_mm_init(ISAVGAMMState *s, target_phys_addr_t vram_base, - target_phys_addr_t ctrl_base, int it_shift) + target_phys_addr_t ctrl_base, int it_shift, + MemoryRegion *address_space) { MemoryRegion *s_ioport_ctrl, *vga_io_memory; @@ -114,26 +113,27 @@ static void vga_mm_init(ISAVGAMMState *s, target_phys_addr_t vram_base, vmstate_register(NULL, 0, &vmstate_vga_common, s); - memory_region_add_subregion(get_system_memory(), ctrl_base, s_ioport_ctrl); + memory_region_add_subregion(address_space, ctrl_base, s_ioport_ctrl); s->vga.bank_offset = 0; - memory_region_add_subregion(get_system_memory(), + memory_region_add_subregion(address_space, vram_base + 0x000a0000, vga_io_memory); memory_region_set_coalescing(vga_io_memory); } int isa_vga_mm_init(target_phys_addr_t vram_base, - target_phys_addr_t ctrl_base, int it_shift) + target_phys_addr_t ctrl_base, int it_shift, + MemoryRegion *address_space) { ISAVGAMMState *s; s = qemu_mallocz(sizeof(*s)); vga_common_init(&s->vga, VGA_RAM_SIZE); - vga_mm_init(s, vram_base, ctrl_base, it_shift); + vga_mm_init(s, vram_base, ctrl_base, it_shift, address_space); s->vga.ds = graphic_console_init(s->vga.update, s->vga.invalidate, s->vga.screen_dump, s->vga.text_update, s); - vga_init_vbe(&s->vga); + vga_init_vbe(&s->vga, address_space); return 0; } diff --git a/hw/vga-isa.c b/hw/vga-isa.c index 518cecc..0d19901 100644 --- a/hw/vga-isa.c +++ b/hw/vga-isa.c @@ -42,8 +42,6 @@ static void vga_reset_isa(DeviceState *dev) vga_common_reset(s); } -#include "exec-memory.h" - static int vga_initfn(ISADevice *dev) { ISAVGAState *d = DO_UPCAST(ISAVGAState, dev, dev); @@ -52,7 +50,7 @@ static int vga_initfn(ISADevice *dev) vga_common_init(s, VGA_RAM_SIZE); vga_io_memory = vga_init_io(s); - memory_region_add_subregion_overlap(get_system_memory(), + memory_region_add_subregion_overlap(isa_address_space(dev), isa_mem_base + 0x000a0000, vga_io_memory, 1); memory_region_set_coalescing(vga_io_memory); @@ -69,7 +67,7 @@ static int vga_initfn(ISADevice *dev) s->ds = graphic_console_init(s->update, s->invalidate, s->screen_dump, s->text_update, s); - vga_init_vbe(s); + vga_init_vbe(s, isa_address_space(dev)); /* ROM BIOS */ rom_add_vga(VGABIOS_FILENAME); return 0; diff --git a/hw/vga-pci.c b/hw/vga-pci.c index c67be0a..3c8bcb0 100644 --- a/hw/vga-pci.c +++ b/hw/vga-pci.c @@ -54,7 +54,7 @@ static int pci_vga_initfn(PCIDevice *dev) // vga + console init vga_common_init(s, VGA_RAM_SIZE); - vga_init(s); + vga_init(s, pci_address_space(dev)); s->ds = graphic_console_init(s->update, s->invalidate, s->screen_dump, s->text_update, s); @@ -64,7 +64,7 @@ static int pci_vga_initfn(PCIDevice *dev) if (!dev->rom_bar) { /* compatibility with pc-0.13 and older */ - vga_init_vbe(s); + vga_init_vbe(s, pci_address_space(dev)); } return 0; diff --git a/hw/vga.c b/hw/vga.c index df47a05..5a78b71 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -2239,9 +2239,7 @@ MemoryRegion *vga_init_io(VGACommonState *s) return vga_mem; } -#include "exec-memory.h" - -void vga_init(VGACommonState *s) +void vga_init(VGACommonState *s, MemoryRegion *address_space) { MemoryRegion *vga_io_memory; @@ -2250,18 +2248,18 @@ void vga_init(VGACommonState *s) s->bank_offset = 0; vga_io_memory = vga_init_io(s); - memory_region_add_subregion_overlap(get_system_memory(), + memory_region_add_subregion_overlap(address_space, isa_mem_base + 0x000a0000, vga_io_memory, 1); memory_region_set_coalescing(vga_io_memory); } -void vga_init_vbe(VGACommonState *s) +void vga_init_vbe(VGACommonState *s, MemoryRegion *system_memory) { #ifdef CONFIG_BOCHS_VBE /* XXX: use optimized standard vga accesses */ - memory_region_add_subregion(get_system_memory(), + memory_region_add_subregion(system_memory, VBE_DISPI_LFB_PHYSICAL_ADDRESS, &s->vram); s->vbe_mapped = 1; diff --git a/hw/vga_int.h b/hw/vga_int.h index aba2e98..176bf40 100644 --- a/hw/vga_int.h +++ b/hw/vga_int.h @@ -186,7 +186,7 @@ static inline int c6_to_8(int v) } void vga_common_init(VGACommonState *s, int vga_ram_size); -void vga_init(VGACommonState *s); +void vga_init(VGACommonState *s, MemoryRegion *address_space); MemoryRegion *vga_init_io(VGACommonState *s); void vga_common_reset(VGACommonState *s); @@ -216,7 +216,7 @@ void vga_draw_cursor_line_32(uint8_t *d1, const uint8_t *src1, unsigned int color_xor); int vga_ioport_invalid(VGACommonState *s, uint32_t addr); -void vga_init_vbe(VGACommonState *s); +void vga_init_vbe(VGACommonState *s, MemoryRegion *address_space); extern const uint8_t sr_mask[8]; extern const uint8_t gr_mask[16]; diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c index d5cfa70..dded3f6 100644 --- a/hw/vmware_vga.c +++ b/hw/vmware_vga.c @@ -1207,7 +1207,8 @@ static const VMStateDescription vmstate_vmware_vga = { } }; -static void vmsvga_init(struct vmsvga_state_s *s, int vga_ram_size) +static void vmsvga_init(struct vmsvga_state_s *s, int vga_ram_size, + MemoryRegion *address_space) { s->scratch_size = SVGA_SCRATCH_SIZE; s->scratch = qemu_malloc(s->scratch_size * 4); @@ -1223,7 +1224,7 @@ static void vmsvga_init(struct vmsvga_state_s *s, int vga_ram_size) s->fifo_ptr = memory_region_get_ram_ptr(&s->fifo_ram); vga_common_init(&s->vga, vga_ram_size); - vga_init(&s->vga); + vga_init(&s->vga, address_space); vmstate_register(NULL, 0, &vmstate_vga_common, &s->vga); vmsvga_reset(s); @@ -1293,7 +1294,7 @@ static int pci_vmsvga_initfn(PCIDevice *dev) "vmsvga-io", 0x10); pci_register_bar(&s->card, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_bar); - vmsvga_init(&s->chip, VGA_RAM_SIZE); + vmsvga_init(&s->chip, VGA_RAM_SIZE, pci_address_space(dev)); pci_register_bar(&s->card, 1, PCI_BASE_ADDRESS_MEM_PREFETCH, iomem); pci_register_bar(&s->card, 2, PCI_BASE_ADDRESS_MEM_PREFETCH, @@ -1301,7 +1302,7 @@ static int pci_vmsvga_initfn(PCIDevice *dev) if (!dev->rom_bar) { /* compatibility with pc-0.13 and older */ - vga_init_vbe(&s->chip.vga); + vga_init_vbe(&s->chip.vga, pci_address_space(dev)); } return 0; -- 1.7.5.3
next prev parent reply other threads:[~2011-07-20 16:50 UTC|newest] Thread overview: 218+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-07-20 16:49 [RFC v5 00/86] Memory API Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 01/86] xen: fix xen-mapcache build on non-Xen capable targets Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 02/86] Hierarchical memory region API Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 03/86] memory: implement dirty tracking Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 04/86] memory: merge adjacent segments of a single memory region Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 05/86] Internal interfaces for memory API Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 06/86] memory: abstract address space operations Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 07/86] memory: rename MemoryRegion::has_ram_addr to ::terminates Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 08/86] memory: late initialization of ram_addr Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 09/86] memory: I/O address space support Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 10/86] memory: add backward compatibility for old portio registration Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 11/86] memory: add backward compatibility for old mmio registration Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 12/86] memory: add ioeventfd support Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-21 19:55 ` Blue Swirl 2011-07-22 7:05 ` Avi Kivity 2011-07-22 7:05 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 13/86] memory: separate building the final memory map into two steps Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 14/86] exec.c: initialize memory map Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 15/86] ioport: register ranges by byte aligned addresses always Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 16/86] pc: grab system_memory Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 17/86] pc: convert pc_memory_init() to memory API Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 18/86] pc: move global memory map out of pc_init1() and into its callers Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 19/86] pci: pass address space to pci bus when created Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 20/86] pci: add MemoryRegion based BAR management API Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 21/86] sysbus: add MemoryRegion based memory " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 22/86] usb-ohci: convert to MemoryRegion Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 23/86] pci: add API to get a BAR's mapped address Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 24/86] vmsvga: don't remember pci BAR address in callback any more Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 25/86] vga: convert vga and its derivatives to the memory API Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 26/86] cirrus: simplify mmio BAR access functions Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 27/86] cirrus: simplify bitblt " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 28/86] cirrus: simplify vga window mmio " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 29/86] vga: " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 30/86] cirrus: simplify linear framebuffer " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 31/86] Integrate I/O memory regions into qemu Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 32/86] exec.c: fix initialization of system I/O memory region Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 33/86] pci: pass I/O address space to new PCI bus Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 34/86] pci: allow I/O BARs to be registered with pci_register_bar_region() Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 35/86] rtl8139: convert to memory API Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 36/86] ac97: " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 37/86] e1000: " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 38/86] eepro100: " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 39/86] es1370: " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 40/86] ide: " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 41/86] ivshmem: " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 42/86] virtio-pci: " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 43/86] ahci: " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 44/86] intel-hda: " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 45/86] lsi53c895a: " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 46/86] ppc: " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 47/86] ne2000: " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 48/86] pcnet: " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:49 ` [RFC v5 49/86] i6300esb: " Avi Kivity 2011-07-20 16:49 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 50/86] isa-mmio: concert " Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 51/86] sun4u: convert " Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 52/86] ehci: " Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 53/86] uhci: " Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 54/86] xen-platform: " Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 55/86] msix: " Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 56/86] pci: remove pci_register_bar_simple() Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 57/86] pci: convert pci rom to memory API Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 58/86] pci: remove pci_register_bar() Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 59/86] pci: fold BAR mapping function into its caller Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 60/86] pci: rename pci_register_bar_region() to pci_register_bar() Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 61/86] pci: remove support for pre memory API BARs Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 62/86] Introduce QEMU_NEW() Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 63/86] apb_pci: convert to memory API Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 64/86] apic: " Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 65/86] arm_gic: " Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 66/86] arm_sysctl: " Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 67/86] arm_timer: " Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 68/86] armv7m: " Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 69/86] gt64xxx.c: " Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 70/86] tusb6010: move declarations to new file tusb6010.h Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 71/86] omap_gpmc/nseries/tusb6010: convert to memory API Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 72/86] onenand: " Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 73/86] pcie_host: " Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 74/86] ppc405_uc: " Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 75/86] ppc4xx_sdram: " Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 76/86] stellaris_enet: " Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 77/86] sysbus: add a variant of sysbus_init_mmio_cb with an unmap callback Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 78/86] sh_pci: convert to memory API Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 79/86] arm11mpcore: use sysbus_init_mmio_cb2 Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 80/86] versatile_pci: convert to memory API Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 81/86] ppce500_pci: convert to sysbus_init_mmio_cb2() Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 82/86] sysbus: remove sysbus_init_mmio_cb() Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 83/86] isa: add isa_address_space() Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` [RFC v5 84/86] pci: add pci_address_space() Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-20 16:50 ` Avi Kivity [this message] 2011-07-20 16:50 ` [Qemu-devel] [RFC v5 85/86] vga: drop get_system_memory() from vga devices and derivatives Avi Kivity 2011-07-20 16:50 ` [RFC v5 86/86] 440fx: fix PAM, PCI holes Avi Kivity 2011-07-20 16:50 ` [Qemu-devel] " Avi Kivity 2011-07-25 13:07 ` Anthony Liguori 2011-07-25 13:14 ` Avi Kivity 2011-07-25 13:17 ` Gleb Natapov 2011-07-25 13:17 ` Gleb Natapov 2011-07-25 13:28 ` Avi Kivity 2011-07-25 13:28 ` Avi Kivity 2011-07-25 13:31 ` Gleb Natapov 2011-07-25 13:31 ` Gleb Natapov 2011-07-25 13:31 ` Avi Kivity 2011-07-25 13:31 ` Avi Kivity 2011-07-25 13:35 ` Gleb Natapov 2011-07-25 13:35 ` Gleb Natapov 2011-07-25 13:38 ` Avi Kivity 2011-07-25 13:38 ` Avi Kivity 2011-07-25 13:47 ` Anthony Liguori 2011-07-25 13:47 ` [Qemu-devel] " Anthony Liguori 2011-07-25 13:50 ` Gleb Natapov 2011-07-25 13:50 ` Gleb Natapov 2011-07-25 14:05 ` Avi Kivity 2011-07-25 14:05 ` Avi Kivity 2011-07-25 14:08 ` Anthony Liguori 2011-07-25 14:10 ` Avi Kivity 2011-07-25 13:32 ` Anthony Liguori 2011-07-25 13:32 ` Anthony Liguori 2011-07-25 21:34 ` Eric Northup 2011-07-25 21:34 ` [Qemu-devel] " Eric Northup 2011-07-26 8:01 ` Avi Kivity 2011-07-26 8:01 ` [Qemu-devel] " Avi Kivity 2011-07-20 17:41 ` [RFC v5 00/86] Memory API Jan Kiszka 2011-07-20 17:41 ` [Qemu-devel] " Jan Kiszka 2011-07-20 17:43 ` Avi Kivity 2011-07-20 17:43 ` [Qemu-devel] " Avi Kivity 2011-07-20 21:43 ` Jan Kiszka 2011-07-20 21:43 ` [Qemu-devel] " Jan Kiszka 2011-07-21 8:37 ` Avi Kivity 2011-07-21 13:38 ` Jan Kiszka 2011-07-21 13:43 ` Avi Kivity 2011-07-21 14:19 ` Jan Kiszka 2011-07-21 14:31 ` Avi Kivity 2011-07-21 14:34 ` Jan Kiszka 2011-07-21 14:40 ` Avi Kivity
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1311180636-17012-86-git-send-email-avi@redhat.com \ --to=avi@redhat.com \ --cc=kvm@vger.kernel.org \ --cc=qemu-devel@nongnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.