[7059] Cleanup SPARC/TCX framebuffer allocation.
Revision: 7059
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7059 Author: pbrook Date: 2009-04-09 22:21:07 +0000 (Thu, 09 Apr 2009)
Log Message:
-----------
Cleanup SPARC/TCX framebuffer allocation.
Signed-off-by Paul Brook <[email protected]>
Modified Paths:
--------------
trunk/cpu-all.h
trunk/exec.c
trunk/hw/sun4m.c
trunk/hw/sun4m.h
trunk/hw/tcx.c
Modified: trunk/cpu-all.h
===================================================================
cpu-all.h +2 -0
@@ -906,6 +906,8 @@ram_addr_t cpu_get_physical_page_desc (target_phys_addr_t addr);ram_addr_t qemu_ram_alloc (ram_addr_t );void qemu_ram_free (ram_addr_t addr); +/* This should only be used for ram local to a device. */ +void *qemu_get_ram_ptr (ram_addr_t addr); int cpu_register_io_memory(int io_index, CPUReadMemoryFunc **mem_read, CPUWriteMemoryFunc **mem_write,
Modified: trunk/exec.c
===================================================================
exec.c +8 -0
@@ -2427,6 +2427,14 @@ { } +/* Return a host pointer to ram allocated with qemu_ram_alloc. +This may only be used if you actually allocated the ram, and +aready know how but the ram block is. */ +void *qemu_get_ram_ptr (ram_addr_t addr) +{ +return phys_ram_base + addr; +} +static uint32_t unassigned_mem_readb (void *opaque,target_phys_addr_t addr) {#ifdef DEBUG_UNASSIGNED
Modified: trunk/hw/sun4m.c
===================================================================
hw/sun4m.c +9 -12
@@ -382,7 +382,7 @@qemu_irq *esp_reset, *le_reset;qemu_irq *fdc_tc;qemu_irq *cpu_halt; -ram_addr_t ram_offset, prom_offset, tcx_offset, idreg_offset; +ram_addr_t ram_offset, prom_offset, idreg_offset;unsigned long kernel_size;int ret;char buf[1024 ];
@@ -478,9 +478,8 @@fprintf (stderr,"qemu: Unsupported depth: %d\n" , graphic_depth);exit (1 ); } - tcx_offset =qemu_ram_alloc (hwdef->vram_size); -tcx_init (hwdef->tcx_base, phys_ram_base + tcx_offset, tcx_offset, - hwdef->vram_size, graphic_width, graphic_height, graphic_depth); +tcx_init (hwdef->tcx_base, hwdef->vram_size, graphic_width, graphic_height, + graphic_depth);lance_init (&nd_table[0 ], hwdef->le_base, ledma, *ledma_irq, le_reset);
@@ -1183,7 +1182,7 @@qemu_irq *cpu_irqs[MAX_CPUS ], *sbi_irq, *sbi_cpu_irq, *espdma_irq, *ledma_irq;qemu_irq *esp_reset, *le_reset; -ram_addr_t ram_offset, prom_offset, tcx_offset; +ram_addr_t ram_offset, prom_offset;unsigned long kernel_size;int ret;char buf[1024 ];
@@ -1264,9 +1263,8 @@fprintf (stderr,"qemu: Unsupported depth: %d\n" , graphic_depth);exit (1 ); } - tcx_offset =qemu_ram_alloc (hwdef->vram_size); -tcx_init (hwdef->tcx_base, phys_ram_base + tcx_offset, tcx_offset, - hwdef->vram_size, graphic_width, graphic_height, graphic_depth); +tcx_init (hwdef->tcx_base, hwdef->vram_size, graphic_width, graphic_height, + graphic_depth);lance_init (&nd_table[0 ], hwdef->le_base, ledma, *ledma_irq, le_reset);
@@ -1409,7 +1407,7 @@qemu_irq *cpu_irqs, *slavio_irq, *espdma_irq, *ledma_irq;qemu_irq *esp_reset, *le_reset;qemu_irq *fdc_tc; -ram_addr_t ram_offset, prom_offset, tcx_offset; +ram_addr_t ram_offset, prom_offset;unsigned long kernel_size;int ret;char buf[1024 ];
@@ -1481,9 +1479,8 @@fprintf (stderr,"qemu: Unsupported depth: %d\n" , graphic_depth);exit (1 ); } - tcx_offset =qemu_ram_alloc (hwdef->vram_size); -tcx_init (hwdef->tcx_base, phys_ram_base + tcx_offset, tcx_offset, - hwdef->vram_size, graphic_width, graphic_height, graphic_depth); +tcx_init (hwdef->tcx_base, hwdef->vram_size, graphic_width, graphic_height, + graphic_depth);lance_init (&nd_table[0 ], hwdef->le_base, ledma, *ledma_irq, le_reset);
Modified: trunk/hw/sun4m.h
===================================================================
hw/sun4m.h +1 -2
@@ -24,8 +24,7 @@ }/* tcx.c */ -void tcx_init (target_phys_addr_t addr,uint8_t *vram_base, -unsigned long vram_offset,int vram_size,int width,int height, +void tcx_init (target_phys_addr_t addr,int vram_size,int width,int height,int depth);/* slavio_intctl.c */
Modified: trunk/hw/tcx.c
===================================================================
hw/tcx.c +6 -2
@@ -497,14 +497,18 @@ tcx_dummy_writel, }; -void tcx_init (target_phys_addr_t addr,uint8_t *vram_base, -unsigned long vram_offset,int vram_size,int width,int height, +void tcx_init (target_phys_addr_t addr,int vram_size,int width,int height,int depth) {TCXState *s;int io_memory, dummy_memory; +ram_addr_t vram_offset;int size; +uint8_t *vram_base; + vram_offset =qemu_ram_alloc (vram_size); + vram_base =qemu_get_ram_ptr (vram_offset); + s =qemu_mallocz (sizeof (TCXState)); s->addr = addr; s->vram_offset = vram_offset;