Commit 07ad1b93a365a15c77b5848bba0f6a3399bce076

Authored by bellard
1 parent d36cd60e

disable keyboard interrupts if keyboard clock disabled (may not be fully correct…

…) - added keyboard ID for extended keyboard


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@482 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 17 additions and 2 deletions
... ... @@ -1462,6 +1462,10 @@ void serial_received_byte(SerialState *s, int ch)
1462 1462 s->lsr |= UART_LSR_BI | UART_LSR_DR;
1463 1463 serial_update_irq();
1464 1464 break;
  1465 + case 'd':
  1466 + // tb_flush();
  1467 + cpu_set_log(CPU_LOG_ALL);
  1468 + break;
1465 1469 case TERM_ESCAPE:
1466 1470 goto send_char;
1467 1471 }
... ... @@ -1979,6 +1983,7 @@ void ne2000_init(void)
1979 1983 /* Keyboard Commands */
1980 1984 #define KBD_CMD_SET_LEDS 0xED /* Set keyboard leds */
1981 1985 #define KBD_CMD_ECHO 0xEE
  1986 +#define KBD_CMD_GET_ID 0xF2 /* get keyboard ID */
1982 1987 #define KBD_CMD_SET_RATE 0xF3 /* Set typematic rate */
1983 1988 #define KBD_CMD_ENABLE 0xF4 /* Enable scanning */
1984 1989 #define KBD_CMD_RESET_DISABLE 0xF5 /* reset and disable scanning */
... ... @@ -2065,6 +2070,8 @@ KBDState kbd_state;
2065 2070 int reset_requested;
2066 2071  
2067 2072 /* update irq and KBD_STAT_[MOUSE_]OBF */
  2073 +/* XXX: not generating the irqs if KBD_MODE_DISABLE_KBD is set may be
  2074 + incorrect, but it avoids having to simulate exact delays */
2068 2075 static void kbd_update_irq(KBDState *s)
2069 2076 {
2070 2077 int irq12_level, irq1_level;
... ... @@ -2080,7 +2087,8 @@ static void kbd_update_irq(KBDState *s)
2080 2087 if (s->mode & KBD_MODE_MOUSE_INT)
2081 2088 irq12_level = 1;
2082 2089 } else {
2083   - if (s->mode & KBD_MODE_KBD_INT)
  2090 + if ((s->mode & KBD_MODE_KBD_INT) &&
  2091 + !(s->mode & KBD_MODE_DISABLE_KBD))
2084 2092 irq1_level = 1;
2085 2093 }
2086 2094 }
... ... @@ -2120,7 +2128,7 @@ uint32_t kbd_read_status(CPUX86State *env, uint32_t addr)
2120 2128 KBDState *s = &kbd_state;
2121 2129 int val;
2122 2130 val = s->status;
2123   -#if defined(DEBUG_KBD) && 0
  2131 +#if defined(DEBUG_KBD)
2124 2132 printf("kbd: read status=0x%02x\n", val);
2125 2133 #endif
2126 2134 return val;
... ... @@ -2162,9 +2170,11 @@ void kbd_write_command(CPUX86State *env, uint32_t addr, uint32_t val)
2162 2170 break;
2163 2171 case KBD_CCMD_KBD_DISABLE:
2164 2172 s->mode |= KBD_MODE_DISABLE_KBD;
  2173 + kbd_update_irq(s);
2165 2174 break;
2166 2175 case KBD_CCMD_KBD_ENABLE:
2167 2176 s->mode &= ~KBD_MODE_DISABLE_KBD;
  2177 + kbd_update_irq(s);
2168 2178 break;
2169 2179 case KBD_CCMD_READ_INPORT:
2170 2180 kbd_queue(s, 0x00, 0);
... ... @@ -2251,6 +2261,11 @@ static void kbd_write_keyboard(KBDState *s, int val)
2251 2261 case 0x05:
2252 2262 kbd_queue(s, KBD_REPLY_RESEND, 0);
2253 2263 break;
  2264 + case KBD_CMD_GET_ID:
  2265 + kbd_queue(s, KBD_REPLY_ACK, 0);
  2266 + kbd_queue(s, 0xab, 0);
  2267 + kbd_queue(s, 0x83, 0);
  2268 + break;
2254 2269 case KBD_CMD_ECHO:
2255 2270 kbd_queue(s, KBD_CMD_ECHO, 0);
2256 2271 break;
... ...