Index: boot/arch/sparc64/loader/Makefile
===================================================================
--- boot/arch/sparc64/loader/Makefile	(revision 04d672c3586c54665c634c7e3ee3478f2444e5ac)
+++ boot/arch/sparc64/loader/Makefile	(revision 63b15373eee376c379663c5f4cbe72e41378054c)
@@ -102,15 +102,23 @@
 	$(USPACEDIR)/srv/kbd/kbd \
 	$(USPACEDIR)/srv/console/console \
-	$(USPACEDIR)/srv/fs/tmpfs/tmpfs \
+	$(USPACEDIR)/srv/fs/tmpfs/tmpfs
+
+ifeq ($(MACHINE),generic)
+RD_SRVS += \
 	$(USPACEDIR)/srv/fs/fat/fat \
 	$(USPACEDIR)/srv/fhc/fhc \
-	$(USPACEDIR)/srv/obio/obio 
+	$(USPACEDIR)/srv/obio/obio
+endif
 
 RD_APPS = \
 	$(USPACEDIR)/app/tetris/tetris \
-	$(USPACEDIR)/app/tester/tester \
 	$(USPACEDIR)/app/trace/trace \
 	$(USPACEDIR)/app/bdsh/bdsh \
 	$(USPACEDIR)/app/klog/klog
+
+ifeq ($(MACHINE),generic)
+RD_APPS += \
+	$(USPACEDIR)/app/tester/tester
+endif
 
 OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
Index: kernel/arch/sparc64/include/drivers/sgcn.h
===================================================================
--- kernel/arch/sparc64/include/drivers/sgcn.h	(revision 04d672c3586c54665c634c7e3ee3478f2444e5ac)
+++ kernel/arch/sparc64/include/drivers/sgcn.h	(revision 63b15373eee376c379663c5f4cbe72e41378054c)
@@ -118,5 +118,4 @@
 void sgcn_grab(void);
 void sgcn_release(void);
-void sgcn_poll(void);
 void sgcn_init(void);
 
Index: kernel/arch/sparc64/src/console.c
===================================================================
--- kernel/arch/sparc64/src/console.c	(revision 04d672c3586c54665c634c7e3ee3478f2444e5ac)
+++ kernel/arch/sparc64/src/console.c	(revision 63b15373eee376c379663c5f4cbe72e41378054c)
@@ -125,24 +125,4 @@
 
 
-/** Kernel thread for polling keyboard.
- *
- * @param arg Ignored.
- */
-void kkbdpoll(void *arg)
-{
-	thread_detach(THREAD);
-
-	if (kbd_type != KBD_SGCN)
-		return;
-
-	while (1) {
-#ifdef CONFIG_SGCN
-		if (kbd_type == KBD_SGCN)
-			sgcn_poll();
-#endif
-		thread_usleep(KEYBOARD_POLL_PAUSE);
-	}
-}
-
 /** Acquire console back for kernel
  *
Index: kernel/arch/sparc64/src/drivers/kbd.c
===================================================================
--- kernel/arch/sparc64/src/drivers/kbd.c	(revision 04d672c3586c54665c634c7e3ee3478f2444e5ac)
+++ kernel/arch/sparc64/src/drivers/kbd.c	(revision 63b15373eee376c379663c5f4cbe72e41378054c)
@@ -57,4 +57,6 @@
 
 kbd_type_t kbd_type = KBD_UNKNOWN;
+
+#if defined (CONFIG_Z8530) || defined (CONFIG_NS16550)
 
 /** Initialize keyboard.
@@ -209,4 +211,5 @@
 }
 
+	#endif
 /** @}
  */
Index: kernel/arch/sparc64/src/drivers/sgcn.c
===================================================================
--- kernel/arch/sparc64/src/drivers/sgcn.c	(revision 04d672c3586c54665c634c7e3ee3478f2444e5ac)
+++ kernel/arch/sparc64/src/drivers/sgcn.c	(revision 63b15373eee376c379663c5f4cbe72e41378054c)
@@ -35,4 +35,5 @@
  */
 
+#include <arch.h>
 #include <arch/drivers/sgcn.h>
 #include <arch/drivers/kbd.h>
@@ -42,12 +43,11 @@
 #include <print.h>
 #include <mm/page.h>
-#include <ipc/irq.h>
-#include <ddi/ddi.h>
-#include <ddi/device.h>
+#include <proc/thread.h>
 #include <console/chardev.h>
 #include <console/console.h>
-#include <ddi/device.h>
 #include <sysinfo/sysinfo.h>
 #include <synch/spinlock.h>
