summaryrefslogtreecommitdiffstats
path: root/sys/dev/microcode
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2004-03-12 00:04:51 +0000
committermiod <miod@openbsd.org>2004-03-12 00:04:51 +0000
commit540ebbf4062ffd41fd44e50627622addcd664b13 (patch)
tree9bca5c81031d51c498767f206caf59f800011349 /sys/dev/microcode
parentchange copyrights on iso images, spotted by miod (diff)
downloadwireguard-openbsd-540ebbf4062ffd41fd44e50627622addcd664b13.tar.xz
wireguard-openbsd-540ebbf4062ffd41fd44e50627622addcd664b13.zip
Preliminary port of NetBSD oosiop driver, for NCR53C700 chips, as commonly
encountered on the oldest hppa machines. Currently compiled in, but disabled, in the kernel, until it is stable enough - right now read access are fine, but writes eventually time out and do not complete. ok deraadt@
Diffstat (limited to 'sys/dev/microcode')
-rw-r--r--sys/dev/microcode/siop/Makefile11
-rw-r--r--sys/dev/microcode/siop/ncr53cxxx.c10
-rw-r--r--sys/dev/microcode/siop/oosiop.ss150
3 files changed, 165 insertions, 6 deletions
diff --git a/sys/dev/microcode/siop/Makefile b/sys/dev/microcode/siop/Makefile
index db8a569b205..223a767324a 100644
--- a/sys/dev/microcode/siop/Makefile
+++ b/sys/dev/microcode/siop/Makefile
@@ -1,7 +1,7 @@
-# $OpenBSD: Makefile,v 1.2 2003/01/08 02:11:38 krw Exp $
+# $OpenBSD: Makefile,v 1.3 2004/03/12 00:04:57 miod Exp $
# $NetBSD: Makefile,v 1.1 2000/04/21 17:57:01 bouyer Exp $
-all: siop.out osiop.out
+all: siop.out osiop.out oosiop.out
PROG= ncr53cxxx
MKSHARE=no
@@ -9,11 +9,14 @@ MAN=
.include <bsd.prog.mk>
-regen: siop.out osiop.out
-headers: siop.out osiop.out
+regen: siop.out osiop.out oosiop.out
+headers: siop.out osiop.out oosiop.out
siop.out: siop.ss ${PROG}
./${PROG} siop.ss -p siop.out
osiop.out: osiop.ss ${PROG}
./${PROG} osiop.ss -p osiop.out
+
+oosiop.out: oosiop.ss ${PROG}
+ ./${PROG} oosiop.ss -p oosiop.out
diff --git a/sys/dev/microcode/siop/ncr53cxxx.c b/sys/dev/microcode/siop/ncr53cxxx.c
index d742fdd6c80..12b6c0aa06f 100644
--- a/sys/dev/microcode/siop/ncr53cxxx.c
+++ b/sys/dev/microcode/siop/ncr53cxxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ncr53cxxx.c,v 1.5 2003/06/27 20:38:49 krw Exp $ */
+/* $OpenBSD: ncr53cxxx.c,v 1.6 2004/03/12 00:04:57 miod Exp $ */
/* $NetBSD: ncr53cxxx.c,v 1.10 2002/04/21 22:40:10 bouyer Exp $ */
/*
@@ -415,7 +415,7 @@ main (int argc, char *argv[])
if (outfp) {
time_t cur_time;
- fprintf(outfp, "/*\t$NetBSD: ncr53cxxx.c,v 1.10 2002/04/21 22:40:10 bouyer Exp $\t*/\n");
+ fprintf(outfp, "/*\t$OpenBSD: ncr53cxxx.c,v 1.6 2004/03/12 00:04:57 miod Exp $\t*/\n");
fprintf(outfp, "/*\n");
fprintf(outfp, " *\tDO NOT EDIT - this file is automatically generated.\n");
time(&cur_time);
@@ -1046,10 +1046,12 @@ void f_wait (void)
errout ("Expected SELECT or RESELECT");
++i;
if (reserved ("rel", i)) {
+#if 0 /* XXX driver will fix relative dsps to absolute */
if (arch < ARCH710) {
errout ("Wrong arch for relative dsps");
return;
}
+#endif
i += 2;
inst1 = evaluate (i) - dsps - 8;
inst0 |= 0x04000000;
@@ -1157,10 +1159,12 @@ void transfer (int word0, int type)
i = tokenix;
inst0 = word0;
if (type == 0 && reserved ("rel", i)) {
+#if 0 /* XXX driver will fix relative dsps to absolute */
if (arch < ARCH710) {
errout ("Wrong arch for relative dsps");
return;
}
+#endif
inst1 = evaluate (i + 2) - dsps - 8;
i += 4;
inst0 |= 0x00800000;
@@ -1244,10 +1248,12 @@ void select_reselect (int t)
inst0 |= (evaluate (t++) & 0xff) << 16;
if (tokens[t++].type == ',') {
if (reserved ("rel", t)) {
+#if 0 /* XXX driver will fix relative dsps to absolute */
if (arch < ARCH710) {
errout ("Wrong arch for relative dsps");
return;
}
+#endif
inst0 |= 0x04000000;
inst1 = evaluate (t + 2) - dsps - 8;
}
diff --git a/sys/dev/microcode/siop/oosiop.ss b/sys/dev/microcode/siop/oosiop.ss
new file mode 100644
index 00000000000..b1c084f803c
--- /dev/null
+++ b/sys/dev/microcode/siop/oosiop.ss
@@ -0,0 +1,150 @@
+; $NetBSD: oosiop.ss,v 1.2 2003/04/06 09:48:42 tsutsui Exp $
+
+;
+; Copyright (c) 2001 Shuichiro URATA. All rights reserved.
+;
+; Redistribution and use in source and binary forms, with or without
+; modification, are permitted provided that the following conditions
+; are met:
+; 1. Redistributions of source code must retain the above copyright
+; notice, this list of conditions and the following disclaimer.
+; 2. Redistributions in binary form must reproduce the above copyright
+; notice, this list of conditions and the following disclaimer in the
+; documentation and/or other materials provided with the distribution.
+; 3. The name of the author may not be used to endorse or promote products
+; derived from this software without specific prior written permission.
+;
+; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+; OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+; IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+;
+
+; NCR 53c700 script
+;
+
+ARCH 700
+
+; interrupt codes
+ABSOLUTE int_done = 0xbeef0000
+ABSOLUTE int_msgin = 0xbeef0001
+ABSOLUTE int_extmsg = 0xbeef0002
+ABSOLUTE int_resel = 0xbeef0003
+ABSOLUTE int_res_id = 0xbeef0004
+ABSOLUTE int_resfail = 0xbeef0005
+ABSOLUTE int_disc = 0xbeef0006
+ABSOLUTE int_err = 0xdeadbeef
+
+; patch entries
+ENTRY p_resel_msgin_move
+ENTRY p_select
+ENTRY p_datain_jump
+ENTRY p_dataout_jump
+ENTRY p_msgin_move
+ENTRY p_msgout_move
+ENTRY p_cmdout_move
+ENTRY p_status_move
+ENTRY p_extmsglen_move
+ENTRY p_extmsgin_move
+
+
+PROC oosiop_script:
+
+ENTRY wait_reselect
+wait_reselect:
+ WAIT RESELECT REL(reselect_fail)
+ INT int_resel
+reselect_fail:
+ INT int_resfail
+
+ENTRY wait_resel_identify
+wait_resel_identify:
+ INT int_err, WHEN NOT MSG_IN
+p_resel_msgin_move:
+ MOVE 0, 0, WHEN MSG_IN
+ INT int_res_id
+
+ENTRY start_select
+start_select:
+p_select:
+ SELECT ATN 0, REL(wait_reselect)
+
+ENTRY phasedispatch
+phasedispatch:
+ JUMP REL(msgin), WHEN MSG_IN
+ JUMP REL(msgout), WHEN MSG_OUT
+ JUMP REL(status), WHEN STATUS
+ JUMP REL(cmdout), WHEN CMD
+p_datain_jump:
+ JUMP 0, WHEN DATA_IN
+p_dataout_jump:
+ JUMP 0, WHEN DATA_OUT
+ INT int_err
+
+msgin:
+ CLEAR ATN
+p_msgin_move:
+ MOVE 0, 0, WHEN MSG_IN
+ JUMP REL(complete), IF 0x00
+ JUMP REL(extmsgsetup), IF 0x01
+ JUMP REL(disconnect), IF 0x04
+ INT int_msgin
+
+ENTRY ack_msgin
+ack_msgin:
+ CLEAR ACK
+ JUMP REL(phasedispatch)
+
+ENTRY sendmsg
+sendmsg:
+ SET ATN
+ CLEAR ACK
+msgout:
+p_msgout_move:
+ MOVE 0, 0, WHEN MSG_OUT
+ CLEAR ATN
+ JUMP REL(phasedispatch)
+
+cmdout:
+ CLEAR ATN
+p_cmdout_move:
+ MOVE 0, 0, WHEN CMD
+ JUMP REL(phasedispatch)
+
+status:
+p_status_move:
+ MOVE 0, 0, WHEN STATUS
+ JUMP REL(phasedispatch)
+
+disconnect:
+ CLEAR ACK
+ WAIT DISCONNECT
+ INT int_disc
+
+complete:
+ CLEAR ACK
+ WAIT DISCONNECT
+ INT int_done
+
+; receive extended message length
+extmsgsetup:
+ CLEAR ACK
+ INT int_err, IF NOT MSG_IN
+p_extmsglen_move:
+ MOVE 0, 0, WHEN MSG_IN
+ INT int_extmsg
+
+; receive extended message
+ENTRY rcv_extmsg
+rcv_extmsg:
+ CLEAR ACK
+ INT int_err, IF NOT MSG_IN
+p_extmsgin_move:
+ MOVE 0, 0, WHEN MSG_IN
+ INT int_msgin