From e5ff38e8f671bc0ef417730bf0630d359c7cd338 Mon Sep 17 00:00:00 2001 From: Steve Murphree Date: Sat, 22 Aug 1998 07:39:57 +0000 Subject: new libbug. --- sys/arch/mvme88k/stand/libbug/Makefile | 12 ++-- sys/arch/mvme88k/stand/libbug/Makefile.inc | 4 +- sys/arch/mvme88k/stand/libbug/bugio.c | 101 ----------------------------- sys/arch/mvme88k/stand/libbug/delay.c | 15 +++++ sys/arch/mvme88k/stand/libbug/diskrd.c | 19 ++++++ sys/arch/mvme88k/stand/libbug/diskwr.c | 19 ++++++ sys/arch/mvme88k/stand/libbug/getbrdid.c | 17 +++++ sys/arch/mvme88k/stand/libbug/inchr.c | 22 +++++++ sys/arch/mvme88k/stand/libbug/instat.c | 17 +++++ sys/arch/mvme88k/stand/libbug/libbug.h | 23 +++++++ sys/arch/mvme88k/stand/libbug/outch.c | 15 +++++ sys/arch/mvme88k/stand/libbug/outln.c | 15 +++++ sys/arch/mvme88k/stand/libbug/outstr.c | 15 +++++ sys/arch/mvme88k/stand/libbug/prom.h | 3 + sys/arch/mvme88k/stand/libbug/putchar.c | 25 +++++++ sys/arch/mvme88k/stand/libbug/return.c | 26 ++++++++ sys/arch/mvme88k/stand/libbug/rtc_rd.c | 14 ++++ 17 files changed, 256 insertions(+), 106 deletions(-) delete mode 100644 sys/arch/mvme88k/stand/libbug/bugio.c create mode 100644 sys/arch/mvme88k/stand/libbug/delay.c create mode 100644 sys/arch/mvme88k/stand/libbug/diskrd.c create mode 100644 sys/arch/mvme88k/stand/libbug/diskwr.c create mode 100644 sys/arch/mvme88k/stand/libbug/getbrdid.c create mode 100644 sys/arch/mvme88k/stand/libbug/inchr.c create mode 100644 sys/arch/mvme88k/stand/libbug/instat.c create mode 100644 sys/arch/mvme88k/stand/libbug/libbug.h create mode 100644 sys/arch/mvme88k/stand/libbug/outch.c create mode 100644 sys/arch/mvme88k/stand/libbug/outln.c create mode 100644 sys/arch/mvme88k/stand/libbug/outstr.c create mode 100644 sys/arch/mvme88k/stand/libbug/prom.h create mode 100644 sys/arch/mvme88k/stand/libbug/putchar.c create mode 100644 sys/arch/mvme88k/stand/libbug/return.c create mode 100644 sys/arch/mvme88k/stand/libbug/rtc_rd.c (limited to 'sys/arch/mvme88k') 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 +#include + +/* 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 +#include + +/* 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 +#include + +/* 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 +#include + +/* 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 +#include + +#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 +#include + +/* 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 +#include + +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 +#include + +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 +#include + +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 +#include + +#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 +#include +#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 +#include + +void +mvmeprom_rtc_rd(ptime) + struct mvmeprom_time *ptime; +{ + asm volatile ("or r2,r0,%0": : "r" (ptime)); + MVMEPROM_CALL(MVMEPROM_RTC_RD); +} -- cgit v1.2.3