+
+#define POLL_INTERVAL		10000
 
 /*
@@ -83,14 +83,4 @@
 #define SGCN_BUFFER_MAGIC	"CON"
 
-/**
- * The driver is polling based, but in order to notify the userspace
- * of a key being pressed, we need to supply the interface with some
- * interrupt number. The interrupt number can be arbitrary as it it
- * will never be used for identifying HW interrupts, but only in
- * notifying the userspace. 
- */
-#define FICTIONAL_INR		1
-
-
 /*
  * Returns a pointer to the object of a given type which is placed at the given
@@ -124,11 +114,6 @@
 static uintptr_t sgcn_buffer_begin;
 
-/**
- * SGCN IRQ structure. So far used only for notifying the userspace of the
- * key being pressed, not for kernel being informed about keyboard interrupts.
- */ 
-static irq_t sgcn_irq;
-
-// TODO think of a way how to synchronize accesses to SGCN buffer between the kernel and the userspace
+/* true iff the kernel driver should ignore pressed keys */
+static bool kbd_disabled;
 
 /* 
@@ -309,39 +294,9 @@
 
 /**
- * The driver works in polled mode, so no interrupt should be handled by it.
- */
-static irq_ownership_t sgcn_claim(irq_t *irq)
-{
-	return IRQ_DECLINE;
-}
-
-/**
- * The driver works in polled mode, so no interrupt should be handled by it.
- */
-static void sgcn_irq_handler(irq_t *irq)
-{
-	panic("Not yet implemented, SGCN works in polled mode.");
-}
-
-/**
  * Grabs the input for kernel.
  */
 void sgcn_grab(void)
 {
-	ipl_t ipl = interrupts_disable();
-	
-	volatile uint32_t *in_wrptr_ptr = &(SGCN_BUFFER_HEADER->in_wrptr);
-	volatile uint32_t *in_rdptr_ptr = &(SGCN_BUFFER_HEADER->in_rdptr);
-	
-	/* skip all the user typed before the grab and hasn't been processed */
-	spinlock_lock(&sgcn_input_lock);
-	*in_rdptr_ptr = *in_wrptr_ptr;
-	spinlock_unlock(&sgcn_input_lock);
-
-	spinlock_lock(&sgcn_irq.lock);
-	sgcn_irq.notif_cfg.notify = false;
-	spinlock_unlock(&sgcn_irq.lock);
-	
-	interrupts_restore(ipl);
+	kbd_disabled = true;
 }
 
@@ -351,10 +306,5 @@
 void sgcn_release(void)
 {
-	ipl_t ipl = interrupts_disable();
-	spinlock_lock(&sgcn_irq.lock);
-	if (sgcn_irq.notif_cfg.answerbox)
-		sgcn_irq.notif_cfg.notify = true;
-	spinlock_unlock(&sgcn_irq.lock);
-	interrupts_restore(ipl);
+	kbd_disabled = true;
 }
 
@@ -364,14 +314,18 @@
  * and sends them to the upper layers of HelenOS.
  */
-void sgcn_poll(void)
+static void sgcn_poll()
 {
 	uint32_t begin = SGCN_BUFFER_HEADER->in_begin;
 	uint32_t end = SGCN_BUFFER_HEADER->in_end;
 	uint32_t size = end - begin;
-	
+
 	spinlock_lock(&sgcn_input_lock);
 	
 	ipl_t ipl = interrupts_disable();
-	spinlock_lock(&sgcn_irq.lock);
+
+	if (kbd_disabled) {
+		interrupts_restore(ipl);
+		return;
+	}
 	
 	/* we need pointers to volatile variables */
@@ -381,11 +335,4 @@
 	volatile uint32_t *in_rdptr_ptr = &(SGCN_BUFFER_HEADER->in_rdptr);
 	
-	if (*in_rdptr_ptr != *in_wrptr_ptr) {
-		/* XXX: send notification to userspace */
-	}
-	
-	spinlock_unlock(&sgcn_irq.lock);
-	interrupts_restore(ipl);	
-
 	while (*in_rdptr_ptr != *in_wrptr_ptr) {
 		
@@ -400,6 +347,19 @@
 		chardev_push_character(&sgcn_io, c);	
 	}	
-	
+
+	interrupts_restore(ipl);	
 	spinlock_unlock(&sgcn_input_lock);
+}
+
+/**
+ * Polling thread function.
+ */
+static void kkbdpoll(void *arg) {
+	while (1) {
+		if (!silent) {
+			sgcn_poll();
+		}
+		thread_usleep(POLL_INTERVAL);
+	}
 }
 
@@ -414,17 +374,12 @@
 	kbd_type = KBD_SGCN;
 
-	devno_t devno = device_assign_devno();
-	irq_initialize(&sgcn_irq);
-	sgcn_irq.devno = devno;
-	sgcn_irq.inr = FICTIONAL_INR;
-	sgcn_irq.claim = sgcn_claim;
-	sgcn_irq.handler = sgcn_irq_handler;
-	irq_register(&sgcn_irq);
-	
 	sysinfo_set_item_val("kbd", NULL, true);
 	sysinfo_set_item_val("kbd.type", NULL, KBD_SGCN);
