Index: kernel/arch/sparc64/src/console.c
===================================================================
--- kernel/arch/sparc64/src/console.c	(revision 3e53ab7b0eacdf72743712841abf0bf6d897b956)
+++ kernel/arch/sparc64/src/console.c	(revision 20eb5e4d3d9057eaf8e976463ec55ff13ff5a8e3)
@@ -39,4 +39,6 @@
 #include <arch/drivers/kbd.h>
 
+#include <arch/drivers/sgcn.h>
+
 #ifdef CONFIG_Z8530
 #include <genarch/kbd/z8530.h>
@@ -55,21 +57,22 @@
 #include <arch.h>
 #include <panic.h>
+#include <func.h>
 #include <print.h>
 
 #define KEYBOARD_POLL_PAUSE	50000	/* 50ms */
 
-/** Initialize kernel console to use framebuffer and keyboard directly. */
-void standalone_sparc64_console_init(void)
+/**
+ * Initialize kernel console to use framebuffer and keyboard directly.
+ * Called on UltraSPARC machines with standard keyboard and framebuffer.
+ *
+ * @param aliases	the "/aliases" OBP node 
+ */
+static void standard_console_init(ofw_tree_node_t *aliases)
 {
 	stdin = NULL;
 
-	ofw_tree_node_t *aliases;
 	ofw_tree_property_t *prop;
 	ofw_tree_node_t *screen;
 	ofw_tree_node_t *keyboard;
-	
-	aliases = ofw_tree_lookup("/aliases");
-	if (!aliases)
-		panic("Can't find /aliases.\n");
 	
 	prop = ofw_tree_getprop(aliases, "screen");
@@ -96,4 +99,34 @@
 }
 
+/** Initilize I/O on the Serengeti machine. */
+static void serengeti_init(void)
+{
+	sgcn_init();
+}
+
+/**
+ * Initialize input/output. Auto-detects the type of machine
+ * and calls the appropriate I/O init routine. 
+ */
+void standalone_sparc64_console_init(void)
+{
+	ofw_tree_node_t *aliases;
+	ofw_tree_property_t *prop;
+	
+	aliases = ofw_tree_lookup("/aliases");
+	if (!aliases)
+		panic("Can't find /aliases.\n");
+	
+	/* "def-cn" = "default console" */
+	prop = ofw_tree_getprop(aliases, "def-cn");
+	
+	if ((!prop) || (!prop->value) || (strcmp(prop->value, "/sgcn") != 0)) {
+		standard_console_init(aliases);
+	} else {
+		serengeti_init();
+	}
+}
+
+
 /** Kernel thread for polling keyboard.
  *
@@ -130,4 +163,8 @@
 #endif
 #endif
+#ifdef CONFIG_SGCN
+		if (kbd_type == KBD_SGCN)
+			sgcn_poll();
+#endif
 		thread_usleep(KEYBOARD_POLL_PAUSE);
 	}
@@ -150,4 +187,9 @@
 		break;
 #endif
+#ifdef CONFIG_SGCN
+	case KBD_SGCN:
+		sgcn_grab();
+		break;
+#endif
 	default:
 		break;
@@ -171,4 +213,9 @@
 		break;
 #endif
+#ifdef CONFIG_SGCN
+	case KBD_SGCN:
+		sgcn_release();
+		break;
+#endif
 	default:
 		break;
