VGA cleanup
cover VGA cleanup
This patch:
- cleans the differences between VGAState/VGACommon state
- moves vga pci, isa, isa-mm out of vga.c (cirrus and blizzar uses VGA common state).
- Cleans all the cirrus_hook_* stuff is something that don't look like a hook :)
I would want this bits morged/reviewed before going the rest of the cleanup:
Todo:
- vga_ioport_read/write and cirrus_vga_ioport_read/write are almost identical after this series of changes. Creating read/write() callbacks for sr/gr/cr/palette. Should put us there. The cirrus ones were the difficult ones, the vga ones are trivial.
- CONFIG_VBE_BOCHS code. This code is only used by vga std (pci + isa). Neither cirrus/blizzard/isa-mm uses it. It should be moved out of vga.c, vga-std.c?, and then used by vga-isa and vga-pci?
- vmware_vga: it uses vga as embeded, but it don't save its state, I am not sure if it wants/need VBE_BOCHS, .... I haven't looked at vmware_vga too much, just to vga and cirrus_vga.
Comments?
Later, Juan.
Juan Quintela (23):
vga: remove useless cast from void *
cirrus_vga: prefix vga_ioport_{read,write} with cirrus
vga: export vga_ioport_{read,write}
vga: split vga_{load,save} into pci and common parts
vga: split pci bits into vga-pci.c
vga: split isa bits inco vga-isa.c
vga: export vga_mem_{read,write}
vga: split vga-isa-mm.o
vga and cirrus_vga: create vga_ioport_invalid() and use it everywhere
cirrus_vga: Add a VGACommonState local var to
cirrus_vga_ioport_{read,write} vga: change tabs to spaces
cirrus_vga: make cirrus_read_hidden_dac() return its result vga and cirrus_vga: substitute switch for equivalent assigntment
vga: Rename last VGAState occurrences to VGACommonState
cirrus_vga: rename cirrus_hook_read_sr() cirrus_vga_read_sr()
cirrus_vga: rename cirrus_hook_write_sr() cirrus_vga_write_sr()
cirrus_vga: rename cirrus_hook_read_palette()
cirrus_vga_read_palette()
cirrus_vga: rename cirrus_hook_write_palette()
cirrus_vga_write_palette()
cirrus_vga: rename cirrus_hook_read_gr() cirrus_vga_read_gr()
cirrus_vga: rename cirrus_hook_write_gr() cirrus_vga_write_gr()
cirrus_vga: rename cirrus_hook_read_cr() cirrus_vga_read_cr()
cirrus_vga: rename cirrus_hook_write_cr() cirrus_vga_write_cr()
cirrus_vga: CIRRUS_HOOK_* is not used anymore
Makefile.target | 9 +- hw/cirrus_vga.c | 532 +++++++++++++++++++++++----------------------------- hw/vga-isa-mm.c | 130 +++++++++++++ hw/vga-isa.c | 50 +++++ hw/vga-pci.c | 164 ++++++++++++++++ hw/vga.c | 357 ++++++------------------------------ hw/vga_int.h | 10 +- hw/vga_template.h | 20 +- hw/vmware_vga.c | 1 + 9 files changed, 662 insertions(+), 611 deletions(-) create mode 100644 hw/vga-isa-mm.c create mode 100644 hw/vga-isa.c create mode 100644 hw/vga-pci.c
PATCH 1/23 vga: remove useless cast from void *
--- hw/vga.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
hw/vga.c +5 -5
@@ -1835,7 +1835,7 @@ static void vga_draw_blank(VGAState *s, int full_update)static void vga_update_display (void *opaque) { -VGAState *s = (VGAState *)opaque; +VGAState *s = opaque;int full_update, graphic_mode;if (ds_get_bits_per_pixel (s->ds) ==0 ) {
@@ -1870,7 +1870,7 @@ static void vga_update_display(void *opaque)/* force a full display refresh */ static void vga_invalidate_display (void *opaque) { -VGAState *s = (VGAState *)opaque; +VGAState *s = opaque; s->full_update =1 ; }
@@ -1944,7 +1944,7 @@ void vga_common_reset(VGACommonState *s)static void vga_reset (void *opaque) { -VGAState *s = (VGAState *) opaque; +VGAState *s = opaque;vga_common_reset (s); }
@@ -1956,7 +1956,7 @@ static void vga_reset(void *opaque)* instead of doing a full vga_update_display() */ static void vga_update_text (void *opaque,console_ch_t *chardata) { -VGAState *s = (VGAState *) opaque; +VGAState *s = opaque;int graphic_mode, i, cursor_offset, cursor_visible;int cw, cheight, width, height, size, c_min, c_max;uint32_t *src;
@@ -2628,7 +2628,7 @@ static DisplayChangeListener* vga_screen_dump_init(DisplayState *ds)available */ static void vga_screen_dump (void *opaque,const char *filename) { -VGAState *s = (VGAState *)opaque; +VGAState *s = opaque;if (!screen_dump_dcl) screen_dump_dcl =vga_screen_dump_init (s->ds);
Signature · 1 line
1.6.2.5
PATCH 2/23 cirrus_vga: prefix vga_ioport_{read, write} with cirrus
In reply to Juan Quintela--- hw/cirrus_vga.c | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-)
hw/cirrus_vga.c +14 -14
@@ -2656,7 +2656,7 @@ static void cirrus_update_memory_access(CirrusVGAState *s)/* I/O ports */ -static uint32_t vga_ioport_read (void *opaque,uint32_t addr) +static uint32_t cirrus_vga_ioport_read (void *opaque,uint32_t addr) {CirrusVGAState *s = opaque;int val, index;
@@ -2762,7 +2762,7 @@ static uint32_t vga_ioport_read(void *opaque, uint32_t addr)return val; } -static void vga_ioport_write (void *opaque,uint32_t addr,uint32_t val) +static void cirrus_vga_ioport_write (void *opaque,uint32_t addr,uint32_t val) {CirrusVGAState *s = opaque;int index;
@@ -2926,7 +2926,7 @@ static uint32_t cirrus_mmio_readb(void *opaque, target_phys_addr_t addr)if (addr >=0x100 ) {return cirrus_mmio_blt_read (s, addr -0x100 ); }else { -return vga_ioport_read (s, addr +0x3c0 ); +return cirrus_vga_ioport_read (s, addr +0x3c0 ); } }
@@ -2970,7 +2970,7 @@ static void cirrus_mmio_writeb(void *opaque, target_phys_addr_t addr,if (addr >=0x100 ) {cirrus_mmio_blt_write (s, addr -0x100 , val); }else { -vga_ioport_write (s, addr +0x3c0 , val); +cirrus_vga_ioport_write (s, addr +0x3c0 , val); } }
@@ -3198,19 +3198,19 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci) s->bustype =CIRRUS_BUSTYPE_ISA ; } -register_ioport_write (0x3c0 ,16 ,1 , vga_ioport_write, s); +register_ioport_write (0x3c0 ,16 ,1 , cirrus_vga_ioport_write, s); -register_ioport_write (0x3b4 ,2 ,1 , vga_ioport_write, s); -register_ioport_write (0x3d4 ,2 ,1 , vga_ioport_write, s); -register_ioport_write (0x3ba ,1 ,1 , vga_ioport_write, s); -register_ioport_write (0x3da ,1 ,1 , vga_ioport_write, s); +register_ioport_write (0x3b4 ,2 ,1 , cirrus_vga_ioport_write, s); +register_ioport_write (0x3d4 ,2 ,1 , cirrus_vga_ioport_write, s); +register_ioport_write (0x3ba ,1 ,1 , cirrus_vga_ioport_write, s); +register_ioport_write (0x3da ,1 ,1 , cirrus_vga_ioport_write, s); -register_ioport_read (0x3c0 ,16 ,1 , vga_ioport_read, s); +register_ioport_read (0x3c0 ,16 ,1 , cirrus_vga_ioport_read, s); -register_ioport_read (0x3b4 ,2 ,1 , vga_ioport_read, s); -register_ioport_read (0x3d4 ,2 ,1 , vga_ioport_read, s); -register_ioport_read (0x3ba ,1 ,1 , vga_ioport_read, s); -register_ioport_read (0x3da ,1 ,1 , vga_ioport_read, s); +register_ioport_read (0x3b4 ,2 ,1 , cirrus_vga_ioport_read, s); +register_ioport_read (0x3d4 ,2 ,1 , cirrus_vga_ioport_read, s); +register_ioport_read (0x3ba ,1 ,1 , cirrus_vga_ioport_read, s); +register_ioport_read (0x3da ,1 ,1 , cirrus_vga_ioport_read, s); s->vga.vga_io_memory =cpu_register_io_memory (cirrus_vga_mem_read, cirrus_vga_mem_write, s);
Signature · 1 line
1.6.2.5
PATCH 3/23 vga: export vga_ioport_{read,write}
In reply to Juan Quintela--- hw/vga.c | 8 ++++---- hw/vga_int.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-)
hw/vga.c +4 -4
@@ -285,9 +285,9 @@ static uint8_t vga_dumb_retrace(VGAState *s)return s->st01 ^ (ST01_V_RETRACE |ST01_DISP_ENABLE ); } -static uint32_t vga_ioport_read (void *opaque,uint32_t addr) +uint32_t vga_ioport_read (void *opaque,uint32_t addr) { -VGAState *s = opaque; +VGACommonState *s = opaque;int val, index;/* check port range access depending on color/monochrome mode */
@@ -378,9 +378,9 @@ static uint32_t vga_ioport_read(void *opaque, uint32_t addr)return val; } -static void vga_ioport_write (void *opaque,uint32_t addr,uint32_t val) +void vga_ioport_write (void *opaque,uint32_t addr,uint32_t val) { -VGAState *s = opaque; +VGACommonState *s = opaque;int index;/* check port range access depending on color/monochrome mode */
hw/vga_int.h +2 -0
@@ -194,6 +194,8 @@ void vga_common_reset(VGACommonState *s);void vga_dirty_log_start (VGACommonState *s); +uint32_t vga_ioport_read (void *opaque,uint32_t addr); +void vga_ioport_write (void *opaque,uint32_t addr,uint32_t val);uint32_t vga_mem_readb (void *opaque,target_phys_addr_t addr);void vga_mem_writeb (void *opaque,target_phys_addr_t addr,uint32_t val);void vga_invalidate_scanlines (VGACommonState *s,int y1,int y2);
Signature · 1 line
1.6.2.5
PATCH 4/23 vga: split vga_{load, save} into pci and common parts
In reply to Juan QuintelaOnce there adjust VGAState <-> VGACommonState Export vga_common_save/vga_common_load (nreeded by wmvare_vga Remove vga.pci_dev field, it is not needed anymore
--- hw/vga.c | 52 ++++++++++++++++++++++++++++++++++------------------ hw/vga_int.h | 3 ++- hw/vmware_vga.c | 1 + 3 files changed, 37 insertions(+), 19 deletions(-)
hw/vga.c +34 -18
@@ -2126,14 +2126,11 @@ static CPUWriteMemoryFunc * const vga_mem_write[3] = { vga_mem_writel, }; -static void vga_save (QEMUFile *f,void *opaque) +void vga_common_save (QEMUFile *f,void *opaque) { -VGAState *s = opaque; +VGACommonState *s = opaque;int i; -if (s->pci_dev) -pci_device_save (s->pci_dev, f); -qemu_put_be32s (f, &s->latch);qemu_put_8s (f, &s->sr_index);qemu_put_buffer (f, s->sr,8 );
@@ -2170,20 +2167,14 @@ static void vga_save(QEMUFile *f, void *opaque)#endif } -static int vga_load (QEMUFile *f,void *opaque,int version_id) +int vga_common_load (QEMUFile *f,void *opaque,int version_id) { -VGAState *s = opaque; -int is_vbe, i, ret; +VGACommonState *s = opaque; +int is_vbe, i;if (version_id >2 )return -EINVAL ; -if (s->pci_dev && version_id >=2 ) { - ret =pci_device_load (s->pci_dev, f); -if (ret <0 ) -return ret; - } -qemu_get_be32s (f, &s->latch);qemu_get_8s (f, &s->sr_index);qemu_get_buffer (f, s->sr,8 );
@@ -2229,9 +2220,33 @@ static int vga_load(QEMUFile *f, void *opaque, int version_id)typedef struct PCIVGAState {PCIDevice dev; -VGAState vga; +VGACommonState vga; }PCIVGAState ; +static void pci_vga_save (QEMUFile *f,void *opaque) +{ +PCIVGAState *s = opaque; + +pci_device_save (&s->dev, f); +vga_common_save (f, &s->vga); +} + +static int pci_vga_load (QEMUFile *f,void *opaque,int version_id) +{ +PCIVGAState *s = opaque; +int ret; + +if (version_id >2 ) +return -EINVAL ; + +if (version_id >=2 ) { + ret =pci_device_load (&s->dev, f); +if (ret <0 ) +return ret; + } +return vga_common_load (f, &s->vga, version_id); +} +void vga_dirty_log_start (VGAState *s) {if (kvm_enabled () && s->map_addr)
@@ -2315,7 +2330,6 @@ void vga_init(VGAState *s)int vga_io_memory;qemu_register_reset (vga_reset, s); -register_savevm ("vga" ,0 ,2 , vga_save, vga_load, s);register_ioport_write (0x3c0 ,16 ,1 , vga_ioport_write, s);
@@ -2428,7 +2442,7 @@ static void vga_mm_init(VGAState *s, target_phys_addr_t vram_base, s_ioport_ctrl =cpu_register_io_memory (vga_mm_read_ctrl, vga_mm_write_ctrl, s); vga_io_memory =cpu_register_io_memory (vga_mem_read, vga_mem_write, s); -register_savevm ("vga" ,0 ,2 , vga_save, vga_load, s); +register_savevm ("vga" ,0 ,2 , vga_common_save, vga_common_load, s);cpu_register_physical_memory (ctrl_base,0x100000 , s_ioport_ctrl); s->bank_offset =0 ;
@@ -2444,6 +2458,7 @@ int isa_vga_init(void)vga_common_init (s,VGA_RAM_SIZE );vga_init (s); +register_savevm ("vga" ,0 ,2 , vga_common_save, vga_common_load, s); s->ds =graphic_console_init (s->update, s->invalidate, s->screen_dump, s->text_update, s);
@@ -2497,7 +2512,8 @@ static int pci_vga_initfn(PCIDevice *dev)// vga + console init vga_common_init (s,VGA_RAM_SIZE );vga_init (s); - s->pci_dev = &d->dev; +register_savevm ("vga" ,0 ,2 , pci_vga_save, pci_vga_load, d); + s->ds =graphic_console_init (s->update, s->invalidate, s->screen_dump, s->text_update, s);
hw/vga_int.h +2 -1
@@ -110,7 +110,6 @@ typedef struct VGACommonState {uint32_t bios_offset;uint32_t bios_size;int it_shift; -PCIDevice *pci_dev;uint32_t latch;uint8_t sr_index;uint8_t sr[256 ];
@@ -194,6 +193,8 @@ void vga_common_reset(VGACommonState *s);void vga_dirty_log_start (VGACommonState *s); +void vga_common_save (QEMUFile *f,void *opaque); +int vga_common_load (QEMUFile *f,void *opaque,int version_id);uint32_t vga_ioport_read (void *opaque,uint32_t addr);void vga_ioport_write (void *opaque,uint32_t addr,uint32_t val);uint32_t vga_mem_readb (void *opaque,target_phys_addr_t addr);
hw/vmware_vga.c +1 -0
@@ -1131,6 +1131,7 @@ static void vmsvga_init(struct vmsvga_state_s *s, int vga_ram_size)#ifdef EMBED_STDVGA vga_common_init (&s->vga, vga_ram_size);vga_init (&s->vga); +register_savevm ("vga" ,0 ,2 , vga_common_save, vga_common_load, &s->vga);#else s->vram_size = vga_ram_size; s->vram_offset =qemu_ram_alloc (vga_ram_size);
Signature · 1 line
1.6.2.5
PATCH 5/23 vga: split pci bits into vga-pci.c
In reply to Juan QuintelaAdjust all the VGAState in VGACommonState
Compile vga-pci.o only for targets that use it.
--- Makefile.target | 9 ++- hw/vga-pci.c | 164 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ hw/vga.c | 134 --------------------------------------------- 3 files changed, 170 insertions(+), 137 deletions(-) create mode 100644 hw/vga-pci.c
Makefile.target +6 -3
@@ -183,7 +183,8 @@ obj-y += e1000.o obj-y += wdt_i6300esb.o # Hardware support -obj-i386-y = ide/core.o ide/isa.o ide/pci.o pckbd.o vga.o $(sound-obj-y) dma.o isa-bus.o +obj-i386-y = ide/core.o ide/isa.o ide/pci.o pckbd.o $(sound-obj-y) dma.o isa-bus.o +obj-i386-y += vga.o vga-pci.o obj-i386-y += fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
@@ -191,7 +192,7 @@ obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o # shared objects obj-ppc-y = ppc.o ide/core.o ide/isa.o ide/pci.o ide/macio.o -obj-ppc-y += vga.o $(sound-obj-y) dma.o isa-bus.o openpic.o +obj-ppc-y += vga.o vga-pci.o $(sound-obj-y) dma.o isa-bus.o openpic.o # PREP target obj-ppc-y += pckbd.o serial.o i8259.o i8254.o fdc.o mc146818rtc.o obj-ppc-y += prep_pci.o ppc_prep.o
@@ -211,6 +212,7 @@ obj-ppc-$(CONFIG_FDT) += device_tree.o obj-mips-y = mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o obj-mips-y += mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o +obj-mips-y += vga-pci.o obj-mips-y += g364fb.o jazz_led.o dp8393x.o obj-mips-y += ide/core.o ide/isa.o ide/pci.o obj-mips-y += gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
@@ -244,7 +246,8 @@ obj-cris-y += etraxfs_ser.o obj-cris-y += pflash_cfi02.o ifeq ($(TARGET_ARCH), sparc64) -obj-sparc-y = sun4u.o ide/core.o ide/pci.o isa-bus.o pckbd.o vga.o apb_pci.o +obj-sparc-y = sun4u.o ide/core.o ide/pci.o isa-bus.o pckbd.o apb_pci.o +obj-sparc-y += vga.o vga-pci.o obj-sparc-y += fdc.o mc146818rtc.o serial.o obj-sparc-y += cirrus_vga.o parallel.o else
hw/vga-pci.c new file +164 -0
164 lines not on this page · raw message
hw/vga.c +0 -134
152 lines not on this page · raw message
Signature · 1 line
1.6.2.5
PATCH 6/23 vga: split isa bits inco vga-isa.c
In reply to Juan QuintelaAdjust all the VGAState in VGACommonState
Compile vga-isa.o in the targets that use it
--- Makefile.target | 4 ++-- hw/vga-isa.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/vga.c | 21 --------------------- 3 files changed, 52 insertions(+), 23 deletions(-) create mode 100644 hw/vga-isa.c
Makefile.target +2 -2
@@ -184,7 +184,7 @@ obj-y += wdt_i6300esb.o # Hardware support obj-i386-y = ide/core.o ide/isa.o ide/pci.o pckbd.o $(sound-obj-y) dma.o isa-bus.o -obj-i386-y += vga.o vga-pci.o +obj-i386-y += vga.o vga-pci.o vga-isa.o obj-i386-y += fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
@@ -212,7 +212,7 @@ obj-ppc-$(CONFIG_FDT) += device_tree.o obj-mips-y = mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o obj-mips-y += mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o -obj-mips-y += vga-pci.o +obj-mips-y += vga-pci.o vga-isa.o obj-mips-y += g364fb.o jazz_led.o dp8393x.o obj-mips-y += ide/core.o ide/isa.o ide/pci.o obj-mips-y += gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
hw/vga-isa.c new file +50 -0
50 lines not on this page · raw message
hw/vga.c +0 -21
@@ -2394,27 +2394,6 @@ 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 (void ) -{ -VGAState *s; - - s =qemu_mallocz (sizeof (VGAState)); - -vga_common_init (s,VGA_RAM_SIZE ); -vga_init (s); -register_savevm ("vga" ,0 ,2 , vga_common_save, vga_common_load, s); - - s->ds =graphic_console_init (s->update, s->invalidate, - s->screen_dump, s->text_update, s); - -#ifdef CONFIG_BOCHS_VBE -/* XXX: use optimized standard vga accesses */ -cpu_register_physical_memory (VBE_DISPI_LFB_PHYSICAL_ADDRESS , -VGA_RAM_SIZE , s->vram_offset); -#endif -return 0 ; -} -int isa_vga_mm_init (target_phys_addr_t vram_base,target_phys_addr_t ctrl_base,int it_shift) {
Signature · 1 line
1.6.2.5
PATCH 7/23 vga: export vga_mem_{read,write}
In reply to Juan Quintela--- hw/vga.c | 4 ++-- hw/vga_int.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-)
hw/vga.c +2 -2
@@ -2113,13 +2113,13 @@ static void vga_update_text(void *opaque, console_ch_t *chardata)dpy_update (s->ds,0 ,0 , s->last_width, height); } -static CPUReadMemoryFunc *const vga_mem_read[3 ] = { +CPUReadMemoryFunc *const vga_mem_read[3 ] = { vga_mem_readb, vga_mem_readw, vga_mem_readl, }; -static CPUWriteMemoryFunc *const vga_mem_write[3 ] = { +CPUWriteMemoryFunc *const vga_mem_write[3 ] = { vga_mem_writeb, vga_mem_writew, vga_mem_writel,
hw/vga_int.h +2 -0
@@ -220,3 +220,5 @@ extern const uint8_t gr_mask[16];#define VGA_RAM_SIZE (8192 * 1024) +extern CPUReadMemoryFunc *const vga_mem_read[3 ]; +extern CPUWriteMemoryFunc *const vga_mem_write[3 ];
Signature · 1 line
1.6.2.5
PATCH 8/23 vga: split vga-isa-mm.o
In reply to Juan QuintelaIt is only used in mips softmmu, compile only there. it_shift field was only used for vga_isa_mm, move it from VGACommonState to ISAVGAMMstate.
--- Makefile.target | 2 +- hw/vga-isa-mm.c | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ hw/vga.c | 96 ---------------------------------------- hw/vga_int.h | 1 - 4 files changed, 131 insertions(+), 98 deletions(-) create mode 100644 hw/vga-isa-mm.c
Makefile.target +1 -1
@@ -212,7 +212,7 @@ obj-ppc-$(CONFIG_FDT) += device_tree.o obj-mips-y = mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o obj-mips-y += mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o -obj-mips-y += vga-pci.o vga-isa.o +obj-mips-y += vga-pci.o vga-isa.o vga-isa-mm.o obj-mips-y += g364fb.o jazz_led.o dp8393x.o obj-mips-y += ide/core.o ide/isa.o ide/pci.o obj-mips-y += gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
hw/vga-isa-mm.c new file +130 -0
130 lines not on this page · raw message
hw/vga.c +0 -96
102 lines not on this page · raw message
hw/vga_int.h +0 -1
@@ -109,7 +109,6 @@ typedef struct VGACommonState {uint32_t lfb_vram_mapped;/* whether 0xa0000 is mapped as ram */ uint32_t bios_offset;uint32_t bios_size; -int it_shift;uint32_t latch;uint8_t sr_index;uint8_t sr[256 ];
Signature · 1 line
1.6.2.5
PATCH 9/23 vga and cirrus_vga: create vga_ioport_invalid() and use it everywhere
In reply to Juan Quintela--- hw/cirrus_vga.c | 11 +++-------- hw/vga.c | 20 ++++++++++++++------ hw/vga_int.h | 2 ++ 3 files changed, 19 insertions(+), 14 deletions(-)
hw/cirrus_vga.c +3 -8
@@ -2661,10 +2661,7 @@ static uint32_t cirrus_vga_ioport_read(void *opaque, uint32_t addr)CirrusVGAState *s = opaque;int val, index; -/* check port range access depending on color/monochrome mode */ -if ((addr >=0x3b0 && addr <=0x3bf && (s->vga.msr &MSR_COLOR_EMULATION )) - || (addr >=0x3d0 && addr <=0x3df - && !(s->vga.msr &MSR_COLOR_EMULATION ))) { +if (vga_ioport_invalid (&s->vga, addr)) { val =0xff ; }else {switch (addr) {
@@ -2768,11 +2765,9 @@ static void cirrus_vga_ioport_write(void *opaque, uint32_t addr, uint32_t val)int index;/* check port range access depending on color/monochrome mode */ -if ((addr >=0x3b0 && addr <=0x3bf && (s->vga.msr &MSR_COLOR_EMULATION )) - || (addr >=0x3d0 && addr <=0x3df - && !(s->vga.msr &MSR_COLOR_EMULATION ))) +if (vga_ioport_invalid (&s->vga, addr)) {return ; - + }#ifdef DEBUG_VGA printf ("VGA: write addr=0x%04x data=0x%02x\n" , addr, val);#endif
hw/vga.c +14 -6
@@ -284,14 +284,23 @@ static uint8_t vga_dumb_retrace(VGAState *s)return s->st01 ^ (ST01_V_RETRACE |ST01_DISP_ENABLE ); } +int vga_ioport_invalid (VGACommonState *s,uint32_t addr) +{ +if (s->msr &MSR_COLOR_EMULATION ) { +/* Color */ +return (addr >=0x3b0 && addr <=0x3bf ); + }else { +/* Monochrome */ +return (addr >=0x3d0 && addr <=0x3df ); + } +} +uint32_t vga_ioport_read (void *opaque,uint32_t addr) {VGACommonState *s = opaque;int val, index; -/* check port range access depending on color/monochrome mode */ -if ((addr >=0x3b0 && addr <=0x3bf && (s->msr &MSR_COLOR_EMULATION )) || - (addr >=0x3d0 && addr <=0x3df && !(s->msr &MSR_COLOR_EMULATION ))) { +if (vga_ioport_invalid (s, addr)) { val =0xff ; }else {switch (addr) {
@@ -383,10 +392,9 @@ void vga_ioport_write(void *opaque, uint32_t addr, uint32_t val)int index;/* check port range access depending on color/monochrome mode */ -if ((addr >=0x3b0 && addr <=0x3bf && (s->msr &MSR_COLOR_EMULATION )) || - (addr >=0x3d0 && addr <=0x3df && !(s->msr &MSR_COLOR_EMULATION ))) +if (vga_ioport_invalid (s, addr)) {return ; - + }#ifdef DEBUG_VGA printf ("VGA: write addr=0x%04x data=0x%02x\n" , addr, val);#endif
hw/vga_int.h +2 -0
@@ -214,6 +214,8 @@ void vga_draw_cursor_line_32(uint8_t *d1, const uint8_t *src1, unsigned int color0, unsigned int color1, unsigned int color_xor); +int vga_ioport_invalid (VGACommonState *s,uint32_t addr); +extern const uint8_t sr_mask[8 ];extern const uint8_t gr_mask[16 ];
Signature · 1 line
1.6.2.5
PATCH 10/23 cirrus_vga: Add a VGACommonState local var to cirrus_vga_ioport_{read, write}
In reply to Juan Quintela--- hw/cirrus_vga.c | 162 ++++++++++++++++++++++++++++--------------------------- 1 files changed, 82 insertions(+), 80 deletions(-)
hw/cirrus_vga.c +82 -80
@@ -2658,95 +2658,96 @@ static void cirrus_update_memory_access(CirrusVGAState *s)static uint32_t cirrus_vga_ioport_read (void *opaque,uint32_t addr) { -CirrusVGAState *s = opaque; +CirrusVGAState *c = opaque; +VGACommonState *s = &c->vga;int val, index; -if (vga_ioport_invalid (&s->vga, addr)) { +if (vga_ioport_invalid (s, addr)) { val =0xff ; }else {switch (addr) {case 0x3c0 : -if (s->vga.ar_flip_flop ==0 ) { - val = s->vga.ar_index; +if (s->ar_flip_flop ==0 ) { + val = s->ar_index; }else { val =0 ; }break ;case 0x3c1 : - index = s->vga.ar_index &0x1f ; + index = s->ar_index &0x1f ;if (index <21 ) - val = s->vga.ar[index]; + val = s->ar[index];else val =0 ;break ;case 0x3c2 : - val = s->vga.st00; + val = s->st00;break ;case 0x3c4 : - val = s->vga.sr_index; + val = s->sr_index;break ;case 0x3c5 : -if (cirrus_hook_read_sr (s, s->vga.sr_index, &val)) +if (cirrus_hook_read_sr (c, s->sr_index, &val))break ; - val = s->vga.sr[s->vga.sr_index]; + val = s->sr[s->sr_index];#ifdef DEBUG_VGA_REG -printf ("vga: read SR%x = 0x%02x\n" , s->vga.sr_index, val); +printf ("vga: read SR%x = 0x%02x\n" , s->sr_index, val);#endif break ;case 0x3c6 : -cirrus_read_hidden_dac (s, &val); +cirrus_read_hidden_dac (c, &val);break ;case 0x3c7 : - val = s->vga.dac_state; + val = s->dac_state;break ;case 0x3c8 : - val = s->vga.dac_write_index; - s->cirrus_hidden_dac_lockindex =0 ; + val = s->dac_write_index; + c->cirrus_hidden_dac_lockindex =0 ;break ;case 0x3c9 : -if (cirrus_hook_read_palette (s, &val)) +if (cirrus_hook_read_palette (c, &val))break ; - val = s->vga.palette[s->vga.dac_read_index *3 + s->vga.dac_sub_index]; -if (++s->vga.dac_sub_index ==3 ) { - s->vga.dac_sub_index =0 ; - s->vga.dac_read_index++; + val = s->palette[s->dac_read_index *3 + s->dac_sub_index]; +if (++s->dac_sub_index ==3 ) { + s->dac_sub_index =0 ; + s->dac_read_index++; }break ;case 0x3ca : - val = s->vga.fcr; + val = s->fcr;break ;case 0x3cc : - val = s->vga.msr; + val = s->msr;break ;case 0x3ce : - val = s->vga.gr_index; + val = s->gr_index;break ;case 0x3cf : -if (cirrus_hook_read_gr (s, s->vga.gr_index, &val)) +if (cirrus_hook_read_gr (c, s->gr_index, &val))break ; - val = s->vga.gr[s->vga.gr_index]; + val = s->gr[s->gr_index];#ifdef DEBUG_VGA_REG -printf ("vga: read GR%x = 0x%02x\n" , s->vga.gr_index, val); +printf ("vga: read GR%x = 0x%02x\n" , s->gr_index, val);#endif break ;case 0x3b4 :case 0x3d4 : - val = s->vga.cr_index; + val = s->cr_index;break ;case 0x3b5 :case 0x3d5 : -if (cirrus_hook_read_cr (s, s->vga.cr_index, &val)) +if (cirrus_hook_read_cr (c, s->cr_index, &val))break ; - val = s->vga.cr[s->vga.cr_index]; + val = s->cr[s->cr_index];#ifdef DEBUG_VGA_REG -printf ("vga: read CR%x = 0x%02x\n" , s->vga.cr_index, val); +printf ("vga: read CR%x = 0x%02x\n" , s->cr_index, val);#endif break ;case 0x3ba :case 0x3da :/* just toggle to fool polling */ - val = s->vga.st01 = s->vga.retrace (&s->vga); - s->vga.ar_flip_flop =0 ; + val = s->st01 = s->retrace (s); + s->ar_flip_flop =0 ;break ;default : val =0x00 ;
@@ -2761,11 +2762,12 @@ static uint32_t cirrus_vga_ioport_read(void *opaque, uint32_t addr)static void cirrus_vga_ioport_write (void *opaque,uint32_t addr,uint32_t val) { -CirrusVGAState *s = opaque; +CirrusVGAState *c = opaque; +VGACommonState *s = &c->vga;int index;/* check port range access depending on color/monochrome mode */ -if (vga_ioport_invalid (&s->vga, addr)) { +if (vga_ioport_invalid (s, addr)) {return ; }#ifdef DEBUG_VGA
@@ -2774,120 +2776,120 @@ static void cirrus_vga_ioport_write(void *opaque, uint32_t addr, uint32_t val)switch (addr) {case 0x3c0 : -if (s->vga.ar_flip_flop ==0 ) { +if (s->ar_flip_flop ==0 ) { val &=0x3f ; - s->vga.ar_index = val; + s->ar_index = val; }else { - index = s->vga.ar_index &0x1f ; + index = s->ar_index &0x1f ;switch (index) { case 0x00 ... 0x0f: - s->vga.ar[index] = val &0x3f ; + s->ar[index] = val &0x3f ;break ;case 0x10 : - s->vga.ar[index] = val & ~0x10 ; + s->ar[index] = val & ~0x10 ;break ;case 0x11 : - s->vga.ar[index] = val; + s->ar[index] = val;break ;case 0x12 : - s->vga.ar[index] = val & ~0xc0 ; + s->ar[index] = val & ~0xc0 ;break ;case 0x13 : - s->vga.ar[index] = val & ~0xf0 ; + s->ar[index] = val & ~0xf0 ;break ;case 0x14 : - s->vga.ar[index] = val & ~0xf0 ; + s->ar[index] = val & ~0xf0 ;break ;default :break ; } } - s->vga.ar_flip_flop ^=1 ; + s->ar_flip_flop ^=1 ;break ;case 0x3c2 : - s->vga.msr = val & ~0x10 ; - s->vga.update_retrace_info (&s->vga); + s->msr = val & ~0x10 ; + s->update_retrace_info (s);break ;case 0x3c4 : - s->vga.sr_index = val; + s->sr_index = val;break ;case 0x3c5 : -if (cirrus_hook_write_sr (s, s->vga.sr_index, val)) +if (cirrus_hook_write_sr (c, s->sr_index, val))break ;#ifdef DEBUG_VGA_REG -printf ("vga: write SR%x = 0x%02x\n" , s->vga.sr_index, val); +printf ("vga: write SR%x = 0x%02x\n" , s->sr_index, val);#endif - s->vga.sr[s->vga.sr_index] = val & sr_mask[s->vga.sr_index]; -if (s->vga.sr_index ==1 ) s->vga.update_retrace_info (&s->vga); + s->sr[s->sr_index] = val & sr_mask[s->sr_index]; +if (s->sr_index ==1 ) s->update_retrace_info (s);break ;case 0x3c6 : -cirrus_write_hidden_dac (s, val); +cirrus_write_hidden_dac (c, val);break ;case 0x3c7 : - s->vga.dac_read_index = val; - s->vga.dac_sub_index =0 ; - s->vga.dac_state =3 ; + s->dac_read_index = val; + s->dac_sub_index =0 ; + s->dac_state =3 ;break ;case 0x3c8 : - s->vga.dac_write_index = val; - s->vga.dac_sub_index =0 ; - s->vga.dac_state =0 ; + s->dac_write_index = val; + s->dac_sub_index =0 ; + s->dac_state =0 ;break ;case 0x3c9 : -if (cirrus_hook_write_palette (s, val)) +if (cirrus_hook_write_palette (c, val))break ; - s->vga.dac_cache[s->vga.dac_sub_index] = val; -if (++s->vga.dac_sub_index ==3 ) { -memcpy (&s->vga.palette[s->vga.dac_write_index *3 ], s->vga.dac_cache,3 ); - s->vga.dac_sub_index =0 ; - s->vga.dac_write_index++; + s->dac_cache[s->dac_sub_index] = val; +if (++s->dac_sub_index ==3 ) { +memcpy (&s->palette[s->dac_write_index *3 ], s->dac_cache,3 ); + s->dac_sub_index =0 ; + s->dac_write_index++; }break ;case 0x3ce : - s->vga.gr_index = val; + s->gr_index = val;break ;case 0x3cf : -if (cirrus_hook_write_gr (s, s->vga.gr_index, val)) +if (cirrus_hook_write_gr (c, s->gr_index, val))break ;#ifdef DEBUG_VGA_REG -printf ("vga: write GR%x = 0x%02x\n" , s->vga.gr_index, val); +printf ("vga: write GR%x = 0x%02x\n" , s->gr_index, val);#endif - s->vga.gr[s->vga.gr_index] = val & gr_mask[s->vga.gr_index]; + s->gr[s->gr_index] = val & gr_mask[s->gr_index];break ;case 0x3b4 :case 0x3d4 : - s->vga.cr_index = val; + s->cr_index = val;break ;case 0x3b5 :case 0x3d5 : -if (cirrus_hook_write_cr (s, s->vga.cr_index, val)) +if (cirrus_hook_write_cr (c, s->cr_index, val))break ;#ifdef DEBUG_VGA_REG -printf ("vga: write CR%x = 0x%02x\n" , s->vga.cr_index, val); +printf ("vga: write CR%x = 0x%02x\n" , s->cr_index, val);#endif /* handle CR0-7 protection */ -if ((s->vga.cr[0x11 ] &0x80 ) && s->vga.cr_index <=7 ) { +if ((s->cr[0x11 ] &0x80 ) && s->cr_index <=7 ) {/* can always write bit 4 of CR7 */ -if (s->vga.cr_index ==7 ) - s->vga.cr[7 ] = (s->vga.cr[7 ] & ~0x10 ) | (val &0x10 ); +if (s->cr_index ==7 ) + s->cr[7 ] = (s->cr[7 ] & ~0x10 ) | (val &0x10 );return ; } -switch (s->vga.cr_index) { +switch (s->cr_index) {case 0x01 :/* horizontal display end */ case 0x07 :case 0x09 :case 0x0c :case 0x0d :case 0x12 :/* vertical display end */ - s->vga.cr[s->vga.cr_index] = val; + s->cr[s->cr_index] = val;break ;default : - s->vga.cr[s->vga.cr_index] = val; + s->cr[s->cr_index] = val;break ; } -switch (s->vga.cr_index) { +switch (s->cr_index) {case 0x00 :case 0x04 :case 0x05 :
@@ -2895,13 +2897,13 @@ static void cirrus_vga_ioport_write(void *opaque, uint32_t addr, uint32_t val)case 0x07 :case 0x11 :case 0x17 : - s->vga.update_retrace_info (&s->vga); + s->update_retrace_info (s);break ; }break ;case 0x3ba :case 0x3da : - s->vga.fcr = val &0x10 ; + s->fcr = val &0x10 ;break ; } }
Signature · 1 line
1.6.2.5
PATCH 11/23 vga: change tabs to spaces
In reply to Juan Quintela--- hw/vga.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
hw/vga.c +3 -3
@@ -333,9 +333,9 @@ uint32_t vga_ioport_read(void *opaque, uint32_t addr)case 0x3c7 : val = s->dac_state;break ; -case 0x3c8 : - val = s->dac_write_index; -break ; +case 0x3c8 : + val = s->dac_write_index; +break ;case 0x3c9 : val = s->palette[s->dac_read_index *3 + s->dac_sub_index];if (++s->dac_sub_index ==3 ) {
Signature · 1 line
1.6.2.5
PATCH 12/23 cirrus_vga: make cirrus_read_hidden_dac() return its result
In reply to Juan Quintela--- hw/cirrus_vga.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
hw/cirrus_vga.c +5 -5
@@ -1399,13 +1399,13 @@ cirrus_hook_write_sr(CirrusVGAState * s, unsigned reg_index, int reg_value)* ***************************************/ -static void cirrus_read_hidden_dac (CirrusVGAState * s,int *reg_value) +static int cirrus_read_hidden_dac (CirrusVGAState * s) { - *reg_value =0xff ;if (++s->cirrus_hidden_dac_lockindex ==5 ) { - *reg_value = s->cirrus_hidden_dac_data; - s->cirrus_hidden_dac_lockindex =0 ; + s->cirrus_hidden_dac_lockindex =0 ; +return s->cirrus_hidden_dac_data; } +return 0xff ; }static void cirrus_write_hidden_dac (CirrusVGAState * s,int reg_value)
@@ -2695,7 +2695,7 @@ static uint32_t cirrus_vga_ioport_read(void *opaque, uint32_t addr)#endif break ;case 0x3c6 : -cirrus_read_hidden_dac (c, &val); + val =cirrus_read_hidden_dac (c);break ;case 0x3c7 : val = s->dac_state;
Signature · 1 line
1.6.2.5
PATCH 13/23 vga and cirrus_vga: substitute switch for equivalent assigntment
In reply to Juan Quintela--- hw/cirrus_vga.c | 15 +-------------- hw/vga.c | 14 +------------- 2 files changed, 2 insertions(+), 27 deletions(-)
hw/cirrus_vga.c +1 -14
@@ -2874,20 +2874,7 @@ static void cirrus_vga_ioport_write(void *opaque, uint32_t addr, uint32_t val) s->cr[7 ] = (s->cr[7 ] & ~0x10 ) | (val &0x10 );return ; } -switch (s->cr_index) { -case 0x01 :/* horizontal display end */ -case 0x07 : -case 0x09 : -case 0x0c : -case 0x0d : -case 0x12 :/* vertical display end */ - s->cr[s->cr_index] = val; -break ; - -default : - s->cr[s->cr_index] = val; -break ; - } + s->cr[s->cr_index] = val;switch (s->cr_index) {case 0x00 :
hw/vga.c +1 -13
@@ -488,19 +488,7 @@ void vga_ioport_write(void *opaque, uint32_t addr, uint32_t val) s->cr[7 ] = (s->cr[7 ] & ~0x10 ) | (val &0x10 );return ; } -switch (s->cr_index) { -case 0x01 :/* horizontal display end */ -case 0x07 : -case 0x09 : -case 0x0c : -case 0x0d : -case 0x12 :/* vertical display end */ - s->cr[s->cr_index] = val; -break ; -default : - s->cr[s->cr_index] = val; -break ; - } + s->cr[s->cr_index] = val;switch (s->cr_index) {case 0x00 :
Signature · 1 line
1.6.2.5
PATCH 14/23 vga: Rename last VGAState occurrences to VGACommonState
In reply to Juan Quintela--- hw/vga.c | 60 +++++++++++++++++++++++++--------------------------- hw/vga_template.h | 20 ++++++++-------- 2 files changed, 39 insertions(+), 41 deletions(-)
hw/vga.c +29 -31
@@ -148,18 +148,16 @@ static uint32_t expand4[256];static uint16_t expand2[256 ];static uint8_t expand4to8[16 ]; -typedef VGACommonState VGAState ; -static void vga_screen_dump (void *opaque,const char *filename);static char *screen_dump_filename;static DisplayChangeListener *screen_dump_dcl; -static void vga_dumb_update_retrace_info (VGAState *s) +static void vga_dumb_update_retrace_info (VGACommonState *s) { (void ) s; } -static void vga_precise_update_retrace_info (VGAState *s) +static void vga_precise_update_retrace_info (VGACommonState *s) {int htotal_chars;int hretr_start_char;
@@ -250,7 +248,7 @@ static void vga_precise_update_retrace_info(VGAState *s)#endif } -static uint8_t vga_precise_retrace (VGAState *s) +static uint8_t vga_precise_retrace (VGACommonState *s) {struct vga_precise_retrace *r = &s->retrace_info.precise;uint8_t val = s->st01 & ~(ST01_V_RETRACE |ST01_DISP_ENABLE );
@@ -279,7 +277,7 @@ static uint8_t vga_precise_retrace(VGAState *s) } } -static uint8_t vga_dumb_retrace (VGAState *s) +static uint8_t vga_dumb_retrace (VGACommonState *s) {return s->st01 ^ (ST01_V_RETRACE |ST01_DISP_ENABLE ); }
@@ -512,7 +510,7 @@ void vga_ioport_write(void *opaque, uint32_t addr, uint32_t val)#ifdef CONFIG_BOCHS_VBE static uint32_t vbe_ioport_read_index (void *opaque,uint32_t addr) { -VGAState *s = opaque; +VGACommonState *s = opaque;uint32_t val; val = s->vbe_index;return val;
@@ -520,7 +518,7 @@ static uint32_t vbe_ioport_read_index(void *opaque, uint32_t addr)static uint32_t vbe_ioport_read_data (void *opaque,uint32_t addr) { -VGAState *s = opaque; +VGACommonState *s = opaque;uint32_t val;if (s->vbe_index <=VBE_DISPI_INDEX_NB ) {
@@ -554,13 +552,13 @@ static uint32_t vbe_ioport_read_data(void *opaque, uint32_t addr)static void vbe_ioport_write_index (void *opaque,uint32_t addr,uint32_t val) { -VGAState *s = opaque; +VGACommonState *s = opaque; s->vbe_index = val; }static void vbe_ioport_write_data (void *opaque,uint32_t addr,uint32_t val) { -VGAState *s = opaque; +VGACommonState *s = opaque;if (s->vbe_index <=VBE_DISPI_INDEX_NB ) {#ifdef DEBUG_BOCHS_VBE
@@ -706,7 +704,7 @@ static void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val)/* called for accesses between 0xa0000 and 0xc0000 */ uint32_t vga_mem_readb (void *opaque,target_phys_addr_t addr) { -VGAState *s = opaque; +VGACommonState *s = opaque;int memory_map_mode, plane;uint32_t ret;
@@ -793,7 +791,7 @@ static uint32_t vga_mem_readl(void *opaque, target_phys_addr_t addr)/* called for accesses between 0xa0000 and 0xc0000 */ void vga_mem_writeb (void *opaque,target_phys_addr_t addr,uint32_t val) { -VGAState *s = opaque; +VGACommonState *s = opaque;int memory_map_mode, plane, write_mode, b, func_select, mask;uint32_t write_mask, bit_mask, set_mask;
@@ -957,7 +955,7 @@ typedef void vga_draw_glyph8_func(uint8_t *d, int linesize,typedef void vga_draw_glyph9_func (uint8_t *d,int linesize,const uint8_t *font_ptr,int h,uint32_t fgcol,uint32_t bgcol,int dup9); -typedef void vga_draw_line_func (VGAState *s1,uint8_t *d, +typedef void vga_draw_line_func (VGACommonState *s1,uint8_t *d,const uint8_t *s,int width);#define DEPTH 8
@@ -1042,7 +1040,7 @@ static unsigned int rgb_to_pixel32bgr_dup(unsigned int r, unsigned int g, unsign }/* return true if the palette was modified */ -static int update_palette16 (VGAState *s) +static int update_palette16 (VGACommonState *s) {int full_update, i;uint32_t v, col, *palette;
@@ -1068,7 +1066,7 @@ static int update_palette16(VGAState *s) }/* return true if the palette was modified */ -static int update_palette256 (VGAState *s) +static int update_palette256 (VGACommonState *s) {int full_update, i;uint32_t v, col, *palette;
@@ -1095,7 +1093,7 @@ static int update_palette256(VGAState *s)return full_update; } -static void vga_get_offsets (VGAState *s, +static void vga_get_offsets (VGACommonState *s,uint32_t *pline_offset,uint32_t *pstart_addr,uint32_t *pline_compare)
@@ -1127,7 +1125,7 @@ static void vga_get_offsets(VGAState *s, }/* update start_addr and line_offset. Return TRUE if modified */ -static int update_basic_params (VGAState *s) +static int update_basic_params (VGACommonState *s) {int full_update;uint32_t start_addr, line_offset, line_compare;
@@ -1216,7 +1214,7 @@ static const uint8_t cursor_glyph[32 * 4] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, }; -static void vga_get_text_resolution (VGAState *s,int *pwidth,int *pheight, +static void vga_get_text_resolution (VGACommonState *s,int *pwidth,int *pheight,int *pcwidth,int *pcheight) {int width, cwidth, height, cheight;
@@ -1265,7 +1263,7 @@ static rgb_to_pixel_dup_func *rgb_to_pixel_dup_table[NB_DEPTHS] = {* - underline * - flashing */ -static void vga_draw_text (VGAState *s,int full_update) +static void vga_draw_text (VGACommonState *s,int full_update) {int cx, cy, cheight, cw, ch, cattr, height, width, ch_attr;int cx_min, cx_max, linesize, x_incr;
@@ -1520,7 +1518,7 @@ static vga_draw_line_func *vga_draw_line_table[NB_DEPTHS * VGA_DRAW_LINE_NB] = { vga_draw_line32_16bgr, }; -static int vga_get_bpp (VGAState *s) +static int vga_get_bpp (VGACommonState *s) {int ret;#ifdef CONFIG_BOCHS_VBE
@@ -1534,7 +1532,7 @@ static int vga_get_bpp(VGAState *s)return ret; } -static void vga_get_resolution (VGAState *s,int *pwidth,int *pheight) +static void vga_get_resolution (VGACommonState *s,int *pwidth,int *pheight) {int width, height;
@@ -1555,7 +1553,7 @@ static void vga_get_resolution(VGAState *s, int *pwidth, int *pheight) *pheight = height; } -void vga_invalidate_scanlines (VGAState *s,int y1,int y2) +void vga_invalidate_scanlines (VGACommonState *s,int y1,int y2) {int y;if (y1 >=VGA_MAX_HEIGHT )
@@ -1567,7 +1565,7 @@ void vga_invalidate_scanlines(VGAState *s, int y1, int y2) } } -static void vga_sync_dirty_bitmap (VGAState *s) +static void vga_sync_dirty_bitmap (VGACommonState *s) {if (s->map_addr)cpu_physical_sync_dirty_bitmap (s->map_addr, s->map_end);
@@ -1581,7 +1579,7 @@ static void vga_sync_dirty_bitmap(VGAState *s)/* * graphic modes */ -static void vga_draw_graphic (VGAState *s,int full_update) +static void vga_draw_graphic (VGACommonState *s,int full_update) {int y1, y, update, linesize, y_start, double_scan, mask, depth;int width, height, shift_control, line_offset, bwidth, bits;
@@ -1798,7 +1796,7 @@ static void vga_draw_graphic(VGAState *s, int full_update)memset (s->invalidated_y_table,0 , ((height +31 ) >>5 ) *4 ); } -static void vga_draw_blank (VGAState *s,int full_update) +static void vga_draw_blank (VGACommonState *s,int full_update) {int i, w, val;uint8_t *d;
@@ -1830,7 +1828,7 @@ static void vga_draw_blank(VGAState *s, int full_update)static void vga_update_display (void *opaque) { -VGAState *s = opaque; +VGACommonState *s = opaque;int full_update, graphic_mode;if (ds_get_bits_per_pixel (s->ds) ==0 ) {
@@ -1865,7 +1863,7 @@ static void vga_update_display(void *opaque)/* force a full display refresh */ static void vga_invalidate_display (void *opaque) { -VGAState *s = opaque; +VGACommonState *s = opaque; s->full_update =1 ; }
@@ -1939,7 +1937,7 @@ void vga_common_reset(VGACommonState *s)static void vga_reset (void *opaque) { -VGAState *s = opaque; +VGACommonState *s = opaque;vga_common_reset (s); }
@@ -1951,7 +1949,7 @@ static void vga_reset(void *opaque)* instead of doing a full vga_update_display() */ static void vga_update_text (void *opaque,console_ch_t *chardata) { -VGAState *s = opaque; +VGACommonState *s = opaque;int graphic_mode, i, cursor_offset, cursor_visible;int cw, cheight, width, height, size, c_min, c_max;uint32_t *src;
@@ -2265,7 +2263,7 @@ void vga_common_init(VGACommonState *s, int vga_ram_size) }/* used by both ISA and PCI */ -void vga_init (VGAState *s) +void vga_init (VGACommonState *s) {int vga_io_memory;
@@ -2389,7 +2387,7 @@ static DisplayChangeListener* vga_screen_dump_init(DisplayState *ds)available */ static void vga_screen_dump (void *opaque,const char *filename) { -VGAState *s = opaque; +VGACommonState *s = opaque;if (!screen_dump_dcl) screen_dump_dcl =vga_screen_dump_init (s->ds);
hw/vga_template.h +10 -10
@@ -154,7 +154,7 @@ static void glue(vga_draw_glyph9_, DEPTH)(uint8_t *d, int linesize,/* * 4 color mode */ -static void glue (vga_draw_line2_ ,DEPTH )(VGAState *s1,uint8_t *d, +static void glue (vga_draw_line2_ ,DEPTH )(VGACommonState *s1,uint8_t *d,const uint8_t *s,int width) {uint32_t plane_mask, *palette, data, v;
@@ -196,7 +196,7 @@ static void glue(vga_draw_line2_, DEPTH)(VGAState *s1, uint8_t *d,/* * 4 color mode, dup2 horizontal */ -static void glue (vga_draw_line2d2_ ,DEPTH )(VGAState *s1,uint8_t *d, +static void glue (vga_draw_line2d2_ ,DEPTH )(VGACommonState *s1,uint8_t *d,const uint8_t *s,int width) {uint32_t plane_mask, *palette, data, v;
@@ -229,7 +229,7 @@ static void glue(vga_draw_line2d2_, DEPTH)(VGAState *s1, uint8_t *d,/* * 16 color mode */ -static void glue (vga_draw_line4_ ,DEPTH )(VGAState *s1,uint8_t *d, +static void glue (vga_draw_line4_ ,DEPTH )(VGACommonState *s1,uint8_t *d,const uint8_t *s,int width) {uint32_t plane_mask, data, v, *palette;
@@ -261,7 +261,7 @@ static void glue(vga_draw_line4_, DEPTH)(VGAState *s1, uint8_t *d,/* * 16 color mode, dup2 horizontal */ -static void glue (vga_draw_line4d2_ ,DEPTH )(VGAState *s1,uint8_t *d, +static void glue (vga_draw_line4d2_ ,DEPTH )(VGACommonState *s1,uint8_t *d,const uint8_t *s,int width) {uint32_t plane_mask, data, v, *palette;
@@ -295,7 +295,7 @@ static void glue(vga_draw_line4d2_, DEPTH)(VGAState *s1, uint8_t *d,* * XXX: add plane_mask support (never used in standard VGA modes) */ -static void glue (vga_draw_line8d2_ ,DEPTH )(VGAState *s1,uint8_t *d, +static void glue (vga_draw_line8d2_ ,DEPTH )(VGACommonState *s1,uint8_t *d,const uint8_t *s,int width) {uint32_t *palette;
@@ -318,7 +318,7 @@ static void glue(vga_draw_line8d2_, DEPTH)(VGAState *s1, uint8_t *d,* * XXX: add plane_mask support (never used in standard VGA modes) */ -static void glue (vga_draw_line8_ ,DEPTH )(VGAState *s1,uint8_t *d, +static void glue (vga_draw_line8_ ,DEPTH )(VGACommonState *s1,uint8_t *d,const uint8_t *s,int width) {uint32_t *palette;
@@ -414,7 +414,7 @@ void glue(vga_draw_cursor_line_, DEPTH)(uint8_t *d1,/* * 15 bit color */ -static void glue (vga_draw_line15_ ,PIXEL_NAME )(VGAState *s1,uint8_t *d, +static void glue (vga_draw_line15_ ,PIXEL_NAME )(VGACommonState *s1,uint8_t *d,const uint8_t *s,int width) {#if DEPTH ==15 && defined(HOST_WORDS_BIGENDIAN ) == defined(TARGET_WORDS_BIGENDIAN )
@@ -439,7 +439,7 @@ static void glue(vga_draw_line15_, PIXEL_NAME)(VGAState *s1, uint8_t *d,/* * 16 bit color */ -static void glue (vga_draw_line16_ ,PIXEL_NAME )(VGAState *s1,uint8_t *d, +static void glue (vga_draw_line16_ ,PIXEL_NAME )(VGACommonState *s1,uint8_t *d,const uint8_t *s,int width) {#if DEPTH ==16 && defined(HOST_WORDS_BIGENDIAN ) == defined(TARGET_WORDS_BIGENDIAN )
@@ -464,7 +464,7 @@ static void glue(vga_draw_line16_, PIXEL_NAME)(VGAState *s1, uint8_t *d,/* * 24 bit color */ -static void glue (vga_draw_line24_ ,PIXEL_NAME )(VGAState *s1,uint8_t *d, +static void glue (vga_draw_line24_ ,PIXEL_NAME )(VGACommonState *s1,uint8_t *d,const uint8_t *s,int width) {int w;
@@ -490,7 +490,7 @@ static void glue(vga_draw_line24_, PIXEL_NAME)(VGAState *s1, uint8_t *d,/* * 32 bit color */ -static void glue (vga_draw_line32_ ,PIXEL_NAME )(VGAState *s1,uint8_t *d, +static void glue (vga_draw_line32_ ,PIXEL_NAME )(VGACommonState *s1,uint8_t *d,const uint8_t *s,int width) {#if DEPTH ==32 && defined(HOST_WORDS_BIGENDIAN ) == defined(TARGET_WORDS_BIGENDIAN ) && !defined(BGR_FORMAT )
Signature · 1 line
1.6.2.5
PATCH 15/23 cirrus_vga: rename cirrus_hook_read_sr() cirrus_vga_read_sr()
In reply to Juan QuintelaAnd make it a real function
--- hw/cirrus_vga.c | 32 ++++++++++++-------------------- 1 files changed, 12 insertions(+), 20 deletions(-)
hw/cirrus_vga.c +12 -20
@@ -1236,19 +1236,17 @@ static void cirrus_update_bank_ptr(CirrusVGAState * s, unsigned bank_index)* ***************************************/ -static int -cirrus_hook_read_sr (CirrusVGAState * s,unsigned reg_index,int *reg_value) +static int cirrus_vga_read_sr (CirrusVGAState * s) { -switch (reg_index) { +switch (s->vga.sr_index) {case 0x00 :// Standard VGA case 0x01 :// Standard VGA case 0x02 :// Standard VGA case 0x03 :// Standard VGA case 0x04 :// Standard VGA -return CIRRUS_HOOK_NOT_HANDLED ; +return s->vga.sr[s->vga.sr_index];case 0x06 :// Unlock Cirrus extensions - *reg_value = s->vga.sr[reg_index]; -break ; +return s->vga.sr[s->vga.sr_index];case 0x10 :case 0x30 :case 0x50 :
@@ -1257,8 +1255,7 @@ cirrus_hook_read_sr(CirrusVGAState * s, unsigned reg_index, int *reg_value)case 0xb0 :case 0xd0 :case 0xf0 :// Graphics Cursor X - *reg_value = s->vga.sr[0x10 ]; -break ; +return s->vga.sr[0x10 ];case 0x11 :case 0x31 :case 0x51 :
@@ -1267,8 +1264,7 @@ cirrus_hook_read_sr(CirrusVGAState * s, unsigned reg_index, int *reg_value)case 0xb1 :case 0xd1 :case 0xf1 :// Graphics Cursor Y - *reg_value = s->vga.sr[0x11 ]; -break ; +return s->vga.sr[0x11 ];case 0x05 :// ??? case 0x07 :// Extended Sequencer Mode case 0x08 :// EEPROM Control
@@ -1294,19 +1290,16 @@ cirrus_hook_read_sr(CirrusVGAState * s, unsigned reg_index, int *reg_value)case 0x1e :// VCLK 3 Denominator & Post case 0x1f :// BIOS Write Enable and MCLK select #ifdef DEBUG_CIRRUS -printf ("cirrus: handled inport sr_index %02x\n" , reg_index); +printf ("cirrus: handled inport sr_index %02x\n" , s->vga.sr_index);#endif - *reg_value = s->vga.sr[reg_index]; -break ; +return s->vga.sr[s->vga.sr_index];default :#ifdef DEBUG_CIRRUS -printf ("cirrus: inport sr_index %02x\n" , reg_index); +printf ("cirrus: inport sr_index %02x\n" , s->vga.sr_index);#endif - *reg_value =0xff ; +return 0xff ;break ; } - -return CIRRUS_HOOK_HANDLED ; } static int
@@ -2687,9 +2680,8 @@ static uint32_t cirrus_vga_ioport_read(void *opaque, uint32_t addr) val = s->sr_index;break ;case 0x3c5 : -if (cirrus_hook_read_sr (c, s->sr_index, &val)) -break ; - val = s->sr[s->sr_index]; + val =cirrus_vga_read_sr (c); +break ;#ifdef DEBUG_VGA_REG printf ("vga: read SR%x = 0x%02x\n" , s->sr_index, val);#endif
Signature · 1 line
1.6.2.5
PATCH 16/23 cirrus_vga: rename cirrus_hook_write_sr() cirrus_vga_write_sr()
In reply to Juan Quintela--- hw/cirrus_vga.c | 45 ++++++++++++++++++++++----------------------- 1 files changed, 22 insertions(+), 23 deletions(-)
hw/cirrus_vga.c +22 -23
@@ -1302,22 +1302,24 @@ static int cirrus_vga_read_sr(CirrusVGAState * s) } } -static int -cirrus_hook_write_sr (CirrusVGAState * s,unsigned reg_index,int reg_value) +static void cirrus_vga_write_sr (CirrusVGAState * s,uint32_t val) { -switch (reg_index) { +switch (s->vga.sr_index) {case 0x00 :// Standard VGA case 0x01 :// Standard VGA case 0x02 :// Standard VGA case 0x03 :// Standard VGA case 0x04 :// Standard VGA -return CIRRUS_HOOK_NOT_HANDLED ; + s->vga.sr[s->vga.sr_index] = val & sr_mask[s->vga.sr_index]; +if (s->vga.sr_index ==1 ) + s->vga.update_retrace_info (&s->vga); +break ;case 0x06 :// Unlock Cirrus extensions - reg_value &=0x17 ; -if (reg_value ==0x12 ) { - s->vga.sr[reg_index] =0x12 ; + val &=0x17 ; +if (val ==0x12 ) { + s->vga.sr[s->vga.sr_index] =0x12 ; }else { - s->vga.sr[reg_index] =0x0f ; + s->vga.sr[s->vga.sr_index] =0x0f ; }break ;case 0x10 :
@@ -1328,8 +1330,8 @@ cirrus_hook_write_sr(CirrusVGAState * s, unsigned reg_index, int reg_value)case 0xb0 :case 0xd0 :case 0xf0 :// Graphics Cursor X - s->vga.sr[0x10 ] = reg_value; - s->hw_cursor_x = (reg_value <<3 ) | (reg_index >>5 ); + s->vga.sr[0x10 ] = val; + s->hw_cursor_x = (val <<3 ) | (s->vga.sr_index >>5 );break ;case 0x11 :case 0x31 :
@@ -1339,8 +1341,8 @@ cirrus_hook_write_sr(CirrusVGAState * s, unsigned reg_index, int reg_value)case 0xb1 :case 0xd1 :case 0xf1 :// Graphics Cursor Y - s->vga.sr[0x11 ] = reg_value; - s->hw_cursor_y = (reg_value <<3 ) | (reg_index >>5 ); + s->vga.sr[0x11 ] = val; + s->hw_cursor_y = (val <<3 ) | (s->vga.sr_index >>5 );break ;case 0x07 :// Extended Sequencer Mode cirrus_update_memory_access (s);
@@ -1365,25 +1367,24 @@ cirrus_hook_write_sr(CirrusVGAState * s, unsigned reg_index, int reg_value)case 0x1d :// VCLK 2 Denominator & Post case 0x1e :// VCLK 3 Denominator & Post case 0x1f :// BIOS Write Enable and MCLK select - s->vga.sr[reg_index] = reg_value; + s->vga.sr[s->vga.sr_index] = val;#ifdef DEBUG_CIRRUS printf ("cirrus: handled outport sr_index %02x, sr_value %02x\n" , - reg_index, reg_value); + s->vga.sr_index, val);#endif break ;case 0x17 :// Configuration Readback and Extended Control - s->vga.sr[reg_index] = (s->vga.sr[reg_index] &0x38 ) | (reg_value &0xc7 ); + s->vga.sr[s->vga.sr_index] = (s->vga.sr[s->vga.sr_index] &0x38 ) + | (val &0xc7 );cirrus_update_memory_access (s);break ;default :#ifdef DEBUG_CIRRUS -printf ("cirrus: outport sr_index %02x, sr_value %02x\n" , reg_index, - reg_value); +printf ("cirrus: outport sr_index %02x, sr_value %02x\n" , + s->vga.sr_index, val);#endif break ; } - -return CIRRUS_HOOK_HANDLED ; }/***************************************
@@ -2806,13 +2807,11 @@ static void cirrus_vga_ioport_write(void *opaque, uint32_t addr, uint32_t val) s->sr_index = val;break ;case 0x3c5 : -if (cirrus_hook_write_sr (c, s->sr_index, val)) -break ;#ifdef DEBUG_VGA_REG printf ("vga: write SR%x = 0x%02x\n" , s->sr_index, val);#endif - s->sr[s->sr_index] = val & sr_mask[s->sr_index]; -if (s->sr_index ==1 ) s->update_retrace_info (s); +cirrus_vga_write_sr (c, val); +break ;break ;case 0x3c6 :cirrus_write_hidden_dac (c, val);
Signature · 1 line
1.6.2.5
PATCH 17/23 cirrus_vga: rename cirrus_hook_read_palette() cirrus_vga_read_palette()
In reply to Juan QuintelaSimplify the logic to do everything inside the function
--- hw/cirrus_vga.c | 27 ++++++++++++--------------- 1 files changed, 12 insertions(+), 15 deletions(-)
hw/cirrus_vga.c +12 -15
@@ -1419,18 +1419,21 @@ static void cirrus_write_hidden_dac(CirrusVGAState * s, int reg_value)* ***************************************/ -static int cirrus_hook_read_palette (CirrusVGAState * s,int *reg_value) +static int cirrus_vga_read_palette (CirrusVGAState * s) { -if (!(s->vga.sr[0x12 ] &CIRRUS_CURSOR_HIDDENPEL )) -return CIRRUS_HOOK_NOT_HANDLED ; - *reg_value = - s->cirrus_hidden_palette[(s->vga.dac_read_index &0x0f ) *3 + - s->vga.dac_sub_index]; +int val; + +if ((s->vga.sr[0x12 ] &CIRRUS_CURSOR_HIDDENPEL )) { + val = s->cirrus_hidden_palette[(s->vga.dac_read_index &0x0f ) *3 + + s->vga.dac_sub_index]; + }else { + val = s->vga.palette[s->vga.dac_read_index *3 + s->vga.dac_sub_index]; + }if (++s->vga.dac_sub_index ==3 ) { s->vga.dac_sub_index =0 ; s->vga.dac_read_index++; } -return CIRRUS_HOOK_HANDLED ; +return val; }static int cirrus_hook_write_palette (CirrusVGAState * s,int reg_value)
@@ -2698,14 +2701,8 @@ static uint32_t cirrus_vga_ioport_read(void *opaque, uint32_t addr) c->cirrus_hidden_dac_lockindex =0 ;break ;case 0x3c9 : -if (cirrus_hook_read_palette (c, &val)) -break ; - val = s->palette[s->dac_read_index *3 + s->dac_sub_index]; -if (++s->dac_sub_index ==3 ) { - s->dac_sub_index =0 ; - s->dac_read_index++; - } -break ; + val =cirrus_vga_read_palette (c); +break ;case 0x3ca : val = s->fcr;break ;
Signature · 1 line
1.6.2.5
PATCH 18/23 cirrus_vga: rename cirrus_hook_write_palette() cirrus_vga_write_palette()
In reply to Juan QuintelaSimplify the logic to do everything inside the function
--- hw/cirrus_vga.c | 24 +++++++++--------------- 1 files changed, 9 insertions(+), 15 deletions(-)
hw/cirrus_vga.c +9 -15
@@ -1436,19 +1436,20 @@ static int cirrus_vga_read_palette(CirrusVGAState * s)return val; } -static int cirrus_hook_write_palette (CirrusVGAState * s,int reg_value) +static void cirrus_vga_write_palette (CirrusVGAState * s,int reg_value) { -if (!(s->vga.sr[0x12 ] &CIRRUS_CURSOR_HIDDENPEL )) -return CIRRUS_HOOK_NOT_HANDLED ; s->vga.dac_cache[s->vga.dac_sub_index] = reg_value;if (++s->vga.dac_sub_index ==3 ) { -memcpy (&s->cirrus_hidden_palette[(s->vga.dac_write_index &0x0f ) *3 ], - s->vga.dac_cache,3 ); +if ((s->vga.sr[0x12 ] &CIRRUS_CURSOR_HIDDENPEL )) { +memcpy (&s->cirrus_hidden_palette[(s->vga.dac_write_index &0x0f ) *3 ], + s->vga.dac_cache,3 ); + }else { +memcpy (&s->vga.palette[s->vga.dac_write_index *3 ], s->vga.dac_cache,3 ); + }/* XXX update cursor */ s->vga.dac_sub_index =0 ; s->vga.dac_write_index++; } -return CIRRUS_HOOK_HANDLED ; }/***************************************
@@ -2824,15 +2825,8 @@ static void cirrus_vga_ioport_write(void *opaque, uint32_t addr, uint32_t val) s->dac_state =0 ;break ;case 0x3c9 : -if (cirrus_hook_write_palette (c, val)) -break ; - s->dac_cache[s->dac_sub_index] = val; -if (++s->dac_sub_index ==3 ) { -memcpy (&s->palette[s->dac_write_index *3 ], s->dac_cache,3 ); - s->dac_sub_index =0 ; - s->dac_write_index++; - } -break ; +cirrus_vga_write_palette (c, val); +break ;case 0x3ce : s->gr_index = val;break ;
Signature · 1 line
1.6.2.5
PATCH 19/23 cirrus_vga: rename cirrus_hook_read_gr() cirrus_vga_read_gr()
In reply to Juan QuintelaSimplify the logic to do everything inside the function.
--- hw/cirrus_vga.c | 83 +++++++++++++++++++++++++----------------------------- 1 files changed, 38 insertions(+), 45 deletions(-)
hw/cirrus_vga.c +38 -45
@@ -1458,38 +1458,33 @@ static void cirrus_vga_write_palette(CirrusVGAState * s, int reg_value)* ***************************************/ -static int -cirrus_hook_read_gr (CirrusVGAState * s,unsigned reg_index,int *reg_value) +static int cirrus_vga_read_gr (CirrusVGAState * s,unsigned reg_index) {switch (reg_index) {case 0x00 :// Standard VGA, BGCOLOR 0x000000ff - *reg_value = s->cirrus_shadow_gr0; -return CIRRUS_HOOK_HANDLED ; +return s->cirrus_shadow_gr0;case 0x01 :// Standard VGA, FGCOLOR 0x000000ff - *reg_value = s->cirrus_shadow_gr1; -return CIRRUS_HOOK_HANDLED ; +return s->cirrus_shadow_gr1;case 0x02 :// Standard VGA case 0x03 :// Standard VGA case 0x04 :// Standard VGA case 0x06 :// Standard VGA case 0x07 :// Standard VGA case 0x08 :// Standard VGA -return CIRRUS_HOOK_NOT_HANDLED ; +return s->vga.gr[s->vga.gr_index];case 0x05 :// Standard VGA, Cirrus extended mode default :break ; }if (reg_index <0x3a ) { - *reg_value = s->vga.gr[reg_index]; +return s->vga.gr[reg_index]; }else {#ifdef DEBUG_CIRRUS printf ("cirrus: inport gr_index %02x\n" , reg_index);#endif - *reg_value =0xff ; +return 0xff ; } - -return CIRRUS_HOOK_HANDLED ; } static int
@@ -1716,97 +1711,97 @@ static uint8_t cirrus_mmio_blt_read(CirrusVGAState * s, unsigned address)switch (address) {case (CIRRUS_MMIO_BLTBGCOLOR +0 ): -cirrus_hook_read_gr (s,0x00 , &value); + value =cirrus_vga_read_gr (s,0x00 );break ;case (CIRRUS_MMIO_BLTBGCOLOR +1 ): -cirrus_hook_read_gr (s,0x10 , &value); + value =cirrus_vga_read_gr (s,0x10 );break ;case (CIRRUS_MMIO_BLTBGCOLOR +2 ): -cirrus_hook_read_gr (s,0x12 , &value); + value =cirrus_vga_read_gr (s,0x12 );break ;case (CIRRUS_MMIO_BLTBGCOLOR +3 ): -cirrus_hook_read_gr (s,0x14 , &value); + value =cirrus_vga_read_gr (s,0x14 );break ;case (CIRRUS_MMIO_BLTFGCOLOR +0 ): -cirrus_hook_read_gr (s,0x01 , &value); + value =cirrus_vga_read_gr (s,0x01 );break ;case (CIRRUS_MMIO_BLTFGCOLOR +1 ): -cirrus_hook_read_gr (s,0x11 , &value); + value =cirrus_vga_read_gr (s,0x11 );break ;case (CIRRUS_MMIO_BLTFGCOLOR +2 ): -cirrus_hook_read_gr (s,0x13 , &value); + value =cirrus_vga_read_gr (s,0x13 );break ;case (CIRRUS_MMIO_BLTFGCOLOR +3 ): -cirrus_hook_read_gr (s,0x15 , &value); + value =cirrus_vga_read_gr (s,0x15 );break ;case (CIRRUS_MMIO_BLTWIDTH +0 ): -cirrus_hook_read_gr (s,0x20 , &value); + value =cirrus_vga_read_gr (s,0x20 );break ;case (CIRRUS_MMIO_BLTWIDTH +1 ): -cirrus_hook_read_gr (s,0x21 , &value); + value =cirrus_vga_read_gr (s,0x21 );break ;case (CIRRUS_MMIO_BLTHEIGHT +0 ): -cirrus_hook_read_gr (s,0x22 , &value); + value =cirrus_vga_read_gr (s,0x22 );break ;case (CIRRUS_MMIO_BLTHEIGHT +1 ): -cirrus_hook_read_gr (s,0x23 , &value); + value =cirrus_vga_read_gr (s,0x23 );break ;case (CIRRUS_MMIO_BLTDESTPITCH +0 ): -cirrus_hook_read_gr (s,0x24 , &value); + value =cirrus_vga_read_gr (s,0x24 );break ;case (CIRRUS_MMIO_BLTDESTPITCH +1 ): -cirrus_hook_read_gr (s,0x25 , &value); + value =cirrus_vga_read_gr (s,0x25 );break ;case (CIRRUS_MMIO_BLTSRCPITCH +0 ): -cirrus_hook_read_gr (s,0x26 , &value); + value =cirrus_vga_read_gr (s,0x26 );break ;case (CIRRUS_MMIO_BLTSRCPITCH +1 ): -cirrus_hook_read_gr (s,0x27 , &value); + value =cirrus_vga_read_gr (s,0x27 );break ;case (CIRRUS_MMIO_BLTDESTADDR +0 ): -cirrus_hook_read_gr (s,0x28 , &value); + value =cirrus_vga_read_gr (s,0x28 );break ;case (CIRRUS_MMIO_BLTDESTADDR +1 ): -cirrus_hook_read_gr (s,0x29 , &value); + value =cirrus_vga_read_gr (s,0x29 );break ;case (CIRRUS_MMIO_BLTDESTADDR +2 ): -cirrus_hook_read_gr (s,0x2a , &value); + value =cirrus_vga_read_gr (s,0x2a );break ;case (CIRRUS_MMIO_BLTSRCADDR +0 ): -cirrus_hook_read_gr (s,0x2c , &value); + value =cirrus_vga_read_gr (s,0x2c );break ;case (CIRRUS_MMIO_BLTSRCADDR +1 ): -cirrus_hook_read_gr (s,0x2d , &value); + value =cirrus_vga_read_gr (s,0x2d );break ;case (CIRRUS_MMIO_BLTSRCADDR +2 ): -cirrus_hook_read_gr (s,0x2e , &value); + value =cirrus_vga_read_gr (s,0x2e );break ;case CIRRUS_MMIO_BLTWRITEMASK : -cirrus_hook_read_gr (s,0x2f , &value); + value =cirrus_vga_read_gr (s,0x2f );break ;case CIRRUS_MMIO_BLTMODE : -cirrus_hook_read_gr (s,0x30 , &value); + value =cirrus_vga_read_gr (s,0x30 );break ;case CIRRUS_MMIO_BLTROP : -cirrus_hook_read_gr (s,0x32 , &value); + value =cirrus_vga_read_gr (s,0x32 );break ;case CIRRUS_MMIO_BLTMODEEXT : -cirrus_hook_read_gr (s,0x33 , &value); + value =cirrus_vga_read_gr (s,0x33 );break ;case (CIRRUS_MMIO_BLTTRANSPARENTCOLOR +0 ): -cirrus_hook_read_gr (s,0x34 , &value); + value =cirrus_vga_read_gr (s,0x34 );break ;case (CIRRUS_MMIO_BLTTRANSPARENTCOLOR +1 ): -cirrus_hook_read_gr (s,0x35 , &value); + value =cirrus_vga_read_gr (s,0x35 );break ;case (CIRRUS_MMIO_BLTTRANSPARENTCOLORMASK +0 ): -cirrus_hook_read_gr (s,0x38 , &value); + value =cirrus_vga_read_gr (s,0x38 );break ;case (CIRRUS_MMIO_BLTTRANSPARENTCOLORMASK +1 ): -cirrus_hook_read_gr (s,0x39 , &value); + value =cirrus_vga_read_gr (s,0x39 );break ;case CIRRUS_MMIO_BLTSTATUS : -cirrus_hook_read_gr (s,0x31 , &value); + value =cirrus_vga_read_gr (s,0x31 );break ;default :#ifdef DEBUG_CIRRUS
@@ -2714,9 +2709,7 @@ static uint32_t cirrus_vga_ioport_read(void *opaque, uint32_t addr) val = s->gr_index;break ;case 0x3cf : -if (cirrus_hook_read_gr (c, s->gr_index, &val)) -break ; - val = s->gr[s->gr_index]; + val =cirrus_vga_read_gr (c, s->gr_index);#ifdef DEBUG_VGA_REG printf ("vga: read GR%x = 0x%02x\n" , s->gr_index, val);#endif
Signature · 1 line
1.6.2.5
PATCH 20/23 cirrus_vga: rename cirrus_hook_write_gr() cirrus_vga_write_gr()
In reply to Juan QuintelaSimplify the logic to do everything inside the function.
--- hw/cirrus_vga.c | 79 ++++++++++++++++++++++++++---------------------------- 1 files changed, 38 insertions(+), 41 deletions(-)
hw/cirrus_vga.c +38 -41
@@ -1487,8 +1487,8 @@ static int cirrus_vga_read_gr(CirrusVGAState * s, unsigned reg_index) } } -static int -cirrus_hook_write_gr (CirrusVGAState * s,unsigned reg_index,int reg_value) +static void +cirrus_vga_write_gr (CirrusVGAState * s,unsigned reg_index,int reg_value) {#if defined(DEBUG_BITBLT ) &&0 printf ("gr%02x: %02x\n" , reg_index, reg_value);
@@ -1496,17 +1496,18 @@ cirrus_hook_write_gr(CirrusVGAState * s, unsigned reg_index, int reg_value)switch (reg_index) {case 0x00 :// Standard VGA, BGCOLOR 0x000000ff s->cirrus_shadow_gr0 = reg_value; -return CIRRUS_HOOK_NOT_HANDLED ; +break ;case 0x01 :// Standard VGA, FGCOLOR 0x000000ff s->cirrus_shadow_gr1 = reg_value; -return CIRRUS_HOOK_NOT_HANDLED ; +break ;case 0x02 :// Standard VGA case 0x03 :// Standard VGA case 0x04 :// Standard VGA case 0x06 :// Standard VGA case 0x07 :// Standard VGA case 0x08 :// Standard VGA -return CIRRUS_HOOK_NOT_HANDLED ; + s->vga.gr[reg_index] = reg_value & gr_mask[reg_index]; +break ;case 0x05 :// Standard VGA, Cirrus extended mode s->vga.gr[reg_index] = reg_value &0x7f ;cirrus_update_memory_access (s);
@@ -1574,8 +1575,6 @@ cirrus_hook_write_gr(CirrusVGAState * s, unsigned reg_index, int reg_value)#endif break ; } - -return CIRRUS_HOOK_HANDLED ; }/***************************************
@@ -1818,100 +1817,100 @@ static void cirrus_mmio_blt_write(CirrusVGAState * s, unsigned address, {switch (address) {case (CIRRUS_MMIO_BLTBGCOLOR +0 ): -cirrus_hook_write_gr (s,0x00 , value); +cirrus_vga_write_gr (s,0x00 , value);break ;case (CIRRUS_MMIO_BLTBGCOLOR +1 ): -cirrus_hook_write_gr (s,0x10 , value); +cirrus_vga_write_gr (s,0x10 , value);break ;case (CIRRUS_MMIO_BLTBGCOLOR +2 ): -cirrus_hook_write_gr (s,0x12 , value); +cirrus_vga_write_gr (s,0x12 , value);break ;case (CIRRUS_MMIO_BLTBGCOLOR +3 ): -cirrus_hook_write_gr (s,0x14 , value); +cirrus_vga_write_gr (s,0x14 , value);break ;case (CIRRUS_MMIO_BLTFGCOLOR +0 ): -cirrus_hook_write_gr (s,0x01 , value); +cirrus_vga_write_gr (s,0x01 , value);break ;case (CIRRUS_MMIO_BLTFGCOLOR +1 ): -cirrus_hook_write_gr (s,0x11 , value); +cirrus_vga_write_gr (s,0x11 , value);break ;case (CIRRUS_MMIO_BLTFGCOLOR +2 ): -cirrus_hook_write_gr (s,0x13 , value); +cirrus_vga_write_gr (s,0x13 , value);break ;case (CIRRUS_MMIO_BLTFGCOLOR +3 ): -cirrus_hook_write_gr (s,0x15 , value); +cirrus_vga_write_gr (s,0x15 , value);break ;case (CIRRUS_MMIO_BLTWIDTH +0 ): -cirrus_hook_write_gr (s,0x20 , value); +cirrus_vga_write_gr (s,0x20 , value);break ;case (CIRRUS_MMIO_BLTWIDTH +1 ): -cirrus_hook_write_gr (s,0x21 , value); +cirrus_vga_write_gr (s,0x21 , value);break ;case (CIRRUS_MMIO_BLTHEIGHT +0 ): -cirrus_hook_write_gr (s,0x22 , value); +cirrus_vga_write_gr (s,0x22 , value);break ;case (CIRRUS_MMIO_BLTHEIGHT +1 ): -cirrus_hook_write_gr (s,0x23 , value); +cirrus_vga_write_gr (s,0x23 , value);break ;case (CIRRUS_MMIO_BLTDESTPITCH +0 ): -cirrus_hook_write_gr (s,0x24 , value); +cirrus_vga_write_gr (s,0x24 , value);break ;case (CIRRUS_MMIO_BLTDESTPITCH +1 ): -cirrus_hook_write_gr (s,0x25 , value); +cirrus_vga_write_gr (s,0x25 , value);break ;case (CIRRUS_MMIO_BLTSRCPITCH +0 ): -cirrus_hook_write_gr (s,0x26 , value); +cirrus_vga_write_gr (s,0x26 , value);break ;case (CIRRUS_MMIO_BLTSRCPITCH +1 ): -cirrus_hook_write_gr (s,0x27 , value); +cirrus_vga_write_gr (s,0x27 , value);break ;case (CIRRUS_MMIO_BLTDESTADDR +0 ): -cirrus_hook_write_gr (s,0x28 , value); +cirrus_vga_write_gr (s,0x28 , value);break ;case (CIRRUS_MMIO_BLTDESTADDR +1 ): -cirrus_hook_write_gr (s,0x29 , value); +cirrus_vga_write_gr (s,0x29 , value);break ;case (CIRRUS_MMIO_BLTDESTADDR +2 ): -cirrus_hook_write_gr (s,0x2a , value); +cirrus_vga_write_gr (s,0x2a , value);break ;case (CIRRUS_MMIO_BLTDESTADDR +3 ):/* ignored */ break ;case (CIRRUS_MMIO_BLTSRCADDR +0 ): -cirrus_hook_write_gr (s,0x2c , value); +cirrus_vga_write_gr (s,0x2c , value);break ;case (CIRRUS_MMIO_BLTSRCADDR +1 ): -cirrus_hook_write_gr (s,0x2d , value); +cirrus_vga_write_gr (s,0x2d , value);break ;case (CIRRUS_MMIO_BLTSRCADDR +2 ): -cirrus_hook_write_gr (s,0x2e , value); +cirrus_vga_write_gr (s,0x2e , value);break ;case CIRRUS_MMIO_BLTWRITEMASK : -cirrus_hook_write_gr (s,0x2f , value); +cirrus_vga_write_gr (s,0x2f , value);break ;case CIRRUS_MMIO_BLTMODE : -cirrus_hook_write_gr (s,0x30 , value); +cirrus_vga_write_gr (s,0x30 , value);break ;case CIRRUS_MMIO_BLTROP : -cirrus_hook_write_gr (s,0x32 , value); +cirrus_vga_write_gr (s,0x32 , value);break ;case CIRRUS_MMIO_BLTMODEEXT : -cirrus_hook_write_gr (s,0x33 , value); +cirrus_vga_write_gr (s,0x33 , value);break ;case (CIRRUS_MMIO_BLTTRANSPARENTCOLOR +0 ): -cirrus_hook_write_gr (s,0x34 , value); +cirrus_vga_write_gr (s,0x34 , value);break ;case (CIRRUS_MMIO_BLTTRANSPARENTCOLOR +1 ): -cirrus_hook_write_gr (s,0x35 , value); +cirrus_vga_write_gr (s,0x35 , value);break ;case (CIRRUS_MMIO_BLTTRANSPARENTCOLORMASK +0 ): -cirrus_hook_write_gr (s,0x38 , value); +cirrus_vga_write_gr (s,0x38 , value);break ;case (CIRRUS_MMIO_BLTTRANSPARENTCOLORMASK +1 ): -cirrus_hook_write_gr (s,0x39 , value); +cirrus_vga_write_gr (s,0x39 , value);break ;case CIRRUS_MMIO_BLTSTATUS : -cirrus_hook_write_gr (s,0x31 , value); +cirrus_vga_write_gr (s,0x31 , value);break ;default :#ifdef DEBUG_CIRRUS
@@ -2824,12 +2823,10 @@ static void cirrus_vga_ioport_write(void *opaque, uint32_t addr, uint32_t val) s->gr_index = val;break ;case 0x3cf : -if (cirrus_hook_write_gr (c, s->gr_index, val)) -break ;#ifdef DEBUG_VGA_REG printf ("vga: write GR%x = 0x%02x\n" , s->gr_index, val);#endif - s->gr[s->gr_index] = val & gr_mask[s->gr_index]; +cirrus_vga_write_gr (c, s->gr_index, val);break ;case 0x3b4 :case 0x3d4 :
Signature · 1 line
1.6.2.5
PATCH 21/23 cirrus_vga: rename cirrus_hook_read_cr() cirrus_vga_read_cr()
In reply to Juan QuintelaSimplify the logic to do everything inside the function. Return 0xff if index is out of range independetly of DEBUG_CIRRUS
--- hw/cirrus_vga.c | 22 +++++++--------------- 1 files changed, 7 insertions(+), 15 deletions(-)
hw/cirrus_vga.c +7 -15
@@ -1583,8 +1583,7 @@ cirrus_vga_write_gr(CirrusVGAState * s, unsigned reg_index, int reg_value)* ***************************************/ -static int -cirrus_hook_read_cr (CirrusVGAState * s,unsigned reg_index,int *reg_value) +static int cirrus_vga_read_cr (CirrusVGAState * s,unsigned reg_index) {switch (reg_index) {case 0x00 :// Standard VGA
@@ -1612,10 +1611,9 @@ cirrus_hook_read_cr(CirrusVGAState * s, unsigned reg_index, int *reg_value)case 0x16 :// Standard VGA case 0x17 :// Standard VGA case 0x18 :// Standard VGA -return CIRRUS_HOOK_NOT_HANDLED ; +return s->vga.cr[s->vga.cr_index];case 0x24 :// Attribute Controller Toggle Readback (R) - *reg_value = (s->vga.ar_flip_flop <<7 ); -break ; +return (s->vga.ar_flip_flop <<7 );case 0x19 :// Interlace End case 0x1a :// Miscellaneous Control case 0x1b :// Extended Display Control
@@ -1624,20 +1622,16 @@ cirrus_hook_read_cr(CirrusVGAState * s, unsigned reg_index, int *reg_value)case 0x22 :// Graphics Data Latches Readback (R) case 0x25 :// Part Status case 0x27 :// Part ID (R) - *reg_value = s->vga.cr[reg_index]; -break ; +return s->vga.cr[s->vga.cr_index];case 0x26 :// Attribute Controller Index Readback (R) - *reg_value = s->vga.ar_index &0x3f ; +return s->vga.ar_index &0x3f ;break ;default :#ifdef DEBUG_CIRRUS printf ("cirrus: inport cr_index %02x\n" , reg_index); - *reg_value =0xff ;#endif -break ; +return 0xff ; } - -return CIRRUS_HOOK_HANDLED ; } static int
@@ -2719,9 +2713,7 @@ static uint32_t cirrus_vga_ioport_read(void *opaque, uint32_t addr)break ;case 0x3b5 :case 0x3d5 : -if (cirrus_hook_read_cr (c, s->cr_index, &val)) -break ; - val = s->cr[s->cr_index]; + val =cirrus_vga_read_cr (c, s->cr_index);#ifdef DEBUG_VGA_REG printf ("vga: read CR%x = 0x%02x\n" , s->cr_index, val);#endif
Signature · 1 line
1.6.2.5
PATCH 22/23 cirrus_vga: rename cirrus_hook_write_cr() cirrus_vga_write_cr()
In reply to Juan QuintelaSimplify the logic to do everything inside the function.
--- hw/cirrus_vga.c | 59 +++++++++++++++++++++++++----------------------------- 1 files changed, 27 insertions(+), 32 deletions(-)
hw/cirrus_vga.c +27 -32
@@ -1634,10 +1634,9 @@ static int cirrus_vga_read_cr(CirrusVGAState * s, unsigned reg_index) } } -static int -cirrus_hook_write_cr (CirrusVGAState * s,unsigned reg_index,int reg_value) +static void cirrus_vga_write_cr (CirrusVGAState * s,int reg_value) { -switch (reg_index) { +switch (s->vga.cr_index) {case 0x00 :// Standard VGA case 0x01 :// Standard VGA case 0x02 :// Standard VGA
@@ -1663,16 +1662,35 @@ cirrus_hook_write_cr(CirrusVGAState * s, unsigned reg_index, int reg_value)case 0x16 :// Standard VGA case 0x17 :// Standard VGA case 0x18 :// Standard VGA -return CIRRUS_HOOK_NOT_HANDLED ; +/* handle CR0-7 protection */ +if ((s->vga.cr[0x11 ] &0x80 ) && s->vga.cr_index <=7 ) { +/* can always write bit 4 of CR7 */ +if (s->vga.cr_index ==7 ) + s->vga.cr[7 ] = (s->vga.cr[7 ] & ~0x10 ) | (reg_value &0x10 ); +return ; + } + s->vga.cr[s->vga.cr_index] = reg_value; +switch (s->vga.cr_index) { +case 0x00 : +case 0x04 : +case 0x05 : +case 0x06 : +case 0x07 : +case 0x11 : +case 0x17 : + s->vga.update_retrace_info (&s->vga); +break ; + } +break ;case 0x19 :// Interlace End case 0x1a :// Miscellaneous Control case 0x1b :// Extended Display Control case 0x1c :// Sync Adjust and Genlock case 0x1d :// Overlay Extended Control - s->vga.cr[reg_index] = reg_value; + s->vga.cr[s->vga.cr_index] = reg_value;#ifdef DEBUG_CIRRUS printf ("cirrus: handled outport cr_index %02x, cr_value %02x\n" , - reg_index, reg_value); + s->vga.cr_index, reg_value);#endif break ;case 0x22 :// Graphics Data Latches Readback (R)
@@ -1683,13 +1701,11 @@ cirrus_hook_write_cr(CirrusVGAState * s, unsigned reg_index, int reg_value)case 0x25 :// Part Status default :#ifdef DEBUG_CIRRUS -printf ("cirrus: outport cr_index %02x, cr_value %02x\n" , reg_index, - reg_value); +printf ("cirrus: outport cr_index %02x, cr_value %02x\n" , + s->vga.cr_index, reg_value);#endif break ; } - -return CIRRUS_HOOK_HANDLED ; }/***************************************
@@ -2826,31 +2842,10 @@ static void cirrus_vga_ioport_write(void *opaque, uint32_t addr, uint32_t val)break ;case 0x3b5 :case 0x3d5 : -if (cirrus_hook_write_cr (c, s->cr_index, val)) -break ;#ifdef DEBUG_VGA_REG printf ("vga: write CR%x = 0x%02x\n" , s->cr_index, val);#endif -/* handle CR0-7 protection */ -if ((s->cr[0x11 ] &0x80 ) && s->cr_index <=7 ) { -/* can always write bit 4 of CR7 */ -if (s->cr_index ==7 ) - s->cr[7 ] = (s->cr[7 ] & ~0x10 ) | (val &0x10 ); -return ; - } - s->cr[s->cr_index] = val; - -switch (s->cr_index) { -case 0x00 : -case 0x04 : -case 0x05 : -case 0x06 : -case 0x07 : -case 0x11 : -case 0x17 : - s->update_retrace_info (s); -break ; - } +cirrus_vga_write_cr (c, val);break ;case 0x3ba :case 0x3da :
Signature · 1 line
1.6.2.5
PATCH 23/23 cirrus_vga: CIRRUS_HOOK_* is not used anymore
In reply to Juan Quintela--- hw/cirrus_vga.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
hw/cirrus_vga.c +0 -5
@@ -208,11 +208,6 @@#define CIRRUS_PNPMMIO_SIZE 0x1000 - -/* I/O and memory hook */ -#define CIRRUS_HOOK_NOT_HANDLED 0 -#define CIRRUS_HOOK_HANDLED 1 -#define ABS (a) ((signed)(a) > 0 ? a : -a)#define BLTUNSAFE (s) \
Signature · 1 line
1.6.2.5
Quoted 27 lines · Juan Quintela
This patch:
- cleans the differences between VGAState/VGACommon state
- moves vga pci, isa, isa-mm out ofvga.c(cirrus and blizzar uses VGA common state).
- Cleans all the cirrus_hook_* stuff is something that don't look like a hook :)I would want this bits morged/reviewed before going the rest of the cleanup:
Todo:
- vga_ioport_read/write and cirrus_vga_ioport_read/write are almost identical
after this series of changes. Creating read/write() callbacks for sr/gr/cr/palette. Should put us there. The cirrus ones were the
difficult ones,
the vga ones are trivial.
-CONFIG_VBE_BOCHScode. This code is only used by vga std (pci + isa). Neither
cirrus/blizzard/isa-mm uses it. It should be moved out ofvga.c,vga-std.c?, and
then used by vga-isa and vga-pci?
-vmware_vga: it uses vga as embeded, but it don't save its state, I am not sure
if it wants/needVBE_BOCHS, .... I haven't looked atvmware_vga
too much, just
to vga andcirrus_vga.
Quoted 3 lines
Comments?
Later, Juan.
This patchset introduced a bug. I noticed today that I can't boot an installation disk of ubuntu-9.04-server-i386. After entering the install program ("Install Ubuntu Server"), I just get a black background with gray vertical lines.
More specifically, from oldest to newest commit:86948bb104f419db9af6b621b85703e8f0d3234c worksf705db9df04c6491f242a5a4585dfe72b708f197 throws a warning about an uninitialized variable (had to disable werror) but works 22286bc6468adac10b2eb7e603f1a8ba524bfb03 throws a warning about an uninitialized variable (had to disable werror) and doesn't work b863d51490b7c6e339c9565eda786cadc1218d48 compiles without warning and doesn't work
So 22286bc6468adac10b2eb7e603f1a8ba524bfb03 must be the problematic commit.
Signature · 1 line
Pierre Riteau -- http://perso.univ-rennes1.fr/pierre.riteau/
Quoted 40 lines · Pierre Riteau
Quoted 28 lines · Juan Quintela
This patch:
- cleans the differences between VGAState/VGACommon state
- moves vga pci, isa, isa-mm out ofvga.c(cirrus and blizzar uses VGA common state).
- Cleans all the cirrus_hook_* stuff is something that don't look like a hook :)I would want this bits morged/reviewed before going the rest of the cleanup:
Todo:
- vga_ioport_read/write and cirrus_vga_ioport_read/write are almost identical
after this series of changes. Creating read/write() callbacks for sr/gr/cr/palette. Should put us there. The cirrus ones were the
difficult ones,
the vga ones are trivial.
-CONFIG_VBE_BOCHScode. This code is only used by vga std (pci + isa). Neither
cirrus/blizzard/isa-mm uses it. It should be moved out ofvga.c,vga-std.c?, and
then used by vga-isa and vga-pci?
-vmware_vga: it uses vga as embeded, but it don't save its state, I am not sure
if it wants/needVBE_BOCHS, .... I haven't looked atvmware_vga
too much, just
to vga andcirrus_vga.Quoted 3 lines
Comments?
Later, Juan.
This patchset introduced a bug. I noticed today that I can't boot an installation disk of ubuntu-9.04-server-i386.
After entering the install program ("Install Ubuntu Server"), I just get a black background with gray vertical lines.
Quoted 4 lines
More specifically, from oldest to newest commit:
86948bb104f419db9af6b621b85703e8f0d3234cworksf705db9df04c6491f242a5a4585dfe72b708f197throws a warning about an uninitialized variable (had to disable werror) but works
could you post the error message? I didn't have that problem.
Quoted 4 lines
22286bc6468adac10b2eb7e603f1a8ba524bfb03throws a warning about an uninitialized variable (had to disable werror) and doesn't workb863d51490b7c6e339c9565eda786cadc1218d48compiles without warning and doesn't work
Weird, it did worked for me. Could you post what command line did you use? I tested with fedora + win XP.
Quoted 2 lines
So
22286bc6468adac10b2eb7e603f1a8ba524bfb03must be the problematic commit.
Thanks, will take a look.
Quoted 41 lines · Juan Quintela
Quoted 40 lines · Pierre Riteau
Quoted 28 lines · Juan Quintela
This patch:
- cleans the differences between VGAState/VGACommon state
- moves vga pci, isa, isa-mm out ofvga.c(cirrus and blizzar uses VGA common state).
- Cleans all the cirrus_hook_* stuff is something that don't look like a hook :)I would want this bits morged/reviewed before going the rest of the cleanup:
Todo:
- vga_ioport_read/write and cirrus_vga_ioport_read/write are almost identical
after this series of changes. Creating read/write() callbacks for sr/gr/cr/palette. Should put us there. The cirrus ones were the difficult ones,
the vga ones are trivial.
-CONFIG_VBE_BOCHScode. This code is only used by vga std (pci + isa). Neither
cirrus/blizzard/isa-mm uses it. It should be moved out ofvga.c,vga-std.c?, and
then used by vga-isa and vga-pci?
-vmware_vga: it uses vga as embeded, but it don't save its state, I am not sure
if it wants/needVBE_BOCHS, .... I haven't looked atvmware_vgatoo much, just
to vga andcirrus_vga.Quoted 3 lines
Comments?
Later, Juan.
This patchset introduced a bug. I noticed today that I can't boot an installation disk of ubuntu-9.04-server-i386.
After entering the install program ("Install Ubuntu Server"), I just get a black background with gray vertical lines.
Quoted 6 lines
Quoted 4 lines
More specifically, from oldest to newest commit:
86948bb104f419db9af6b621b85703e8f0d3234cworksf705db9df04c6491f242a5a4585dfe72b708f197throws a warning about an uninitialized variable (had to disable werror) but workscould you post the error message? I didn't have that problem.
/mnt/qemu/hw/cirrus_vga.c: In function 'cirrus_vga_ioport_read':/mnt/qemu/hw/cirrus_vga.c:2656: warning: 'val' may be used uninitialized in this function
I'm using ./configure --target-list=i386-softmmu --disable-werror, gcc is version 4.3.2 (from Debian Lenny).
Quoted 8 lines
Quoted 5 lines
22286bc6468adac10b2eb7e603f1a8ba524bfb03throws a warning about an uninitialized variable (had to disable werror) and doesn't workb863d51490b7c6e339c9565eda786cadc1218d48compiles without warning and doesn't workWeird, it did worked for me. Could you post what command line did you use? I tested with fedora + win XP.
qemu -cdrom ~/ubuntu-9.04-server-i386.iso -boot d
Quoted 5 lines
Quoted 3 lines
So
22286bc6468adac10b2eb7e603f1a8ba524bfb03must be the problematic commit.Thanks, will take a look.
Signature · 1 line
Pierre Riteau -- http://perso.univ-rennes1.fr/pierre.riteau/
Quoted 10 lines · Pierre Riteau
Quoted 10 lines
Quoted 9 lines
This patchset introduced a bug. I noticed today that I can't boot an installation disk of ubuntu-9.04-server-i386.
After entering the install program ("Install Ubuntu Server"), I just get a black background with gray vertical lines.More specifically, from oldest to newest commit:
86948bb104f419db9af6b621b85703e8f0d3234cworksf705db9df04c6491f242a5a4585dfe72b708f197throws a warning about an uninitialized variable (had to disable werror) but works
Quoted 5 lines
Quoted 1 line
could you post the error message? I didn't have that problem.
/mnt/qemu/hw/cirrus_vga.c: In function 'cirrus_vga_ioport_read':/mnt/qemu/hw/cirrus_vga.c:2656: warning: 'val' may be used uninitialized in this function
This is fixed on a later, patch, sorry :(
Quoted 9 lines
I'm using ./configure --target-list=i386-softmmu --disable-werror, gcc is version 4.3.2 (from Debian Lenny).
Quoted 6 lines
Quoted 5 lines
22286bc6468adac10b2eb7e603f1a8ba524bfb03throws a warning about an uninitialized variable (had to disable werror) and doesn't workb863d51490b7c6e339c9565eda786cadc1218d48compiles without warning and doesn't work
Quoted 10 lines
Quoted 2 lines
Weird, it did worked for me. Could you post what command line did you use? I tested with fedora + win XP.
qemu -cdrom ~/ubuntu-9.04-server-i386.iso -boot d
Quoted 5 lines
Quoted 3 lines
So
22286bc6468adac10b2eb7e603f1a8ba524bfb03must be the problematic commit.Thanks, will take a look.
could you check this patch?
(still not sure why it worked for fedora + xp for me)
Quoted 1 line
From
97869744f37ccd2846e3edcc1ad9f582d9bea1c6Mon Sep 17 00:00:00 2001
From: Juan Quintela <[email protected]>
Date: Wed, 16 Sep 2009 15:44:49 +0200
Subject: [PATCH] cirrus_vga: also assign gr0/1 when writting shadow_gr0/1
--- hw/cirrus_vga.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
hw/cirrus_vga.c +2 -0
@@ -1490,9 +1490,11 @@ cirrus_vga_write_gr(CirrusVGAState * s, unsigned reg_index, int reg_value)#endif switch (reg_index) {case 0x00 :// Standard VGA, BGCOLOR 0x000000ff + s->vga.gr[reg_index] = reg_value & gr_mask[reg_index]; s->cirrus_shadow_gr0 = reg_value;break ;case 0x01 :// Standard VGA, FGCOLOR 0x000000ff + s->vga.gr[reg_index] = reg_value & gr_mask[reg_index]; s->cirrus_shadow_gr1 = reg_value;break ;case 0x02 :// Standard VGA
Signature · 1 line
1.6.2.5
Quoted 69 lines · Juan Quintela
Quoted 10 lines · Pierre Riteau
Quoted 10 lines
Quoted 9 lines
This patchset introduced a bug. I noticed today that I can't boot an installation disk of ubuntu-9.04-server-i386.
After entering the install program ("Install Ubuntu Server"), I just get a black background with gray vertical lines.More specifically, from oldest to newest commit:
86948bb104f419db9af6b621b85703e8f0d3234cworksf705db9df04c6491f242a5a4585dfe72b708f197throws a warning about an uninitialized variable (had to disable werror) but worksQuoted 5 lines
Quoted 1 line
could you post the error message? I didn't have that problem.
/mnt/qemu/hw/cirrus_vga.c: In function 'cirrus_vga_ioport_read':/mnt/qemu/hw/cirrus_vga.c:2656: warning: 'val' may be used uninitialized in this functionThis is fixed on a later, patch, sorry :(
Quoted 9 lines
I'm using ./configure --target-list=i386-softmmu --disable-werror, gcc is version 4.3.2 (from Debian Lenny).
Quoted 6 lines
Quoted 5 lines
22286bc6468adac10b2eb7e603f1a8ba524bfb03throws a warning about an uninitialized variable (had to disable werror) and doesn't workb863d51490b7c6e339c9565eda786cadc1218d48compiles without warning and doesn't workQuoted 10 lines
Quoted 2 lines
Weird, it did worked for me. Could you post what command line did you use? I tested with fedora + win XP.
qemu -cdrom ~/ubuntu-9.04-server-i386.iso -boot d
Quoted 5 lines
Quoted 3 lines
So
22286bc6468adac10b2eb7e603f1a8ba524bfb03must be the problematic commit.Thanks, will take a look.
could you check this patch?
(still not sure why it worked for fedora + xp for me)From
97869744f37ccd2846e3edcc1ad9f582d9bea1c6Mon Sep 17 00:00:00 2001
From: Juan Quintela <[email protected]>
Date: Wed, 16 Sep 2009 15:44:49 +0200
Subject: [PATCH]cirrus_vga: also assign gr0/1 when writting shadow_gr0/1Signed-off-by Juan Quintela <[email protected]>---
hw/cirrus_vga.c| 2 ++1 files changed, 2 insertions(+), 0 deletions(-)hw/cirrus_vga.c +2
-0@@ -1490,9 +1490,11 @@ cirrus_vga_write_gr(CirrusVGAState * s, unsigned reg_index, int reg_value)#endif switch (reg_index) {case 0x00 :// Standard VGA, BGCOLOR 0x000000ff + s->vga.gr[reg_index] = reg_value & gr_mask[reg_index]; s->cirrus_shadow_gr0 = reg_value;break ;case 0x01 :// Standard VGA, FGCOLOR 0x000000ff + s->vga.gr[reg_index] = reg_value & gr_mask[reg_index]; s->cirrus_shadow_gr1 = reg_value;break ;
Quoted 6 lines
case 0x02: // Standard VGASignature · 1 line
1.6.2.5
It works now! Thanks.
Signature · 1 line
Pierre Riteau -- http://perso.univ-rennes1.fr/pierre.riteau/