Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/bebox/stand/boot Add missing siop_clearfifo() and s...
details: https://anonhg.NetBSD.org/src/rev/4d807523151c
branches: trunk
changeset: 329948:4d807523151c
user: phx <phx%NetBSD.org@localhost>
date: Sat Jun 14 20:50:12 2014 +0000
description:
Add missing siop_clearfifo() and some debugging output (-DDEBUG).
diffstat:
sys/arch/bebox/stand/boot/siop.c | 52 +++++++++++++++++++++++++++++++++++----
1 files changed, 46 insertions(+), 6 deletions(-)
diffs (94 lines):
diff -r c461563a1f11 -r 4d807523151c sys/arch/bebox/stand/boot/siop.c
--- a/sys/arch/bebox/stand/boot/siop.c Sat Jun 14 20:49:36 2014 +0000
+++ b/sys/arch/bebox/stand/boot/siop.c Sat Jun 14 20:50:12 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: siop.c,v 1.3 2013/01/03 14:03:39 kiyohara Exp $ */
+/* $NetBSD: siop.c,v 1.4 2014/06/14 20:50:12 phx Exp $ */
/*
* Copyright (c) 2010 KIYOHARA Takashi
* All rights reserved.
@@ -33,6 +33,12 @@
#include "boot.h"
#include "sdvar.h"
+#ifdef DEBUG
+#define DPRINTF(x) printf x
+#else
+#define DPRINTF(x)
+#endif
+
#define ALLOC(T, A) \
(T *)(((uint32_t)alloc(sizeof(T) + (A)) + (A)) & ~((A) - 1))
#define VTOPHYS(va) (uint32_t)(va)
@@ -142,6 +148,25 @@
}
static void
+siop_clearfifo(struct siop_adapter *adp)
+{
+ int timo = 0;
+ uint8_t ctest3 = readb(adp->addr + SIOP_CTEST3);
+
+ DPRINTF(("DMA FIFO not empty!\n"));
+ writeb(adp->addr + SIOP_CTEST3, ctest3 | CTEST3_CLF);
+ while ((readb(adp->addr + SIOP_CTEST3) & CTEST3_CLF) != 0) {
+ delay(1);
+ if (++timo > 1000) {
+ printf("Clear FIFO failed!\n");
+ writeb(adp->addr + SIOP_CTEST3,
+ readb(adp->addr + SIOP_CTEST3) & ~CTEST3_CLF);
+ return;
+ }
+ }
+}
+
+static void
siop_sdp(struct siop_adapter *adp, struct siop_xfer *xfer, struct scsi_xfer *xs,
int offset)
{
@@ -296,8 +321,7 @@
if (scratcha0 & A_flag_data)
siop_ma(adp, xs);
else if ((dstat & DSTAT_DFE) == 0)
-printf("PHASE STATUS: siop_clearfifo...\n");
-// siop_clearfifo(adp);
+ siop_clearfifo(adp);
CALL_SCRIPT(Ent_status);
return 1;
case SSTAT1_PHASE_MSGIN:
@@ -309,8 +333,7 @@
if (scratcha0 & A_flag_data)
siop_ma(adp, xs);
else if ((dstat & DSTAT_DFE) == 0)
-printf("PHASE MSGIN: siop_clearfifo...\n");
-// siop_clearfifo(adp);
+ siop_clearfifo(adp);
writeb(adp->addr + SIOP_SCRATCHA,
scratcha0 & ~A_flag_data);
CALL_SCRIPT(Ent_msgin);
@@ -879,7 +902,24 @@
sense = (struct scsi_sense_data *)xs->data;
- /* otherwise use the default */
+ DPRINTF((" sense debug information:\n"));
+ DPRINTF(("\tcode 0x%x valid %d\n",
+ SSD_RCODE(sense->response_code),
+ sense->response_code & SSD_RCODE_VALID ? 1 : 0));
+ DPRINTF(("\tseg 0x%x key 0x%x ili 0x%x eom 0x%x fmark 0x%x\n",
+ sense->segment,
+ SSD_SENSE_KEY(sense->flags),
+ sense->flags & SSD_ILI ? 1 : 0,
+ sense->flags & SSD_EOM ? 1 : 0,
+ sense->flags & SSD_FILEMARK ? 1 : 0));
+ DPRINTF(("\ninfo: 0x%x 0x%x 0x%x 0x%x followed by %d "
+ "extra bytes\n",
+ sense->info[0],
+ sense->info[1],
+ sense->info[2],
+ sense->info[3],
+ sense->extra_len));
+
switch (SSD_RCODE(sense->response_code)) {
/*
Home |
Main Index |
Thread Index |
Old Index