summaryrefslogtreecommitdiffstats
path: root/sys/arch/sgi
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2010-03-07 13:42:15 +0000
committermiod <miod@openbsd.org>2010-03-07 13:42:15 +0000
commit44e8cb744dc9de40f13e62a78e7403fd8eb71b5d (patch)
tree6553bf1c9a2a5c5f243ebfa7617b4c97785ea1f3 /sys/arch/sgi
parentAdd an MD interface for PCI drivers to be able to retrieve the node and widget (diff)
downloadwireguard-openbsd-44e8cb744dc9de40f13e62a78e7403fd8eb71b5d.tar.xz
wireguard-openbsd-44e8cb744dc9de40f13e62a78e7403fd8eb71b5d.zip
On Origin-like systems, get glass console information (if any) from the
fake ARCBios component structures associated to the KL configuration. The ARCBios data tells us if the device is the output console, and the KL component data tells us its node and widget numbers.
Diffstat (limited to 'sys/arch/sgi')
-rw-r--r--sys/arch/sgi/include/mnode.h3
-rw-r--r--sys/arch/sgi/sgi/sginode.c38
2 files changed, 39 insertions, 2 deletions
diff --git a/sys/arch/sgi/include/mnode.h b/sys/arch/sgi/include/mnode.h
index bae3ec5b698..13f8b3762ec 100644
--- a/sys/arch/sgi/include/mnode.h
+++ b/sys/arch/sgi/include/mnode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mnode.h,v 1.12 2010/01/09 20:33:16 miod Exp $ */
+/* $OpenBSD: mnode.h,v 1.13 2010/03/07 13:42:15 miod Exp $ */
/*
* Copyright (c) 2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -418,5 +418,6 @@ int kl_scan_board(lboard_t *, uint, int (*)(klinfo_t *, void *), void *);
extern int kl_n_mode;
extern u_int kl_n_shift;
+extern klinfo_t *kl_glass_console;
#endif /* __MACHINE_MNODE_H__ */
diff --git a/sys/arch/sgi/sgi/sginode.c b/sys/arch/sgi/sgi/sginode.c
index f44ee068294..5b363183e79 100644
--- a/sys/arch/sgi/sgi/sginode.c
+++ b/sys/arch/sgi/sgi/sginode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sginode.c,v 1.16 2010/01/09 20:33:16 miod Exp $ */
+/* $OpenBSD: sginode.c,v 1.17 2010/03/07 13:42:17 miod Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
*
@@ -53,6 +53,7 @@
#include <machine/mnode.h>
#include <sgi/xbow/hub.h>
+#include <sgi/xbow/xbow.h>
void kl_add_memory_ip27(int16_t, int16_t *, unsigned int);
void kl_add_memory_ip35(int16_t, int16_t *, unsigned int);
@@ -68,6 +69,7 @@ int kl_first_pass_comp(klinfo_t *, void *);
int kl_n_mode = 0;
u_int kl_n_shift = 32;
+klinfo_t *kl_glass_console = NULL;
void
kl_init(int ip35)
@@ -127,6 +129,7 @@ kl_first_pass_comp(klinfo_t *comp, void *arg)
{
klcpu_t *cpucomp;
klmembnk_m_t *memcomp_m;
+ arc_config64_t *arc;
#ifdef DEBUG
klhub_t *hubcomp;
klmembnk_n_t *memcomp_n;
@@ -134,6 +137,7 @@ kl_first_pass_comp(klinfo_t *comp, void *arg)
int i;
#endif
+ arc = (arc_config64_t *)comp->arcs_compt;
switch (comp->struct_type) {
case KLSTRUCT_CPU:
cpucomp = (klcpu_t *)comp;
@@ -193,6 +197,27 @@ kl_first_pass_comp(klinfo_t *comp, void *arg)
kl_n_mode ? MD_MEM_BANKS_N : MD_MEM_BANKS_M);
break;
+ case KLSTRUCT_GFX:
+ DB_PRF(("\tgraphics widget %d\n", comp->widid));
+ /*
+ * We rely upon the PROM setting up a fake ARCBios component
+ * for the graphics console, if there is one.
+ * Of course, the ARCBios structure is only available as long
+ * as we do not tear down the PROM TLB, which is why we check
+ * for this as early as possible and remember the console
+ * component (KL struct are not short-lived).
+ */
+ if (arc != NULL &&
+ arc->class != 0 && arc->type == arc_DisplayController &&
+ ISSET(arc->flags, ARCBIOS_DEVFLAGS_CONSOLE_OUTPUT)) {
+ DB_PRF(("\t(console device)\n"));
+ /* paranoia */
+ if (comp->widid >= WIDGET_MIN &&
+ comp->widid <= WIDGET_MAX)
+ kl_glass_console = comp;
+ }
+ break;
+
#ifdef DEBUG
case KLSTRUCT_HUB:
hubcomp = (klhub_t *)comp;
@@ -221,6 +246,17 @@ kl_first_pass_comp(klinfo_t *comp, void *arg)
break;
#endif
}
+#ifdef DEBUG
+ if (arc != NULL) {
+ DB_PRF(("\tARCBios component: class %d type %d flags %02x key 0x%lx",
+ arc->class, arc->type, arc->flags, arc->key));
+ if (arc->id_len != 0)
+ DB_PRF((" %.*s\n",
+ (int)arc->id_len, (const char *)arc->id));
+ else
+ DB_PRF((" (no name)\n"));
+ }
+#endif
return 0;
}