summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2001-03-03 05:33:48 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2001-03-03 05:33:48 +0000
commit71ff5cc792c2eebda550e02895130fe4dac9f3c4 (patch)
tree0279c006e46dbd700ec27f04b25109e1dfbf44a8
parentf593bb54fef5eb2f50f90ae102c5f22180f3f79e (diff)
Support ADB keyboards as console. Only use adb if no USB keyboard is
present. Code mostly borrowed from NetBSD.
-rw-r--r--sys/arch/powerpc/powerpc/ofw_machdep.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/sys/arch/powerpc/powerpc/ofw_machdep.c b/sys/arch/powerpc/powerpc/ofw_machdep.c
index bbb2a2e1c9b..37d8934da46 100644
--- a/sys/arch/powerpc/powerpc/ofw_machdep.c
+++ b/sys/arch/powerpc/powerpc/ofw_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_machdep.c,v 1.20 2001/03/02 01:53:30 drahn Exp $ */
+/* $OpenBSD: ofw_machdep.c,v 1.21 2001/03/03 05:33:47 drahn Exp $ */
/* $NetBSD: ofw_machdep.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */
/*
@@ -367,6 +367,12 @@ u_int32_t cons_addr;
#include "vgafb_pci.h"
+struct usb_kbd_ihandles {
+ struct usb_kbd_ihandles *next;
+ int ihandle;
+};
+
+
void
ofwconprobe()
{
@@ -420,14 +426,30 @@ ofwconprobe()
/* what to do about serial console? */
if (strcmp ("keyboard", iname) == 0) {
int node;
+ struct usb_kbd_ihandles *ukbds;
+ int akbd;
char type[20];
- /* ok we have a keyboard, is it usb or adb? */
- /* TODO */
- /* configure usb if UKBD exists */
-#if NUKBD > 0
- printf("USB");
- ukbd_cnattach();
-#endif
+ /* if there is a usb keyboard, we want it, do not
+ * dereference the pointer that is returned
+ */
+ if (OF_call_method("`usb-kbd-ihandles", OF_stdin, 0, 1, &ukbds)
+ != -1 && ukbds != NULL)
+ {
+ printf("USB");
+ ukbd_cnattach();
+ goto kbd_found;
+ }
+ if (OF_call_method("`adb-kbd-ihandle", OF_stdin, 0, 1, &akbd)
+ != -1 &&
+ akbd != 0 &&
+ OF_instance_to_package(akbd) != -1)
+ {
+ printf("ADB");
+ akbd_cnattach();
+ goto kbd_found;
+ }
+ panic("no console keyboard");
+kbd_found:
}
printf("\n");
@@ -452,7 +474,7 @@ ofwconprobe()
pcidev(addr[1].phys_hi),
pcifunc(addr[1].phys_hi));
-#if 0
+#if 1
printf(": memaddr %x size %x, ", addr[0].phys_lo, addr[0].size_lo);
printf(": consaddr %x, ", cons_addr);
printf(": ioaddr %x, size %x", addr[1].phys_lo, addr[1].size_lo);