cirrus_vga: rename cirrus_hook_write_sr() cirrus_vga_write_sr()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Juan Quintela 2009-08-31 16:07:26 +02:00 committed by Anthony Liguori
parent 8a82c322ce
commit 31c63201c9
1 changed files with 22 additions and 23 deletions

View File

@ -1302,22 +1302,24 @@ static int cirrus_vga_read_sr(CirrusVGAState * s)
} }
} }
static int static void cirrus_vga_write_sr(CirrusVGAState * s, uint32_t val)
cirrus_hook_write_sr(CirrusVGAState * s, unsigned reg_index, int reg_value)
{ {
switch (reg_index) { switch (s->vga.sr_index) {
case 0x00: // Standard VGA case 0x00: // Standard VGA
case 0x01: // Standard VGA case 0x01: // Standard VGA
case 0x02: // Standard VGA case 0x02: // Standard VGA
case 0x03: // Standard VGA case 0x03: // Standard VGA
case 0x04: // 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 case 0x06: // Unlock Cirrus extensions
reg_value &= 0x17; val &= 0x17;
if (reg_value == 0x12) { if (val == 0x12) {
s->vga.sr[reg_index] = 0x12; s->vga.sr[s->vga.sr_index] = 0x12;
} else { } else {
s->vga.sr[reg_index] = 0x0f; s->vga.sr[s->vga.sr_index] = 0x0f;
} }
break; break;
case 0x10: case 0x10:
@ -1328,8 +1330,8 @@ cirrus_hook_write_sr(CirrusVGAState * s, unsigned reg_index, int reg_value)
case 0xb0: case 0xb0:
case 0xd0: case 0xd0:
case 0xf0: // Graphics Cursor X case 0xf0: // Graphics Cursor X
s->vga.sr[0x10] = reg_value; s->vga.sr[0x10] = val;
s->hw_cursor_x = (reg_value << 3) | (reg_index >> 5); s->hw_cursor_x = (val << 3) | (s->vga.sr_index >> 5);
break; break;
case 0x11: case 0x11:
case 0x31: case 0x31:
@ -1339,8 +1341,8 @@ cirrus_hook_write_sr(CirrusVGAState * s, unsigned reg_index, int reg_value)
case 0xb1: case 0xb1:
case 0xd1: case 0xd1:
case 0xf1: // Graphics Cursor Y case 0xf1: // Graphics Cursor Y
s->vga.sr[0x11] = reg_value; s->vga.sr[0x11] = val;
s->hw_cursor_y = (reg_value << 3) | (reg_index >> 5); s->hw_cursor_y = (val << 3) | (s->vga.sr_index >> 5);
break; break;
case 0x07: // Extended Sequencer Mode case 0x07: // Extended Sequencer Mode
cirrus_update_memory_access(s); 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 0x1d: // VCLK 2 Denominator & Post
case 0x1e: // VCLK 3 Denominator & Post case 0x1e: // VCLK 3 Denominator & Post
case 0x1f: // BIOS Write Enable and MCLK select 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 #ifdef DEBUG_CIRRUS
printf("cirrus: handled outport sr_index %02x, sr_value %02x\n", printf("cirrus: handled outport sr_index %02x, sr_value %02x\n",
reg_index, reg_value); s->vga.sr_index, val);
#endif #endif
break; break;
case 0x17: // Configuration Readback and Extended Control 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); cirrus_update_memory_access(s);
break; break;
default: default:
#ifdef DEBUG_CIRRUS #ifdef DEBUG_CIRRUS
printf("cirrus: outport sr_index %02x, sr_value %02x\n", reg_index, printf("cirrus: outport sr_index %02x, sr_value %02x\n",
reg_value); s->vga.sr_index, val);
#endif #endif
break; 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; s->sr_index = val;
break; break;
case 0x3c5: case 0x3c5:
if (cirrus_hook_write_sr(c, s->sr_index, val))
break;
#ifdef DEBUG_VGA_REG #ifdef DEBUG_VGA_REG
printf("vga: write SR%x = 0x%02x\n", s->sr_index, val); printf("vga: write SR%x = 0x%02x\n", s->sr_index, val);
#endif #endif
s->sr[s->sr_index] = val & sr_mask[s->sr_index]; cirrus_vga_write_sr(c, val);
if (s->sr_index == 1) s->update_retrace_info(s); break;
break; break;
case 0x3c6: case 0x3c6:
cirrus_write_hidden_dac(c, val); cirrus_write_hidden_dac(c, val);