}
if (!timeout) {
- printk_warning("Unexpected Keyboard controller input buffer full\n");
+ printk(BIOS_WARNING, "Unexpected Keyboard controller input buffer full\n");
}
return !!timeout;
}
}
if (!timeout) {
- printk_warning("Keyboard controller output buffer result timeout\n");
+ printk(BIOS_WARNING, "Keyboard controller output buffer result timeout\n");
}
return !!timeout;
}
}
if (!timeout) {
- printk_err("Couldn't cleanup the keyboard controller buffers\n");
- printk_err("Status (0x%x): 0x%x, Buffer (0x%x): 0x%x\n",
+ printk(BIOS_ERR, "Couldn't cleanup the keyboard controller buffers\n");
+ printk(BIOS_ERR, "Status (0x%x): 0x%x, Buffer (0x%x): 0x%x\n",
KBD_STATUS, inb(KBD_STATUS), KBD_DATA, inb(KBD_DATA));
}
if (!kbc_output_buffer_full()) {
/* There probably is no keyboard controller. */
- printk_err("Could not reset keyboard controller.\n");
+ printk(BIOS_ERR, "Could not reset keyboard controller.\n");
return 0;
}
self_test = inb(KBD_DATA);
if (self_test != 0x55) {
- printk_err("Keyboard Controller self-test failed: 0x%x\n",
+ printk(BIOS_ERR, "Keyboard Controller self-test failed: 0x%x\n",
self_test);
return 0;
}
if (!kbc_input_buffer_empty()) return 0;
outb(command, KBD_DATA);
if (!kbc_output_buffer_full()) {
- printk_err("Could not send keyboard command %02x\n",
+ printk(BIOS_ERR, "Could not send keyboard command %02x\n",
command);
return 0;
}
regval = inb(KBD_DATA);
--resend;
- } while (regval == 0xFE && resend > 0);
+ } while (regval == KBD_REPLY_RESEND && resend > 0);
return regval;
}
-static void pc_keyboard_init(struct pc_keyboard *keyboard)
+void pc_keyboard_init(struct pc_keyboard *keyboard)
{
u8 regval;
- printk_debug("Keyboard init...\n");
+ printk(BIOS_DEBUG, "Keyboard init...\n");
/* Run a keyboard controller self-test */
if (!kbc_self_test())
if (!kbc_input_buffer_empty()) return;
outb(0x20, KBD_DATA); /* send cmd: enable keyboard */
if (!kbc_input_buffer_empty()) {
- printk_info("Timeout while enabling keyboard\n");
+ printk(BIOS_INFO, "Timeout while enabling keyboard\n");
return;
}
/* reset keyboard and self test (keyboard side) */
regval = send_keyboard(0xFF);
- if (regval != 0xFA) {
- printk_err("Keyboard selftest failed ACK: 0x%x\n", regval);
+ if (regval == KBD_REPLY_RESEND) {
+ /* keeps sending RESENDs, probably no keyboard. */
+ printk(BIOS_INFO, "No PS/2 keyboard detected.\n");
+ return;
+ }
+
+ if (regval != KBD_REPLY_ACK) {
+ printk(BIOS_ERR, "Keyboard selftest failed ACK: 0x%x\n", regval);
return;
}
if (!kbc_output_buffer_full()) {
- printk_err("Timeout waiting for keyboard after reset.\n");
+ printk(BIOS_ERR, "Timeout waiting for keyboard after reset.\n");
return;
}
regval = inb(KBD_DATA);
if (regval != 0xAA) {
- printk_err("Keyboard selftest failed: 0x%x\n", regval);
+ printk(BIOS_ERR, "Keyboard selftest failed: 0x%x\n", regval);
return;
}
/* disable the keyboard */
regval = send_keyboard(0xF5);
- if (regval != 0xFA) {
- printk_err("Keyboard disable failed ACK: 0x%x\n", regval);
+ if (regval != KBD_REPLY_ACK) {
+ printk(BIOS_ERR, "Keyboard disable failed ACK: 0x%x\n", regval);
return;
}
/* Set scancode command */
regval = send_keyboard(0xF0);
- if (regval != 0xFA) {
- printk_err("Keyboard set scancode cmd failed ACK: 0x%x\n", regval);
+ if (regval != KBD_REPLY_ACK) {
+ printk(BIOS_ERR, "Keyboard set scancode cmd failed ACK: 0x%x\n", regval);
return;
}
/* Set scancode mode 2 */
regval = send_keyboard(0x02);
- if (regval != 0xFA) {
- printk_err("Keyboard set scancode mode failed ACK: 0x%x\n", regval);
+ if (regval != KBD_REPLY_ACK) {
+ printk(BIOS_ERR, "Keyboard set scancode mode failed ACK: 0x%x\n", regval);
return;
}
/* enable the keyboard */
regval = send_keyboard(0xF4);
- if (regval != 0xFA) {
- printk_err("Keyboard enable failed ACK: 0x%x\n", regval);
+ if (regval != KBD_REPLY_ACK) {
+ printk(BIOS_ERR, "Keyboard enable failed ACK: 0x%x\n", regval);
return;
}
if (!kbc_input_buffer_empty()) return;
outb(0x61, KBD_DATA); /* send cmd: enable keyboard and IRQ 1 */
if (kbc_output_buffer_full()) {
- printk_err("Timeout during final keyboard enable\n");
+ printk(BIOS_ERR, "Timeout during final keyboard enable\n");
return;
}
}
-
-void init_pc_keyboard(unsigned port0, unsigned port1, struct pc_keyboard *kbd)
-{
- if ((port0 == 0x60) && (port1 == 0x64)) {
- pc_keyboard_init(kbd);
- } else {
- printk_warning("Unsupported keyboard controller.\n");
- }
-}
-
/*
* Support PS/2 mode - oddball SIOs(KBC) need this setup
* Not well documented. Google - 0xcb keyboard controller