summaryrefslogtreecommitdiff
path: root/sys/arch/macppc/stand/Locore.c
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2007-06-13 02:17:33 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2007-06-13 02:17:33 +0000
commitb80ad0b3ac0ae856697de4144f0b147863887fce (patch)
tree48bf8a762e092a891f152df0817e8f140600cc9d /sys/arch/macppc/stand/Locore.c
parentb6beaff152c22af1b998cf05c5a1fa0c8d9f3e0b (diff)
Switch macppc to the interactive bootloader in stand/boot.
Much more useable on serial console systems.
Diffstat (limited to 'sys/arch/macppc/stand/Locore.c')
-rw-r--r--sys/arch/macppc/stand/Locore.c125
1 files changed, 82 insertions, 43 deletions
diff --git a/sys/arch/macppc/stand/Locore.c b/sys/arch/macppc/stand/Locore.c
index 0ba69b57d03..bcec257ed36 100644
--- a/sys/arch/macppc/stand/Locore.c
+++ b/sys/arch/macppc/stand/Locore.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: Locore.c,v 1.11 2006/12/05 20:30:26 gwk Exp $ */
+/* $OpenBSD: Locore.c,v 1.12 2007/06/13 02:17:32 drahn Exp $ */
/* $NetBSD: Locore.c,v 1.1 1997/04/16 20:29:11 thorpej Exp $ */
/*
@@ -34,6 +34,8 @@
#include <lib/libsa/stand.h>
#include <macppc/stand/openfirm.h>
+#include <dev/cons.h>
+
/*
#include "machine/cpu.h"
@@ -215,35 +217,6 @@ OF_getprop(int handle, char *prop, void *buf, int buflen)
return args.size;
}
-#ifdef __notyet__ /* Has a bug on FirePower */
-int
-OF_setprop(int handle, char *prop, void *buf, int len)
-{
- static struct {
- char *name;
- int nargs;
- int nreturns;
- int phandle;
- char *prop;
- void *buf;
- int len;
- int size;
- } args = {
- "setprop",
- 4,
- 1,
- };
-
- args.phandle = handle;
- args.prop = prop;
- args.buf = buf;
- args.len = len;
- if (openfirmware(&args) == -1)
- return -1;
- return args.size;
-}
-#endif
-
int
OF_open(char *dname)
{
@@ -375,16 +348,6 @@ OF_claim(void *virt, u_int size, u_int align)
1,
};
-/*
-#ifdef FIRMWORKSBUGS
-*/
-#if 0
- /*
- * Bug with Firmworks OFW
- */
- if (virt)
- return virt;
-#endif
args.virt = virt;
args.size = size;
args.align = align;
@@ -537,7 +500,13 @@ void
putchar(int c)
{
char ch = c;
-
+ if (c == '\177') {
+ ch = '\b';
+ OF_write(stdout, &ch, 1);
+ ch = ' ';
+ OF_write(stdout, &ch, 1);
+ ch = '\b';
+ }
if (c == '\n')
putchar('\r');
OF_write(stdout, &ch, 1);
@@ -546,11 +515,81 @@ putchar(int c)
int
getchar()
{
- unsigned char ch = '\0';
+ int c = cngetc();
+
+ if (c == '\r')
+ c = '\n';
+
+ if ((c < ' ' && c != '\n') || c == '\177')
+ return(c);
+
+ putchar(c);
+
+ return(c);
+}
+
+void
+ofc_probe(struct consdev *cn)
+{
+ cn->cn_pri = CN_NORMAL;
+ cn->cn_dev = makedev(0,0); /* WTF */
+}
+
+
+void
+ofc_init(struct consdev *cn)
+{
+}
+
+char buffered_char;
+int
+ofc_getc(dev_t dev)
+{
+ u_int8_t ch;
int l;
+ if (dev & 0x80) {
+ if (buffered_char != 0)
+ return 1;
+
+ l = OF_read(stdin, &ch, 1);
+ if (l == 1) {
+ buffered_char = ch;
+ return 1;
+ }
+ return 0;
+ }
+
+ if (buffered_char != 0) {
+ ch = buffered_char;
+ buffered_char = 0;
+ return ch;
+ }
+
while ((l = OF_read(stdin, &ch, 1)) != 1)
if (l != -2 && l != 0)
- return -1;
+ return 0;
return ch;
+
+}
+
+void
+ofc_putc(dev_t dev, int c)
+{
+ char ch;
+
+ ch = 'a';
+ OF_write(stdout, &ch, 1);
+ ch = c;
+ if (c == '\177' && c == '\b') {
+ ch = 'A';
+ }
+ OF_write(stdout, &ch, 1);
+}
+
+
+void
+machdep()
+{
+ cninit();
}