Index: kernel/arch/sparc64/Makefile.inc
===================================================================
--- kernel/arch/sparc64/Makefile.inc	(revision da747470c430a8c8b5e0ad34a1485ec2d5f3e0cb)
+++ kernel/arch/sparc64/Makefile.inc	(revision 287920fbf506e950a6b1035b8520eeaf673338bf)
@@ -65,6 +65,5 @@
 
 CONFIG_Z8530 = y
-CONFIG_KBD_SUN = y
-DEFS += -DCONFIG_KBD_SUN
+DEFS += -DCONFIG_Z8530
 
 ARCH_SOURCES = \
Index: kernel/arch/sparc64/include/drivers/kbd.h
===================================================================
--- kernel/arch/sparc64/include/drivers/kbd.h	(revision 287920fbf506e950a6b1035b8520eeaf673338bf)
+++ kernel/arch/sparc64/include/drivers/kbd.h	(revision 287920fbf506e950a6b1035b8520eeaf673338bf)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2006 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup sparc64	
+ * @{
+ */
+/** @file
+ */
+
+#ifndef KERN_sparc64_KBD_H_
+#define KERN_sparc64_KBD_H_
+
+#include <arch/types.h>
+
+extern volatile uint8_t *kbd_virt_address;
+
+extern void kbd_init(void);
+
+#endif
+
+/** @}
+ */
Index: kernel/arch/sparc64/include/drivers/z8530.h
===================================================================
--- kernel/arch/sparc64/include/drivers/z8530.h	(revision da747470c430a8c8b5e0ad34a1485ec2d5f3e0cb)
+++ kernel/arch/sparc64/include/drivers/z8530.h	(revision 287920fbf506e950a6b1035b8520eeaf673338bf)
@@ -37,4 +37,5 @@
 
 #include <arch/types.h>
+#include <arch/drivers/kbd.h>
 
 #define STATUS_REG	4
@@ -43,6 +44,4 @@
 
 #define LAST_REG	DATA_REG
-
-extern volatile uint8_t *kbd_virt_address;
 
 static inline void z8530_data_write(uint8_t data)
@@ -66,6 +65,4 @@
 }
 
-extern void kbd_init(void);
-
 #endif
 
Index: kernel/arch/sparc64/src/console.c
===================================================================
--- kernel/arch/sparc64/src/console.c	(revision da747470c430a8c8b5e0ad34a1485ec2d5f3e0cb)
+++ kernel/arch/sparc64/src/console.c	(revision 287920fbf506e950a6b1035b8520eeaf673338bf)
@@ -38,6 +38,13 @@
 #include <genarch/fb/fb.h>
 #include <arch/drivers/fb.h>
-#include <arch/drivers/i8042.h>
-#include <genarch/i8042/i8042.h>
+
+#include <arch/drivers/kbd.h>
+#ifdef CONFIG_Z8530
+#include <genarch/kbd/z8530.h>
+#endif
+#ifdef CONFIG_16550A
+#include <genarch/kbd/16550a.h>
+#endif
+
 #include <console/chardev.h>
 #include <console/console.h>
@@ -72,5 +79,10 @@
 		
 	while (1) {
-		i8042_poll();		
+#ifdef CONFIG_Z8530
+		z8530_poll();
+#endif
+#ifdef CONFIG_16550A
+		16550a_poll();
+#endif
 		thread_usleep(KEYBOARD_POLL_PAUSE);
 	}
Index: kernel/arch/sparc64/src/drivers/kbd.c
===================================================================
--- kernel/arch/sparc64/src/drivers/kbd.c	(revision da747470c430a8c8b5e0ad34a1485ec2d5f3e0cb)
+++ kernel/arch/sparc64/src/drivers/kbd.c	(revision 287920fbf506e950a6b1035b8520eeaf673338bf)
@@ -33,4 +33,5 @@
  */
 
+#include <arch/drivers/kbd.h>
 #ifdef CONFIG_Z8530
 #include <genarch/kbd/z8530.h>
@@ -39,8 +40,10 @@
 #include <genarch/kbd/16650a.h>
 #endif
+
 #include <arch/boot/boot.h>
 #include <arch/mm/page.h>
 #include <arch/types.h>
 #include <typedefs.h>
+#include <align.h>
 
 volatile uint8_t *kbd_virt_address = NULL;
@@ -50,4 +53,7 @@
 	size_t offset;
 	uintptr_t aligned_addr;
+
+	/* FIXME: supply value read from OpenFirmware */
+	bootinfo.keyboard.size = 8;
 
 	/*
Index: kernel/arch/sparc64/src/mm/tlb.c
===================================================================
--- kernel/arch/sparc64/src/mm/tlb.c	(revision da747470c430a8c8b5e0ad34a1485ec2d5f3e0cb)
+++ kernel/arch/sparc64/src/mm/tlb.c	(revision 287920fbf506e950a6b1035b8520eeaf673338bf)
@@ -48,7 +48,4 @@
 #include <symtab.h>
 
-#include <arch/drivers/fb.h>
-#include <arch/drivers/i8042.h>
-
 char *context_encoding[] = {
 	"Primary",
@@ -61,6 +58,5 @@
 {
 	/*
-	 * TLBs are actually initialized by
-	 * take_over_tlb_and_tt() early
+	 * TLBs are actually initialized early
 	 * in start.S.
 	 */
