diff options
Diffstat (limited to 'sys')
54 files changed, 316 insertions, 320 deletions
diff --git a/sys/arch/luna88k/dev/mb89352.c b/sys/arch/luna88k/dev/mb89352.c index 067aab69c27..868c42d91d5 100644 --- a/sys/arch/luna88k/dev/mb89352.c +++ b/sys/arch/luna88k/dev/mb89352.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mb89352.c,v 1.29 2020/07/20 20:33:10 krw Exp $ */ +/* $OpenBSD: mb89352.c,v 1.30 2020/09/22 19:32:51 krw Exp $ */ /* $NetBSD: mb89352.c,v 1.5 2000/03/23 07:01:31 thorpej Exp $ */ /* NecBSD: mb89352.c,v 1.4 1998/03/14 07:31:20 kmatsuda Exp */ @@ -411,7 +411,7 @@ spc_scsi_cmd(struct scsi_xfer *xs) int s, flags; SPC_TRACE(("spc_scsi_cmd ")); - SPC_CMDS(("[0x%x, %d]->%d ", (int)xs->cmd->opcode, xs->cmdlen, + SPC_CMDS(("[0x%x, %d]->%d ", (int)xs->cmd.opcode, xs->cmdlen, sc_link->target)); flags = xs->flags; @@ -427,7 +427,7 @@ spc_scsi_cmd(struct scsi_xfer *xs) acb->scsi_cmd_length = 0; acb->data_length = 0; } else { - bcopy(xs->cmd, &acb->scsi_cmd, xs->cmdlen); + bcopy(&xs->cmd, &acb->scsi_cmd, xs->cmdlen); acb->scsi_cmd_length = xs->cmdlen; acb->data_addr = xs->data; acb->data_length = xs->datalen; diff --git a/sys/arch/sparc64/dev/vdsk.c b/sys/arch/sparc64/dev/vdsk.c index 501b19c8277..981d267da78 100644 --- a/sys/arch/sparc64/dev/vdsk.c +++ b/sys/arch/sparc64/dev/vdsk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vdsk.c,v 1.67 2020/09/05 13:05:06 krw Exp $ */ +/* $OpenBSD: vdsk.c,v 1.68 2020/09/22 19:32:52 krw Exp $ */ /* * Copyright (c) 2009, 2011 Mark Kettenis * @@ -927,7 +927,7 @@ vdsk_scsi_cmd(struct scsi_xfer *xs) int timeout, s; int desc; - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case READ_COMMAND: case READ_10: case READ_12: @@ -956,7 +956,7 @@ vdsk_scsi_cmd(struct scsi_xfer *xs) return; default: - printf("%s cmd 0x%02x\n", __func__, xs->cmd->opcode); + printf("%s cmd 0x%02x\n", __func__, xs->cmd.opcode); case MODE_SENSE: case MODE_SENSE_BIG: case REPORT_LUNS: @@ -1008,7 +1008,7 @@ vdsk_submit_cmd(struct scsi_xfer *xs) int len, ncookies; int desc; - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case READ_COMMAND: case READ_10: case READ_12: @@ -1033,19 +1033,19 @@ vdsk_submit_cmd(struct scsi_xfer *xs) * layout as 10-byte READ/WRITE commands. */ if (xs->cmdlen == 6) { - rw = (struct scsi_rw *)xs->cmd; + rw = (struct scsi_rw *)&xs->cmd; lba = _3btol(rw->addr) & (SRW_TOPADDR << 16 | 0xffff); sector_count = rw->length ? rw->length : 0x100; } else if (xs->cmdlen == 10) { - rw10 = (struct scsi_rw_10 *)xs->cmd; + rw10 = (struct scsi_rw_10 *)&xs->cmd; lba = _4btol(rw10->addr); sector_count = _2btol(rw10->length); } else if (xs->cmdlen == 12) { - rw12 = (struct scsi_rw_12 *)xs->cmd; + rw12 = (struct scsi_rw_12 *)&xs->cmd; lba = _4btol(rw12->addr); sector_count = _4btol(rw12->length); } else if (xs->cmdlen == 16) { - rw16 = (struct scsi_rw_16 *)xs->cmd; + rw16 = (struct scsi_rw_16 *)&xs->cmd; lba = _8btol(rw16->addr); sector_count = _4btol(rw16->length); } @@ -1140,7 +1140,7 @@ vdsk_complete_cmd(struct scsi_xfer *xs, int desc) void vdsk_scsi_inq(struct scsi_xfer *xs) { - struct scsi_inquiry *inq = (struct scsi_inquiry *)xs->cmd; + struct scsi_inquiry *inq = (struct scsi_inquiry *)&xs->cmd; if (ISSET(inq->flags, SI_EVPD)) vdsk_scsi_done(xs, XS_DRIVER_STUFFUP); diff --git a/sys/dev/ata/atascsi.c b/sys/dev/ata/atascsi.c index 219593bdb1c..bec5c9833fc 100644 --- a/sys/dev/ata/atascsi.c +++ b/sys/dev/ata/atascsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atascsi.c,v 1.148 2020/09/05 13:05:06 krw Exp $ */ +/* $OpenBSD: atascsi.c,v 1.149 2020/09/22 19:32:52 krw Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -512,7 +512,7 @@ atascsi_disk_cmd(struct scsi_xfer *xs) ap = atascsi_lookup_port(link); - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case READ_COMMAND: case READ_10: case READ_12: @@ -572,7 +572,7 @@ atascsi_disk_cmd(struct scsi_xfer *xs) } xa->flags = flags; - scsi_cmd_rw_decode(xs->cmd, &lba, §or_count); + scsi_cmd_rw_decode(&xs->cmd, &lba, §or_count); if ((lba >> 48) != 0 || (sector_count >> 16) != 0) { atascsi_done(xs, XS_DRIVER_STUFFUP); return; @@ -658,7 +658,7 @@ atascsi_disk_cmd_done(struct ata_xfer *xa) void atascsi_disk_inq(struct scsi_xfer *xs) { - struct scsi_inquiry *inq = (struct scsi_inquiry *)xs->cmd; + struct scsi_inquiry *inq = (struct scsi_inquiry *)&xs->cmd; if (xs->cmdlen != sizeof(*inq)) { atascsi_done(xs, XS_DRIVER_STUFFUP); @@ -965,7 +965,7 @@ atascsi_disk_write_same_16(struct scsi_xfer *xs) } ap = atascsi_lookup_port(link); - cdb = (struct scsi_write_same_16 *)xs->cmd; + cdb = (struct scsi_write_same_16 *)&xs->cmd; if (!ISSET(cdb->flags, WRITE_SAME_F_UNMAP) || !ISSET(ap->ap_features, ATA_PORT_F_TRIM)) { @@ -1048,7 +1048,7 @@ atascsi_disk_unmap(struct scsi_xfer *xs) if (ISSET(xs->flags, SCSI_POLL) || xs->cmdlen != sizeof(*cdb)) atascsi_done(xs, XS_DRIVER_STUFFUP); - cdb = (struct scsi_unmap *)xs->cmd; + cdb = (struct scsi_unmap *)&xs->cmd; len = _2btol(cdb->list_len); if (xs->datalen != len || len < sizeof(*unmap)) { atascsi_done(xs, XS_DRIVER_STUFFUP); @@ -1403,7 +1403,7 @@ atascsi_passthru_12(struct scsi_xfer *xs) return; } - cdb = (struct scsi_ata_passthru_12 *)xs->cmd; + cdb = (struct scsi_ata_passthru_12 *)&xs->cmd; /* validate cdb */ if (atascsi_passthru_map(xs, cdb->count_proto, cdb->flags) != 0) { @@ -1441,7 +1441,7 @@ atascsi_passthru_16(struct scsi_xfer *xs) return; } - cdb = (struct scsi_ata_passthru_16 *)xs->cmd; + cdb = (struct scsi_ata_passthru_16 *)&xs->cmd; /* validate cdb */ if (atascsi_passthru_map(xs, cdb->count_proto, cdb->flags) != 0) { @@ -1519,7 +1519,7 @@ atascsi_disk_start_stop(struct scsi_xfer *xs) struct atascsi *as = link->bus->sb_adapter_softc; struct atascsi_port *ap; struct ata_xfer *xa = xs->io; - struct scsi_start_stop *ss = (struct scsi_start_stop *)xs->cmd; + struct scsi_start_stop *ss = (struct scsi_start_stop *)&xs->cmd; if (xs->cmdlen != sizeof(*ss)) { atascsi_done(xs, XS_DRIVER_STUFFUP); @@ -1644,7 +1644,7 @@ atascsi_atapi_cmd(struct scsi_xfer *xs) fis->lba_high = 0x20; /* Copy SCSI command into ATAPI packet. */ - memcpy(xa->packetcmd, xs->cmd, xs->cmdlen); + memcpy(xa->packetcmd, &xs->cmd, xs->cmdlen); ata_exec(as, xa); } @@ -1688,7 +1688,7 @@ atascsi_atapi_cmd_done(struct ata_xfer *xa) void atascsi_pmp_cmd(struct scsi_xfer *xs) { - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case REQUEST_SENSE: atascsi_pmp_sense(xs); return; @@ -1723,7 +1723,7 @@ void atascsi_pmp_inq(struct scsi_xfer *xs) { struct scsi_inquiry_data inq; - struct scsi_inquiry *in_inq = (struct scsi_inquiry *)xs->cmd; + struct scsi_inquiry *in_inq = (struct scsi_inquiry *)&xs->cmd; if (ISSET(in_inq->flags, SI_EVPD)) { /* any evpd pages we need to support here? */ diff --git a/sys/dev/atapiscsi/atapiscsi.c b/sys/dev/atapiscsi/atapiscsi.c index 2ec7f317bfc..0bf7f9d4c37 100644 --- a/sys/dev/atapiscsi/atapiscsi.c +++ b/sys/dev/atapiscsi/atapiscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atapiscsi.c,v 1.116 2020/07/22 13:16:04 krw Exp $ */ +/* $OpenBSD: atapiscsi.c,v 1.117 2020/09/22 19:32:52 krw Exp $ */ /* * This code is derived from code with the copyright below. @@ -354,7 +354,7 @@ wdc_atapi_send_cmd(struct scsi_xfer *sc_xfer) for (idx = 0; idx < sc_xfer->cmdlen; idx++) { WDCDEBUG_PRINT((" %02x", - ((unsigned char *)sc_xfer->cmd)[idx]), + ((unsigned char *)&sc_xfer->cmd)[idx]), DEBUG_XFERS | DEBUG_ERRORS); } WDCDEBUG_PRINT(("\n"), DEBUG_XFERS | DEBUG_ERRORS); @@ -363,8 +363,8 @@ wdc_atapi_send_cmd(struct scsi_xfer *sc_xfer) if (drvp->atapi_cap & ACAP_DSC) { WDCDEBUG_PRINT(("about to send cmd 0x%x ", - sc_xfer->cmd->opcode), DEBUG_DSC); - switch (sc_xfer->cmd->opcode) { + sc_xfer->cmd.opcode), DEBUG_DSC); + switch (sc_xfer->cmd.opcode) { case READ: case WRITE: xfer->c_flags |= C_MEDIA_ACCESS; @@ -377,10 +377,10 @@ wdc_atapi_send_cmd(struct scsi_xfer *sc_xfer) xfer->c_bcount = 0; xfer->transfer_len = _3btol(((struct scsi_rw_tape *) - sc_xfer->cmd)->len); + &sc_xfer->cmd)->len); _lto3b(0, ((struct scsi_rw_tape *) - sc_xfer->cmd)->len); + &sc_xfer->cmd)->len); xfer->c_done = wdc_atapi_tape_done; WDCDEBUG_PRINT( ("R/W in completion mode, do 0 blocks\n"), @@ -388,7 +388,7 @@ wdc_atapi_send_cmd(struct scsi_xfer *sc_xfer) } else WDCDEBUG_PRINT(("R/W %d blocks %d bytes\n", _3btol(((struct scsi_rw_tape *) - sc_xfer->cmd)->len), + &sc_xfer->cmd)->len), sc_xfer->datalen), DEBUG_DSC); @@ -835,7 +835,7 @@ wdc_atapi_intr_command(struct channel_softc *chp, struct wdc_xfer *xfer, cmd_reqsense->opcode = REQUEST_SENSE; cmd_reqsense->length = xfer->c_bcount; } else - bcopy(sc_xfer->cmd, cmd, sc_xfer->cmdlen); + bcopy(&sc_xfer->cmd, cmd, sc_xfer->cmdlen); WDC_LOG_ATAPI_CMD(chp, xfer->drive, xfer->c_flags, cmdlen, cmd); @@ -877,8 +877,8 @@ wdc_atapi_intr_command(struct channel_softc *chp, struct wdc_xfer *xfer, /* If we read/write to a tape we will get into buffer availability mode. */ if (drvp->atapi_cap & ACAP_DSC) { - if ((sc_xfer->cmd->opcode == READ || - sc_xfer->cmd->opcode == WRITE)) { + if ((sc_xfer->cmd.opcode == READ || + sc_xfer->cmd.opcode == WRITE)) { drvp->drive_flags |= DRIVE_DSCBA; WDCDEBUG_PRINT(("set DSCBA\n"), DEBUG_DSC); } else if ((xfer->c_flags & C_MEDIA_ACCESS) && @@ -1474,7 +1474,7 @@ wdc_atapi_tape_done(struct channel_softc *chp, struct wdc_xfer *xfer, _lto3b(xfer->transfer_len, ((struct scsi_rw_tape *) - sc_xfer->cmd)->len); + &sc_xfer->cmd)->len); xfer->c_bcount = sc_xfer->datalen; xfer->c_done = NULL; diff --git a/sys/dev/ic/aac.c b/sys/dev/ic/aac.c index 6021e7c8c7a..2289c5f69ce 100644 --- a/sys/dev/ic/aac.c +++ b/sys/dev/ic/aac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aac.c,v 1.89 2020/09/05 13:05:06 krw Exp $ */ +/* $OpenBSD: aac.c,v 1.90 2020/09/22 19:32:52 krw Exp $ */ /*- * Copyright (c) 2000 Michael Smith @@ -720,7 +720,7 @@ aac_bio_command(struct aac_softc *sc, struct aac_command **cmp) AAC_FIBSTATE_ASYNC | AAC_FIBSTATE_FAST_RESPONSE; - switch(xs->cmd->opcode) { + switch(xs->cmd.opcode) { case READ_COMMAND: case READ_10: opcode = READ_COMMAND; @@ -731,7 +731,7 @@ aac_bio_command(struct aac_softc *sc, struct aac_command **cmp) break; default: panic("%s: invalid opcode %#x", sc->aac_dev.dv_xname, - xs->cmd->opcode); + xs->cmd.opcode); } /* build the read/write request */ @@ -2129,13 +2129,13 @@ aac_internal_cache_cmd(struct scsi_xfer *xs) AAC_DPRINTF(AAC_D_CMD, ("%s: aac_internal_cache_cmd: ", sc->aac_dev.dv_xname)); - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case TEST_UNIT_READY: case START_STOP: #if 0 case VERIFY: #endif - AAC_DPRINTF(AAC_D_CMD, ("opc %#x tgt %d ", xs->cmd->opcode, + AAC_DPRINTF(AAC_D_CMD, ("opc %#x tgt %d ", xs->cmd.opcode, target)); break; @@ -2179,7 +2179,7 @@ aac_internal_cache_cmd(struct scsi_xfer *xs) default: AAC_DPRINTF(AAC_D_CMD, ("\n")); printf("aac_internal_cache_cmd got bad opcode: %#x\n", - xs->cmd->opcode); + xs->cmd.opcode); xs->error = XS_DRIVER_STUFFUP; return; } @@ -2222,7 +2222,7 @@ aac_scsi_cmd(struct scsi_xfer *xs) link = xs->sc_link; target = link->target; - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case TEST_UNIT_READY: case REQUEST_SENSE: case INQUIRY: @@ -2250,7 +2250,7 @@ aac_scsi_cmd(struct scsi_xfer *xs) goto ready; default: - AAC_DPRINTF(AAC_D_CMD, ("unknown opc %#x ", xs->cmd->opcode)); + AAC_DPRINTF(AAC_D_CMD, ("unknown opc %#x ", xs->cmd.opcode)); /* XXX Not yet implemented */ xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); @@ -2260,22 +2260,22 @@ aac_scsi_cmd(struct scsi_xfer *xs) case READ_10: case WRITE_COMMAND: case WRITE_10: - AAC_DPRINTF(AAC_D_CMD, ("rw opc %#x ", xs->cmd->opcode)); + AAC_DPRINTF(AAC_D_CMD, ("rw opc %#x ", xs->cmd.opcode)); /* A read or write operation. */ if (xs->cmdlen == 6) { - rw = (struct scsi_rw *)xs->cmd; + rw = (struct scsi_rw *)&xs->cmd; blockno = _3btol(rw->addr) & (SRW_TOPADDR << 16 | 0xffff); blockcnt = rw->length ? rw->length : 0x100; } else { - rw10 = (struct scsi_rw_10 *)xs->cmd; + rw10 = (struct scsi_rw_10 *)&xs->cmd; blockno = _4btol(rw10->addr); blockcnt = _2btol(rw10->length); } AAC_DPRINTF(AAC_D_CMD, ("opcode=%d blkno=%d bcount=%d ", - xs->cmd->opcode, blockno, blockcnt)); + xs->cmd.opcode, blockno, blockcnt)); if (blockno >= sc->aac_hdr[target].hd_size || blockno + blockcnt > sc->aac_hdr[target].hd_size) { diff --git a/sys/dev/ic/adv.c b/sys/dev/ic/adv.c index 4a2aebb4922..1f0e29f76ee 100644 --- a/sys/dev/ic/adv.c +++ b/sys/dev/ic/adv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adv.c,v 1.50 2020/08/08 12:40:55 krw Exp $ */ +/* $OpenBSD: adv.c,v 1.51 2020/09/22 19:32:52 krw Exp $ */ /* $NetBSD: adv.c,v 1.6 1998/10/28 20:39:45 dante Exp $ */ /* @@ -546,7 +546,7 @@ adv_scsi_cmd(xs) ccb->scsiq.q2.ccb_ptr = (ulong) ccb; - ccb->scsiq.cdbptr = &xs->cmd->opcode; + ccb->scsiq.cdbptr = (u_int8_t *)&xs->cmd; ccb->scsiq.q2.cdb_len = xs->cmdlen; ccb->scsiq.q1.target_id = ASC_TID_TO_TARGET_ID(sc_link->target); ccb->scsiq.q1.target_lun = sc_link->lun; @@ -629,7 +629,7 @@ adv_scsi_cmd(xs) #ifdef ASC_DEBUG printf("id = %d, lun = %d, cmd = %d, ccb = 0x%lX \n", sc_link->target, - sc_link->lun, xs->cmd->opcode, + sc_link->lun, xs->cmd.opcode, (unsigned long)ccb); #endif /* @@ -784,7 +784,7 @@ adv_narrow_isr_callback(sc, qdonep) printf(" - ccb=0x%lx, id=%d, lun=%d, cmd=%d, ", (unsigned long)ccb, xs->sc_link->target, - xs->sc_link->lun, xs->cmd->opcode); + xs->sc_link->lun, xs->cmd.opcode); #endif timeout_del(&xs->stimeout); @@ -827,7 +827,7 @@ adv_narrow_isr_callback(sc, qdonep) * If an INQUIRY command completed successfully, then call * the AscInquiryHandling() function to patch bugged boards. */ - if ((xs->cmd->opcode == SCSICMD_Inquiry) && + if ((xs->cmd.opcode == SCSICMD_Inquiry) && (xs->sc_link->lun == 0) && (xs->datalen - qdonep->remain_bytes) >= 8) { AscInquiryHandling(sc, diff --git a/sys/dev/ic/adw.c b/sys/dev/ic/adw.c index fddc8b42936..60dfe556e10 100644 --- a/sys/dev/ic/adw.c +++ b/sys/dev/ic/adw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adw.c,v 1.67 2020/08/08 12:40:55 krw Exp $ */ +/* $OpenBSD: adw.c,v 1.68 2020/09/22 19:32:52 krw Exp $ */ /* $NetBSD: adw.c,v 1.23 2000/05/27 18:24:50 dante Exp $ */ /* @@ -604,8 +604,8 @@ adw_build_req(struct scsi_xfer *xs, ADW_CCB *ccb, int flags) * is supported. */ scsiqp->cdb_len = xs->cmdlen; - bcopy((caddr_t)xs->cmd, &scsiqp->cdb, 12); - bcopy((caddr_t)xs->cmd + 12, &scsiqp->cdb16, 4); + bcopy(&xs->cmd, &scsiqp->cdb, 12); + bcopy((caddr_t)&xs->cmd + 12, &scsiqp->cdb16, 4); scsiqp->target_id = sc_link->target; scsiqp->target_lun = sc_link->lun; @@ -746,7 +746,7 @@ adw_poll(ADW_SOFTC *sc, struct scsi_xfer *xs, int count) adw_intr(sc); splx(s); if (xs->flags & ITSDONE) { - if ((xs->cmd->opcode == INQUIRY) + if ((xs->cmd.opcode == INQUIRY) && (xs->sc_link->lun == 0) && (xs->error == XS_NOERROR)) adw_print_info(sc, xs->sc_link->target); diff --git a/sys/dev/ic/aic6250.c b/sys/dev/ic/aic6250.c index 2e603159a53..cd4582c4075 100644 --- a/sys/dev/ic/aic6250.c +++ b/sys/dev/ic/aic6250.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic6250.c,v 1.12 2020/07/20 14:41:13 krw Exp $ */ +/* $OpenBSD: aic6250.c,v 1.13 2020/09/22 19:32:52 krw Exp $ */ /* * Copyright (c) 2010, 2013 Miodrag Vallat. @@ -390,7 +390,7 @@ aic6250_scsi_cmd(struct scsi_xfer *xs) int s, flags; AIC_TRACE(("aic6250_scsi_cmd ")); - AIC_CMDS(("[0x%x, %d]->%d ", (int)xs->cmd->opcode, xs->cmdlen, + AIC_CMDS(("[0x%x, %d]->%d ", (int)xs->cmd.opcode, xs->cmdlen, sc_link->target)); flags = xs->flags; @@ -406,7 +406,7 @@ aic6250_scsi_cmd(struct scsi_xfer *xs) acb->scsi_cmd_length = 0; acb->data_length = 0; } else { - bcopy(xs->cmd, &acb->scsi_cmd, xs->cmdlen); + bcopy(&xs->cmd, &acb->scsi_cmd, xs->cmdlen); acb->scsi_cmd_length = xs->cmdlen; acb->data_addr = xs->data; acb->data_length = xs->datalen; diff --git a/sys/dev/ic/aic6360.c b/sys/dev/ic/aic6360.c index ed9ace02286..25c59d2b491 100644 --- a/sys/dev/ic/aic6360.c +++ b/sys/dev/ic/aic6360.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic6360.c,v 1.37 2020/07/20 14:41:13 krw Exp $ */ +/* $OpenBSD: aic6360.c,v 1.38 2020/09/22 19:32:52 krw Exp $ */ /* $NetBSD: aic6360.c,v 1.52 1996/12/10 21:27:51 thorpej Exp $ */ #ifdef DDB @@ -483,7 +483,7 @@ aic_scsi_cmd(struct scsi_xfer *xs) int s, flags; AIC_TRACE(("aic_scsi_cmd ")); - AIC_CMDS(("[0x%x, %d]->%d ", (int)xs->cmd->opcode, xs->cmdlen, + AIC_CMDS(("[0x%x, %d]->%d ", (int)xs->cmd.opcode, xs->cmdlen, sc_link->target)); flags = xs->flags; @@ -499,7 +499,7 @@ aic_scsi_cmd(struct scsi_xfer *xs) acb->scsi_cmd_length = 0; acb->data_length = 0; } else { - bcopy(xs->cmd, &acb->scsi_cmd, xs->cmdlen); + bcopy(&xs->cmd, &acb->scsi_cmd, xs->cmdlen); acb->scsi_cmd_length = xs->cmdlen; acb->data_addr = xs->data; acb->data_length = xs->datalen; diff --git a/sys/dev/ic/aic79xx_openbsd.c b/sys/dev/ic/aic79xx_openbsd.c index 84d59da4564..0601dcaa680 100644 --- a/sys/dev/ic/aic79xx_openbsd.c +++ b/sys/dev/ic/aic79xx_openbsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic79xx_openbsd.c,v 1.58 2020/07/28 21:33:14 krw Exp $ */ +/* $OpenBSD: aic79xx_openbsd.c,v 1.59 2020/09/22 19:32:52 krw Exp $ */ /* * Copyright (c) 2004 Milos Urbanek, Kenneth R. Westerback & Marco Peereboom @@ -486,7 +486,7 @@ ahd_setup_data(struct ahd_softc *ahd, struct scsi_xfer *xs, return; } - memcpy(hscb->shared_data.idata.cdb, xs->cmd, hscb->cdb_len); + memcpy(hscb->shared_data.idata.cdb, &xs->cmd, hscb->cdb_len); /* Only use S/G if there is a transfer */ if (xs->datalen) { diff --git a/sys/dev/ic/aic7xxx_openbsd.c b/sys/dev/ic/aic7xxx_openbsd.c index eeb7e208c23..7c855474b87 100644 --- a/sys/dev/ic/aic7xxx_openbsd.c +++ b/sys/dev/ic/aic7xxx_openbsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic7xxx_openbsd.c,v 1.70 2020/07/29 15:25:34 deraadt Exp $ */ +/* $OpenBSD: aic7xxx_openbsd.c,v 1.71 2020/09/22 19:32:52 krw Exp $ */ /* $NetBSD: aic7xxx_osm.c,v 1.14 2003/11/02 11:07:44 wiz Exp $ */ /* @@ -513,10 +513,10 @@ ahc_setup_data(struct ahc_softc *ahc, struct scsi_xfer *xs, } if (hscb->cdb_len > 12) { - memcpy(hscb->cdb32, xs->cmd, hscb->cdb_len); + memcpy(hscb->cdb32, &xs->cmd, hscb->cdb_len); scb->flags |= SCB_CDB32_PTR; } else { - memcpy(hscb->shared_data.cdb, xs->cmd, hscb->cdb_len); + memcpy(hscb->shared_data.cdb, &xs->cmd, hscb->cdb_len); } /* Only use S/G if there is a transfer */ diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c index db85c6366c3..a7937f1af74 100644 --- a/sys/dev/ic/ami.c +++ b/sys/dev/ic/ami.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ami.c,v 1.258 2020/09/05 13:05:06 krw Exp $ */ +/* $OpenBSD: ami.c,v 1.259 2020/09/22 19:32:52 krw Exp $ */ /* * Copyright (c) 2001 Michael Shalayeff @@ -1102,7 +1102,7 @@ ami_done_pt(struct ami_softc *sc, struct ami_ccb *ccb) xs->error = XS_DRIVER_STUFFUP; else if (ccb->ccb_status != 0x00) xs->error = XS_DRIVER_STUFFUP; - else if (xs->flags & SCSI_POLL && xs->cmd->opcode == INQUIRY) { + else if (xs->flags & SCSI_POLL && xs->cmd.opcode == INQUIRY) { type = ((struct scsi_inquiry_data *)xs->data)->device & SID_TYPE; if (!(type == T_PROCESSOR || type == T_ENCLOSURE)) @@ -1242,7 +1242,7 @@ ami_scsi_raw_cmd(struct scsi_xfer *xs) ccb->ccb_pt->apt_param = AMI_PTPARAM(AMI_TIMEOUT_6,1,0); ccb->ccb_pt->apt_channel = channel; ccb->ccb_pt->apt_target = target; - bcopy(xs->cmd, ccb->ccb_pt->apt_cdb, AMI_MAX_CDB); + bcopy(&xs->cmd, ccb->ccb_pt->apt_cdb, AMI_MAX_CDB); ccb->ccb_pt->apt_ncdb = xs->cmdlen; ccb->ccb_pt->apt_nsense = AMI_MAX_SENSE; ccb->ccb_pt->apt_datalen = xs->datalen; @@ -1338,7 +1338,7 @@ ami_scsi_cmd(struct scsi_xfer *xs) xs->error = XS_NOERROR; - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case READ_COMMAND: case READ_10: case WRITE_COMMAND: @@ -1370,7 +1370,7 @@ ami_scsi_cmd(struct scsi_xfer *xs) case VERIFY: #endif case PREVENT_ALLOW: - AMI_DPRINTF(AMI_D_CMD, ("opc %d tgt %d ", xs->cmd->opcode, + AMI_DPRINTF(AMI_D_CMD, ("opc %d tgt %d ", xs->cmd.opcode, target)); xs->error = XS_NOERROR; scsi_done(xs); @@ -1391,7 +1391,7 @@ ami_scsi_cmd(struct scsi_xfer *xs) return; case INQUIRY: - if (ISSET(((struct scsi_inquiry *)xs->cmd)->flags, SI_EVPD)) { + if (ISSET(((struct scsi_inquiry *)&xs->cmd)->flags, SI_EVPD)) { xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); return; @@ -1428,7 +1428,7 @@ ami_scsi_cmd(struct scsi_xfer *xs) default: AMI_DPRINTF(AMI_D_CMD, ("unsupported scsi command %#x tgt %d ", - xs->cmd->opcode, target)); + xs->cmd.opcode, target)); xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); @@ -1437,11 +1437,11 @@ ami_scsi_cmd(struct scsi_xfer *xs) /* A read or write operation. */ if (xs->cmdlen == 6) { - rw = (struct scsi_rw *)xs->cmd; + rw = (struct scsi_rw *)&xs->cmd; blockno = _3btol(rw->addr) & (SRW_TOPADDR << 16 | 0xffff); blockcnt = rw->length ? rw->length : 0x100; } else { - rw10 = (struct scsi_rw_10 *)xs->cmd; + rw10 = (struct scsi_rw_10 *)&xs->cmd; blockno = _4btol(rw10->addr); blockcnt = _2btol(rw10->length); } diff --git a/sys/dev/ic/cac.c b/sys/dev/ic/cac.c index dda32869feb..f5680b4af44 100644 --- a/sys/dev/ic/cac.c +++ b/sys/dev/ic/cac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cac.c,v 1.71 2020/09/05 13:05:06 krw Exp $ */ +/* $OpenBSD: cac.c,v 1.72 2020/09/22 19:32:52 krw Exp $ */ /* $NetBSD: cac.c,v 1.15 2000/11/08 19:20:35 ad Exp $ */ /* @@ -604,7 +604,7 @@ cac_scsi_cmd(xs) xs->error = XS_NOERROR; dinfo = &sc->sc_dinfos[target]; - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case TEST_UNIT_READY: case START_STOP: #if 0 @@ -676,12 +676,12 @@ cac_scsi_cmd(xs) flags = 0; /* A read or write operation. */ if (xs->cmdlen == 6) { - rw = (struct scsi_rw *)xs->cmd; + rw = (struct scsi_rw *)&xs->cmd; blockno = _3btol(rw->addr) & (SRW_TOPADDR << 16 | 0xffff); blockcnt = rw->length ? rw->length : 0x100; } else { - rw10 = (struct scsi_rw_10 *)xs->cmd; + rw10 = (struct scsi_rw_10 *)&xs->cmd; blockno = _4btol(rw10->addr); blockcnt = _2btol(rw10->length); } @@ -694,7 +694,7 @@ cac_scsi_cmd(xs) break; } - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case READ_COMMAND: case READ_10: op = CAC_CMD_READ; @@ -723,7 +723,7 @@ cac_scsi_cmd(xs) default: #ifdef CAC_DEBUG - printf("unsupported scsi command %#x tgt %d ", xs->cmd->opcode, target); + printf("unsupported scsi command %#x tgt %d ", xs->cmd.opcode, target); #endif xs->error = XS_DRIVER_STUFFUP; } diff --git a/sys/dev/ic/ciss.c b/sys/dev/ic/ciss.c index 22118fad044..d65b5cd0cdb 100644 --- a/sys/dev/ic/ciss.c +++ b/sys/dev/ic/ciss.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ciss.c,v 1.88 2020/07/24 12:43:31 krw Exp $ */ +/* $OpenBSD: ciss.c,v 1.89 2020/09/22 19:32:52 krw Exp $ */ /* * Copyright (c) 2005,2006 Michael Shalayeff @@ -869,7 +869,7 @@ ciss_scsi_cmd(struct scsi_xfer *xs) cmd->flags |= CISS_CDB_OUT; cmd->tmo = htole16(xs->timeout < 1000? 1 : xs->timeout / 1000); bzero(&cmd->cdb[0], sizeof(cmd->cdb)); - bcopy(xs->cmd, &cmd->cdb[0], CISS_MAX_CDB); + bcopy(&xs->cmd, &cmd->cdb[0], CISS_MAX_CDB); lock = CISS_LOCK(sc); ciss_cmd(ccb, BUS_DMA_WAITOK, xs->flags & (SCSI_POLL|SCSI_NOSLEEP)); diff --git a/sys/dev/ic/gdt_common.c b/sys/dev/ic/gdt_common.c index d1440b57998..770063ea56e 100644 --- a/sys/dev/ic/gdt_common.c +++ b/sys/dev/ic/gdt_common.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gdt_common.c,v 1.81 2020/09/05 13:05:06 krw Exp $ */ +/* $OpenBSD: gdt_common.c,v 1.82 2020/09/22 19:32:52 krw Exp $ */ /* * Copyright (c) 1999, 2000, 2003 Niklas Hallqvist. All rights reserved. @@ -591,7 +591,7 @@ gdt_scsi_cmd(struct scsi_xfer *xs) break; } - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case TEST_UNIT_READY: case REQUEST_SENSE: case INQUIRY: @@ -614,7 +614,7 @@ gdt_scsi_cmd(struct scsi_xfer *xs) default: GDT_DPRINTF(GDT_D_CMD, - ("unknown opc %d ", xs->cmd->opcode)); + ("unknown opc %d ", xs->cmd.opcode)); /* XXX Not yet implemented */ xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); @@ -630,18 +630,18 @@ gdt_scsi_cmd(struct scsi_xfer *xs) */ sc->sc_cmd_off = 0; - if (xs->cmd->opcode == SYNCHRONIZE_CACHE) { + if (xs->cmd.opcode == SYNCHRONIZE_CACHE) { blockno = blockcnt = 0; } else { /* A read or write operation. */ if (xs->cmdlen == 6) { - rw = (struct scsi_rw *)xs->cmd; + rw = (struct scsi_rw *)&xs->cmd; blockno = _3btol(rw->addr) & (SRW_TOPADDR << 16 | 0xffff); blockcnt = rw->length ? rw->length : 0x100; } else { - rw10 = (struct scsi_rw_10 *)xs->cmd; + rw10 = (struct scsi_rw_10 *)&xs->cmd; blockno = _4btol(rw10->addr); blockcnt = _2btol(rw10->length); } @@ -673,7 +673,7 @@ gdt_scsi_cmd(struct scsi_xfer *xs) ccb->gc_flags = 0; gdt_ccb_set_cmd(ccb, GDT_GCF_SCSI); - if (xs->cmd->opcode != SYNCHRONIZE_CACHE) { + if (xs->cmd.opcode != SYNCHRONIZE_CACHE) { xfer = ccb->gc_dmamap_xfer; error = bus_dmamap_load(sc->sc_dmat, xfer, xs->data, xs->datalen, NULL, @@ -762,10 +762,10 @@ gdt_exec_ccb(struct gdt_ccb *ccb) gdt_enc16(sc->sc_cmd + GDT_CMD_UNION + GDT_CACHE_DEVICENO, target); - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case PREVENT_ALLOW: case SYNCHRONIZE_CACHE: - if (xs->cmd->opcode == PREVENT_ALLOW) { + if (xs->cmd.opcode == PREVENT_ALLOW) { /* XXX PREVENT_ALLOW support goes here */ } else { GDT_DPRINTF(GDT_D_CMD, @@ -789,8 +789,8 @@ gdt_exec_ccb(struct gdt_ccb *ccb) break; } - if (xs->cmd->opcode != PREVENT_ALLOW && - xs->cmd->opcode != SYNCHRONIZE_CACHE) { + if (xs->cmd.opcode != PREVENT_ALLOW && + xs->cmd.opcode != SYNCHRONIZE_CACHE) { gdt_enc32(sc->sc_cmd + GDT_CMD_UNION + GDT_CACHE_BLOCKNO, ccb->gc_blockno); gdt_enc32(sc->sc_cmd + GDT_CMD_UNION + GDT_CACHE_BLOCKCNT, @@ -883,13 +883,13 @@ gdt_internal_cache_cmd(struct scsi_xfer *xs) GDT_DPRINTF(GDT_D_CMD, ("gdt_internal_cache_cmd ")); - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case TEST_UNIT_READY: case START_STOP: #if 0 case VERIFY: #endif - GDT_DPRINTF(GDT_D_CMD, ("opc %d tgt %d ", xs->cmd->opcode, + GDT_DPRINTF(GDT_D_CMD, ("opc %d tgt %d ", xs->cmd.opcode, target)); break; @@ -933,7 +933,7 @@ gdt_internal_cache_cmd(struct scsi_xfer *xs) default: GDT_DPRINTF(GDT_D_CMD, ("unsupported scsi command %#x tgt %d ", - xs->cmd->opcode, target)); + xs->cmd.opcode, target)); xs->error = XS_DRIVER_STUFFUP; return; } @@ -1050,8 +1050,8 @@ gdt_intr(void *arg) timeout_del(&xs->stimeout); ctx.service = ccb->gc_service; prev_cmd = ccb->gc_flags & GDT_GCF_CMD_MASK; - if (xs && xs->cmd->opcode != PREVENT_ALLOW && - xs->cmd->opcode != SYNCHRONIZE_CACHE) { + if (xs && xs->cmd.opcode != PREVENT_ALLOW && + xs->cmd.opcode != SYNCHRONIZE_CACHE) { bus_dmamap_sync(sc->sc_dmat, ccb->gc_dmamap_xfer, 0, ccb->gc_dmamap_xfer->dm_mapsize, (xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_POSTREAD : diff --git a/sys/dev/ic/iha.c b/sys/dev/ic/iha.c index 24247858254..b5301eebbb7 100644 --- a/sys/dev/ic/iha.c +++ b/sys/dev/ic/iha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iha.c,v 1.51 2020/07/16 21:18:30 krw Exp $ */ +/* $OpenBSD: iha.c,v 1.52 2020/09/22 19:32:52 krw Exp $ */ /*------------------------------------------------------------------------- * * Device driver for the INI-9XXXU/UW or INIC-940/950 PCI SCSI Controller. @@ -260,13 +260,13 @@ iha_scsi_cmd(struct scsi_xfer *xs) pScb->SCB_Ident = MSG_IDENTIFYFLAG | (pScb->SCB_Lun & MSG_IDENTIFY_LUNMASK); - if ((xs->cmd->opcode != REQUEST_SENSE) + if ((xs->cmd.opcode != REQUEST_SENSE) && ((pScb->SCB_Flags & SCSI_POLL) == 0)) pScb->SCB_Ident |= MSG_IDENTIFY_DISCFLAG; pScb->SCB_Xs = xs; pScb->SCB_CDBLen = xs->cmdlen; - bcopy(xs->cmd, &pScb->SCB_CDB, xs->cmdlen); + bcopy(&xs->cmd, &pScb->SCB_CDB, xs->cmdlen); pScb->SCB_BufCharsLeft = pScb->SCB_BufChars = xs->datalen; @@ -2396,7 +2396,7 @@ iha_timeout(void *arg) if (xs != NULL) { sc_print_addr(xs->sc_link); - printf("SCSI OpCode 0x%02x timed out\n", xs->cmd->opcode); + printf("SCSI OpCode 0x%02x timed out\n", xs->cmd.opcode); iha_abort_xs(xs->sc_link->bus->sb_adapter_softc, xs, HOST_TIMED_OUT); } } diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c index 76a291a627a..ca75c17e6c1 100644 --- a/sys/dev/ic/mfi.c +++ b/sys/dev/ic/mfi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfi.c,v 1.186 2020/09/01 12:17:53 krw Exp $ */ +/* $OpenBSD: mfi.c,v 1.187 2020/09/22 19:32:52 krw Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <marco@peereboom.us> * @@ -1079,7 +1079,7 @@ mfi_scsi_xs_done(struct mfi_softc *sc, struct mfi_ccb *ccb) xs->error = XS_DRIVER_STUFFUP; DNPRINTF(MFI_D_CMD, "%s: mfi_scsi_xs_done stuffup %02x on %02x\n", - DEVNAME(sc), hdr->mfh_cmd_status, xs->cmd->opcode); + DEVNAME(sc), hdr->mfh_cmd_status, xs->cmd.opcode); if (hdr->mfh_scsi_status != 0) { DNPRINTF(MFI_D_INTR, @@ -1120,7 +1120,7 @@ mfi_scsi_ld(struct mfi_softc *sc, struct mfi_ccb *ccb, struct scsi_xfer *xs) pf->mpf_sense_addr = htole64(ccb->ccb_psense); memset(pf->mpf_cdb, 0, 16); - memcpy(pf->mpf_cdb, xs->cmd, xs->cmdlen); + memcpy(pf->mpf_cdb, &xs->cmd, xs->cmdlen); ccb->ccb_done = mfi_scsi_xs_done; ccb->ccb_cookie = xs; @@ -1160,7 +1160,7 @@ mfi_scsi_cmd(struct scsi_xfer *xs) union mfi_mbox mbox; DNPRINTF(MFI_D_CMD, "%s: mfi_scsi_cmd opcode: %#x\n", - DEVNAME(sc), xs->cmd->opcode); + DEVNAME(sc), xs->cmd.opcode); KERNEL_UNLOCK(); @@ -1174,11 +1174,11 @@ mfi_scsi_cmd(struct scsi_xfer *xs) xs->error = XS_NOERROR; - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { /* IO path */ case READ_10: case WRITE_10: - rw10 = (struct scsi_rw_10 *)xs->cmd; + rw10 = (struct scsi_rw_10 *)&xs->cmd; blockno = (uint64_t)_4btol(rw10->addr); blockcnt = _2btol(rw10->length); if (mfi_scsi_io(sc, ccb, xs, blockno, blockcnt)) @@ -1187,7 +1187,7 @@ mfi_scsi_cmd(struct scsi_xfer *xs) case READ_COMMAND: case WRITE_COMMAND: - rw = (struct scsi_rw *)xs->cmd; + rw = (struct scsi_rw *)&xs->cmd; blockno = (uint64_t)(_3btol(rw->addr) & (SRW_TOPADDR << 16 | 0xffff)); blockcnt = rw->length ? rw->length : 0x100; @@ -1197,7 +1197,7 @@ mfi_scsi_cmd(struct scsi_xfer *xs) case READ_16: case WRITE_16: - rw16 = (struct scsi_rw_16 *)xs->cmd; + rw16 = (struct scsi_rw_16 *)&xs->cmd; blockno = _8btol(rw16->addr); blockcnt = _4btol(rw16->length); if (mfi_scsi_io(sc, ccb, xs, blockno, blockcnt)) @@ -2759,7 +2759,7 @@ mfi_pd_scsi_cmd(struct scsi_xfer *xs) pf->mpf_sense_addr = htole64(ccb->ccb_psense); memset(pf->mpf_cdb, 0, sizeof(pf->mpf_cdb)); - memcpy(pf->mpf_cdb, xs->cmd, xs->cmdlen); + memcpy(pf->mpf_cdb, &xs->cmd, xs->cmdlen); ccb->ccb_done = mfi_scsi_xs_done; ccb->ccb_cookie = xs; diff --git a/sys/dev/ic/mpi.c b/sys/dev/ic/mpi.c index bc365c6de1f..89c4f0ce9c1 100644 --- a/sys/dev/ic/mpi.c +++ b/sys/dev/ic/mpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpi.c,v 1.222 2020/08/26 13:57:19 krw Exp $ */ +/* $OpenBSD: mpi.c,v 1.223 2020/09/22 19:32:52 krw Exp $ */ /* * Copyright (c) 2005, 2006, 2009 David Gwynne <dlg@openbsd.org> @@ -1359,7 +1359,7 @@ mpi_scsi_cmd(struct scsi_xfer *xs) else io->tagging = MPI_SCSIIO_ATTR_SIMPLE_Q; - memcpy(io->cdb, xs->cmd, xs->cmdlen); + memcpy(io->cdb, &xs->cmd, xs->cmdlen); htolem32(&io->data_length, xs->datalen); @@ -1420,7 +1420,7 @@ mpi_scsi_cmd_done(struct mpi_ccb *ccb) sie = ccb->ccb_rcb->rcb_reply; DNPRINTF(MPI_D_CMD, "%s: mpi_scsi_cmd_done xs cmd: 0x%02x len: %d " - "flags 0x%x\n", DEVNAME(sc), xs->cmd->opcode, xs->datalen, + "flags 0x%x\n", DEVNAME(sc), xs->cmd.opcode, xs->datalen, xs->flags); DNPRINTF(MPI_D_CMD, "%s: target_id: %d bus: %d msg_length: %d " "function: 0x%02x\n", DEVNAME(sc), sie->target_id, sie->bus, diff --git a/sys/dev/ic/ncr53c9x.c b/sys/dev/ic/ncr53c9x.c index a360ce2cfe3..6fbb124c373 100644 --- a/sys/dev/ic/ncr53c9x.c +++ b/sys/dev/ic/ncr53c9x.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ncr53c9x.c,v 1.76 2020/07/20 14:41:13 krw Exp $ */ +/* $OpenBSD: ncr53c9x.c,v 1.77 2020/09/22 19:32:52 krw Exp $ */ /* $NetBSD: ncr53c9x.c,v 1.56 2000/11/30 14:41:46 thorpej Exp $ */ /* @@ -832,7 +832,7 @@ ncr53c9x_scsi_cmd(xs) int s, flags; NCR_TRACE(("[ncr53c9x_scsi_cmd] ")); - NCR_CMDS(("[0x%x, %d]->%d ", (int)xs->cmd->opcode, xs->cmdlen, + NCR_CMDS(("[0x%x, %d]->%d ", (int)xs->cmd.opcode, xs->cmdlen, sc_link->target)); /* @@ -864,7 +864,7 @@ ncr53c9x_scsi_cmd(xs) ecb->clen = 0; ecb->dleft = 0; } else { - bcopy(xs->cmd, &ecb->cmd.cmd, xs->cmdlen); + bcopy(&xs->cmd, &ecb->cmd.cmd, xs->cmdlen); ecb->clen = xs->cmdlen; ecb->daddr = xs->data; ecb->dleft = xs->datalen; diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c index 01856d36a84..f47d04f004e 100644 --- a/sys/dev/ic/nvme.c +++ b/sys/dev/ic/nvme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nvme.c,v 1.87 2020/09/05 13:05:06 krw Exp $ */ +/* $OpenBSD: nvme.c,v 1.88 2020/09/22 19:32:52 krw Exp $ */ /* * Copyright (c) 2014 David Gwynne <dlg@openbsd.org> @@ -536,7 +536,7 @@ nvme_activate(struct nvme_softc *sc, int act) void nvme_scsi_cmd(struct scsi_xfer *xs) { - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case READ_COMMAND: case READ_10: case READ_12: @@ -647,7 +647,7 @@ nvme_scsi_io_fill(struct nvme_softc *sc, struct nvme_ccb *ccb, void *slot) u_int64_t lba; u_int32_t blocks; - scsi_cmd_rw_decode(xs->cmd, &lba, &blocks); + scsi_cmd_rw_decode(&xs->cmd, &lba, &blocks); sqe->opcode = ISSET(xs->flags, SCSI_DATA_IN) ? NVM_CMD_READ : NVM_CMD_WRITE; @@ -749,7 +749,7 @@ nvme_scsi_sync_done(struct nvme_softc *sc, struct nvme_ccb *ccb, void nvme_scsi_inq(struct scsi_xfer *xs) { - struct scsi_inquiry *inq = (struct scsi_inquiry *)xs->cmd; + struct scsi_inquiry *inq = (struct scsi_inquiry *)&xs->cmd; if (!ISSET(inq->flags, SI_EVPD)) { nvme_scsi_inquiry(xs); diff --git a/sys/dev/ic/oosiop.c b/sys/dev/ic/oosiop.c index cd9f60cd034..2b69682f3b6 100644 --- a/sys/dev/ic/oosiop.c +++ b/sys/dev/ic/oosiop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: oosiop.c,v 1.33 2020/07/20 14:41:13 krw Exp $ */ +/* $OpenBSD: oosiop.c,v 1.34 2020/09/22 19:32:52 krw Exp $ */ /* $NetBSD: oosiop.c,v 1.4 2003/10/29 17:45:55 tsutsui Exp $ */ /* @@ -740,7 +740,7 @@ oosiop_scsicmd(struct scsi_xfer *xs) xfer = cb->xfer; /* Setup SCSI command buffer DMA */ - err = bus_dmamap_load(sc->sc_dmat, cb->cmddma, xs->cmd, + err = bus_dmamap_load(sc->sc_dmat, cb->cmddma, &xs->cmd, xs->cmdlen, NULL, ((xs->flags & SCSI_NOSLEEP) ? BUS_DMA_NOWAIT : BUS_DMA_WAITOK) | BUS_DMA_STREAMING | BUS_DMA_WRITE); @@ -857,7 +857,7 @@ oosiop_setup(struct oosiop_softc *sc, struct oosiop_cb *cb) OOSIOP_XFERMSG_SYNC(sc, cb, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); xfer->msgout[0] = MSG_IDENTIFY(cb->lun, - (cb->xs->cmd->opcode != REQUEST_SENSE)); + (cb->xs->cmd.opcode != REQUEST_SENSE)); cb->msgoutlen = 1; if (sc->sc_tgt[cb->id].flags & TGTF_SYNCNEG) { @@ -955,7 +955,7 @@ FREE: sc->sc_tgt[cb->id].nexus = NULL; } else { /* Set up REQUEST_SENSE command */ - struct scsi_sense *cmd = (struct scsi_sense *)xs->cmd; + struct scsi_sense *cmd = (struct scsi_sense *)&xs->cmd; int err; bzero(cmd, sizeof(*cmd)); @@ -1013,7 +1013,7 @@ oosiop_timeout(void *arg) int s; sc_print_addr(xs->sc_link); - printf("command 0x%02x timeout on xs %p\n", xs->cmd->opcode, xs); + printf("command 0x%02x timeout on xs %p\n", xs->cmd.opcode, xs); s = splbio(); diff --git a/sys/dev/ic/osiop.c b/sys/dev/ic/osiop.c index abf980a07f3..dac23239861 100644 --- a/sys/dev/ic/osiop.c +++ b/sys/dev/ic/osiop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: osiop.c,v 1.62 2020/07/24 12:43:31 krw Exp $ */ +/* $OpenBSD: osiop.c,v 1.63 2020/09/22 19:32:52 krw Exp $ */ /* $NetBSD: osiop.c,v 1.9 2002/04/05 18:27:54 bouyer Exp $ */ /* @@ -391,7 +391,7 @@ osiop_scsicmd(xs) acb->status = ACB_S_READY; acb->xs = xs; acb->xsflags = xs->flags; - memcpy(&acb->ds->scsi_cmd, xs->cmd, xs->cmdlen); + memcpy(&acb->ds->scsi_cmd, &xs->cmd, xs->cmdlen); acb->ds->cmd.count = xs->cmdlen; acb->datalen = 0; #ifdef OSIOP_DEBUG @@ -1930,7 +1930,7 @@ osiop_timeout(arg) int s; sc_print_addr(xs->sc_link); - printf("command 0x%02x timeout on xs %p\n", xs->cmd->opcode, xs); + printf("command 0x%02x timeout on xs %p\n", xs->cmd.opcode, xs); s = splbio(); /* reset the scsi bus */ diff --git a/sys/dev/ic/qla.c b/sys/dev/ic/qla.c index 149b02f34f2..ecaed773b23 100644 --- a/sys/dev/ic/qla.c +++ b/sys/dev/ic/qla.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qla.c,v 1.67 2020/07/20 14:41:13 krw Exp $ */ +/* $OpenBSD: qla.c,v 1.68 2020/09/22 19:32:52 krw Exp $ */ /* * Copyright (c) 2011 David Gwynne <dlg@openbsd.org> @@ -2260,7 +2260,7 @@ qla_put_cmd(struct qla_softc *sc, void *buf, struct scsi_xfer *xs, } else { req->req_target = htole16(target << 8 | xs->sc_link->lun); } - memcpy(req->req_cdb, xs->cmd, xs->cmdlen); + memcpy(req->req_cdb, &xs->cmd, xs->cmdlen); req->req_totalcnt = htole32(xs->datalen); req->req_handle = ccb->ccb_id; diff --git a/sys/dev/ic/qlw.c b/sys/dev/ic/qlw.c index 88f6ec51180..16da5c1e481 100644 --- a/sys/dev/ic/qlw.c +++ b/sys/dev/ic/qlw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qlw.c,v 1.46 2020/08/13 10:37:27 krw Exp $ */ +/* $OpenBSD: qlw.c,v 1.47 2020/09/22 19:32:52 krw Exp $ */ /* * Copyright (c) 2011 David Gwynne <dlg@openbsd.org> @@ -1379,7 +1379,7 @@ qlw_put_cmd(struct qlw_softc *sc, void *buf, struct scsi_xfer *xs, lun = xs->sc_link->lun; req->device = qlw_swap16(sc, (((bus << 7) | target) << 8) | lun); - memcpy(req->cdb, xs->cmd, xs->cmdlen); + memcpy(req->cdb, &xs->cmd, xs->cmdlen); req->ccblen = qlw_swap16(sc, xs->cmdlen); req->handle = qlw_swap32(sc, ccb->ccb_id); diff --git a/sys/dev/ic/siop.c b/sys/dev/ic/siop.c index 7d415e6e5d8..eabaa40e589 100644 --- a/sys/dev/ic/siop.c +++ b/sys/dev/ic/siop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: siop.c,v 1.85 2020/07/30 00:03:25 krw Exp $ */ +/* $OpenBSD: siop.c,v 1.86 2020/09/22 19:32:52 krw Exp $ */ /* $NetBSD: siop.c,v 1.79 2005/11/18 23:10:32 bouyer Exp $ */ /* @@ -1486,7 +1486,7 @@ siop_scsicmd(xs) bzero(&siop_cmd->cmd_c.siop_tables->xscmd, sizeof(siop_cmd->cmd_c.siop_tables->xscmd)); - bcopy(xs->cmd, &siop_cmd->cmd_c.siop_tables->xscmd, xs->cmdlen); + bcopy(&xs->cmd, &siop_cmd->cmd_c.siop_tables->xscmd, xs->cmdlen); siop_cmd->cmd_c.siop_tables->cmd.count = siop_htoc32(&sc->sc_c, xs->cmdlen); @@ -1536,7 +1536,7 @@ siop_scsicmd(xs) delay(1000); continue; } - if (xs->cmd->opcode == INQUIRY && xs->error == XS_NOERROR) { + if (xs->cmd.opcode == INQUIRY && xs->error == XS_NOERROR) { struct scsi_inquiry_data *inqbuf = (struct scsi_inquiry_data *)xs->data; if ((inqbuf->device & SID_QUAL) == SID_QUAL_BAD_LU) @@ -1779,7 +1779,7 @@ siop_timeout(v) sc_print_addr(siop_cmd->cmd_c.xs->sc_link); printf("timeout on SCSI command 0x%x\n", - siop_cmd->cmd_c.xs->cmd->opcode); + siop_cmd->cmd_c.xs->cmd.opcode); s = splbio(); /* reset the scsi bus */ diff --git a/sys/dev/ic/trm.c b/sys/dev/ic/trm.c index f8fe4568a6b..fad3566980d 100644 --- a/sys/dev/ic/trm.c +++ b/sys/dev/ic/trm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trm.c,v 1.42 2020/07/16 21:18:30 krw Exp $ +/* $OpenBSD: trm.c,v 1.43 2020/09/22 19:32:52 krw Exp $ * ------------------------------------------------------------ * O.S : OpenBSD * File Name : trm.c @@ -325,7 +325,7 @@ trm_scsi_cmd(struct scsi_xfer *xs) if ((xs->flags & SCSI_POLL) != 0) { sc_print_addr(xs->sc_link); printf("trm_scsi_cmd. sc = %p, xs = %p, opcode = 0x%02x\n", - sc, xs, lun, xs->cmd->opcode); + sc, xs, lun, xs->cmd.opcode); } #endif @@ -379,13 +379,13 @@ trm_scsi_cmd(struct scsi_xfer *xs) if (xs->datalen != 0) { #ifdef TRM_DEBUG0 sc_print_addr(xs->sc_link); - printf("xs->datalen=%x\n", (u_int32_t)xs->datalen); + printf("xs->datalen=%x\n", (u_int32_t)&xs->datalen); sc_print_addr(xs->sc_link); printf("sc->sc_dmatag=0x%x\n", (u_int32_t)sc->sc_dmatag); sc_print_addr(xs->sc_link); printf("pSRB->dmamapxfer=0x%x\n", (u_int32_t)pSRB->dmamapxfer); sc_print_addr(xs->sc_link); - printf("xs->data=0x%x\n", (u_int32_t)xs->data); + printf("xs->data=0x%x\n", (u_int32_t)&xs->data); #endif if ((error = bus_dmamap_load(sc->sc_dmatag, pSRB->dmamapxfer, xs->data, xs->datalen, NULL, @@ -419,7 +419,7 @@ trm_scsi_cmd(struct scsi_xfer *xs) pSRB->xs = xs; pSRB->ScsiCmdLen = xs->cmdlen; - memcpy(pSRB->CmdBlock, xs->cmd, xs->cmdlen); + memcpy(pSRB->CmdBlock, &xs->cmd, xs->cmdlen); timeout_set(&xs->stimeout, trm_timeout, pSRB); @@ -620,7 +620,7 @@ trm_timeout(void *arg1) if (xs != NULL) { sc = xs->sc_link->bus->sb_adapter_softc; sc_print_addr(xs->sc_link); - printf("SCSI OpCode 0x%02x ", xs->cmd->opcode); + printf("SCSI OpCode 0x%02x ", xs->cmd.opcode); if (pSRB->SRBFlag & TRM_AUTO_REQSENSE) printf("REQUEST SENSE "); printf("timed out\n"); @@ -2038,7 +2038,7 @@ trm_FinishSRB(struct trm_softc *sc, struct trm_scsi_req_q *pSRB) if ((xs->flags & SCSI_POLL) != 0) { - if (xs->cmd->opcode == INQUIRY && pDCB->sc_link == NULL) { + if (xs->cmd.opcode == INQUIRY && pDCB->sc_link == NULL) { ptr = (struct scsi_inquiry_data *) xs->data; @@ -2064,8 +2064,8 @@ trm_FinishSRB(struct trm_softc *sc, struct trm_scsi_req_q *pSRB) if ((xs->error != 0) || (xs->status != 0) || ((xs->flags & SCSI_POLL) != 0)) { sc_print_addr(xs->sc_link); - printf("trm_FinishSRB. xs->cmd->opcode = 0x%02x, xs->error = %d, xs->status = %d\n", - xs->cmd->opcode, xs->error, xs->status); + printf("trm_FinishSRB. xs->cmd.opcode = 0x%02x, xs->error = %d, xs->status = %d\n", + xs->cmd.opcode, xs->error, xs->status); } #endif diff --git a/sys/dev/ic/twe.c b/sys/dev/ic/twe.c index d42d550e07e..86b97912b9f 100644 --- a/sys/dev/ic/twe.c +++ b/sys/dev/ic/twe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: twe.c,v 1.62 2020/09/05 13:05:06 krw Exp $ */ +/* $OpenBSD: twe.c,v 1.63 2020/09/22 19:32:53 krw Exp $ */ /* * Copyright (c) 2000-2002 Michael Shalayeff. All rights reserved. @@ -708,8 +708,8 @@ twe_done(sc, ccb) dmap = ccb->ccb_dmamap; if (xs) { - if (xs->cmd->opcode != PREVENT_ALLOW && - xs->cmd->opcode != SYNCHRONIZE_CACHE) { + if (xs->cmd.opcode != PREVENT_ALLOW && + xs->cmd.opcode != SYNCHRONIZE_CACHE) { bus_dmamap_sync(sc->dmat, dmap, 0, dmap->dm_mapsize, (xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); @@ -800,13 +800,13 @@ twe_scsi_cmd(xs) xs->error = XS_NOERROR; - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case TEST_UNIT_READY: case START_STOP: #if 0 case VERIFY: #endif - TWE_DPRINTF(TWE_D_CMD, ("opc %d tgt %d ", xs->cmd->opcode, + TWE_DPRINTF(TWE_D_CMD, ("opc %d tgt %d ", xs->cmd.opcode, target)); break; @@ -860,21 +860,21 @@ twe_scsi_cmd(xs) lock = TWE_LOCK(sc); flags = 0; - if (xs->cmd->opcode == SYNCHRONIZE_CACHE) { + if (xs->cmd.opcode == SYNCHRONIZE_CACHE) { blockno = blockcnt = 0; } else { /* A read or write operation. */ if (xs->cmdlen == 6) { - rw = (struct scsi_rw *)xs->cmd; + rw = (struct scsi_rw *)&xs->cmd; blockno = _3btol(rw->addr) & (SRW_TOPADDR << 16 | 0xffff); blockcnt = rw->length ? rw->length : 0x100; } else { - rw10 = (struct scsi_rw_10 *)xs->cmd; + rw10 = (struct scsi_rw_10 *)&xs->cmd; blockno = _4btol(rw10->addr); blockcnt = _2btol(rw10->length); /* reflect DPO & FUA flags */ - if (xs->cmd->opcode == WRITE_10 && + if (xs->cmd.opcode == WRITE_10 && rw10->byte2 & 0x18) flags = TWE_FLAGS_CACHEDISABLE; } @@ -890,7 +890,7 @@ twe_scsi_cmd(xs) } } - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case READ_COMMAND: op = TWE_CMD_READ; break; case READ_10: op = TWE_CMD_READ; break; case WRITE_COMMAND: op = TWE_CMD_WRITE; break; @@ -925,7 +925,7 @@ twe_scsi_cmd(xs) default: TWE_DPRINTF(TWE_D_CMD, ("unsupported scsi command %#x tgt %d ", - xs->cmd->opcode, target)); + xs->cmd.opcode, target)); xs->error = XS_DRIVER_STUFFUP; } diff --git a/sys/dev/ic/uha.c b/sys/dev/ic/uha.c index 5e949d5c8d1..2278bef9385 100644 --- a/sys/dev/ic/uha.c +++ b/sys/dev/ic/uha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uha.c,v 1.38 2020/07/29 12:09:47 krw Exp $ */ +/* $OpenBSD: uha.c,v 1.39 2020/09/22 19:32:53 krw Exp $ */ /* $NetBSD: uha.c,v 1.3 1996/10/13 01:37:29 christos Exp $ */ /* * Copyright (c) 1994, 1996 Charles M. Hannum. All rights reserved. @@ -295,7 +295,7 @@ uha_scsi_cmd(xs) mscp->opcode = UHA_TSP; /* XXX Not for tapes. */ mscp->ca = 0x01; - bcopy(xs->cmd, &mscp->scsi_cmd, mscp->scsi_cmd_length); + bcopy(&xs->cmd, &mscp->scsi_cmd, mscp->scsi_cmd_length); } mscp->xdir = UHA_SDET; mscp->dcn = 0x00; diff --git a/sys/dev/ic/wd33c93.c b/sys/dev/ic/wd33c93.c index 78035b84860..52b7e6e16e5 100644 --- a/sys/dev/ic/wd33c93.c +++ b/sys/dev/ic/wd33c93.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wd33c93.c,v 1.18 2020/07/20 14:41:13 krw Exp $ */ +/* $OpenBSD: wd33c93.c,v 1.19 2020/09/22 19:32:53 krw Exp $ */ /* $NetBSD: wd33c93.c,v 1.24 2010/11/13 13:52:02 uebayasi Exp $ */ /* @@ -549,7 +549,7 @@ wd33c93_scsi_cmd(struct scsi_xfer *xs) * to be six bytes long. */ if (sc->sc_chip <= SBIC_CHIP_WD33C93) { - switch (xs->cmd->opcode >> 5) { + switch (xs->cmd.opcode >> 5) { case 0: case 1: case 5: @@ -575,8 +575,8 @@ wd33c93_scsi_cmd(struct scsi_xfer *xs) * time to recover when the target powers down (the fewer * targets on the bus, the larger the time needed to recover). */ - if (xs->cmd->opcode == START_STOP && - ((struct scsi_start_stop *)xs->cmd)->how == SSS_STOP) { + if (xs->cmd.opcode == START_STOP && + ((struct scsi_start_stop *)&xs->cmd)->how == SSS_STOP) { if (xs->timeout < 30000) xs->timeout = 30000; } @@ -593,7 +593,7 @@ wd33c93_scsi_cmd(struct scsi_xfer *xs) acb->timeout = xs->timeout; timeout_set(&acb->to, wd33c93_timeout, acb); - memcpy(&acb->cmd, xs->cmd, xs->cmdlen); + memcpy(&acb->cmd, &xs->cmd, xs->cmdlen); acb->clen = xs->cmdlen; acb->daddr = xs->data; acb->dleft = xs->datalen; diff --git a/sys/dev/isa/wds.c b/sys/dev/isa/wds.c index d90f63fb18e..34d98044b9a 100644 --- a/sys/dev/isa/wds.c +++ b/sys/dev/isa/wds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wds.c,v 1.56 2020/07/29 12:13:05 krw Exp $ */ +/* $OpenBSD: wds.c,v 1.57 2020/09/22 19:32:53 krw Exp $ */ /* $NetBSD: wds.c,v 1.13 1996/11/03 16:20:31 mycroft Exp $ */ #undef WDSDIAG @@ -893,7 +893,7 @@ wds_scsi_cmd(struct scsi_xfer *xs) /* Zero out the command structure. */ bzero(&scb->cmd, sizeof scb->cmd); - bcopy(xs->cmd, &scb->cmd.scb, xs->cmdlen < 12 ? xs->cmdlen : 12); + bcopy(&xs->cmd, &scb->cmd.scb, xs->cmdlen < 12 ? xs->cmdlen : 12); /* Set up some of the command fields. */ scb->cmd.targ = (xs->sc_link->target << 5) | xs->sc_link->lun; diff --git a/sys/dev/pci/arc.c b/sys/dev/pci/arc.c index 7ddeddf7b14..51b1609ae4c 100644 --- a/sys/dev/pci/arc.c +++ b/sys/dev/pci/arc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arc.c,v 1.119 2020/07/24 12:43:31 krw Exp $ */ +/* $OpenBSD: arc.c,v 1.120 2020/09/22 19:32:53 krw Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -1165,7 +1165,7 @@ arc_scsi_cmd(struct scsi_xfer *xs) cmd->data_len = htole32(xs->datalen); - bcopy(xs->cmd, cmd->cdb, xs->cmdlen); + bcopy(&xs->cmd, cmd->cdb, xs->cmdlen); /* we've built the command, let's put it on the hw */ bus_dmamap_sync(sc->sc_dmat, ARC_DMA_MAP(sc->sc_requests), diff --git a/sys/dev/pci/ips.c b/sys/dev/pci/ips.c index 090bf0f30b5..178cdfaa448 100644 --- a/sys/dev/pci/ips.c +++ b/sys/dev/pci/ips.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ips.c,v 1.131 2020/09/05 13:05:06 krw Exp $ */ +/* $OpenBSD: ips.c,v 1.132 2020/09/22 19:32:53 krw Exp $ */ /* * Copyright (c) 2006, 2007, 2009 Alexander Yurchenko <grange@openbsd.org> @@ -844,7 +844,7 @@ ips_scsi_cmd(struct scsi_xfer *xs) DPRINTF(IPS_D_XFER, ("%s: ips_scsi_cmd: xs %p, target %d, " "opcode 0x%02x, flags 0x%x\n", sc->sc_dev.dv_xname, xs, target, - xs->cmd->opcode, xs->flags)); + xs->cmd.opcode, xs->flags)); if (target >= sc->sc_nunits || link->lun != 0) { DPRINTF(IPS_D_INFO, ("%s: ips_scsi_cmd: invalid params " @@ -859,18 +859,18 @@ ips_scsi_cmd(struct scsi_xfer *xs) xs->error = XS_NOERROR; /* Fake SCSI commands */ - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case READ_10: case READ_COMMAND: case WRITE_10: case WRITE_COMMAND: if (xs->cmdlen == sizeof(struct scsi_rw)) { - rw = (void *)xs->cmd; + rw = (void *)&xs->cmd; blkno = _3btol(rw->addr) & (SRW_TOPADDR << 16 | 0xffff); blkcnt = rw->length ? rw->length : 0x100; } else { - rw10 = (void *)xs->cmd; + rw10 = (void *)&xs->cmd; blkno = _4btol(rw10->addr); blkcnt = _2btol(rw10->length); } @@ -949,7 +949,7 @@ ips_scsi_cmd(struct scsi_xfer *xs) break; default: DPRINTF(IPS_D_INFO, ("%s: unsupported scsi command 0x%02x\n", - sc->sc_dev.dv_xname, xs->cmd->opcode)); + sc->sc_dev.dv_xname, xs->cmd.opcode)); xs->error = XS_DRIVER_STUFFUP; } @@ -971,7 +971,7 @@ ips_scsi_pt_cmd(struct scsi_xfer *xs) DPRINTF(IPS_D_XFER, ("%s: ips_scsi_pt_cmd: xs %p, chan %d, target %d, " "opcode 0x%02x, flags 0x%x\n", sc->sc_dev.dv_xname, xs, chan, - target, xs->cmd->opcode, xs->flags)); + target, xs->cmd.opcode, xs->flags)); if (pt->pt_procdev[0] == '\0' && target == pt->pt_proctgt && dev) strlcpy(pt->pt_procdev, dev->dv_xname, sizeof(pt->pt_procdev)); @@ -1022,7 +1022,7 @@ ips_scsi_pt_cmd(struct scsi_xfer *xs) dcdb->datalen = htole16(xs->datalen); dcdb->cdblen = xs->cmdlen; dcdb->senselen = MIN(sizeof(xs->sense), sizeof(dcdb->sense)); - memcpy(dcdb->cdb, xs->cmd, xs->cmdlen); + memcpy(dcdb->cdb, &xs->cmd, xs->cmdlen); if (ips_load_xs(sc, ccb, xs)) { DPRINTF(IPS_D_ERR, ("%s: ips_scsi_pt_cmd: ips_load_xs " @@ -1507,7 +1507,7 @@ ips_done_pt(struct ips_softc *sc, struct ips_ccb *ccb) memcpy(&xs->sense, dcdb->sense, MIN(sizeof(xs->sense), sizeof(dcdb->sense))); - if (xs->cmd->opcode == INQUIRY && xs->error == XS_NOERROR) { + if (xs->cmd.opcode == INQUIRY && xs->error == XS_NOERROR) { int type = ((struct scsi_inquiry_data *)xs->data)->device & SID_TYPE; diff --git a/sys/dev/pci/mfii.c b/sys/dev/pci/mfii.c index 9729c4575fc..3d3fa6bf8f2 100644 --- a/sys/dev/pci/mfii.c +++ b/sys/dev/pci/mfii.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfii.c,v 1.81 2020/09/01 12:17:53 krw Exp $ */ +/* $OpenBSD: mfii.c,v 1.82 2020/09/22 19:32:53 krw Exp $ */ /* * Copyright (c) 2012 David Gwynne <dlg@openbsd.org> @@ -2088,7 +2088,7 @@ mfii_scsi_cmd(struct scsi_xfer *xs) timeout_set(&xs->stimeout, mfii_scsi_cmd_tmo, xs); - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case READ_COMMAND: case READ_10: case READ_12: @@ -2297,7 +2297,7 @@ mfii_scsi_cmd_io(struct mfii_softc *sc, struct scsi_xfer *xs) io->direction = MPII_SCSIIO_DIR_NONE; break; } - memcpy(io->cdb, xs->cmd, xs->cmdlen); + memcpy(io->cdb, &xs->cmd, xs->cmdlen); ctx->type_nseg = sc->sc_iop->ldio_ctx_type_nseg; ctx->timeout_value = htole16(0x14); /* XXX */ @@ -2356,7 +2356,7 @@ mfii_scsi_cmd_cdb(struct mfii_softc *sc, struct scsi_xfer *xs) io->direction = MPII_SCSIIO_DIR_NONE; break; } - memcpy(io->cdb, xs->cmd, xs->cmdlen); + memcpy(io->cdb, &xs->cmd, xs->cmdlen); ctx->virtual_disk_target_id = htole16(link->target); @@ -2472,7 +2472,7 @@ mfii_pd_scsi_cmd_cdb(struct mfii_softc *sc, struct scsi_xfer *xs) io->direction = MPII_SCSIIO_DIR_NONE; break; } - memcpy(io->cdb, xs->cmd, xs->cmdlen); + memcpy(io->cdb, &xs->cmd, xs->cmdlen); ctx->virtual_disk_target_id = htole16(link->target); ctx->raid_flags = MFII_RAID_CTX_IO_TYPE_SYSPD; diff --git a/sys/dev/pci/mpii.c b/sys/dev/pci/mpii.c index 90e7f09e16a..32694d2f38d 100644 --- a/sys/dev/pci/mpii.c +++ b/sys/dev/pci/mpii.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpii.c,v 1.139 2020/08/26 13:57:19 krw Exp $ */ +/* $OpenBSD: mpii.c,v 1.140 2020/09/22 19:32:53 krw Exp $ */ /* * Copyright (c) 2010, 2012 Mike Belopuhov * Copyright (c) 2009 James Giannoules @@ -2955,7 +2955,7 @@ mpii_scsi_cmd(struct scsi_xfer *xs) io->tagging = MPII_SCSIIO_ATTR_SIMPLE_Q; - memcpy(io->cdb, xs->cmd, xs->cmdlen); + memcpy(io->cdb, &xs->cmd, xs->cmdlen); htolem32(&io->data_length, xs->datalen); @@ -3098,7 +3098,7 @@ mpii_scsi_cmd_done(struct mpii_ccb *ccb) sie = ccb->ccb_rcb->rcb_reply; DNPRINTF(MPII_D_CMD, "%s: mpii_scsi_cmd_done xs cmd: 0x%02x len: %d " - "flags 0x%x\n", DEVNAME(sc), xs->cmd->opcode, xs->datalen, + "flags 0x%x\n", DEVNAME(sc), xs->cmd.opcode, xs->datalen, xs->flags); DNPRINTF(MPII_D_CMD, "%s: dev_handle: %d msg_length: %d " "function: 0x%02x\n", DEVNAME(sc), lemtoh16(&sie->dev_handle), diff --git a/sys/dev/pci/qle.c b/sys/dev/pci/qle.c index cee23004f65..0c83be39e6b 100644 --- a/sys/dev/pci/qle.c +++ b/sys/dev/pci/qle.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qle.c,v 1.60 2020/07/22 13:16:05 krw Exp $ */ +/* $OpenBSD: qle.c,v 1.61 2020/09/22 19:32:53 krw Exp $ */ /* * Copyright (c) 2013, 2014 Jonathan Matthew <jmatthew@openbsd.org> @@ -2635,7 +2635,7 @@ qle_put_cmd(struct qle_softc *sc, void *buf, struct scsi_xfer *xs, htobem16(&cmnd->fcp_lun[1], lun >> 16); /* cmnd->fcp_task_attr = TSK_SIMPLE; */ /* cmnd->fcp_task_mgmt = 0; */ - memcpy(cmnd->fcp_cdb, xs->cmd, xs->cmdlen); + memcpy(cmnd->fcp_cdb, &xs->cmd, xs->cmdlen); /* FCP_DL goes after the cdb */ fcp_dl = htobe32(xs->datalen); diff --git a/sys/dev/pci/vmwpvs.c b/sys/dev/pci/vmwpvs.c index e9b0876050f..a334d7c805b 100644 --- a/sys/dev/pci/vmwpvs.c +++ b/sys/dev/pci/vmwpvs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmwpvs.c,v 1.23 2020/07/22 13:16:05 krw Exp $ */ +/* $OpenBSD: vmwpvs.c,v 1.24 2020/09/22 19:32:53 krw Exp $ */ /* * Copyright (c) 2013 David Gwynne <dlg@openbsd.org> @@ -930,7 +930,7 @@ vmwpvs_scsi_cmd(struct scsi_xfer *xs) break; } - memcpy(r->cdb, xs->cmd, xs->cmdlen); + memcpy(r->cdb, &xs->cmd, xs->cmdlen); r->cdblen = xs->cmdlen; r->lun[1] = link->lun; /* ugly :( */ r->tag = MSG_SIMPLE_Q_TAG; diff --git a/sys/dev/pv/hvs.c b/sys/dev/pv/hvs.c index 0d5e6523561..84b43e5edd4 100644 --- a/sys/dev/pv/hvs.c +++ b/sys/dev/pv/hvs.c @@ -361,7 +361,7 @@ hvs_scsi_cmd(struct scsi_xfer *xs) srb->srb_lun = link->lun; srb->srb_cdblen = xs->cmdlen; - memcpy(srb->srb_data, xs->cmd, xs->cmdlen); + memcpy(srb->srb_data, &xs->cmd, xs->cmdlen); switch (xs->flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) { case SCSI_DATA_IN: @@ -424,7 +424,7 @@ hvs_scsi_cmd(struct scsi_xfer *xs) #ifdef HVS_DEBUG_IO DPRINTF("%s: %u.%u: rid %llu opcode %#x flags %#x datalen %d\n", sc->sc_dev.dv_xname, link->target, link->lun, ccb->ccb_rid, - xs->cmd->opcode, xs->flags, xs->datalen); + xs->cmd.opcode, xs->flags, xs->datalen); #endif if (xs->flags & SCSI_POLL) @@ -664,7 +664,7 @@ hvs_scsi_cmd_done(struct hvs_ccb *ccb) } if (error == XS_NOERROR) { - if (xs->cmd->opcode == INQUIRY) + if (xs->cmd.opcode == INQUIRY) fixup_inquiry(xs, srb); else if (srb->srb_direction != SRB_DATA_NONE) xs->resid = xs->datalen - srb->srb_datalen; diff --git a/sys/dev/pv/vioblk.c b/sys/dev/pv/vioblk.c index c5a62c0feb4..1788717ba12 100644 --- a/sys/dev/pv/vioblk.c +++ b/sys/dev/pv/vioblk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vioblk.c,v 1.30 2020/09/05 13:05:07 krw Exp $ */ +/* $OpenBSD: vioblk.c,v 1.31 2020/09/22 19:32:53 krw Exp $ */ /* * Copyright (c) 2012 Stefan Fritsch. @@ -406,7 +406,7 @@ vioblk_scsi_cmd(struct scsi_xfer *xs) u_int32_t sector_count = 0; uint8_t operation; - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case READ_COMMAND: case READ_10: case READ_12: @@ -447,7 +447,7 @@ vioblk_scsi_cmd(struct scsi_xfer *xs) return; default: - printf("%s cmd 0x%02x\n", __func__, xs->cmd->opcode); + printf("%s cmd 0x%02x\n", __func__, xs->cmd.opcode); case MODE_SENSE: case MODE_SENSE_BIG: case REPORT_LUNS: @@ -460,19 +460,19 @@ vioblk_scsi_cmd(struct scsi_xfer *xs) * layout as 10-byte READ/WRITE commands. */ if (xs->cmdlen == 6) { - rw = (struct scsi_rw *)xs->cmd; + rw = (struct scsi_rw *)&xs->cmd; lba = _3btol(rw->addr) & (SRW_TOPADDR << 16 | 0xffff); sector_count = rw->length ? rw->length : 0x100; } else if (xs->cmdlen == 10) { - rw10 = (struct scsi_rw_10 *)xs->cmd; + rw10 = (struct scsi_rw_10 *)&xs->cmd; lba = _4btol(rw10->addr); sector_count = _2btol(rw10->length); } else if (xs->cmdlen == 12) { - rw12 = (struct scsi_rw_12 *)xs->cmd; + rw12 = (struct scsi_rw_12 *)&xs->cmd; lba = _4btol(rw12->addr); sector_count = _4btol(rw12->length); } else if (xs->cmdlen == 16) { - rw16 = (struct scsi_rw_16 *)xs->cmd; + rw16 = (struct scsi_rw_16 *)&xs->cmd; lba = _8btol(rw16->addr); sector_count = _4btol(rw16->length); } @@ -562,7 +562,7 @@ out_done: void vioblk_scsi_inq(struct scsi_xfer *xs) { - struct scsi_inquiry *inq = (struct scsi_inquiry *)xs->cmd; + struct scsi_inquiry *inq = (struct scsi_inquiry *)&xs->cmd; struct scsi_inquiry_data inqd; if (ISSET(inq->flags, SI_EVPD)) { diff --git a/sys/dev/pv/vioscsi.c b/sys/dev/pv/vioscsi.c index 85a3f996ffc..aa2a1ccd8f2 100644 --- a/sys/dev/pv/vioscsi.c +++ b/sys/dev/pv/vioscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vioscsi.c,v 1.25 2020/07/22 13:16:05 krw Exp $ */ +/* $OpenBSD: vioscsi.c,v 1.26 2020/09/22 19:32:53 krw Exp $ */ /* * Copyright (c) 2013 Google Inc. * @@ -212,7 +212,7 @@ vioscsi_scsi_cmd(struct scsi_xfer *xs) if ((size_t)xs->cmdlen > sizeof(req->cdb)) goto stuffup; memset(req->cdb, 0, sizeof(req->cdb)); - memcpy(req->cdb, xs->cmd, xs->cmdlen); + memcpy(req->cdb, &xs->cmd, xs->cmdlen); int isread = !!(xs->flags & SCSI_DATA_IN); diff --git a/sys/dev/pv/xbf.c b/sys/dev/pv/xbf.c index 9ad437687d4..d635214664e 100644 --- a/sys/dev/pv/xbf.c +++ b/sys/dev/pv/xbf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xbf.c,v 1.48 2020/09/05 13:05:07 krw Exp $ */ +/* $OpenBSD: xbf.c,v 1.49 2020/09/22 19:32:53 krw Exp $ */ /* * Copyright (c) 2016, 2017 Mike Belopuhov @@ -385,7 +385,7 @@ xbf_scsi_cmd(struct scsi_xfer *xs) { struct xbf_softc *sc = xs->sc_link->bus->sb_adapter_softc; - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case READ_COMMAND: case READ_10: case READ_12: @@ -420,7 +420,7 @@ xbf_scsi_cmd(struct scsi_xfer *xs) xbf_scsi_done(xs, XS_NOERROR); return; default: - printf("%s cmd 0x%02x\n", __func__, xs->cmd->opcode); + printf("%s cmd 0x%02x\n", __func__, xs->cmd.opcode); case MODE_SENSE: case MODE_SENSE_BIG: case REPORT_LUNS: @@ -436,7 +436,7 @@ xbf_scsi_cmd(struct scsi_xfer *xs) if (ISSET(xs->flags, SCSI_POLL) && xbf_poll_cmd(xs)) { printf("%s: op %#x timed out\n", sc->sc_dev.dv_xname, - xs->cmd->opcode); + xs->cmd.opcode); if (sc->sc_state == XBF_CONNECTED) { xbf_reclaim_cmd(xs); xbf_scsi_done(xs, XS_TIMEOUT); @@ -617,7 +617,7 @@ xbf_submit_cmd(struct scsi_xfer *xs) unsigned int ndesc = 0; int desc, error; - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case READ_COMMAND: case READ_10: case READ_12: @@ -645,19 +645,19 @@ xbf_submit_cmd(struct scsi_xfer *xs) * has the same layout as 10-byte READ/WRITE commands. */ if (xs->cmdlen == 6) { - rw = (struct scsi_rw *)xs->cmd; + rw = (struct scsi_rw *)&xs->cmd; lba = _3btol(rw->addr) & (SRW_TOPADDR << 16 | 0xffff); nblk = rw->length ? rw->length : 0x100; } else if (xs->cmdlen == 10) { - rw10 = (struct scsi_rw_10 *)xs->cmd; + rw10 = (struct scsi_rw_10 *)&xs->cmd; lba = _4btol(rw10->addr); nblk = _2btol(rw10->length); } else if (xs->cmdlen == 12) { - rw12 = (struct scsi_rw_12 *)xs->cmd; + rw12 = (struct scsi_rw_12 *)&xs->cmd; lba = _4btol(rw12->addr); nblk = _4btol(rw12->length); } else if (xs->cmdlen == 16) { - rw16 = (struct scsi_rw_16 *)xs->cmd; + rw16 = (struct scsi_rw_16 *)&xs->cmd; lba = _8btol(rw16->addr); nblk = _4btol(rw16->length); } @@ -809,7 +809,7 @@ xbf_complete_cmd(struct xbf_softc *sc, struct xbf_ccb_queue *cq, int desc) void xbf_scsi_inq(struct scsi_xfer *xs) { - struct scsi_inquiry *inq = (struct scsi_inquiry *)xs->cmd; + struct scsi_inquiry *inq = (struct scsi_inquiry *)&xs->cmd; if (ISSET(inq->flags, SI_EVPD)) xbf_scsi_done(xs, XS_DRIVER_STUFFUP); diff --git a/sys/dev/sdmmc/sdmmc_scsi.c b/sys/dev/sdmmc/sdmmc_scsi.c index b5f45672563..0b7ffa260a9 100644 --- a/sys/dev/sdmmc/sdmmc_scsi.c +++ b/sys/dev/sdmmc/sdmmc_scsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmc_scsi.c,v 1.57 2020/09/05 13:05:07 krw Exp $ */ +/* $OpenBSD: sdmmc_scsi.c,v 1.58 2020/09/22 19:32:53 krw Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -290,11 +290,11 @@ sdmmc_scsi_decode_rw(struct scsi_xfer *xs, u_int32_t *blocknop, struct scsi_rw_10 *rw10; if (xs->cmdlen == 6) { - rw = (struct scsi_rw *)xs->cmd; + rw = (struct scsi_rw *)&xs->cmd; *blocknop = _3btol(rw->addr) & (SRW_TOPADDR << 16 | 0xffff); *blockcntp = rw->length ? rw->length : 0x100; } else { - rw10 = (struct scsi_rw_10 *)xs->cmd; + rw10 = (struct scsi_rw_10 *)&xs->cmd; *blocknop = _4btol(rw10->addr); *blockcntp = _2btol(rw10->length); } @@ -323,12 +323,12 @@ sdmmc_scsi_cmd(struct scsi_xfer *xs) } DPRINTF(("%s: scsi cmd target=%d opcode=%#x proc=\"%s\" (poll=%#x)\n", - DEVNAME(sc), link->target, xs->cmd->opcode, curproc ? + DEVNAME(sc), link->target, xs->cmd.pcode, curproc ? curproc->p_p->ps_comm : "", xs->flags & SCSI_POLL)); xs->error = XS_NOERROR; - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case READ_COMMAND: case READ_10: case WRITE_COMMAND: @@ -356,7 +356,7 @@ sdmmc_scsi_cmd(struct scsi_xfer *xs) default: DPRINTF(("%s: unsupported scsi command %#x\n", - DEVNAME(sc), xs->cmd->opcode)); + DEVNAME(sc), xs->cmd.opcode)); xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); return; @@ -391,7 +391,7 @@ sdmmc_inquiry(struct scsi_xfer *xs) struct sdmmc_scsi_softc *scbus = sc->sc_scsibus; struct sdmmc_scsi_target *tgt = &scbus->sc_tgt[link->target]; struct scsi_inquiry_data inq; - struct scsi_inquiry *cdb = (struct scsi_inquiry *)xs->cmd; + struct scsi_inquiry *cdb = (struct scsi_inquiry *)&xs->cmd; char vendor[sizeof(inq.vendor) + 1]; char product[sizeof(inq.product) + 1]; char revision[sizeof(inq.revision) + 1]; @@ -486,7 +486,7 @@ sdmmc_complete_xs(void *arg) int s; DPRINTF(("%s: scsi cmd target=%d opcode=%#x proc=\"%s\" (poll=%#x)" - " complete\n", DEVNAME(sc), link->target, xs->cmd->opcode, + " complete\n", DEVNAME(sc), link->target, xs->cmd.opcode, curproc ? curproc->p_p->ps_comm : "", xs->flags & SCSI_POLL)); s = splbio(); @@ -517,7 +517,7 @@ sdmmc_done_xs(struct sdmmc_ccb *ccb) timeout_del(&xs->stimeout); DPRINTF(("%s: scsi cmd target=%d opcode=%#x proc=\"%s\" (error=%#x)" - " done\n", DEVNAME(sc), link->target, xs->cmd->opcode, + " done\n", DEVNAME(sc), link->target, xs->cmd.opcode, curproc ? curproc->p_p->ps_comm : "", xs->error)); xs->resid = 0; diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index 78e06f86c3c..b204464b25c 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.414 2020/09/05 13:05:06 krw Exp $ */ +/* $OpenBSD: softraid.c,v 1.415 2020/09/22 19:32:52 krw Exp $ */ /* * Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -2351,7 +2351,7 @@ sr_scsi_cmd(struct scsi_xfer *xs) wu->swu_state = SR_WU_INPROGRESS; wu->swu_xs = xs; - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case READ_COMMAND: case READ_10: case READ_16: @@ -2359,7 +2359,7 @@ sr_scsi_cmd(struct scsi_xfer *xs) case WRITE_10: case WRITE_16: DNPRINTF(SR_D_CMD, "%s: sr_scsi_cmd: READ/WRITE %02x\n", - DEVNAME(sc), xs->cmd->opcode); + DEVNAME(sc), xs->cmd.opcode); if (sd->sd_scsi_rw(wu)) goto stuffup; break; @@ -2395,7 +2395,7 @@ sr_scsi_cmd(struct scsi_xfer *xs) case READ_CAPACITY: case READ_CAPACITY_16: DNPRINTF(SR_D_CMD, "%s: sr_scsi_cmd READ CAPACITY 0x%02x\n", - DEVNAME(sc), xs->cmd->opcode); + DEVNAME(sc), xs->cmd.opcode); if (sd->sd_scsi_read_cap(wu)) goto stuffup; goto complete; @@ -2409,7 +2409,7 @@ sr_scsi_cmd(struct scsi_xfer *xs) default: DNPRINTF(SR_D_CMD, "%s: unsupported scsi command %x\n", - DEVNAME(sc), xs->cmd->opcode); + DEVNAME(sc), xs->cmd.opcode); /* XXX might need to add generic function to handle others */ goto stuffup; } @@ -4011,7 +4011,7 @@ sr_raid_inquiry(struct sr_workunit *wu) { struct sr_discipline *sd = wu->swu_dis; struct scsi_xfer *xs = wu->swu_xs; - struct scsi_inquiry *cdb = (struct scsi_inquiry *)xs->cmd; + struct scsi_inquiry *cdb = (struct scsi_inquiry *)&xs->cmd; struct scsi_inquiry_data inq; DNPRINTF(SR_D_DIS, "%s: sr_raid_inquiry\n", DEVNAME(sd->sd_sc)); @@ -4056,7 +4056,7 @@ sr_raid_read_cap(struct sr_workunit *wu) secsize = sd->sd_meta->ssdi.ssd_secsize; addr = ((sd->sd_meta->ssdi.ssd_size * DEV_BSIZE) / secsize) - 1; - if (xs->cmd->opcode == READ_CAPACITY) { + if (xs->cmd.opcode == READ_CAPACITY) { bzero(&rcd, sizeof(rcd)); if (addr > 0xffffffffllu) _lto4b(0xffffffff, rcd.addr); @@ -4065,7 +4065,7 @@ sr_raid_read_cap(struct sr_workunit *wu) _lto4b(secsize, rcd.length); sr_copy_internal_data(xs, &rcd, sizeof(rcd)); rv = 0; - } else if (xs->cmd->opcode == READ_CAPACITY_16) { + } else if (xs->cmd.opcode == READ_CAPACITY_16) { bzero(&rcd16, sizeof(rcd16)); _lto8b(addr, rcd16.addr); _lto4b(secsize, rcd16.length); @@ -4124,7 +4124,7 @@ int sr_raid_start_stop(struct sr_workunit *wu) { struct scsi_xfer *xs = wu->swu_xs; - struct scsi_start_stop *ss = (struct scsi_start_stop *)xs->cmd; + struct scsi_start_stop *ss = (struct scsi_start_stop *)&xs->cmd; DNPRINTF(SR_D_DIS, "%s: sr_raid_start_stop\n", DEVNAME(wu->swu_dis->sd_sc)); @@ -4579,7 +4579,7 @@ sr_validate_io(struct sr_workunit *wu, daddr_t *blkno, char *func) int rv = 1; DNPRINTF(SR_D_DIS, "%s: %s 0x%02x\n", DEVNAME(sd->sd_sc), func, - xs->cmd->opcode); + xs->cmd.opcode); if (sd->sd_meta->ssd_data_blkno == 0) panic("invalid data blkno"); @@ -4597,11 +4597,11 @@ sr_validate_io(struct sr_workunit *wu, daddr_t *blkno, char *func) } if (xs->cmdlen == 10) - *blkno = _4btol(((struct scsi_rw_10 *)xs->cmd)->addr); + *blkno = _4btol(((struct scsi_rw_10 *)&xs->cmd)->addr); else if (xs->cmdlen == 16) - *blkno = _8btol(((struct scsi_rw_16 *)xs->cmd)->addr); + *blkno = _8btol(((struct scsi_rw_16 *)&xs->cmd)->addr); else if (xs->cmdlen == 6) - *blkno = _3btol(((struct scsi_rw *)xs->cmd)->addr); + *blkno = _3btol(((struct scsi_rw *)&xs->cmd)->addr); else { printf("%s: %s: illegal cmdlen for %s\n", DEVNAME(sd->sd_sc), func, sd->sd_meta->ssd_devname); @@ -4724,8 +4724,7 @@ sr_rebuild(struct sr_discipline *sd) xs_r.datalen = sz << DEV_BSHIFT; xs_r.data = buf; xs_r.cmdlen = sizeof(*cr); - xs_r.cmd = &xs_r.cmdstore; - cr = (struct scsi_rw_16 *)xs_r.cmd; + cr = (struct scsi_rw_16 *)&xs_r.cmd; cr->opcode = READ_16; _lto4b(sz, cr->length); _lto8b(lba, cr->addr); @@ -4745,8 +4744,7 @@ sr_rebuild(struct sr_discipline *sd) xs_w.datalen = sz << DEV_BSHIFT; xs_w.data = buf; xs_w.cmdlen = sizeof(*cw); - xs_w.cmd = &xs_w.cmdstore; - cw = (struct scsi_rw_16 *)xs_w.cmd; + cw = (struct scsi_rw_16 *)&xs_w.cmd; cw->opcode = WRITE_16; _lto4b(sz, cw->length); _lto8b(lba, cw->addr); diff --git a/sys/dev/usb/umass_scsi.c b/sys/dev/usb/umass_scsi.c index a5a94d6acab..b3157c41eec 100644 --- a/sys/dev/usb/umass_scsi.c +++ b/sys/dev/usb/umass_scsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umass_scsi.c,v 1.60 2020/08/26 13:57:20 krw Exp $ */ +/* $OpenBSD: umass_scsi.c,v 1.61 2020/09/22 19:32:53 krw Exp $ */ /* $NetBSD: umass_scsipi.c,v 1.9 2003/02/16 23:14:08 augustss Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -188,7 +188,7 @@ umass_scsi_cmd(struct scsi_xfer *xs) DPRINTF(UDMASS_CMD, ("%s: umass_scsi_cmd: at %lld.%06ld: %d:%d " "xs=%p cmd=0x%02x datalen=%d (quirks=0x%x, poll=%d)\n", sc->sc_dev.dv_xname, (long long)sc->tv.tv_sec, sc->tv.tv_usec, - sc_link->target, sc_link->lun, xs, xs->cmd->opcode, + sc_link->target, sc_link->lun, xs, xs->cmd.opcode, xs->datalen, sc_link->quirks, xs->flags & SCSI_POLL)); if (usbd_is_dying(sc->sc_udev)) { @@ -205,7 +205,7 @@ umass_scsi_cmd(struct scsi_xfer *xs) } #endif - cmd = xs->cmd; + cmd = &xs->cmd; cmdlen = xs->cmdlen; dir = DIR_NONE; @@ -302,7 +302,7 @@ umass_scsi_cb(struct umass_softc *sc, void *priv, int residue, int status) * response, omitting response data from the * "vendor specific data" on... */ - if (xs->cmd->opcode == INQUIRY && + if (xs->cmd.opcode == INQUIRY && residue < xs->datalen) { xs->error = XS_NOERROR; break; @@ -314,7 +314,7 @@ umass_scsi_cb(struct umass_softc *sc, void *priv, int residue, int status) /* FALLTHROUGH */ case STATUS_CMD_FAILED: DPRINTF(UDMASS_CMD, ("umass_scsi_cb: status cmd failed for " - "scsi op 0x%02x\n", xs->cmd->opcode)); + "scsi op 0x%02x\n", xs->cmd.opcode)); /* fetch sense data */ sc->sc_sense = 1; memset(&scbus->sc_sense_cmd, 0, sizeof(scbus->sc_sense_cmd)); diff --git a/sys/dev/vscsi.c b/sys/dev/vscsi.c index a98519e72c2..f1edcc46355 100644 --- a/sys/dev/vscsi.c +++ b/sys/dev/vscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vscsi.c,v 1.56 2020/07/22 13:16:04 krw Exp $ */ +/* $OpenBSD: vscsi.c,v 1.57 2020/09/22 19:32:52 krw Exp $ */ /* * Copyright (c) 2008 David Gwynne <dlg@openbsd.org> @@ -169,7 +169,7 @@ vscsi_cmd(struct scsi_xfer *xs) if (ISSET(xs->flags, SCSI_POLL) && ISSET(xs->flags, SCSI_NOSLEEP)) { printf("%s: POLL && NOSLEEP for 0x%02x\n", DEVNAME(sc), - xs->cmd->opcode); + xs->cmd.opcode); xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); return; @@ -351,7 +351,7 @@ vscsi_i2t(struct vscsi_softc *sc, struct vscsi_ioc_i2t *i2t) i2t->tag = ccb->ccb_tag; i2t->target = link->target; i2t->lun = link->lun; - memcpy(&i2t->cmd, xs->cmd, xs->cmdlen); + memcpy(&i2t->cmd, &xs->cmd, xs->cmdlen); i2t->cmdlen = xs->cmdlen; i2t->datalen = xs->datalen; diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index eea24157406..b5185a10e91 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd.c,v 1.261 2020/09/01 12:17:53 krw Exp $ */ +/* $OpenBSD: cd.c,v 1.262 2020/09/22 19:32:53 krw Exp $ */ /* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */ /* @@ -587,12 +587,12 @@ cdstart(struct scsi_xfer *xs) (SID_ANSII_REV(&link->inqdata) < SCSI_REV_2) && ((secno & 0x1fffff) == secno) && ((nsecs & 0xff) == nsecs)) - xs->cmdlen = cd_cmd_rw6(xs->cmd, read, secno, nsecs); + xs->cmdlen = cd_cmd_rw6(&xs->cmd, read, secno, nsecs); else if (((secno & 0xffffffff) == secno) && ((nsecs & 0xffff) == nsecs)) - xs->cmdlen = cd_cmd_rw10(xs->cmd, read, secno, nsecs); + xs->cmdlen = cd_cmd_rw10(&xs->cmd, read, secno, nsecs); else - xs->cmdlen = cd_cmd_rw12(xs->cmd, read, secno, nsecs); + xs->cmdlen = cd_cmd_rw12(&xs->cmd, read, secno, nsecs); disk_busy(&sc->sc_dk); scsi_xs_exec(xs); @@ -1288,7 +1288,7 @@ cd_load_unload(struct cd_softc *sc, int options, int slot) xs->cmdlen = sizeof(*cmd); xs->timeout = 200000; - cmd = (struct scsi_load_unload *)xs->cmd; + cmd = (struct scsi_load_unload *)&xs->cmd; cmd->opcode = LOAD_UNLOAD; cmd->options = options; /* ioctl uses ATAPI values */ cmd->slot = slot; @@ -1353,7 +1353,7 @@ cd_play(struct cd_softc *sc, int secno, int nsecs) xs->cmdlen = sizeof(*cmd); xs->timeout = 200000; - cmd = (struct scsi_play *)xs->cmd; + cmd = (struct scsi_play *)&xs->cmd; cmd->opcode = PLAY; _lto4b(secno, cmd->blk_addr); _lto2b(nsecs, cmd->xfer_len); @@ -1440,7 +1440,7 @@ cd_play_msf(struct cd_softc *sc, int startm, int starts, int startf, int endm, xs->cmdlen = sizeof(*cmd); xs->timeout = 20000; - cmd = (struct scsi_play_msf *)xs->cmd; + cmd = (struct scsi_play_msf *)&xs->cmd; cmd->opcode = PLAY_MSF; cmd->start_m = startm; cmd->start_s = starts; @@ -1471,7 +1471,7 @@ cd_pause(struct cd_softc *sc, int go) xs->cmdlen = sizeof(*cmd); xs->timeout = 2000; - cmd = (struct scsi_pause *)xs->cmd; + cmd = (struct scsi_pause *)&xs->cmd; cmd->opcode = PAUSE; cmd->resume = go; @@ -1521,7 +1521,7 @@ cd_read_subchannel(struct cd_softc *sc, int mode, int format, int track, xs->datalen = len; xs->timeout = 5000; - cmd = (struct scsi_read_subchannel *)xs->cmd; + cmd = (struct scsi_read_subchannel *)&xs->cmd; cmd->opcode = READ_SUBCHANNEL; if (mode == CD_MSF_FORMAT) SET(cmd->byte2, CD_MSF); @@ -1558,7 +1558,7 @@ cd_read_toc(struct cd_softc *sc, int mode, int start, void *data, int len, bzero(data, len); - cmd = (struct scsi_read_toc *)xs->cmd; + cmd = (struct scsi_read_toc *)&xs->cmd; cmd->opcode = READ_TOC; if (mode == CD_MSF_FORMAT) @@ -1659,7 +1659,7 @@ dvd_auth(struct cd_softc *sc, union dvd_authinfo *a) xs->timeout = 30000; xs->data = buf; - cmd = xs->cmd; + cmd = &xs->cmd; switch (a->type) { case DVD_LU_SEND_AGID: @@ -1845,7 +1845,7 @@ dvd_read_physical(struct cd_softc *sc, union dvd_struct *s) xs->datalen = DVD_READ_PHYSICAL_BUFSIZE; xs->timeout = 30000; - cmd = xs->cmd; + cmd = &xs->cmd; cmd->opcode = GPCMD_READ_DVD_STRUCTURE; cmd->bytes[6] = s->type; _lto2b(xs->datalen, &cmd->bytes[7]); @@ -1902,7 +1902,7 @@ dvd_read_copyright(struct cd_softc *sc, union dvd_struct *s) xs->datalen = DVD_READ_COPYRIGHT_BUFSIZE; xs->timeout = 30000; - cmd = xs->cmd; + cmd = &xs->cmd; cmd->opcode = GPCMD_READ_DVD_STRUCTURE; cmd->bytes[6] = s->type; _lto2b(xs->datalen, &cmd->bytes[7]); @@ -1943,7 +1943,7 @@ dvd_read_disckey(struct cd_softc *sc, union dvd_struct *s) xs->datalen = sizeof(*buf); xs->timeout = 30000; - cmd = (struct scsi_read_dvd_structure *)xs->cmd; + cmd = (struct scsi_read_dvd_structure *)&xs->cmd; cmd->opcode = GPCMD_READ_DVD_STRUCTURE; cmd->format = s->type; cmd->agid = s->disckey.agid << 6; @@ -1983,7 +1983,7 @@ dvd_read_bca(struct cd_softc *sc, union dvd_struct *s) xs->datalen = DVD_READ_BCA_BUFLEN; xs->timeout = 30000; - cmd = xs->cmd; + cmd = &xs->cmd; cmd->opcode = GPCMD_READ_DVD_STRUCTURE; cmd->bytes[6] = s->type; _lto2b(xs->datalen, &cmd->bytes[7]); @@ -2024,7 +2024,7 @@ dvd_read_manufact(struct cd_softc *sc, union dvd_struct *s) xs->datalen = sizeof(*buf); xs->timeout = 30000; - cmd = (struct scsi_read_dvd_structure *)xs->cmd; + cmd = (struct scsi_read_dvd_structure *)&xs->cmd; cmd->opcode = GPCMD_READ_DVD_STRUCTURE; cmd->format = s->type; _lto2b(xs->datalen, cmd->length); diff --git a/sys/scsi/ch.c b/sys/scsi/ch.c index c78f6306153..1d8781f3dcb 100644 --- a/sys/scsi/ch.c +++ b/sys/scsi/ch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ch.c,v 1.66 2020/08/11 15:23:57 krw Exp $ */ +/* $OpenBSD: ch.c,v 1.67 2020/09/22 19:32:53 krw Exp $ */ /* $NetBSD: ch.c,v 1.26 1997/02/21 22:06:52 thorpej Exp $ */ /* @@ -366,7 +366,7 @@ ch_move(struct ch_softc *sc, struct changer_move *cm) xs->retries = CHRETRIES; xs->timeout = 100000; - cmd = (struct scsi_move_medium *)xs->cmd; + cmd = (struct scsi_move_medium *)&xs->cmd; cmd->opcode = MOVE_MEDIUM; _lto2b(sc->sc_picker, cmd->tea); _lto2b(fromelem, cmd->src); @@ -425,7 +425,7 @@ ch_exchange(struct ch_softc *sc, struct changer_exchange *ce) xs->retries = CHRETRIES; xs->timeout = 100000; - cmd = (struct scsi_exchange_medium *)xs->cmd; + cmd = (struct scsi_exchange_medium *)&xs->cmd; cmd->opcode = EXCHANGE_MEDIUM; _lto2b(sc->sc_picker, cmd->tea); _lto2b(src, cmd->src); @@ -473,7 +473,7 @@ ch_position(struct ch_softc *sc, struct changer_position *cp) xs->retries = CHRETRIES; xs->timeout = 100000; - cmd = (struct scsi_position_to_element *)xs->cmd; + cmd = (struct scsi_position_to_element *)&xs->cmd; cmd->opcode = POSITION_TO_ELEMENT; _lto2b(sc->sc_picker, cmd->tea); _lto2b(dst, cmd->dst); @@ -640,7 +640,7 @@ ch_getelemstatus(struct ch_softc *sc, int first, int count, caddr_t data, xs->retries = CHRETRIES; xs->timeout = 100000; - cmd = (struct scsi_read_element_status *)xs->cmd; + cmd = (struct scsi_read_element_status *)&xs->cmd; cmd->opcode = READ_ELEMENT_STATUS; _lto2b(first, cmd->sea); _lto2b(count, cmd->count); diff --git a/sys/scsi/mpath.c b/sys/scsi/mpath.c index a757dc7b986..69d937f0cad 100644 --- a/sys/scsi/mpath.c +++ b/sys/scsi/mpath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpath.c,v 1.53 2020/07/22 13:16:05 krw Exp $ */ +/* $OpenBSD: mpath.c,v 1.54 2020/09/22 19:32:53 krw Exp $ */ /* * Copyright (c) 2009 David Gwynne <dlg@openbsd.org> @@ -204,7 +204,7 @@ mpath_cmd(struct scsi_xfer *xs) return; } - memcpy(mxs->cmd, xs->cmd, xs->cmdlen); + memcpy(&mxs->cmd, &xs->cmd, xs->cmdlen); mxs->cmdlen = xs->cmdlen; mxs->data = xs->data; mxs->datalen = xs->datalen; @@ -256,7 +256,7 @@ mpath_start(struct mpath_path *p, struct scsi_xfer *mxs) if (xs == NULL) goto fail; - memcpy(mxs->cmd, xs->cmd, xs->cmdlen); + memcpy(&mxs->cmd, &xs->cmd, xs->cmdlen); mxs->cmdlen = xs->cmdlen; mxs->data = xs->data; mxs->datalen = xs->datalen; diff --git a/sys/scsi/safte.c b/sys/scsi/safte.c index ad805e7ddf9..05a95bdb061 100644 --- a/sys/scsi/safte.c +++ b/sys/scsi/safte.c @@ -1,4 +1,4 @@ -/* $OpenBSD: safte.c,v 1.65 2020/09/12 17:03:51 krw Exp $ */ +/* $OpenBSD: safte.c,v 1.66 2020/09/22 19:32:53 krw Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -249,7 +249,7 @@ safte_read_config(struct safte_softc *sc) xs->retries = 2; xs->timeout = 30000; - cmd = (struct safte_readbuf_cmd *)xs->cmd; + cmd = (struct safte_readbuf_cmd *)&xs->cmd; cmd->opcode = READ_BUFFER; SET(cmd->flags, SAFTE_RD_MODE); cmd->bufferid = SAFTE_RD_CONFIG; @@ -397,7 +397,7 @@ safte_read_encstat(void *arg) xs->retries = 2; xs->timeout = 30000; - cmd = (struct safte_readbuf_cmd *)xs->cmd; + cmd = (struct safte_readbuf_cmd *)&xs->cmd; cmd->opcode = READ_BUFFER; SET(cmd->flags, SAFTE_RD_MODE); cmd->bufferid = SAFTE_RD_ENCSTAT; @@ -581,7 +581,7 @@ safte_bio_blink(struct safte_softc *sc, struct bioc_blink *blink) xs->retries = 2; xs->timeout = 30000; - cmd = (struct safte_writebuf_cmd *)xs->cmd; + cmd = (struct safte_writebuf_cmd *)&xs->cmd; cmd->opcode = WRITE_BUFFER; SET(cmd->flags, SAFTE_WR_MODE); cmd->length = htobe16(sizeof(struct safte_slotop)); diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index f989c479617..645790e961a 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi_base.c,v 1.275 2020/09/08 12:36:42 krw Exp $ */ +/* $OpenBSD: scsi_base.c,v 1.276 2020/09/22 19:32:53 krw Exp $ */ /* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */ /* @@ -768,7 +768,6 @@ scsi_xs_io(struct scsi_link *link, void *io, int flags) xs->sc_link = link; xs->retries = SCSI_RETRIES; xs->timeout = 10000; - xs->cmd = &xs->cmdstore; xs->io = io; } @@ -804,7 +803,7 @@ scsi_test_unit_ready(struct scsi_link *link, int retries, int flags) xs->retries = retries; xs->timeout = 10000; - cmd = (struct scsi_test_unit_ready *)xs->cmd; + cmd = (struct scsi_test_unit_ready *)&xs->cmd; cmd->opcode = TEST_UNIT_READY; error = scsi_xs_sync(xs); @@ -819,7 +818,7 @@ scsi_init_inquiry(struct scsi_xfer *xs, u_int8_t flags, u_int8_t pagecode, { struct scsi_inquiry *cmd; - cmd = (struct scsi_inquiry *)xs->cmd; + cmd = (struct scsi_inquiry *)&xs->cmd; cmd->opcode = INQUIRY; cmd->flags = flags; cmd->pagecode = pagecode; @@ -948,7 +947,7 @@ scsi_read_cap_10(struct scsi_link *link, struct scsi_read_cap_data *rdcap, memset(&cdb, 0, sizeof(cdb)); cdb.opcode = READ_CAPACITY; - memcpy(xs->cmd, &cdb, sizeof(cdb)); + memcpy(&xs->cmd, &cdb, sizeof(cdb)); xs->cmdlen = sizeof(cdb); xs->data = (void *)rdcap; xs->datalen = sizeof(*rdcap); @@ -985,7 +984,7 @@ scsi_read_cap_16(struct scsi_link *link, struct scsi_read_cap_data_16 *rdcap, cdb.byte2 = SRC16_SERVICE_ACTION; _lto4b(sizeof(*rdcap), cdb.length); - memcpy(xs->cmd, &cdb, sizeof(cdb)); + memcpy(&xs->cmd, &cdb, sizeof(cdb)); xs->cmdlen = sizeof(cdb); xs->data = (void *)rdcap; xs->datalen = sizeof(*rdcap); @@ -1025,7 +1024,7 @@ scsi_prevent(struct scsi_link *link, int type, int flags) xs->retries = 2; xs->timeout = 5000; - cmd = (struct scsi_prevent *)xs->cmd; + cmd = (struct scsi_prevent *)&xs->cmd; cmd->opcode = PREVENT_ALLOW; cmd->how = type; @@ -1052,7 +1051,7 @@ scsi_start(struct scsi_link *link, int type, int flags) xs->retries = 2; xs->timeout = (type == SSS_START) ? 30000 : 10000; - cmd = (struct scsi_start_stop *)xs->cmd; + cmd = (struct scsi_start_stop *)&xs->cmd; cmd->opcode = START_STOP; cmd->how = type; @@ -1091,7 +1090,7 @@ scsi_mode_sense(struct scsi_link *link, int pg_code, */ memset(data, 0, len); - cmd = (struct scsi_mode_sense *)xs->cmd; + cmd = (struct scsi_mode_sense *)&xs->cmd; cmd->opcode = MODE_SENSE; cmd->page = pg_code; @@ -1150,7 +1149,7 @@ scsi_mode_sense_big(struct scsi_link *link, int pg_code, */ memset(data, 0, len); - cmd = (struct scsi_mode_sense_big *)xs->cmd; + cmd = (struct scsi_mode_sense_big *)&xs->cmd; cmd->opcode = MODE_SENSE_BIG; cmd->page = pg_code; @@ -1343,7 +1342,7 @@ scsi_mode_select(struct scsi_link *link, int byte2, xs->datalen = len; xs->timeout = timeout; - cmd = (struct scsi_mode_select *)xs->cmd; + cmd = (struct scsi_mode_select *)&xs->cmd; cmd->opcode = MODE_SELECT; cmd->byte2 = byte2; cmd->length = len; @@ -1378,7 +1377,7 @@ scsi_mode_select_big(struct scsi_link *link, int byte2, xs->datalen = len; xs->timeout = timeout; - cmd = (struct scsi_mode_select_big *)xs->cmd; + cmd = (struct scsi_mode_select_big *)&xs->cmd; cmd->opcode = MODE_SELECT_BIG; cmd->byte2 = byte2; _lto2b(len, cmd->length); @@ -1414,7 +1413,7 @@ scsi_report_luns(struct scsi_link *link, int selectreport, bzero(data, datalen); - cmd = (struct scsi_report_luns *)xs->cmd; + cmd = (struct scsi_report_luns *)&xs->cmd; cmd->opcode = REPORT_LUNS; cmd->selectreport = selectreport; _lto4b(datalen, cmd->length); @@ -2490,7 +2489,7 @@ scsi_print_sense(struct scsi_xfer *xs) /* XXX For error 0x71, current opcode is not the relevant one. */ printf("%sCheck Condition (error %#x) on opcode 0x%x\n", (serr == SSD_ERRCODE_DEFERRED) ? "DEFERRED " : "", serr, - xs->cmd->opcode); + xs->cmd.opcode); if (serr != SSD_ERRCODE_CURRENT && serr != SSD_ERRCODE_DEFERRED) { if (ISSET(sense->error_code, SSD_ERRCODE_VALID)) { @@ -2744,7 +2743,7 @@ scsi_show_sense(struct scsi_xfer *xs) void scsi_show_xs(struct scsi_xfer *xs) { - u_char *b = (u_char *)xs->cmd; + u_char *b = (u_char *)&xs->cmd; int i = 0; if (!ISSET(xs->sc_link->flags, SDEV_DB1)) @@ -2763,7 +2762,7 @@ scsi_show_xs(struct scsi_xfer *xs) printf("bp(%p)\n", xs->bp); sc_print_addr(xs->sc_link); - printf("cmd (%p): ", xs->cmd); + printf("cmd (%p): ", &xs->cmd); if (!ISSET(xs->flags, SCSI_RESET)) { while (i < xs->cmdlen) { diff --git a/sys/scsi/scsi_ioctl.c b/sys/scsi/scsi_ioctl.c index 01c0d70e8d7..ae5370bccab 100644 --- a/sys/scsi/scsi_ioctl.c +++ b/sys/scsi/scsi_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi_ioctl.c,v 1.66 2020/08/19 22:46:19 krw Exp $ */ +/* $OpenBSD: scsi_ioctl.c,v 1.67 2020/09/22 19:32:53 krw Exp $ */ /* $NetBSD: scsi_ioctl.c,v 1.23 1996/10/12 23:23:17 christos Exp $ */ /* @@ -110,7 +110,7 @@ scsi_ioc_cmd(struct scsi_link *link, scsireq_t *screq) if (xs == NULL) return ENOMEM; - memcpy(xs->cmd, screq->cmd, screq->cmdlen); + memcpy(&xs->cmd, screq->cmd, screq->cmdlen); xs->cmdlen = screq->cmdlen; if (screq->datalen > 0) { @@ -205,7 +205,7 @@ scsi_ioc_ata_cmd(struct scsi_link *link, atareq_t *atareq) if (xs == NULL) return ENOMEM; - cdb = (struct scsi_ata_passthru_12 *)xs->cmd; + cdb = (struct scsi_ata_passthru_12 *)&xs->cmd; cdb->opcode = ATA_PASSTHRU_12; if (atareq->datalen > 0) { diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h index 6bd568e9df3..9c7488531f1 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.h,v 1.198 2020/08/30 19:41:25 krw Exp $ */ +/* $OpenBSD: scsiconf.h,v 1.199 2020/09/22 19:32:53 krw Exp $ */ /* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */ /* @@ -393,7 +393,7 @@ struct scsi_xfer { struct scsi_link *sc_link; /* all about our device and adapter */ int retries; /* the number of times to retry */ int timeout; /* in milliseconds */ - struct scsi_generic *cmd; /* The scsi command to execute */ + struct scsi_generic cmd; /* The scsi command to execute */ int cmdlen; /* how long it is */ u_char *data; /* dma address OR a uio address */ int datalen; /* data len (blank if uio) */ @@ -402,7 +402,6 @@ struct scsi_xfer { struct buf *bp; /* If we need to associate with a buf */ struct scsi_sense_data sense; /* 18 bytes*/ u_int8_t status; /* SCSI status */ - struct scsi_generic cmdstore; /* stash the command in here */ /* * timeout structure for hba's to use for a command */ diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 152cd6f3572..f9239692c12 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.328 2020/09/14 18:44:54 krw Exp $ */ +/* $OpenBSD: sd.c,v 1.329 2020/09/22 19:32:53 krw Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -689,16 +689,16 @@ sdstart(struct scsi_xfer *xs) (SID_ANSII_REV(&link->inqdata) < SCSI_REV_2) && ((secno & 0x1fffff) == secno) && ((nsecs & 0xff) == nsecs)) - xs->cmdlen = sd_cmd_rw6(xs->cmd, read, secno, nsecs); + xs->cmdlen = sd_cmd_rw6(&xs->cmd, read, secno, nsecs); else if (sc->params.disksize > UINT32_MAX) - xs->cmdlen = sd_cmd_rw16(xs->cmd, read, secno, nsecs); + xs->cmdlen = sd_cmd_rw16(&xs->cmd, read, secno, nsecs); else if (nsecs <= UINT16_MAX) - xs->cmdlen = sd_cmd_rw10(xs->cmd, read, secno, nsecs); + xs->cmdlen = sd_cmd_rw10(&xs->cmd, read, secno, nsecs); else - xs->cmdlen = sd_cmd_rw12(xs->cmd, read, secno, nsecs); + xs->cmdlen = sd_cmd_rw12(&xs->cmd, read, secno, nsecs); disk_busy(&sc->sc_dk); if (!read) @@ -1340,7 +1340,7 @@ sddump(dev_t dev, daddr_t blkno, caddr_t va, size_t size) xs->data = va; xs->datalen = nwrt * sectorsize; - xs->cmdlen = sd_cmd_rw10(xs->cmd, 0, blkno, nwrt); /* XXX */ + xs->cmdlen = sd_cmd_rw10(&xs->cmd, 0, blkno, nwrt); /* XXX */ rv = scsi_xs_sync(xs); scsi_xs_put(xs); @@ -1869,7 +1869,7 @@ sd_flush(struct sd_softc *sc, int flags) return EIO; } - cmd = (struct scsi_synchronize_cache *)xs->cmd; + cmd = (struct scsi_synchronize_cache *)&xs->cmd; cmd->opcode = SYNCHRONIZE_CACHE; xs->cmdlen = sizeof(*cmd); diff --git a/sys/scsi/ses.c b/sys/scsi/ses.c index 27b8df29e2e..1aca6ea2ebb 100644 --- a/sys/scsi/ses.c +++ b/sys/scsi/ses.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ses.c,v 1.62 2020/09/12 16:51:04 krw Exp $ */ +/* $OpenBSD: ses.c,v 1.63 2020/09/22 19:32:53 krw Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -283,7 +283,7 @@ ses_read_config(struct ses_softc *sc) xs->retries = 2; xs->timeout = 3000; - cmd = (struct ses_scsi_diag *)xs->cmd; + cmd = (struct ses_scsi_diag *)&xs->cmd; cmd->opcode = RECEIVE_DIAGNOSTIC; SET(cmd->flags, SES_DIAG_PCV); cmd->pgcode = SES_PAGE_CONFIG; @@ -381,7 +381,7 @@ ses_read_status(struct ses_softc *sc) xs->retries = 2; xs->timeout = 3000; - cmd = (struct ses_scsi_diag *)xs->cmd; + cmd = (struct ses_scsi_diag *)&xs->cmd; cmd->opcode = RECEIVE_DIAGNOSTIC; SET(cmd->flags, SES_DIAG_PCV); cmd->pgcode = SES_PAGE_STATUS; @@ -612,7 +612,7 @@ ses_write_config(struct ses_softc *sc) xs->retries = 2; xs->timeout = 3000; - cmd = (struct ses_scsi_diag *)xs->cmd; + cmd = (struct ses_scsi_diag *)&xs->cmd; cmd->opcode = SEND_DIAGNOSTIC; SET(cmd->flags, SES_DIAG_PF); cmd->length = htobe16(sc->sc_buflen); diff --git a/sys/scsi/st.c b/sys/scsi/st.c index 4740533bab2..f30eea68334 100644 --- a/sys/scsi/st.c +++ b/sys/scsi/st.c @@ -1,4 +1,4 @@ -/* $OpenBSD: st.c,v 1.184 2020/08/22 15:07:11 krw Exp $ */ +/* $OpenBSD: st.c,v 1.185 2020/09/22 19:32:53 krw Exp $ */ /* $NetBSD: st.c,v 1.71 1997/02/21 23:03:49 thorpej Exp $ */ /* @@ -886,7 +886,7 @@ ststart(struct scsi_xfer *xs) /* * Fill out the scsi command */ - cmd = (struct scsi_rw_tape *)xs->cmd; + cmd = (struct scsi_rw_tape *)&xs->cmd; bzero(cmd, sizeof(*cmd)); if ((bp->b_flags & B_READ) == B_WRITE) { cmd->opcode = WRITE; @@ -1252,7 +1252,7 @@ st_read(struct st_softc *st, char *buf, int size, int flags) xs->retries = 0; xs->timeout = ST_IO_TIME; - cmd = (struct scsi_rw_tape *)xs->cmd; + cmd = (struct scsi_rw_tape *)&xs->cmd; cmd->opcode = READ; if (ISSET(st->flags, ST_FIXEDBLOCKS)) { SET(cmd->byte2, SRW_FIXED); @@ -1297,7 +1297,7 @@ st_read_block_limits(struct st_softc *st, int flags) xs->datalen = sizeof(*block_limits); xs->timeout = ST_CTL_TIME; - cmd = (struct scsi_block_limits *)xs->cmd; + cmd = (struct scsi_block_limits *)&xs->cmd; cmd->opcode = READ_BLOCK_LIMITS; error = scsi_xs_sync(xs); @@ -1514,7 +1514,7 @@ st_erase(struct st_softc *st, int full, int flags) * the drive to erase the entire unit. Without this bit, we're * asking the drive to write an erase gap. */ - cmd = (struct scsi_erase *)xs->cmd; + cmd = (struct scsi_erase *)&xs->cmd; cmd->opcode = ERASE; if (full) { cmd->byte2 = SE_IMMED|SE_LONG; @@ -1613,7 +1613,7 @@ st_space(struct st_softc *st, int number, u_int what, int flags) if (xs == NULL) return ENOMEM; - cmd = (struct scsi_space *)xs->cmd; + cmd = (struct scsi_space *)&xs->cmd; cmd->opcode = SPACE; cmd->byte2 = what; _lto3b(number, cmd->number); @@ -1700,7 +1700,7 @@ st_write_filemarks(struct st_softc *st, int number, int flags) break; } - cmd = (struct scsi_write_filemarks *)xs->cmd; + cmd = (struct scsi_write_filemarks *)&xs->cmd; cmd->opcode = WRITE_FILEMARKS; _lto3b(number, cmd->number); @@ -1787,7 +1787,7 @@ st_load(struct st_softc *st, u_int type, int flags) xs->cmdlen = sizeof(*cmd); xs->timeout = ST_SPC_TIME; - cmd = (struct scsi_load *)xs->cmd; + cmd = (struct scsi_load *)&xs->cmd; cmd->opcode = LOAD; cmd->how = type; @@ -1818,7 +1818,7 @@ st_rewind(struct st_softc *st, u_int immediate, int flags) xs->cmdlen = sizeof(*cmd); xs->timeout = immediate ? ST_CTL_TIME : ST_SPC_TIME; - cmd = (struct scsi_rewind *)xs->cmd; + cmd = (struct scsi_rewind *)&xs->cmd; cmd->opcode = REWIND; cmd->byte2 = immediate; @@ -1886,11 +1886,11 @@ st_interpret_sense(struct scsi_xfer *xs) break; case SKEY_BLANK_CHECK: if (sense->error_code & SSD_ERRCODE_VALID && - xs->cmd->opcode == SPACE) { + xs->cmd.opcode == SPACE) { switch (ASC_ASCQ(sense)) { case SENSE_END_OF_DATA_DETECTED: SET(st->flags, ST_EOD_DETECTED); - space = (struct scsi_space *)xs->cmd; + space = (struct scsi_space *)&xs->cmd; number = _3btol(space->number); st->media_fileno = number - info; st->media_eom = st->media_fileno; |