-	sysinfo_set_item_val("kbd.devno", NULL, devno);
-	sysinfo_set_item_val("kbd.inr", NULL, FICTIONAL_INR);
 	sysinfo_set_item_val("fb.kind", NULL, 4);
+
+	thread_t *t = thread_create(kkbdpoll, NULL, TASK, 0, "kkbdpoll", true);
+	if (!t)
+		panic("Cannot create kkbdpoll.");
+	thread_ready(t);
 	
 	chardev_initialize("sgcn_io", &sgcn_io, &sgcn_ops);
Index: kernel/arch/sparc64/src/sparc64.c
===================================================================
--- kernel/arch/sparc64/src/sparc64.c	(revision 04d672c3586c54665c634c7e3ee3478f2444e5ac)
+++ kernel/arch/sparc64/src/sparc64.c	(revision 63b15373eee376c379663c5f4cbe72e41378054c)
@@ -38,5 +38,4 @@
 #include <arch/trap/trap.h>
 #include <arch/console.h>
-#include <proc/thread.h>
 #include <console/console.h>
 #include <arch/boot/boot.h>
@@ -105,13 +104,4 @@
 	if (config.cpu_active == 1) {
 		standalone_sparc64_console_init();
-
-		/* Create thread that polls keyboard.
-		 * XXX: this is only used by sgcn now
-		 */
-		thread_t *t = thread_create(kkbdpoll, NULL, TASK, 0, "kkbdpoll",
-		    true);
-		if (!t)
-			panic("Cannot create kkbdpoll.");
-		thread_ready(t);
 	}
 }
Index: uspace/srv/kbd/Makefile
===================================================================
--- uspace/srv/kbd/Makefile	(revision 04d672c3586c54665c634c7e3ee3478f2444e5ac)
+++ uspace/srv/kbd/Makefile	(revision 63b15373eee376c379663c5f4cbe72e41378054c)
@@ -117,7 +117,13 @@
 endif
 ifeq ($(UARCH), sparc64)
+    ifeq ($(MACHINE),serengeti)
+	GENARCH_SOURCES += \
+		port/sgcn.c \
+		ctl/stty.c
+    else
 	GENARCH_SOURCES += \
 		port/z8530.c \
 		ctl/sun.c
+    endif
 endif
 
Index: uspace/srv/kbd/port/sgcn.c
===================================================================
--- uspace/srv/kbd/port/sgcn.c	(revision 04d672c3586c54665c634c7e3ee3478f2444e5ac)
+++ uspace/srv/kbd/port/sgcn.c	(revision 63b15373eee376c379663c5f4cbe72e41378054c)
@@ -37,5 +37,4 @@
 #include <as.h>
 #include <ddi.h>
-#include <ipc/ipc.h>
 #include <async.h>
 #include <kbd.h>
@@ -43,4 +42,7 @@
 #include <sysinfo.h>
 #include <stdio.h>
+#include <thread.h>
+
+#define POLL_INTERVAL		10000
 
 /**
@@ -88,14 +90,14 @@
 static uintptr_t sram_buffer_offset;
 
-static void sgcn_irq_handler(ipc_callid_t iid, ipc_call_t *call);
+/* polling thread */
+static void *sgcn_thread_impl(void *arg);
 
 
 /**
  * Initializes the SGCN driver.
- * Maps the physical memory (SRAM) and registers the interrupt. 
+ * Maps the physical memory (SRAM) and creates the polling thread. 
  */
 int kbd_port_init(void)
 {
-	async_set_interrupt_received(sgcn_irq_handler);
 	sram_virt_addr = (uintptr_t) as_get_mappable_page(sysinfo_value("sram.area.size"));
 	if (physmem_map((void *) sysinfo_value("sram.address.physical"),
@@ -107,6 +109,13 @@
 	
 	sram_buffer_offset = sysinfo_value("sram.buffer.offset");
-	ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"),
-		0, (void *) 0);
+
+	thread_id_t tid;
+	int rc;
+
+	rc = thread_create(sgcn_thread_impl, NULL, "kbd_poll", &tid);
+	if (rc != 0) {
+		return rc;
+	}
+
 	return 0;
 }
@@ -116,5 +125,5 @@
  * the buffer. 
  */
-static void sgcn_irq_handler(ipc_callid_t iid, ipc_call_t *call)
+static void sgcn_key_pressed(void)
 {
 	char c;
@@ -138,4 +147,18 @@
 }
 
+/**
+ * Thread to poll SGCN for keypresses.
+ */
+static void *sgcn_thread_impl(void *arg)
+{
+	(void) arg;
+
+	while (1) {
+		sgcn_key_pressed();
+		usleep(POLL_INTERVAL);
+	}
+}
+
+
 /** @}
  */
