On Mon, Jun 21, 2010 at 12:44:35PM -0700, Matthew Dempsky wrote:
> It looks like adw(4) has never correctly supported >12 byte SCSI
> requests. It wants to copy from 12 bytes past the start of the CDB,
> but &xs->cmd[12] is actually 192 bytes past (and pointing at who knows
> what).
>
> However, I don't have any adw(4) hardware nor know off hand how to
> force a >12 byte SCSI request to test if this fixes anything.
>
> Index: dev/ic/adw.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/ic/adw.c,v
> retrieving revision 1.44
> diff -u -p dev/ic/adw.c
> --- dev/ic/adw.c 20 May 2010 00:55:17 -0000 1.44
> +++ dev/ic/adw.c 21 Jun 2010 19:36:34 -0000
> @@ -690,10 +690,10 @@ adw_build_req(xs, ccb, flags)
> * For wide boards a CDB length maximum of 16 bytes
> * is supported.
> */
> - bcopy(xs->cmd, &scsiqp->cdb, ((scsiqp->cdb_len = xs->cmdlen) <= 12)?
> - xs->cmdlen : 12 );
> - if(xs->cmdlen > 12)
> - bcopy(&(xs->cmd[12]), &scsiqp->cdb16, xs->cmdlen - 12);
> + bcopy(xs->cmd, &scsiqp->cdb, MIN(xs->cmdlen, 12));
> + if (xs->cmdlen > 12)
> + bcopy((caddr_t)xs->cmd + 12, &scsiqp->cdb16, xs->cmdlen - 12);
> + scsiqp->cdb_len = xs->cmdlen;
>
> scsiqp->target_id = sc_link->target;
> scsiqp->target_lun = sc_link->lun;
How about this diff.
.... Ken
Index: dev/ic/adw.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/adw.c,v
retrieving revision 1.44
diff -u -p -r1.44 adw.c
--- dev/ic/adw.c 20 May 2010 00:55:17 -0000 1.44
+++ dev/ic/adw.c 22 Jun 2010 00:31:56 -0000
@@ -690,10 +689,9 @@ adw_build_req(xs, ccb, flags)
* For wide boards a CDB length maximum of 16 bytes
* is supported.
*/
- bcopy(xs->cmd, &scsiqp->cdb, ((scsiqp->cdb_len = xs->cmdlen) <= 12)?
- xs->cmdlen : 12 );
- if(xs->cmdlen > 12)
- bcopy(&(xs->cmd[12]), &scsiqp->cdb16, xs->cmdlen - 12);
+ scsiqp->cdb_len = xs->cmdlen;
+ bcopy(xs->cmd, &scsiqp->cdb, 12);
+ bcopy(&(xs->cmd->bytes[11]), &scsiqp->cdb16, 4);
scsiqp->target_id = sc_link->target;
scsiqp->target_lun = sc_link->lun;
Index: arch/vax/dec/sii.c
===================================================================
RCS file: /cvs/src/sys/arch/vax/dec/sii.c,v
retrieving revision 1.9
diff -u -p -r1.9 sii.c
--- arch/vax/dec/sii.c 20 May 2010 00:55:17 -0000 1.9
+++ arch/vax/dec/sii.c 22 Jun 2010 00:31:56 -0000
@@ -817,7 +817,7 @@ again:
if (state->cmdlen > 0) {
printf("%s: device %d: cmd 0x%x: command data
not all sent (%d) 1\n",
sc->sc_dev.dv_xname, sc->sc_target,
- sc->sc_xs[sc->sc_target]->cmd[0],
+ sc->sc_xs[sc->sc_target]->cmd->opcode,
state->cmdlen);
state->cmdlen = 0;
#ifdef DEBUG
@@ -899,7 +899,7 @@ again:
if (state->cmdlen > 0) {
printf("%s: device %d: cmd 0x%x: command data
not all sent (%d) 2\n",
sc->sc_dev.dv_xname, sc->sc_target,
- sc->sc_xs[sc->sc_target]->cmd[0],
+ sc->sc_xs[sc->sc_target]->cmd->opcode,
state->cmdlen);
state->cmdlen = 0;
#ifdef DEBUG
@@ -1692,7 +1692,8 @@ sii_CmdDone(sc, target, error)
if (sii_debug > 1) {
printf("sii_CmdDone: %s target %d cmd 0x%x err %d resid %d\n",
sc->sc_dev.dv_xname,
- target, xs->cmd[0], error, sc->sc_st[target].buflen);
+ target, xs->cmd->opcode, error,
+ sc->sc_st[target].buflen);
}
#endif