summaryrefslogtreecommitdiff
path: root/sys/arch/mac68k/dev
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-14 11:36:11 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-14 11:36:11 +0000
commitb46bb97c2cc9cd125394a685a737394f4b18e54c (patch)
treeb9297e2e7969da4147eedcd873ea9be903b96bf4 /sys/arch/mac68k/dev
parentceda3725fbf49211ee12966bcf4efa9cc34a4e29 (diff)
update from netbsd (without losing local changes)
Diffstat (limited to 'sys/arch/mac68k/dev')
-rw-r--r--sys/arch/mac68k/dev/adb.c2
-rw-r--r--sys/arch/mac68k/dev/asc.c4
-rw-r--r--sys/arch/mac68k/dev/mac68k5380.c9
-rw-r--r--sys/arch/mac68k/dev/ncr5380.c77
-rw-r--r--sys/arch/mac68k/dev/ncr5380reg.h3
-rw-r--r--sys/arch/mac68k/dev/rd_root.c79
6 files changed, 155 insertions, 19 deletions
diff --git a/sys/arch/mac68k/dev/adb.c b/sys/arch/mac68k/dev/adb.c
index c8906239952..8e75d7df8ab 100644
--- a/sys/arch/mac68k/dev/adb.c
+++ b/sys/arch/mac68k/dev/adb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: adb.c,v 1.4.2.1 1995/11/02 04:35:05 briggs Exp $ */
+/* $NetBSD: adb.c,v 1.5 1995/11/01 04:40:21 briggs Exp $ */
/*-
* Copyright (C) 1994 Bradley A. Grantham
diff --git a/sys/arch/mac68k/dev/asc.c b/sys/arch/mac68k/dev/asc.c
index b487e47786b..7d6782b19a0 100644
--- a/sys/arch/mac68k/dev/asc.c
+++ b/sys/arch/mac68k/dev/asc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: asc.c,v 1.8 1995/09/21 03:36:25 briggs Exp $ */
+/* $NetBSD: asc.c,v 1.9 1995/11/01 04:58:21 briggs Exp $ */
/*-
* Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo,
@@ -84,8 +84,6 @@ ascattach(parent, dev, aux)
void *aux;
{
printf(" Apple sound chip.\n");
-
- ASCBase = IOBase + ASCBase;
}
int
diff --git a/sys/arch/mac68k/dev/mac68k5380.c b/sys/arch/mac68k/dev/mac68k5380.c
index e94e16bbf0f..72bb0f51380 100644
--- a/sys/arch/mac68k/dev/mac68k5380.c
+++ b/sys/arch/mac68k/dev/mac68k5380.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mac68k5380.c,v 1.14 1995/10/01 05:10:20 briggs Exp $ */
+/* $NetBSD: mac68k5380.c,v 1.15 1995/11/01 04:59:03 briggs Exp $ */
/*
* Copyright (c) 1995 Allen Briggs
@@ -376,9 +376,10 @@ extern int *nofault, mac68k_buserr_addr;
count = ( (u_long) mac68k_buserr_addr
- (u_long) ncr_5380_with_drq);
if ((count < 0) || (count > pending_5380_count)) {
- printf("pdma in: count = %d (0x%x) (pending "
- "count %d)\n", count, count,
- pending_5380_count);
+ printf("pdma %s: count = %d (0x%x) (pending "
+ "count %d)\n",
+ (pdma_5380_dir == 2) ? "in" : "out",
+ count, count, pending_5380_count);
panic("something is wrong");
}
diff --git a/sys/arch/mac68k/dev/ncr5380.c b/sys/arch/mac68k/dev/ncr5380.c
index a6af97e3df5..c6d4798ca90 100644
--- a/sys/arch/mac68k/dev/ncr5380.c
+++ b/sys/arch/mac68k/dev/ncr5380.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ncr5380.c,v 1.10.2.2 1995/10/31 21:47:49 briggs Exp $ */
+/* $NetBSD: ncr5380.c,v 1.14 1995/12/04 02:10:44 briggs Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman.
@@ -68,6 +68,17 @@ u_char dbg_target_mask = 0x7f;
*/
u_char ncr5380_no_parchk = 0xff;
+#ifdef AUTO_SENSE
+
+/*
+ * Bit masks of targets that accept linked commands, and those
+ * that we've already checked out
+ */
+u_char ncr_will_link = 0x00;
+u_char ncr_test_link = 0x00;
+
+#endif /* AUTO_SENSE */
+
/*
* This is the default sense-command we send.
*/
@@ -191,7 +202,6 @@ extern __inline__ void finish_req(SC_REQ *reqp)
if (reqp->xs->error != 0)
show_request(reqp, "ERR_RET");
#endif
-
/*
* Return request to free-q
*/
@@ -201,7 +211,8 @@ extern __inline__ void finish_req(SC_REQ *reqp)
splx(sps);
xs->flags |= ITSDONE;
- scsi_done(xs);
+ if (!(reqp->dr_flag & DRIVER_LINKCHK))
+ scsi_done(xs);
}
/*
@@ -306,7 +317,7 @@ static int
ncr5380_scsi_cmd(struct scsi_xfer *xs)
{
int sps;
- SC_REQ *reqp;
+ SC_REQ *reqp, *link, *tmp;
int flags = xs->flags;
/*
@@ -375,27 +386,59 @@ ncr5380_scsi_cmd(struct scsi_xfer *xs)
* Interrupts are disabled while we are fiddling with the issue-queue.
*/
sps = splbio();
+ link = NULL;
if ((issue_q == NULL) || (reqp->xcmd.opcode == REQUEST_SENSE)) {
reqp->next = issue_q;
issue_q = reqp;
}
else {
- SC_REQ *tmp, *link;
-
tmp = issue_q;
- link = NULL;
do {
if (!link && (tmp->targ_id == reqp->targ_id) && !tmp->link)
link = tmp;
} while (tmp->next && (tmp = tmp->next));
tmp->next = reqp;
#ifdef AUTO_SENSE
- if (link) {
+ if (link && (ncr_will_link & (1<<reqp->targ_id))) {
link->link = reqp;
link->xcmd.bytes[link->xs->cmdlen-2] |= 1;
}
#endif
}
+#ifdef AUTO_SENSE
+ /*
+ * If we haven't already, check the target for link support.
+ * Do this by prefixing the current command with a dummy
+ * Request_Sense command, link the dummy to the current
+ * command, and insert the dummy command at the head of the
+ * issue queue. Set the DRIVER_LINKCHK flag so that we'll
+ * ignore the results of the dummy command, since we only
+ * care about whether it was accepted or not.
+ */
+ if (!link && !(ncr_test_link & (1<<reqp->targ_id)) &&
+ (tmp = free_head) && !(reqp->dr_flag & DRIVER_NOINT)) {
+ free_head = tmp->next;
+ tmp->dr_flag = (reqp->dr_flag & ~DRIVER_DMAOK) | DRIVER_LINKCHK;
+ tmp->phase = NR_PHASE;
+ tmp->msgout = MSG_NOOP;
+ tmp->status = SCSGOOD;
+ tmp->xs = reqp->xs;
+ tmp->targ_id = reqp->targ_id;
+ tmp->targ_lun = reqp->targ_lun;
+ bcopy(sense_cmd, &tmp->xcmd, sizeof(sense_cmd));
+ tmp->xdata_ptr = (u_char *)&tmp->xs->sense;
+ tmp->xdata_len = sizeof(tmp->xs->sense);
+ ncr_test_link |= 1<<tmp->targ_id;
+ tmp->link = reqp;
+ tmp->xcmd.bytes[sizeof(sense_cmd)-2] |= 1;
+ tmp->next = issue_q;
+ issue_q = tmp;
+#ifdef DBG_REQ
+ if (dbg_target_mask & (1 << tmp->targ_id))
+ show_request(tmp, "LINKCHK");
+#endif
+ }
+#endif
splx(sps);
#ifdef DBG_REQ
@@ -844,6 +887,8 @@ SC_REQ *reqp;
reqp->xs->error = code ? code : XS_SELTIMEOUT;
DBG_SELPRINT ("Target %d not responding to sel\n",
reqp->targ_id);
+ if (reqp->dr_flag & DRIVER_LINKCHK)
+ ncr_test_link &= ~(1<<reqp->targ_id);
finish_req(reqp);
PID("scsi_select8");
return (0);
@@ -1532,6 +1577,17 @@ int linked;
int sps;
/*
+ * If this is the driver's Link Check for this target, ignore
+ * the results of the command. All we care about is whether we
+ * got here from a LINK_CMD_COMPLETE or CMD_COMPLETE message.
+ */
+ PID("linkcheck");
+ if (reqp->dr_flag & DRIVER_LINKCHK) {
+ if (linked)
+ ncr_will_link |= 1<<reqp->targ_id;
+ return (0);
+ }
+ /*
* If we not executing an auto-sense and the status code
* is request-sense, we automatically issue a request
* sense command.
@@ -1551,7 +1607,7 @@ int linked;
issue_q = reqp;
splx(sps);
}
- else reqp->xcmd.bytes[4] |= 1;
+ else reqp->xcmd.bytes[sizeof(sense_cmd)-2] |= 1;
#ifdef DBG_REQ
bzero(reqp->xdata_ptr, reqp->xdata_len);
@@ -1875,9 +1931,10 @@ show_request(reqp, qtxt)
SC_REQ *reqp;
char *qtxt;
{
- printf("REQ-%s: %d %x[%d] cmd[0]=%x S=%x M=%x R=%x resid=%d %s\n",
+ printf("REQ-%s: %d %x[%d] cmd[0]=%x S=%x M=%x R=%x resid=%d dr_flag=%x %s\n",
qtxt, reqp->targ_id, reqp->xdata_ptr, reqp->xdata_len,
reqp->xcmd.opcode, reqp->status, reqp->message,
+ reqp->dr_flag,
reqp->xs->error, reqp->xs->resid, reqp->link ? "L":"");
if (reqp->status == SCSCHKC)
show_data_sense(reqp->xs);
diff --git a/sys/arch/mac68k/dev/ncr5380reg.h b/sys/arch/mac68k/dev/ncr5380reg.h
index 60a7a7c7653..a19f41f3fca 100644
--- a/sys/arch/mac68k/dev/ncr5380reg.h
+++ b/sys/arch/mac68k/dev/ncr5380reg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ncr5380reg.h,v 1.4 1995/10/02 09:03:54 briggs Exp $ */
+/* $NetBSD: ncr5380reg.h,v 1.5 1995/12/04 02:10:46 briggs Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman.
@@ -219,6 +219,7 @@ typedef struct req_q {
#define DRIVER_NOINT 0x04 /* We are booting: no interrupts */
#define DRIVER_DMAOK 0x08 /* DMA can be used on this request */
#define DRIVER_BOUNCING 0x10 /* Using the bounce buffer */
+#define DRIVER_LINKCHK 0x20 /* Doing the linked command check */
/* XXX: Should go to ncr5380var.h */
static SC_REQ *issue_q = NULL; /* Commands waiting to be issued*/
diff --git a/sys/arch/mac68k/dev/rd_root.c b/sys/arch/mac68k/dev/rd_root.c
new file mode 100644
index 00000000000..e7ac28a3040
--- /dev/null
+++ b/sys/arch/mac68k/dev/rd_root.c
@@ -0,0 +1,79 @@
+/* $NetBSD: rd_root.c,v 1.1 1995/11/21 04:53:20 briggs Exp $ */
+
+/*
+ * Copyright (c) 1995 Gordon W. Ross
+ * 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.
+ */
+
+#include <sys/param.h>
+#include <sys/reboot.h>
+
+#include <dev/ramdisk.h>
+
+extern int boothowto;
+
+#ifndef MINIROOTSIZE
+#define MINIROOTSIZE 512
+#endif
+
+#define ROOTBYTES (MINIROOTSIZE << DEV_BSHIFT)
+
+/*
+ * This array will be patched to contain a file-system image.
+ * See the program: src/distrib/sun3/common/rdsetroot.c
+ */
+int rd_root_size = ROOTBYTES;
+char rd_root_image[ROOTBYTES] = "|This is the root ramdisk!\n";
+
+/*
+ * This is called during autoconfig.
+ */
+void
+rd_attach_hook(unit, rd)
+ int unit;
+ struct rd_conf *rd;
+{
+ if (unit == 0) {
+ /* Setup root ramdisk */
+ rd->rd_addr = (caddr_t) rd_root_image;
+ rd->rd_size = (size_t) rd_root_size;
+ rd->rd_type = RD_KMEM_FIXED;
+ printf(" fixed, %d blocks", MINIROOTSIZE);
+ }
+}
+
+/*
+ * This is called during open (i.e. mountroot)
+ */
+void
+rd_open_hook(unit, rd)
+ int unit;
+ struct rd_conf *rd;
+{
+ if (unit == 0) {
+ /* The root ramdisk only works single-user. */
+ boothowto |= RB_SINGLE;
+ }
+}