summaryrefslogtreecommitdiff
path: root/sys/arch/mvme88k
diff options
context:
space:
mode:
authorSteve Murphree <smurph@cvs.openbsd.org>1998-08-22 07:39:57 +0000
committerSteve Murphree <smurph@cvs.openbsd.org>1998-08-22 07:39:57 +0000
commite5ff38e8f671bc0ef417730bf0630d359c7cd338 (patch)
tree6f0c5785922df76c76c748da975e776ba9ff5e65 /sys/arch/mvme88k
parent54b313cb5b55623cec92c7947a80799b753d8695 (diff)
new libbug.
Diffstat (limited to 'sys/arch/mvme88k')
-rw-r--r--sys/arch/mvme88k/stand/libbug/Makefile12
-rw-r--r--sys/arch/mvme88k/stand/libbug/Makefile.inc4
-rw-r--r--sys/arch/mvme88k/stand/libbug/bugio.c101
-rw-r--r--sys/arch/mvme88k/stand/libbug/delay.c15
-rw-r--r--sys/arch/mvme88k/stand/libbug/diskrd.c19
-rw-r--r--sys/arch/mvme88k/stand/libbug/diskwr.c19
-rw-r--r--sys/arch/mvme88k/stand/libbug/getbrdid.c17
-rw-r--r--sys/arch/mvme88k/stand/libbug/inchr.c22
-rw-r--r--sys/arch/mvme88k/stand/libbug/instat.c17
-rw-r--r--sys/arch/mvme88k/stand/libbug/libbug.h23
-rw-r--r--sys/arch/mvme88k/stand/libbug/outch.c15
-rw-r--r--sys/arch/mvme88k/stand/libbug/outln.c15
-rw-r--r--sys/arch/mvme88k/stand/libbug/outstr.c15
-rw-r--r--sys/arch/mvme88k/stand/libbug/prom.h3
-rw-r--r--sys/arch/mvme88k/stand/libbug/putchar.c25
-rw-r--r--sys/arch/mvme88k/stand/libbug/return.c26
-rw-r--r--sys/arch/mvme88k/stand/libbug/rtc_rd.c14
17 files changed, 256 insertions, 106 deletions
diff --git a/sys/arch/mvme88k/stand/libbug/Makefile b/sys/arch/mvme88k/stand/libbug/Makefile
index ba775e5693d..5fe2004ecf8 100644
--- a/sys/arch/mvme88k/stand/libbug/Makefile
+++ b/sys/arch/mvme88k/stand/libbug/Makefile
@@ -1,13 +1,17 @@
+# $OpenBSD: Makefile,v 1.4 1998/08/22 07:39:51 smurph Exp $
+
LIB=bug
NOPIC=
NOPROFILE=
-CFLAGS+=-I${.CURDIR}/../../include
+S=${.CURDIR}/../../../..
+DIR_SA=$S/lib/libsa
+
+CFLAGS+=-I${.CURDIR}/../../include -I${DIR_SA}
-SRCS=delay.c diskrd.c diskwr.c getbrdid.c instat.c outln.c outstr.c \
- return.c rtc_rd.c
-.PATH: ${.CURDIR}/../../../../lib/libc_sa ${.CURDIR}/${MACHINE_ARCH}
+SRCS= delay.c diskrd.c diskwr.c getbrdid.c inchr.c instat.c outln.c \
+ outstr.c putchar.c return.c rtc_rd.c
install:
diff --git a/sys/arch/mvme88k/stand/libbug/Makefile.inc b/sys/arch/mvme88k/stand/libbug/Makefile.inc
index dc1ad6b04c8..90276eebe90 100644
--- a/sys/arch/mvme88k/stand/libbug/Makefile.inc
+++ b/sys/arch/mvme88k/stand/libbug/Makefile.inc
@@ -1,4 +1,6 @@
-LIB_BUG_DIR=${S}/arch/${MACHINE}/stand/libbug
+# $OpenBSD: Makefile.inc,v 1.2 1998/08/22 07:39:52 smurph Exp $
+
+LIB_BUG_DIR=${S}/arch/mvme88k/stand/libbug
LIBBUG_DIR!= cd ${LIB_BUG_DIR}; \
printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx
diff --git a/sys/arch/mvme88k/stand/libbug/bugio.c b/sys/arch/mvme88k/stand/libbug/bugio.c
deleted file mode 100644
index 6406dac3e13..00000000000
--- a/sys/arch/mvme88k/stand/libbug/bugio.c
+++ /dev/null
@@ -1,101 +0,0 @@
-#include "bugio.h"
-
-#define INCHR "0x0000"
-#define INSTAT "0x0001"
-#define INLN "0x0002"
-#define READSTR "0x0003"
-#define READLN "0x0004"
-#define DSKRD "0x0010"
-#define DSKWR "0x0011"
-#define DSKCFIG "0x0012"
-#define OUTCHR "0x0020"
-#define PCRLF "0x0026"
-#define TMDISP "0x0042"
-#define DELAY "0x0043"
-#define RTC_DSP "0x0052"
-#define RTC_RD "0x0053"
-#define RETURN "0x0063"
-#define BRD_ID "0x0070"
-#define BUGTRAP "0x01F0"
-
-char
-buginchr(void)
-{
- register int cc asm("r2");
- asm("or r9,r0," INCHR);
- asm("tb0 0,r0,0x1F0");
- /*asm("or %0,r0,r2" : "=r" (cc) : );*/
- return ((char)cc & 0xFF);
-}
-
-/* return 1 if not empty else 0 */
-
-buginstat(void)
-{
- int ret;
- asm("or r9,r0," INSTAT);
- asm("tb0 0,r0,0x1F0");
- asm("or %0,r0,r2" : "=r" (ret) : );
- return (ret & 0x40 ? 1 : 0);
-}
-
-bugoutchr(unsigned char c)
-{
- unsigned char cc;
-
- if ((cc = c) == '\n') {
- bugpcrlf();
- return;
- }
- asm("or r2,r0,%0" : : "r" (cc));
- asm("or r9,r0," OUTCHR);
- asm("tb0 0,r0,0x1F0");
-}
-
-bugpcrlf(void)
-{
- asm("or r9,r0," PCRLF);
- asm("tb0 0,r0,0x1F0");
-}
-/* return 0 on success */
-
-bugdskrd(struct bugdisk_io *arg)
-{
- int ret;
- asm("or r9,r0, " DSKRD);
- asm("tb0 0,r0,0x1F0");
- asm("or %0,r0,r2" : "=r" (ret) : );
- return ((ret&0x4) == 0x4 ? 1 : 0);
-}
-
-/* return 0 on success */
-
-bugdskwr(struct bugdisk_io *arg)
-{
- int ret;
- asm("or r9,r0, " DSKWR);
- asm("tb0 0,r0,0x1F0");
- asm("or %0,r0,r2" : "=r" (ret) : );
- return ((ret&0x4) == 0x4 ? 1 : 0);
-}
-
-bugrtcrd(struct bugrtc *rtc)
-{
- asm("or r9,r0, " RTC_RD);
- asm("tb0 0,r0,0x1F0");
-}
-
-bugreturn(void)
-{
- asm("or r9,r0, " RETURN);
- asm("tb0 0,r0,0x1F0");
-}
-
-bugbrdid(struct bugbrdid *id)
-{
- struct bugbrdid *ptr;
- asm("or r9,r0, " BRD_ID);
- asm("tb0 0,r0,0x1F0");
- asm("or %0,r0,r2" : "=r" (ptr) : );
- bcopy(ptr, id, sizeof(struct bugbrdid));
-}
diff --git a/sys/arch/mvme88k/stand/libbug/delay.c b/sys/arch/mvme88k/stand/libbug/delay.c
new file mode 100644
index 00000000000..68b1db12106
--- /dev/null
+++ b/sys/arch/mvme88k/stand/libbug/delay.c
@@ -0,0 +1,15 @@
+/*
+ * bug routines -- assumes that the necessary sections of memory
+ * are preserved.
+ */
+#include <sys/types.h>
+#include <machine/prom.h>
+
+/* BUG - timing routine */
+void
+mvmeprom_delay(msec)
+ int msec;
+{
+ asm volatile ("or r2,r0,%0": : "r" (msec));
+ MVMEPROM_CALL(MVMEPROM_DELAY);
+}
diff --git a/sys/arch/mvme88k/stand/libbug/diskrd.c b/sys/arch/mvme88k/stand/libbug/diskrd.c
new file mode 100644
index 00000000000..bc69b365501
--- /dev/null
+++ b/sys/arch/mvme88k/stand/libbug/diskrd.c
@@ -0,0 +1,19 @@
+/*
+ * bug routines -- assumes that the necessary sections of memory
+ * are preserved.
+ */
+#include <sys/types.h>
+#include <machine/prom.h>
+
+/* returns 0: success, nonzero: error */
+int
+mvmeprom_diskrd(arg)
+ struct mvmeprom_dskio *arg;
+{
+ int ret;
+
+ asm volatile ("or r2,r0,%0": : "r" (arg));
+ MVMEPROM_CALL(MVMEPROM_DSKRD);
+ asm volatile ("or %0,r0,r2" : "=r" (ret));
+ return (!(ret & 0x4));
+}
diff --git a/sys/arch/mvme88k/stand/libbug/diskwr.c b/sys/arch/mvme88k/stand/libbug/diskwr.c
new file mode 100644
index 00000000000..681f521b5b0
--- /dev/null
+++ b/sys/arch/mvme88k/stand/libbug/diskwr.c
@@ -0,0 +1,19 @@
+/*
+ * bug routines -- assumes that the necessary sections of memory
+ * are preserved.
+ */
+#include <sys/types.h>
+#include <machine/prom.h>
+
+/* returns 0: success, nonzero: error */
+int
+mvmeprom_diskwr(arg)
+ struct mvmeprom_dskio *arg;
+{
+ int ret;
+
+ asm volatile ("or r2,r0,%0": : "r" (arg) );
+ MVMEPROM_CALL(MVMEPROM_DSKWR);
+ asm volatile ("or %0,r0,r2" : "=r" (ret));
+ return (!(ret & 0x4));
+}
diff --git a/sys/arch/mvme88k/stand/libbug/getbrdid.c b/sys/arch/mvme88k/stand/libbug/getbrdid.c
new file mode 100644
index 00000000000..eeda9468ab7
--- /dev/null
+++ b/sys/arch/mvme88k/stand/libbug/getbrdid.c
@@ -0,0 +1,17 @@
+/*
+ * bug routines -- assumes that the necessary sections of memory
+ * are preserved.
+ */
+#include <sys/types.h>
+#include <machine/prom.h>
+
+/* BUG - query board routines */
+struct mvmeprom_brdid *
+mvmeprom_brdid()
+{
+ struct mvmeprom_brdid *id;
+
+ MVMEPROM_CALL(MVMEPROM_GETBRDID);
+ asm volatile ("or %0,r0,r2": "=r" (id):);
+ return (id);
+}
diff --git a/sys/arch/mvme88k/stand/libbug/inchr.c b/sys/arch/mvme88k/stand/libbug/inchr.c
new file mode 100644
index 00000000000..34c12b024da
--- /dev/null
+++ b/sys/arch/mvme88k/stand/libbug/inchr.c
@@ -0,0 +1,22 @@
+/* $OpenBSD: inchr.c,v 1.1 1998/08/22 07:39:55 smurph Exp $ */
+
+/*
+ * bug routines -- assumes that the necessary sections of memory
+ * are preserved.
+ */
+#include <sys/types.h>
+#include <machine/prom.h>
+
+#include "stand.h"
+#include "libbug.h"
+
+/* returns 0 if no characters ready to read */
+int
+getchar()
+{
+ int ret;
+
+ MVMEPROM_CALL(MVMEPROM_INCHR);
+ asm volatile ("or %0,r0,r2" : "=r" (ret));
+ return ret;
+}
diff --git a/sys/arch/mvme88k/stand/libbug/instat.c b/sys/arch/mvme88k/stand/libbug/instat.c
new file mode 100644
index 00000000000..0ac97fe7676
--- /dev/null
+++ b/sys/arch/mvme88k/stand/libbug/instat.c
@@ -0,0 +1,17 @@
+/*
+ * bug routines -- assumes that the necessary sections of memory
+ * are preserved.
+ */
+#include <sys/types.h>
+#include <machine/prom.h>
+
+/* returns 0 if no characters ready to read */
+int
+mvmeprom_instat()
+{
+ short ret;
+
+ MVMEPROM_CALL(MVMEPROM_INSTAT);
+ asm volatile ("or %0,r0,r2" : "=r" (ret));
+ return (!(ret & 0x4));
+}
diff --git a/sys/arch/mvme88k/stand/libbug/libbug.h b/sys/arch/mvme88k/stand/libbug/libbug.h
new file mode 100644
index 00000000000..7d8d63e35fa
--- /dev/null
+++ b/sys/arch/mvme88k/stand/libbug/libbug.h
@@ -0,0 +1,23 @@
+/* $OpenBSD: libbug.h,v 1.1 1998/08/22 07:39:55 smurph Exp $ */
+
+/*
+ * prototypes and such. note that get/put char are in stand.h
+ */
+
+
+void mvmeprom_delay __P((int));
+int mvmeprom_diskrd __P((struct mvmeprom_dskio *));
+int mvmeprom_diskwr __P((struct mvmeprom_dskio *));
+struct mvmeprom_brdid *mvmeprom_getbrdid __P((void));
+int peekchar __P((void));
+void mvmeprom_outln __P((char *, char *));
+void mvmeprom_outstr __P((char *, char *));
+void mvmeprom_rtc_rd __P((struct mvmeprom_time *));
+
+/*
+ * bugcrt stuff
+ */
+
+extern struct mvmeprom_args bugargs;
+
+void bugexec __P((void (*)()));
diff --git a/sys/arch/mvme88k/stand/libbug/outch.c b/sys/arch/mvme88k/stand/libbug/outch.c
new file mode 100644
index 00000000000..78110e0299f
--- /dev/null
+++ b/sys/arch/mvme88k/stand/libbug/outch.c
@@ -0,0 +1,15 @@
+/*
+ * bug routines -- assumes that the necessary sections of memory
+ * are preserved.
+ */
+#include <sys/types.h>
+#include <machine/prom.h>
+
+void
+mvmeprom_outchr(a)
+ char a;
+{
+ asm volatile ("or r2, r0, %0" : :"r" (a));
+ BUG_CALL(_OUTCHR);
+}
+
diff --git a/sys/arch/mvme88k/stand/libbug/outln.c b/sys/arch/mvme88k/stand/libbug/outln.c
new file mode 100644
index 00000000000..ed0067e42d9
--- /dev/null
+++ b/sys/arch/mvme88k/stand/libbug/outln.c
@@ -0,0 +1,15 @@
+/*
+ * bug routines -- assumes that the necessary sections of memory
+ * are preserved.
+ */
+#include <sys/types.h>
+#include <machine/prom.h>
+
+void
+mvmeprom_outln(start, end)
+ char *start, *end;
+{
+ asm volatile ("or r2,r0,%0": : "r" (start));
+ asm volatile ("or r3,r0,%0": : "r" (end));
+ MVMEPROM_CALL(MVMEPROM_OUTSTRCRLF);
+}
diff --git a/sys/arch/mvme88k/stand/libbug/outstr.c b/sys/arch/mvme88k/stand/libbug/outstr.c
new file mode 100644
index 00000000000..c9e3c355736
--- /dev/null
+++ b/sys/arch/mvme88k/stand/libbug/outstr.c
@@ -0,0 +1,15 @@
+/*
+ * bug routines -- assumes that the necessary sections of memory
+ * are preserved.
+ */
+#include <sys/types.h>
+#include <machine/prom.h>
+
+void
+mvmeprom_outstr(start, end)
+ char *start, *end;
+{
+ asm volatile ("or r2,r0,%0": : "r" (start));
+ asm volatile ("or r3,r0,%0": : "r" (end));
+ MVMEPROM_CALL(MVMEPROM_OUTSTR);
+}
diff --git a/sys/arch/mvme88k/stand/libbug/prom.h b/sys/arch/mvme88k/stand/libbug/prom.h
new file mode 100644
index 00000000000..4048e86eaff
--- /dev/null
+++ b/sys/arch/mvme88k/stand/libbug/prom.h
@@ -0,0 +1,3 @@
+#define MVMEPROM_CALL(x) \
+ asm volatile ( __CONCAT("or r9,r0," __STRING(x)) ); \
+ asm volatile ("tb0 0,r0,496");
diff --git a/sys/arch/mvme88k/stand/libbug/putchar.c b/sys/arch/mvme88k/stand/libbug/putchar.c
new file mode 100644
index 00000000000..564bcb75c15
--- /dev/null
+++ b/sys/arch/mvme88k/stand/libbug/putchar.c
@@ -0,0 +1,25 @@
+/* $OpenBSD: putchar.c,v 1.1 1998/08/22 07:39:56 smurph Exp $ */
+
+/*
+ * putchar: easier to do this with outstr than to add more macros to
+ * handle byte passing on the stack
+ */
+
+#include <sys/types.h>
+#include <machine/prom.h>
+
+#include "stand.h"
+#include "libbug.h"
+
+void
+putchar(c)
+
+int c;
+
+{
+ char ca[2];
+ if (c == '\n')
+ putchar('\r');
+ ca[0] = c;
+ mvmeprom_outstr(&ca[0], &ca[1]);
+}
diff --git a/sys/arch/mvme88k/stand/libbug/return.c b/sys/arch/mvme88k/stand/libbug/return.c
new file mode 100644
index 00000000000..1b8d198c4a5
--- /dev/null
+++ b/sys/arch/mvme88k/stand/libbug/return.c
@@ -0,0 +1,26 @@
+/*
+ * bug routines -- assumes that the necessary sections of memory
+ * are preserved.
+ */
+#include <sys/types.h>
+#include <machine/prom.h>
+#include "stand.h"
+#include "libbug.h"
+
+/* BUG - return to bug routine */
+void
+mvmeprom_return()
+{
+ MVMEPROM_CALL(MVMEPROM_EXIT);
+ /*NOTREACHED*/
+}
+
+/* BUG - return to bug routine */
+__dead void
+_rtt()
+{
+ MVMEPROM_CALL(MVMEPROM_EXIT);
+ printf("_rtt: exit failed. spinning...");
+ while (1) ;
+ /*NOTREACHED*/
+}
diff --git a/sys/arch/mvme88k/stand/libbug/rtc_rd.c b/sys/arch/mvme88k/stand/libbug/rtc_rd.c
new file mode 100644
index 00000000000..9b32f960ea3
--- /dev/null
+++ b/sys/arch/mvme88k/stand/libbug/rtc_rd.c
@@ -0,0 +1,14 @@
+/*
+ * bug routines -- assumes that the necessary sections of memory
+ * are preserved.
+ */
+#include <sys/types.h>
+#include <machine/prom.h>
+
+void
+mvmeprom_rtc_rd(ptime)
+ struct mvmeprom_time *ptime;
+{
+ asm volatile ("or r2,r0,%0": : "r" (ptime));
+ MVMEPROM_CALL(MVMEPROM_RTC_RD);
+}