mirror of
https://git.proxmox.com/git/qemu
synced 2025-08-07 11:28:46 +00:00
cirrus_vga: rename cirrus_hook_read_cr() cirrus_vga_read_cr()
Simplify the logic to do everything inside the function. Return 0xff if index is out of range independetly of DEBUG_CIRRUS Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
22286bc646
commit
b863d51490
@ -1583,8 +1583,7 @@ cirrus_vga_write_gr(CirrusVGAState * s, unsigned reg_index, int reg_value)
|
|||||||
*
|
*
|
||||||
***************************************/
|
***************************************/
|
||||||
|
|
||||||
static int
|
static int cirrus_vga_read_cr(CirrusVGAState * s, unsigned reg_index)
|
||||||
cirrus_hook_read_cr(CirrusVGAState * s, unsigned reg_index, int *reg_value)
|
|
||||||
{
|
{
|
||||||
switch (reg_index) {
|
switch (reg_index) {
|
||||||
case 0x00: // Standard VGA
|
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 0x16: // Standard VGA
|
||||||
case 0x17: // Standard VGA
|
case 0x17: // Standard VGA
|
||||||
case 0x18: // 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)
|
case 0x24: // Attribute Controller Toggle Readback (R)
|
||||||
*reg_value = (s->vga.ar_flip_flop << 7);
|
return (s->vga.ar_flip_flop << 7);
|
||||||
break;
|
|
||||||
case 0x19: // Interlace End
|
case 0x19: // Interlace End
|
||||||
case 0x1a: // Miscellaneous Control
|
case 0x1a: // Miscellaneous Control
|
||||||
case 0x1b: // Extended Display 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 0x22: // Graphics Data Latches Readback (R)
|
||||||
case 0x25: // Part Status
|
case 0x25: // Part Status
|
||||||
case 0x27: // Part ID (R)
|
case 0x27: // Part ID (R)
|
||||||
*reg_value = s->vga.cr[reg_index];
|
return s->vga.cr[s->vga.cr_index];
|
||||||
break;
|
|
||||||
case 0x26: // Attribute Controller Index Readback (R)
|
case 0x26: // Attribute Controller Index Readback (R)
|
||||||
*reg_value = s->vga.ar_index & 0x3f;
|
return s->vga.ar_index & 0x3f;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#ifdef DEBUG_CIRRUS
|
#ifdef DEBUG_CIRRUS
|
||||||
printf("cirrus: inport cr_index %02x\n", reg_index);
|
printf("cirrus: inport cr_index %02x\n", reg_index);
|
||||||
*reg_value = 0xff;
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
return 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CIRRUS_HOOK_HANDLED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2719,9 +2713,7 @@ static uint32_t cirrus_vga_ioport_read(void *opaque, uint32_t addr)
|
|||||||
break;
|
break;
|
||||||
case 0x3b5:
|
case 0x3b5:
|
||||||
case 0x3d5:
|
case 0x3d5:
|
||||||
if (cirrus_hook_read_cr(c, s->cr_index, &val))
|
val = cirrus_vga_read_cr(c, s->cr_index);
|
||||||
break;
|
|
||||||
val = s->cr[s->cr_index];
|
|
||||||
#ifdef DEBUG_VGA_REG
|
#ifdef DEBUG_VGA_REG
|
||||||
printf("vga: read CR%x = 0x%02x\n", s->cr_index, val);
|
printf("vga: read CR%x = 0x%02x\n", s->cr_index, val);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user