diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/integratorcp.c | 18 | ||||
-rw-r--r-- | hw/pl110.c | 11 | ||||
-rw-r--r-- | hw/sun4m.c | 19 | ||||
-rw-r--r-- | hw/tcx.c | 17 | ||||
-rw-r--r-- | hw/vga.c | 20 |
5 files changed, 31 insertions, 54 deletions
diff --git a/hw/integratorcp.c b/hw/integratorcp.c index db73efd..1bcd734 100644 --- a/hw/integratorcp.c +++ b/hw/integratorcp.c @@ -27,22 +27,6 @@ void irq_info(void) { } -static void *lcd; - -void vga_update_display(void) -{ - pl110_update_display(lcd); -} - -void vga_screen_dump(const char *filename) -{ -} - -void vga_invalidate_display(void) -{ - pl110_invalidate_display(lcd); -} - void DMA_run (void) { } @@ -1210,7 +1194,7 @@ static void integratorcp_init(int ram_size, int vga_ram_size, int boot_device, exit (1); } } - lcd = pl110_init(ds, 0xc0000000, pic, 22); + pl110_init(ds, 0xc0000000, pic, 22, 0); /* Load the kernel. */ if (!kernel_filename) { @@ -89,7 +89,7 @@ static int pl110_enabled(pl110_state *s) return (s->cr & PL110_CR_EN) && (s->cr & PL110_CR_PWR); } -void pl110_update_display(void *opaque) +static void pl110_update_display(void *opaque) { pl110_state *s = (pl110_state *)opaque; drawfn* fntable; @@ -205,7 +205,7 @@ void pl110_update_display(void *opaque) dpy_update(s->ds, 0, first, s->cols, last - first + 1); } -void pl110_invalidate_display(void * opaque) +static void pl110_invalidate_display(void * opaque) { pl110_state *s = (pl110_state *)opaque; s->invalidate = 1; @@ -378,7 +378,8 @@ static CPUWriteMemoryFunc *pl110_writefn[] = { pl110_write }; -void *pl110_init(DisplayState *ds, uint32_t base, void *pic, int irq) +void *pl110_init(DisplayState *ds, uint32_t base, void *pic, int irq, + int versatile) { pl110_state *s; int iomemtype; @@ -386,11 +387,13 @@ void *pl110_init(DisplayState *ds, uint32_t base, void *pic, int irq) s = (pl110_state *)qemu_mallocz(sizeof(pl110_state)); iomemtype = cpu_register_io_memory(0, pl110_readfn, pl110_writefn, s); - cpu_register_physical_memory(base, 0x007fffff, iomemtype); + cpu_register_physical_memory(base, 0x00000fff, iomemtype); s->base = base; s->ds = ds; s->pic = pic; s->irq = irq; + graphic_console_init(ds, pl110_update_display, pl110_invalidate_display, + NULL, s); /* ??? Save/restore. */ return s; } @@ -187,23 +187,6 @@ void pic_set_irq_cpu(int irq, int level, unsigned int cpu) slavio_pic_set_irq_cpu(slavio_intctl, irq, level, cpu); } -static void *tcx; - -void vga_update_display() -{ - tcx_update_display(tcx); -} - -void vga_invalidate_display() -{ - tcx_invalidate_display(tcx); -} - -void vga_screen_dump(const char *filename) -{ - tcx_screen_dump(tcx, filename); -} - static void *iommu; uint32_t iommu_translate(uint32_t addr) @@ -256,7 +239,7 @@ static void sun4m_init(int ram_size, int vga_ram_size, int boot_device, slavio_intctl_set_cpu(slavio_intctl, i, envs[i]); } - tcx = tcx_init(ds, PHYS_JJ_TCX_FB, phys_ram_base + ram_size, ram_size, vram_size, graphic_width, graphic_height); + tcx_init(ds, PHYS_JJ_TCX_FB, phys_ram_base + ram_size, ram_size, vram_size, graphic_width, graphic_height); if (nd_table[0].vlan) { if (nd_table[0].model == NULL || strcmp(nd_table[0].model, "lance") == 0) { @@ -37,6 +37,8 @@ typedef struct TCXState { uint8_t dac_index, dac_state; } TCXState; +static void tcx_screen_dump(void *opaque, const char *filename); + static void tcx_draw_line32(TCXState *s1, uint8_t *d, const uint8_t *s, int width) { @@ -81,7 +83,7 @@ static void tcx_draw_line8(TCXState *s1, uint8_t *d, /* Fixed line length 1024 allows us to do nice tricks not possible on VGA... */ -void tcx_update_display(void *opaque) +static void tcx_update_display(void *opaque) { TCXState *ts = opaque; uint32_t page; @@ -158,7 +160,7 @@ void tcx_update_display(void *opaque) } } -void tcx_invalidate_display(void *opaque) +static void tcx_invalidate_display(void *opaque) { TCXState *s = opaque; int i; @@ -269,15 +271,15 @@ static CPUWriteMemoryFunc *tcx_dac_write[3] = { tcx_dac_writel, }; -void *tcx_init(DisplayState *ds, uint32_t addr, uint8_t *vram_base, - unsigned long vram_offset, int vram_size, int width, int height) +void tcx_init(DisplayState *ds, uint32_t addr, uint8_t *vram_base, + unsigned long vram_offset, int vram_size, int width, int height) { TCXState *s; int io_memory; s = qemu_mallocz(sizeof(TCXState)); if (!s) - return NULL; + return; s->ds = ds; s->addr = addr; s->vram = vram_base; @@ -289,14 +291,15 @@ void *tcx_init(DisplayState *ds, uint32_t addr, uint8_t *vram_base, io_memory = cpu_register_io_memory(0, tcx_dac_read, tcx_dac_write, s); cpu_register_physical_memory(addr + 0x200000, TCX_DAC_NREGS, io_memory); + graphic_console_init(s->ds, tcx_update_display, tcx_invalidate_display, + tcx_screen_dump, s); register_savevm("tcx", addr, 1, tcx_save, tcx_load, s); qemu_register_reset(tcx_reset, s); tcx_reset(s); dpy_resize(s->ds, width, height); - return s; } -void tcx_screen_dump(void *opaque, const char *filename) +static void tcx_screen_dump(void *opaque, const char *filename) { TCXState *s = opaque; FILE *f; @@ -146,6 +146,8 @@ static uint8_t expand4to8[16]; VGAState *vga_state; int vga_io_memory; +static void vga_screen_dump(void *opaque, const char *filename); + static uint32_t vga_ioport_read(void *opaque, uint32_t addr) { VGAState *s = opaque; @@ -1482,9 +1484,9 @@ static void vga_draw_blank(VGAState *s, int full_update) #define GMODE_GRAPH 1 #define GMODE_BLANK 2 -void vga_update_display(void) +static void vga_update_display(void *opaque) { - VGAState *s = vga_state; + VGAState *s = (VGAState *)opaque; int full_update, graphic_mode; if (s->ds->depth == 0) { @@ -1532,9 +1534,9 @@ void vga_update_display(void) } /* force a full display refresh */ -void vga_invalidate_display(void) +static void vga_invalidate_display(void *opaque) { - VGAState *s = vga_state; + VGAState *s = (VGAState *)opaque; s->last_width = -1; s->last_height = -1; @@ -1698,6 +1700,8 @@ void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base, s->get_bpp = vga_get_bpp; s->get_offsets = vga_get_offsets; s->get_resolution = vga_get_resolution; + graphic_console_init(s->ds, vga_update_display, vga_invalidate_display, + vga_screen_dump, s); /* XXX: currently needed for display */ vga_state = s; } @@ -1854,13 +1858,13 @@ static int ppm_save(const char *filename, uint8_t *data, /* save the vga display in a PPM image even if no display is available */ -void vga_screen_dump(const char *filename) +static void vga_screen_dump(void *opaque, const char *filename) { - VGAState *s = vga_state; + VGAState *s = (VGAState *)opaque; DisplayState *saved_ds, ds1, *ds = &ds1; /* XXX: this is a little hackish */ - vga_invalidate_display(); + vga_invalidate_display(s); saved_ds = s->ds; memset(ds, 0, sizeof(DisplayState)); @@ -1871,7 +1875,7 @@ void vga_screen_dump(const char *filename) s->ds = ds; s->graphic_mode = -1; - vga_update_display(); + vga_update_display(s); if (ds->data) { ppm_save(filename, ds->data, vga_save_w, vga_save_h, |