/*-
* Copyright (c) 1996-1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Charles M. Hannum, Masaru Oki, Takumi Nakamura, Masanobu Saitoh and
* Minoura Makoto.
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``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 FOUNDATION OR CONTRIBUTORS
* 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.
*/
/*-
* Copyright (c) 1994 Jarle Greipsland
* 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 debug functions? At the end of this file there are a bunch of
* functions that will print out various information regarding queued SCSI
* commands, driver state and chip contents. You can call them from the
* kernel debugger. If you set SPC_DEBUG to 0 they are not included (the
* kernel uses less memory) but you lose the debugging facilities.
*/
#define SPC_DEBUG 0
/*
* If there were none, wake anybody waiting for one to come free,
* starting with queued entries.
*/
if (TAILQ_NEXT(acb, chain) == NULL)
wakeup(&sc->free_list);
splx(s);
}
/*
* DRIVER FUNCTIONS CALLABLE FROM HIGHER LEVEL DRIVERS
*/
/*
* Expected sequence:
* 1) Command inserted into ready list
* 2) Command selected for execution
* 3) Command won arbitration and has selected target device
* 4) Send message out (identify message, eventually also sync.negotiations)
* 5) Send command
* 5a) Receive disconnect message, disconnect.
* 5b) Reselected by target
* 5c) Receive identify message from target.
* 6) Send or receive data
* 7) Receive status
* 8) Receive message (command complete etc.)
* 9) If status == SCSI_CHECK construct a synthetic request sense SCSI cmd.
* Repeat 2-8 (no disconnects please...)
*/
/*
* Start a selection. This is used by mha_sched() to select an idle target,
* and by mha_done() to immediately reselect a target to get sense information.
*/
void
mhaselect(struct mha_softc *sc, u_char target, u_char lun, u_char *cmd,
u_char clen)
{
int i;
int s;
/*
* The SCSI chip made a snapshot of the data bus while the reselection
* was being negotiated. This enables us to determine which target did
* the reselect.
*/
selid = sc->sc_selid & ~(1 << sc->sc_id);
if (selid & (selid - 1)) {
printf("%s: reselect with invalid selid %02x; sending DEVICE RESET\n",
device_xname(sc->sc_dev), selid);
SPC_BREAK();
goto reset;
}
/*
* Search wait queue for disconnected cmd
* The list should be short, so I haven't bothered with
* any more sophisticated structures than a simple
* singly linked list.
*/
target = ffs(selid) - 1;
lun = message & 0x07;
TAILQ_FOREACH(acb, &sc->nexus_list, chain) {
periph = acb->xs->xs_periph;
if (periph->periph_target == target &&
periph->periph_lun == lun)
break;
}
if (acb == NULL) {
printf("%s: reselect from target %d lun %d with no nexus; sending ABORT\n",
device_xname(sc->sc_dev), target, lun);
SPC_BREAK();
goto abort;
}
/* Make this nexus active again. */
TAILQ_REMOVE(&sc->nexus_list, acb, chain);
sc->sc_state = SPC_HASNEXUS;
sc->sc_nexus = acb;
ti = &sc->sc_tinfo[target];
ti->lubusy |= (1 << lun);
mha_setsync(sc, ti);
if (acb->flags & ACB_RESET)
mha_sched_msgout(sc, SEND_DEV_RESET);
else if (acb->flags & ACB_ABORTED)
mha_sched_msgout(sc, SEND_ABORT);
/* Do an implicit RESTORE POINTERS. */
sc->sc_dp = acb->daddr;
sc->sc_dleft = acb->dleft;
sc->sc_cp = (u_char *)&acb->cmd;
sc->sc_cleft = acb->clen;
/*
* $B%-%e!<$N=hM}Cf$G$J$1$l$P!"%9%1%8%e!<%j%s%03+;O$9$k(B
*/
if (sc->sc_state == SPC_IDLE)
mha_sched(sc);
splx(s);
if (flags & XS_CTL_POLL) {
/* Not allowed to use interrupts, use polling instead */
mha_poll(sc, acb);
}
SPC_MISC(("SUCCESSFULLY_QUEUED"));
return;
case ADAPTER_REQ_GROW_RESOURCES:
/* XXX Not supported. */
return;
case ADAPTER_REQ_SET_XFER_MODE:
/* XXX Not supported. */
return;
}
}
/*
* Adjust transfer size in buffer structure
*/
void
mha_minphys(struct buf *bp)
{
SPC_TRACE(("mha_minphys "));
minphys(bp);
}
/*
* Used when interrupt driven I/O isn't allowed, e.g. during boot.
*/
void
mha_poll(struct mha_softc *sc, struct acb *acb)
{
struct scsipi_xfer *xs = acb->xs;
int count = xs->timeout * 100;
int s;
s = splbio();
SPC_TRACE(("[mha_poll] "));
while (count) {
/*
* If we had interrupts enabled, would we
* have got an interrupt?
*/
if (SSR & SS_IREQUEST)
mhaintr(sc);
if ((xs->xs_status & XS_STS_DONE) != 0)
break;
DELAY(10);
#if 1
if (sc->sc_state == SPC_IDLE) {
SPC_TRACE(("[mha_poll: rescheduling] "));
mha_sched(sc);
}
#endif
count--;
}
/*
* Set synchronous transfer offset and period.
*/
inline void
mha_setsync(struct mha_softc *sc, struct spc_tinfo *ti)
{
}
/*
* Schedule a SCSI operation. This has now been pulled out of the interrupt
* handler so that we may call it from mha_scsi_cmd and mha_done. This may
* save us an unnecessary interrupt just to get things going. Should only be
* called when state == SPC_IDLE and at bio pl.
*/
void
mha_sched(struct mha_softc *sc)
{
struct scsipi_periph *periph;
struct acb *acb;
int t;
SPC_TRACE(("[mha_sched] "));
if (sc->sc_state != SPC_IDLE)
panic("mha_sched: not IDLE (state=%d)", sc->sc_state);
if (sc->sc_flags & SPC_ABORTING)
return;
/*
* Find first acb in ready queue that is for a target/lunit
* combinations that is not busy.
*/
TAILQ_FOREACH(acb, &sc->ready_list, chain) {
struct spc_tinfo *ti;
periph = acb->xs->xs_periph;
t = periph->periph_target;
ti = &sc->sc_tinfo[t];
if (!(ti->lubusy & (1 << periph->periph_lun))) {
if ((acb->flags & ACB_QBITS) != ACB_QREADY)
panic("mha: busy entry on ready list");
TAILQ_REMOVE(&sc->ready_list, acb, chain);
ACB_SETQ(acb, ACB_QNONE);
sc->sc_nexus = acb;
sc->sc_flags = 0;
sc->sc_prevphase = INVALID_PHASE;
sc->sc_dp = acb->daddr;
sc->sc_dleft = acb->dleft;
ti->lubusy |= (1<<periph->periph_lun);
mhaselect(sc, t, periph->periph_lun,
(u_char *)&acb->cmd, acb->clen);
break;
} else {
SPC_MISC(("%d:%d busy\n",
periph->periph_target,
periph->periph_lun));
}
}
}
/*
* Now, if we've come here with no error code, i.e. we've kept the
* initial XS_NOERROR, and the status code signals that we should
* check sense, we'll need to set up a request sense cmd block and
* push the command back into the ready queue *before* any other
* commands for this target/lunit, else we lose the sense info.
* We don't support chk sense conditions for the request sense cmd.
*/
if (xs->error == XS_NOERROR) {
if ((acb->flags & ACB_ABORTED) != 0) {
xs->error = XS_TIMEOUT;
} else if (acb->flags & ACB_CHKSENSE) {
xs->error = XS_SENSE;
} else {
xs->status = acb->stat & ST_MASK;
switch (xs->status) {
case SCSI_CHECK:
xs->resid = acb->dleft;
/* FALLTHROUGH */
case SCSI_BUSY:
xs->error = XS_BUSY;
break;
case SCSI_OK:
xs->resid = acb->dleft;
break;
default:
xs->error = XS_DRIVER_STUFFUP;
#if SPC_DEBUG
printf("%s: mha_done: bad stat 0x%x\n",
device_xname(sc->sc_dev), acb->stat);
#endif
break;
}
}
}
#if SPC_DEBUG
if ((mha_debug & SPC_SHOWMISC) != 0) {
if (xs->resid != 0)
printf("resid=%d ", xs->resid);
if (xs->error == XS_SENSE)
printf("sense=0x%02x\n", xs->sense.scsi_sense.response_code);
else
printf("error=%d\n", xs->error);
}
#endif
/*
* Remove the ACB from whatever queue it's on.
*/
switch (acb->flags & ACB_QBITS) {
case ACB_QNONE:
if (acb != sc->sc_nexus) {
panic("%s: floating acb", device_xname(sc->sc_dev));
}
sc->sc_nexus = NULL;
sc->sc_state = SPC_IDLE;
ti->lubusy &= ~(1<<periph->periph_lun);
mha_sched(sc);
break;
case ACB_QREADY:
TAILQ_REMOVE(&sc->ready_list, acb, chain);
break;
case ACB_QNEXUS:
TAILQ_REMOVE(&sc->nexus_list, acb, chain);
ti->lubusy &= ~(1<<periph->periph_lun);
break;
case ACB_QFREE:
panic("%s: dequeue: busy acb on free list",
device_xname(sc->sc_dev));
break;
default:
panic("%s: dequeue: unknown queue %d",
device_xname(sc->sc_dev), acb->flags & ACB_QBITS);
}
/* Put it on the free list, and clear flags. */
#if 0
TAILQ_INSERT_HEAD(&sc->free_list, acb, chain);
acb->flags = ACB_QFREE;
#else
mha_free_acb(sc, acb, xs->xs_control);
#endif
/*
* Schedule an outgoing message by prioritizing it, and asserting
* attention on the bus. We can only do this when we are the initiator
* else there will be an illegal command interrupt.
*/
#define mha_sched_msgout(m) \
do { \
SPC_MISC(("mha_sched_msgout %d ", m)); \
CMR = CMD_SET_ATN; \
sc->sc_msgpriq |= (m); \
} while (0)
/*
* Precondition:
* The SCSI bus is already in the MSGI phase and there is a message byte
* on the bus, along with an asserted REQ signal.
*/
void
mha_msgin(struct mha_softc *sc)
{
int v;
/*
* Prepare for a new message. A message should (according
* to the SCSI standard) be transmitted in one single
* MESSAGE_IN_PHASE. If we have been in some other phase,
* then this is a new message.
*/
if (sc->sc_prevphase != MESSAGE_IN_PHASE) {
sc->sc_flags &= ~SPC_DROP_MSGI;
sc->sc_imlen = 0;
}
WAIT;
v = MBR; /* modified byte */
v = sc->sc_pcx[0];
sc->sc_imess[sc->sc_imlen] = v;
/*
* If we're going to reject the message, don't bother storing
* the incoming bytes. But still, we need to ACK them.
*/
if (sc->sc_imlen >= SPC_MAX_MSG_LEN) {
mha_sched_msgout(SEND_REJECT);
sc->sc_flags |= SPC_DROP_MSGI;
} else {
sc->sc_imlen++;
/*
* This testing is suboptimal, but most
* messages will be of the one byte variety, so
* it should not affect performance
* significantly.
*/
if (sc->sc_imlen == 1 && MSG_IS1BYTE(sc->sc_imess[0]))
goto gotit;
if (sc->sc_imlen == 2 && MSG_IS2BYTE(sc->sc_imess[0]))
goto gotit;
if (sc->sc_imlen >= 3 && MSG_ISEXTENDED(sc->sc_imess[0]) &&
sc->sc_imlen == sc->sc_imess[1] + 2)
goto gotit;
}
#if 0
/* Ack what we have so far */
ESPCMD(sc, ESPCMD_MSGOK);
#endif
return;
gotit:
SPC_MSGS(("gotmsg(%x)", sc->sc_imess[0]));
/*
* Now we should have a complete message (1 byte, 2 byte
* and moderately long extended messages). We only handle
* extended messages which total length is shorter than
* SPC_MAX_MSG_LEN. Longer messages will be amputated.
*/
if (sc->sc_state == SPC_HASNEXUS) {
struct acb *acb = sc->sc_nexus;
struct spc_tinfo *ti =
&sc->sc_tinfo[acb->xs->xs_periph->periph_target];
switch (sc->sc_imess[0]) {
case MSG_CMDCOMPLETE:
SPC_MSGS(("cmdcomplete "));
if (sc->sc_dleft < 0) {
struct scsipi_periph *periph = acb->xs->xs_periph;
printf("mha: %d extra bytes from %d:%d\n",
-sc->sc_dleft,
periph->periph_target,
periph->periph_lun);
sc->sc_dleft = 0;
}
acb->xs->resid = acb->dleft = sc->sc_dleft;
sc->sc_flags |= SPC_BUSFREE_OK;
break;
case MSG_MESSAGE_REJECT:
#if SPC_DEBUG
if (mha_debug & SPC_SHOWMSGS)
printf("%s: our msg rejected by target\n",
device_xname(sc->sc_dev));
#endif
#if 1 /* XXX - must remember last message */
scsipi_printaddr(acb->xs->xs_periph);
printf("MSG_MESSAGE_REJECT>>");
#endif
if (sc->sc_flags & SPC_SYNCHNEGO) {
ti->period = ti->offset = 0;
sc->sc_flags &= ~SPC_SYNCHNEGO;
ti->flags &= ~T_NEGOTIATE;
}
/* Not all targets understand INITIATOR_DETECTED_ERR */
if (sc->sc_msgout == SEND_INIT_DET_ERR)
mha_sched_msgout(SEND_ABORT);
break;
case MSG_NOOP:
SPC_MSGS(("noop "));
break;
case MSG_DISCONNECT:
SPC_MSGS(("disconnect "));
ti->dconns++;
sc->sc_flags |= SPC_DISCON;
sc->sc_flags |= SPC_BUSFREE_OK;
if ((acb->xs->xs_periph->periph_quirks & PQUIRK_AUTOSAVE) == 0)
break;
/*FALLTHROUGH*/
case MSG_SAVEDATAPOINTER:
SPC_MSGS(("save datapointer "));
acb->dleft = sc->sc_dleft;
acb->daddr = sc->sc_dp;
break;
case MSG_RESTOREPOINTERS:
SPC_MSGS(("restore datapointer "));
if (!acb) {
mha_sched_msgout(SEND_ABORT);
printf("%s: no DATAPOINTERs to restore\n",
device_xname(sc->sc_dev));
break;
}
sc->sc_dp = acb->daddr;
sc->sc_dleft = acb->dleft;
break;
case MSG_PARITY_ERROR:
printf("%s:target%d: MSG_PARITY_ERROR\n",
device_xname(sc->sc_dev),
acb->xs->xs_periph->periph_target);
break;
case MSG_EXTENDED:
SPC_MSGS(("extended(%x) ", sc->sc_imess[2]));
switch (sc->sc_imess[2]) {
case MSG_EXT_SDTR:
SPC_MSGS(("SDTR period %d, offset %d ",
sc->sc_imess[3], sc->sc_imess[4]));
ti->period = sc->sc_imess[3];
ti->offset = sc->sc_imess[4];
if (sc->sc_minsync == 0) {
/* We won't do synch */
ti->offset = 0;
mha_sched_msgout(SEND_SDTR);
} else if (ti->offset == 0) {
printf("%s:%d: async\n", "mha",
acb->xs->xs_periph->periph_target);
ti->offset = 0;
sc->sc_flags &= ~SPC_SYNCHNEGO;
} else if (ti->period > 124) {
printf("%s:%d: async\n", "mha",
acb->xs->xs_periph->periph_target);
ti->offset = 0;
mha_sched_msgout(SEND_SDTR);
} else {
#if 0
int p;
p = mha_stp2cpb(sc, ti->period);
ti->period = mha_cpb2stp(sc, p);
#endif
if (MSG_ISIDENTIFY(sc->sc_imess[0])) { /* Identify? */
SPC_MISC(("searching "));
/*
* Search wait queue for disconnected cmd
* The list should be short, so I haven't bothered with
* any more sophisticated structures than a simple
* singly linked list.
*/
lunit = sc->sc_imess[0] & 0x07;
TAILQ_FOREACH(acb, &sc->nexus_list, chain) {
periph = acb->xs->xs_periph;
if (periph->periph_lun == lunit &&
sc->sc_selid == (1<<periph->periph_target)) {
TAILQ_REMOVE(&sc->nexus_list, acb,
chain);
ACB_SETQ(acb, ACB_QNONE);
break;
}
}
if (!acb) { /* Invalid reselection! */
mha_sched_msgout(SEND_ABORT);
printf("mha: invalid reselect (idbit=0x%2x)\n",
sc->sc_selid);
} else { /* Reestablish nexus */
/*
* Setup driver data structures and
* do an implicit RESTORE POINTERS
*/
ti = &sc->sc_tinfo[periph->periph_target];
sc->sc_nexus = acb;
sc->sc_dp = acb->daddr;
sc->sc_dleft = acb->dleft;
sc->sc_tinfo[periph->periph_target].lubusy
|= (1<<periph->periph_lun);
if (ti->flags & T_SYNCMODE) {
TMR = TM_SYNC; /* XXX */
} else {
TMR = TM_ASYNC;
}
SPC_MISC(("... found acb"));
sc->sc_state = SPC_HASNEXUS;
}
} else {
printf("%s: bogus reselect (no IDENTIFY) %0x2x\n",
device_xname(sc->sc_dev), sc->sc_selid);
mha_sched_msgout(SEND_DEV_RESET);
}
} else { /* Neither SPC_HASNEXUS nor SPC_RESELECTED! */
printf("%s: unexpected message in; will send DEV_RESET\n",
device_xname(sc->sc_dev));
mha_sched_msgout(SEND_DEV_RESET);
}
if (sc->sc_prevphase == MESSAGE_OUT_PHASE) {
if (sc->sc_omp == sc->sc_omess) {
/*
* This is a retransmission.
*
* We get here if the target stayed in MESSAGE OUT
* phase. Section 5.1.9.2 of the SCSI 2 spec indicates
* that all of the previously transmitted messages must
* be sent again, in the same order. Therefore, we
* requeue all the previously transmitted messages, and
* start again from the top. Our simple priority
* scheme keeps the messages in the right order.
*/
SPC_MISC(("retransmitting "));
sc->sc_msgpriq |= sc->sc_msgoutq;
/*
* Set ATN. If we're just sending a trivial 1-byte
* message, we'll clear ATN later on anyway.
*/
CMR = CMD_SET_ATN; /* XXX? */
} else {
/* This is a continuation of the previous message. */
n = sc->sc_omp - sc->sc_omess;
goto nextbyte;
}
}
/* No messages transmitted so far. */
sc->sc_msgoutq = 0;
sc->sc_lastmsg = 0;
nextbyte:
/* Send message bytes. */
/* send TRANSFER command. */
sc->sc_ps[3] = 1;
sc->sc_ps[4] = n >> 8;
sc->sc_pc[10] = n;
sc->sc_ps[-1] = 0x000F; /* burst */
__asm volatile ("nop");
CMR = CMD_SEND_FROM_DMA; /* send from DMA */
for (;;) {
if ((SSR & SS_BUSY) != 0)
break;
if (SSR & SS_IREQUEST)
goto out;
}
for (;;) {
#if 0
for (;;) {
if ((PSNS & PSNS_REQ) != 0)
break;
/* Wait for REQINIT. XXX Need timeout. */
}
#endif
if (SSR & SS_IREQUEST) {
/*
* Target left MESSAGE OUT, possibly to reject
* our message.
*
* If this is the last message being sent, then we
* deassert ATN, since either the target is going to
* ignore this message, or it's going to ask for a
* retransmission via MESSAGE PARITY ERROR (in which
* case we reassert ATN anyway).
*/
#if 0
if (sc->sc_msgpriq == 0)
CMR = CMD_RESET_ATN;
#endif
goto out;
}
#if 0
/* Clear ATN before last byte if this is the last message. */
if (n == 1 && sc->sc_msgpriq == 0)
CMR = CMD_RESET_ATN;
#endif
while ((SSR & SS_DREG_FULL) != 0)
;
/* Send message byte. */
sc->sc_pc[0] = *--sc->sc_omp;
--n;
/* Keep track of the last message we've sent any bytes of. */
sc->sc_lastmsg = sc->sc_currmsg;
if (n == 0)
break;
}
/* We get here only if the entire message has been transmitted. */
if (sc->sc_msgpriq != 0) {
/* There are more outgoing messages. */
goto nextmsg;
}
/*
* The last message has been transmitted. We need to remember the last
* message transmitted (in case the target switches to MESSAGE IN phase
* and sends a MESSAGE REJECT), and the list of messages transmitted
* this time around (in case the target stays in MESSAGE OUT phase to
* request a retransmit).
*/
if (acb == sc->sc_nexus) {
/*
* If we're still selecting, the message will be scheduled
* after selection is complete.
*/
if (sc->sc_state == SPC_HASNEXUS) {
sc->sc_flags |= SPC_ABORTING;
mha_sched_msgout(SEND_ABORT);
}
} else {
if (sc->sc_state == SPC_IDLE)
mha_sched(sc);
}
}
if (acb->flags & ACB_ABORTED) {
/* abort timed out */
printf(" AGAIN\n");
#if 0
mha_init(sc, 1); /* XXX 1?*/
#endif
} else {
/* abort the operation that has timed out */
printf("\n");
xs->error = XS_TIMEOUT;
mha_abort(sc, acb);
}
splx(s);
}
#if SPC_DEBUG
/*
* The following functions are mostly used for debugging purposes, either
* directly called from the driver or from the kernel debugger.
*/