diff options
author | Avi Kivity <avi@redhat.com> | 2011-08-15 17:17:37 +0300 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-08-22 10:47:49 -0500 |
commit | be20f9e902ca47ea84e1b1c1e89b0a55d59b4c11 (patch) | |
tree | 11fd0270b2f59ae1bcc68481fd2156bdcf841d36 /hw | |
parent | f5e6fed879ae10b9f6494a6eed21c1979391d7cb (diff) | |
download | qemu-be20f9e902ca47ea84e1b1c1e89b0a55d59b4c11.zip qemu-be20f9e902ca47ea84e1b1c1e89b0a55d59b4c11.tar.gz qemu-be20f9e902ca47ea84e1b1c1e89b0a55d59b4c11.tar.bz2 |
vga: drop get_system_memory() from vga devices and derivatives
Instead, use the bus accessors, or get the address space directly
from the board constructor.
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/cirrus_vga.c | 12 | ||||
-rw-r--r-- | hw/mips_jazz.c | 3 | ||||
-rw-r--r-- | hw/pc.c | 3 | ||||
-rw-r--r-- | hw/pc.h | 5 | ||||
-rw-r--r-- | hw/qxl.c | 2 | ||||
-rw-r--r-- | hw/vga-isa-mm.c | 15 | ||||
-rw-r--r-- | hw/vga-isa.c | 5 | ||||
-rw-r--r-- | hw/vga-pci.c | 4 | ||||
-rw-r--r-- | hw/vga.c | 9 | ||||
-rw-r--r-- | hw/vga_int.h | 4 | ||||
-rw-r--r-- | hw/vmware_vga.c | 9 |
11 files changed, 37 insertions, 34 deletions
diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c index 0f91112..4d0ef0d 100644 --- a/hw/cirrus_vga.c +++ b/hw/cirrus_vga.c @@ -32,7 +32,6 @@ #include "console.h" #include "vga_int.h" #include "loader.h" -#include "exec-memory.h" /* * TODO: @@ -2801,7 +2800,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; @@ -2854,7 +2854,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); @@ -2897,14 +2897,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 = g_malloc0(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); @@ -2928,7 +2928,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 ea20510..84ce061 100644 --- a/hw/mips_jazz.c +++ b/hw/mips_jazz.c @@ -38,6 +38,7 @@ #include "mc146818rtc.h" #include "blockdev.h" #include "sysbus.h" +#include "exec-memory.h" enum jazz_model_e { @@ -197,7 +198,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; @@ -42,6 +42,7 @@ #include "blockdev.h" #include "ui/qemu-spice.h" #include "memory.h" +#include "exec-memory.h" /* output Bochs bios info messages */ //#define DEBUG_BIOS @@ -1066,7 +1067,7 @@ void pc_vga_init(PCIBus *pci_bus) 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) { @@ -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) @@ -1598,7 +1598,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 b934978..f8984c6 100644 --- a/hw/vga-isa-mm.c +++ b/hw/vga-isa-mm.c @@ -27,7 +27,6 @@ #include "vga_int.h" #include "pixel_ops.h" #include "qemu-timer.h" -#include "exec-memory.h" typedef struct ISAVGAMMState { VGACommonState vga; @@ -97,7 +96,8 @@ static const MemoryRegionOps vga_mm_ctrl_ops = { }; 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; @@ -113,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 = g_malloc0(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 fef7f58..0d19901 100644 --- a/hw/vga-isa.c +++ b/hw/vga-isa.c @@ -28,7 +28,6 @@ #include "pixel_ops.h" #include "qemu-timer.h" #include "loader.h" -#include "exec-memory.h" typedef struct ISAVGAState { ISADevice dev; @@ -51,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); @@ -68,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; @@ -28,7 +28,6 @@ #include "vga_int.h" #include "pixel_ops.h" #include "qemu-timer.h" -#include "exec-memory.h" //#define DEBUG_VGA //#define DEBUG_VGA_MEM @@ -2241,7 +2240,7 @@ MemoryRegion *vga_init_io(VGACommonState *s) return vga_mem; } -void vga_init(VGACommonState *s) +void vga_init(VGACommonState *s, MemoryRegion *address_space) { MemoryRegion *vga_io_memory; @@ -2250,18 +2249,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 100d98c..7e4ed71 100644 --- a/hw/vga_int.h +++ b/hw/vga_int.h @@ -187,7 +187,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); @@ -217,7 +217,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 a840cbd..5396a6c 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 = g_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; |