aboutsummaryrefslogtreecommitdiff
path: root/hw/vga.c
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-10 02:24:36 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-10 02:24:36 +0000
commitb584726df971c1238a5249cc21121cf2ebbcaf55 (patch)
tree32b73d21de064d8b3c28750d35608cac701d1863 /hw/vga.c
parenta8b01dd87f3f1cb93d51ce87b13f57fe5415e33e (diff)
Clean up VGA ram allocation.
Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7063 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/vga.c')
-rw-r--r--hw/vga.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/hw/vga.c b/hw/vga.c
index 4d1049ba44..b53b743e61 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -2266,8 +2266,7 @@ static void vga_map(PCIDevice *pci_dev, int region_num,
vga_dirty_log_start(s);
}
-void vga_common_init(VGAState *s, uint8_t *vga_ram_base,
- ram_addr_t vga_ram_offset, int vga_ram_size)
+void vga_common_init(VGAState *s, int vga_ram_size)
{
int i, j, v, b;
@@ -2294,8 +2293,8 @@ void vga_common_init(VGAState *s, uint8_t *vga_ram_base,
expand4to8[i] = v;
}
- s->vram_ptr = vga_ram_base;
- s->vram_offset = vga_ram_offset;
+ s->vram_offset = qemu_ram_alloc(vga_ram_size);
+ s->vram_ptr = qemu_get_ram_ptr(s->vram_offset);
s->vram_size = vga_ram_size;
s->get_bpp = vga_get_bpp;
s->get_offsets = vga_get_offsets;
@@ -2445,14 +2444,13 @@ static void vga_mm_init(VGAState *s, target_phys_addr_t vram_base,
qemu_register_coalesced_mmio(vram_base + 0x000a0000, 0x20000);
}
-int isa_vga_init(uint8_t *vga_ram_base,
- unsigned long vga_ram_offset, int vga_ram_size)
+int isa_vga_init(int vga_ram_size)
{
VGAState *s;
s = qemu_mallocz(sizeof(VGAState));
- vga_common_init(s, vga_ram_base, vga_ram_offset, vga_ram_size);
+ vga_common_init(s, vga_ram_size);
vga_init(s);
s->ds = graphic_console_init(s->update, s->invalidate,
@@ -2461,21 +2459,19 @@ int isa_vga_init(uint8_t *vga_ram_base,
#ifdef CONFIG_BOCHS_VBE
/* XXX: use optimized standard vga accesses */
cpu_register_physical_memory(VBE_DISPI_LFB_PHYSICAL_ADDRESS,
- vga_ram_size, vga_ram_offset);
+ vga_ram_size, s->vram_offset);
#endif
return 0;
}
-int isa_vga_mm_init(uint8_t *vga_ram_base,
- unsigned long vga_ram_offset, int vga_ram_size,
- target_phys_addr_t vram_base, target_phys_addr_t ctrl_base,
- int it_shift)
+int isa_vga_mm_init(int vga_ram_size, target_phys_addr_t vram_base,
+ target_phys_addr_t ctrl_base, int it_shift)
{
VGAState *s;
s = qemu_mallocz(sizeof(VGAState));
- vga_common_init(s, vga_ram_base, vga_ram_offset, vga_ram_size);
+ vga_common_init(s, vga_ram_size);
vga_mm_init(s, vram_base, ctrl_base, it_shift);
s->ds = graphic_console_init(s->update, s->invalidate,
@@ -2484,7 +2480,7 @@ int isa_vga_mm_init(uint8_t *vga_ram_base,
#ifdef CONFIG_BOCHS_VBE
/* XXX: use optimized standard vga accesses */
cpu_register_physical_memory(VBE_DISPI_LFB_PHYSICAL_ADDRESS,
- vga_ram_size, vga_ram_offset);
+ vga_ram_size, s->vram_offset);
#endif
return 0;
}
@@ -2500,8 +2496,7 @@ static void pci_vga_write_config(PCIDevice *d,
vga_dirty_log_start(s);
}
-int pci_vga_init(PCIBus *bus, uint8_t *vga_ram_base,
- unsigned long vga_ram_offset, int vga_ram_size,
+int pci_vga_init(PCIBus *bus, int vga_ram_size,
unsigned long vga_bios_offset, int vga_bios_size)
{
PCIVGAState *d;
@@ -2515,7 +2510,7 @@ int pci_vga_init(PCIBus *bus, uint8_t *vga_ram_base,
return -1;
s = &d->vga_state;
- vga_common_init(s, vga_ram_base, vga_ram_offset, vga_ram_size);
+ vga_common_init(s, vga_ram_size);
vga_init(s);
s->ds = graphic_console_init(s->update, s->invalidate,