提交 b863d514 编写于 作者: J Juan Quintela 提交者: Anthony Liguori

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: NJuan Quintela <quintela@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 22286bc6
...@@ -1583,8 +1583,7 @@ cirrus_vga_write_gr(CirrusVGAState * s, unsigned reg_index, int reg_value) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册