diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 10:44:53 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 10:44:53 +0000 |
commit | 49235ceee0c25492d4ca35194d7c72838a9ec284 (patch) | |
tree | 14f77677934d4f4cb9baa428691ace792fd0deed /sys/arch/mvme68k/stand/libbug | |
parent | c9328c850e70436131e06a34f73c14cc230c18f9 (diff) |
mvme68k port by me. some parts by dale rahn.
Diffstat (limited to 'sys/arch/mvme68k/stand/libbug')
23 files changed, 468 insertions, 0 deletions
diff --git a/sys/arch/mvme68k/stand/libbug/Makefile b/sys/arch/mvme68k/stand/libbug/Makefile new file mode 100644 index 00000000000..ba775e5693d --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/Makefile @@ -0,0 +1,14 @@ +LIB=bug + +NOPIC= +NOPROFILE= + +CFLAGS+=-I${.CURDIR}/../../include + +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} + +install: + +.include <bsd.lib.mk> diff --git a/sys/arch/mvme68k/stand/libbug/Makefile.inc b/sys/arch/mvme68k/stand/libbug/Makefile.inc new file mode 100644 index 00000000000..dc1ad6b04c8 --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/Makefile.inc @@ -0,0 +1,12 @@ +LIB_BUG_DIR=${S}/arch/${MACHINE}/stand/libbug + +LIBBUG_DIR!= cd ${LIB_BUG_DIR}; \ + printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx + +LIBBUG=${LIBBUG_DIR}/libbug.a + +$(LIBBUG): .NOTMAIN __always_make_libbug + @echo making sure the libbug is up to date... + @(cd ${LIB_BUG_DIR}; ${MAKE}) + +__always_make_libbug: .NOTMAIN diff --git a/sys/arch/mvme68k/stand/libbug/m68k/delay.c b/sys/arch/mvme68k/stand/libbug/m68k/delay.c new file mode 100644 index 00000000000..a5c1f620084 --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m68k/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 ("movel %0,sp@-" : :"d" (msec)); + MVMEPROM_CALL(MVMEPROM_DELAY); +} diff --git a/sys/arch/mvme68k/stand/libbug/m68k/diskrd.c b/sys/arch/mvme68k/stand/libbug/m68k/diskrd.c new file mode 100644 index 00000000000..b0ebde49624 --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m68k/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 ("movel %0, sp@-"::"d" (arg)); + MVMEPROM_CALL(MVMEPROM_DSKRD); + asm volatile ("movew ccr,%0": "=d" (ret)); + return (!(ret & 0x4)); +} diff --git a/sys/arch/mvme68k/stand/libbug/m68k/diskwr.c b/sys/arch/mvme68k/stand/libbug/m68k/diskwr.c new file mode 100644 index 00000000000..962b947ccb3 --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m68k/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 ("movel %0, sp@-"::"d" (arg)); + MVMEPROM_CALL(MVMEPROM_DSKWR); + asm volatile ("movew ccr,%0": "=d" (ret)); + return (!(ret & 0x4)); +} diff --git a/sys/arch/mvme68k/stand/libbug/m68k/getbrdid.c b/sys/arch/mvme68k/stand/libbug/m68k/getbrdid.c new file mode 100644 index 00000000000..ded49ac3155 --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m68k/getbrdid.c @@ -0,0 +1,18 @@ +/* + * 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_getbrdid() +{ + struct mvmeprom_brdid *id; + + asm volatile ("clrl sp@-"); + MVMEPROM_CALL(MVMEPROM_GETBRDID); + asm volatile ("movel sp@+,%0": "=d" (id):); + return (id); +} diff --git a/sys/arch/mvme68k/stand/libbug/m68k/instat.c b/sys/arch/mvme68k/stand/libbug/m68k/instat.c new file mode 100644 index 00000000000..5e2f2d3e69e --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m68k/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() +{ + u_short ret; + + MVMEPROM_CALL(MVMEPROM_INSTAT); + asm volatile ("movew ccr,%0": "=d" (ret)); + return (!(ret & 0x4)); +} diff --git a/sys/arch/mvme68k/stand/libbug/m68k/outln.c b/sys/arch/mvme68k/stand/libbug/m68k/outln.c new file mode 100644 index 00000000000..344f0ed01f1 --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m68k/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 ("movl %0, sp@-" : "=a" (start)); + asm volatile ("movl %0, sp@-" : "=a" (end)); + MVMEPROM_CALL(MVMEPROM_OUTSTRCRLF); +} diff --git a/sys/arch/mvme68k/stand/libbug/m68k/outstr.c b/sys/arch/mvme68k/stand/libbug/m68k/outstr.c new file mode 100644 index 00000000000..b0a7c9ebc92 --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m68k/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 ("movl %0, sp@-" : "=a" (start)); + asm volatile ("movl %0, sp@-" : "=a" (end)); + MVMEPROM_CALL(MVMEPROM_OUTSTR); +} diff --git a/sys/arch/mvme68k/stand/libbug/m68k/return.c b/sys/arch/mvme68k/stand/libbug/m68k/return.c new file mode 100644 index 00000000000..00206a16c48 --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m68k/return.c @@ -0,0 +1,14 @@ +/* + * bug routines -- assumes that the necessary sections of memory + * are preserved. + */ +#include <sys/types.h> +#include <machine/prom.h> + +/* BUG - return to bug routine */ +void +mvmeprom_return() +{ + MVMEPROM_CALL(MVMEPROM_EXIT); + /*NOTREACHED*/ +} diff --git a/sys/arch/mvme68k/stand/libbug/m68k/rtc_rd.c b/sys/arch/mvme68k/stand/libbug/m68k/rtc_rd.c new file mode 100644 index 00000000000..7b075c4fd9f --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m68k/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 ("movel %0,sp@-" : :"a" (ptime)); + MVMEPROM_CALL(MVMEPROM_RTC_RD); +} diff --git a/sys/arch/mvme68k/stand/libbug/m88k/delay.c b/sys/arch/mvme68k/stand/libbug/m88k/delay.c new file mode 100644 index 00000000000..68b1db12106 --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m88k/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/mvme68k/stand/libbug/m88k/diskrd.c b/sys/arch/mvme68k/stand/libbug/m88k/diskrd.c new file mode 100644 index 00000000000..bc69b365501 --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m88k/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/mvme68k/stand/libbug/m88k/diskwr.c b/sys/arch/mvme68k/stand/libbug/m88k/diskwr.c new file mode 100644 index 00000000000..681f521b5b0 --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m88k/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/mvme68k/stand/libbug/m88k/getbrdid.c b/sys/arch/mvme68k/stand/libbug/m88k/getbrdid.c new file mode 100644 index 00000000000..eeda9468ab7 --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m88k/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/mvme68k/stand/libbug/m88k/instat.c b/sys/arch/mvme68k/stand/libbug/m88k/instat.c new file mode 100644 index 00000000000..0ac97fe7676 --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m88k/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/mvme68k/stand/libbug/m88k/outch.c b/sys/arch/mvme68k/stand/libbug/m88k/outch.c new file mode 100644 index 00000000000..78110e0299f --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m88k/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/mvme68k/stand/libbug/m88k/outln.c b/sys/arch/mvme68k/stand/libbug/m88k/outln.c new file mode 100644 index 00000000000..ed0067e42d9 --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m88k/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/mvme68k/stand/libbug/m88k/outstr.c b/sys/arch/mvme68k/stand/libbug/m88k/outstr.c new file mode 100644 index 00000000000..c9e3c355736 --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m88k/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/mvme68k/stand/libbug/m88k/prom.h b/sys/arch/mvme68k/stand/libbug/m88k/prom.h new file mode 100644 index 00000000000..4048e86eaff --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m88k/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/mvme68k/stand/libbug/m88k/return.c b/sys/arch/mvme68k/stand/libbug/m88k/return.c new file mode 100644 index 00000000000..00206a16c48 --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m88k/return.c @@ -0,0 +1,14 @@ +/* + * bug routines -- assumes that the necessary sections of memory + * are preserved. + */ +#include <sys/types.h> +#include <machine/prom.h> + +/* BUG - return to bug routine */ +void +mvmeprom_return() +{ + MVMEPROM_CALL(MVMEPROM_EXIT); + /*NOTREACHED*/ +} diff --git a/sys/arch/mvme68k/stand/libbug/m88k/rtc_rd.c b/sys/arch/mvme68k/stand/libbug/m88k/rtc_rd.c new file mode 100644 index 00000000000..7cff3227678 --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/m88k/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); +} diff --git a/sys/arch/mvme68k/stand/libbug/ppc/bug.c b/sys/arch/mvme68k/stand/libbug/ppc/bug.c new file mode 100644 index 00000000000..02a1b1fd15b --- /dev/null +++ b/sys/arch/mvme68k/stand/libbug/ppc/bug.c @@ -0,0 +1,133 @@ +/* + * bug routines -- assumes that the necessary sections of memory + * are preserved. + */ +#include "bug.h" + +#define _INCHR "0x00" +#define _INSTAT "0x01" +#define _INLN "0x02" +#define _READSTR "0x03" +#define _READLN "0x04" +#define _OUTCHR "0x20" +#define _OUTSTR "0x21" +#define _OUTLN "0x22" +#define _DSKRD "0x10" +#define _DSKWR "0x11" +#define _DSKCFIG "0x12" +#define _DSKFMT "0x14" +#define _DSKCTRL "0x15" +#define _WRITE "0x23" +#define _WRITELN "0x24" +#define _DELAY "0x43" +#define _RTC_RD "0x53" +#define _RETURN "0x63" +#define _BRD_ID "0x70" + +/* BUG - tty routines */ + +#define BUG_CALL(x) \ + asm volatile ("addi r10,r0," x); \ + asm volatile ("sc"); + +char bug_inchr() +{ + register char a; + asm volatile ("sub r31,r31,4"); + BUG_CALL(_INCHR); + asm volatile ("or %0,r0,r2" : "=r" (a)); + return a; +} + +/* returns 0 if no characters ready to read */ +int bug_instat() +{ + short ret; + BUG_CALL(_INSTAT); + asm volatile ("or %0,r0,r2" : "=r" (ret)); + return (!(ret & 0x4)); + +} + +void bug_outchr(char a) +{ + asm volatile ("or r2, r0, %0" : :"r" (a)); + BUG_CALL(_OUTCHR); + return; +} + +void bug_outstr(char *pstrb, char *pstre) +{ + asm volatile ("or r2,r0,%0": : "r" (pstrb) ); + asm volatile ("or r3,r0,%0": : "r" (pstre) ); + BUG_CALL(_OUTSTR); + return; +} + +void bug_outln(char *pstrb, char *pstre) +{ + asm volatile ("or r2,r0,%0": : "r" (pstrb) ); + asm volatile ("or r3,r0,%0": : "r" (pstre) ); + BUG_CALL(_OUTLN); + return; +} + +/* BUG - disk routines */ + +/* returns 0: success, nonzero: error */ +int bug_diskrd(bug_dskio *arg) +{ + int ret; + asm volatile ("or r2,r0,%0": : "r" (arg) ); + BUG_CALL(_DSKRD); + return (!(ret & 0x4)); +} +/* returns 0: success, nonzero: error */ +int bug_diskwr(bug_dskio *arg) +{ + int ret; + asm volatile ("or r2,r0,%0": : "r" (arg) ); + BUG_CALL(_DSKWR); + return (!(ret & 0x4)); +} +#ifdef NOTYET +bug_diskcfig() +{ + +} +bug_diskfmt(){} +bug_diskctrl(){} +#endif + +/* BUG - timing routine */ + +void bug_delay(int delay_msec) +{ + asm volatile ("or r2,r0,%0": : "r" (delay_msec) ); + BUG_CALL(_DELAY); + return ; +} + +/* BUG - return to bug routine */ + +void bug_return() +{ + BUG_CALL(_RETURN); + /*NOTREACHED*/ +} + +/* BUG - query board routines */ + +struct bug_brdid *bug_brdid() +{ + struct bug_brdid *pbrd_id; + BUG_CALL(_BRD_ID); + asm volatile ("or %0,r0,r2": "=r" (pbrd_id):); + return pbrd_id; +} +void bug_rtc_rd(struct bug_time *ptime) +{ + asm volatile ("or r2,r0,%0": : "r" (ptime)); + BUG_CALL(_RTC_RD); + return; +} |