summaryrefslogtreecommitdiffstats
path: root/sys/boot/ofw
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2008-09-19 11:00:14 +0000
committersobomax <sobomax@FreeBSD.org>2008-09-19 11:00:14 +0000
commitd1938e477bd6188affb7549fd2d1c9722c62fda8 (patch)
tree555a7cbe414eed3b760e8119ce7ec55d8cef74cf /sys/boot/ofw
parentb15971d062dbfb3280b6ce2a5b8720c366aeb54e (diff)
downloadFreeBSD-src-d1938e477bd6188affb7549fd2d1c9722c62fda8.zip
FreeBSD-src-d1938e477bd6188affb7549fd2d1c9722c62fda8.tar.gz
On PowerPC send output to both "/chosen/stdout" and "screen" nodes, unless
they point to the very same device. This should make loader usable on some (all?) PowerMacs, where "/chosen/stdout" is disconneted from the "screen" by the OF init process by default, except when user actually has requested interaction with OF by holding ALT-CMD-O-F. Along with rev 183168 this should provide a way to build bootable FreeBSD/ppc installation or live CD that works OOB. Also, it should bring PowerMac experience closer to that on other arches. MFC after: 1 week (assiming re@ blessing)
Diffstat (limited to 'sys/boot/ofw')
-rw-r--r--sys/boot/ofw/libofw/Makefile2
-rw-r--r--sys/boot/ofw/libofw/ofw_console.c29
2 files changed, 30 insertions, 1 deletions
diff --git a/sys/boot/ofw/libofw/Makefile b/sys/boot/ofw/libofw/Makefile
index 8a56a77..0e45708 100644
--- a/sys/boot/ofw/libofw/Makefile
+++ b/sys/boot/ofw/libofw/Makefile
@@ -14,7 +14,7 @@ CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I.
CFLAGS+= -ffreestanding
.if ${MACHINE_ARCH} == "powerpc"
-CFLAGS+= -msoft-float
+CFLAGS+= -msoft-float -DPOWERMAC_SCREEN_HACK
.endif
.ifdef(BOOT_DISK_DEBUG)
diff --git a/sys/boot/ofw/libofw/ofw_console.c b/sys/boot/ofw/libofw/ofw_console.c
index 59ce9a5..560dd9f 100644
--- a/sys/boot/ofw/libofw/ofw_console.c
+++ b/sys/boot/ofw/libofw/ofw_console.c
@@ -42,6 +42,10 @@ int ofw_cons_poll(void);
static ihandle_t stdin;
static ihandle_t stdout;
+#ifdef POWERMAC_SCREEN_HACK
+static ihandle_t stdout1;
+static int do_stdout1 = 0;
+#endif
struct console ofwconsole = {
"ofw",
@@ -57,9 +61,26 @@ struct console ofwconsole = {
static void
ofw_cons_probe(struct console *cp)
{
+#ifdef POWERMAC_SCREEN_HACK
+ char path1[128], path2[128];
+#endif
OF_getprop(chosen, "stdin", &stdin, sizeof(stdin));
OF_getprop(chosen, "stdout", &stdout, sizeof(stdout));
+#ifdef POWERMAC_SCREEN_HACK
+ stdout1 = OF_open("screen");
+ if (stdout1 != -1) {
+ if (OF_instance_to_path(stdout, path1, sizeof(path1)) == -1)
+ path1[0] = '\0';
+ if (OF_instance_to_path(stdout1, path2, sizeof(path2)) == -1)
+ path2[0] = '\0';
+ if (strcmp(path1, path2) == 0) {
+ OF_close(stdout1);
+ } else {
+ do_stdout1 = 1;
+ }
+ }
+#endif
cp->c_flags |= C_PRESENTIN|C_PRESENTOUT;
}
@@ -77,10 +98,18 @@ ofw_cons_putchar(int c)
if (c == '\n') {
cbuf = '\r';
OF_write(stdout, &cbuf, 1);
+#ifdef POWERMAC_SCREEN_HACK
+ if (do_stdout1 != 0)
+ OF_write(stdout1, &cbuf, 1);
+#endif
}
cbuf = c;
OF_write(stdout, &cbuf, 1);
+#ifdef POWERMAC_SCREEN_HACK
+ if (do_stdout1 != 0)
+ OF_write(stdout1, &cbuf, 1);
+#endif
}
static int saved_char = -1;
OpenPOWER on IntegriCloud