From 1e243afe67a618d2fd04408d87bf3ca61a494092 Mon Sep 17 00:00:00 2001 From: mycroft Date: Fri, 17 Sep 2004 23:43:17 +0000 Subject: [PATCH] Remove the "xfer" argument to scsipi_command(). --- sys/dev/scsipi/cd.c | 50 +++++++++++++++++------------------ sys/dev/scsipi/ch.c | 18 ++++++------- sys/dev/scsipi/if_se.c | 6 ++--- sys/dev/scsipi/scsi_base.c | 6 ++--- sys/dev/scsipi/scsipi_base.c | 26 +++++++++--------- sys/dev/scsipi/scsipi_ioctl.c | 8 +++--- sys/dev/scsipi/scsipiconf.c | 22 +++++++-------- sys/dev/scsipi/scsipiconf.h | 7 +++-- sys/dev/scsipi/sd.c | 8 +++--- sys/dev/scsipi/ses.c | 6 ++--- sys/dev/scsipi/ss_mustek.c | 14 +++++----- sys/dev/scsipi/ss_scanjet.c | 8 +++--- sys/dev/scsipi/st.c | 20 +++++++------- sys/dev/scsipi/st_scsi.c | 8 +++--- 14 files changed, 102 insertions(+), 105 deletions(-) diff --git a/sys/dev/scsipi/cd.c b/sys/dev/scsipi/cd.c index 45b9ef2ca17a..e7dfb8f6a729 100644 --- a/sys/dev/scsipi/cd.c +++ b/sys/dev/scsipi/cd.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd.c,v 1.207 2004/09/17 23:35:13 mycroft Exp $ */ +/* $NetBSD: cd.c,v 1.208 2004/09/17 23:43:17 mycroft Exp $ */ /*- * Copyright (c) 1998, 2001, 2003, 2004 The NetBSD Foundation, Inc. @@ -54,7 +54,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.207 2004/09/17 23:35:13 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.208 2004/09/17 23:43:17 mycroft Exp $"); #include "rnd.h" @@ -1600,7 +1600,7 @@ cd_size(struct cd_softc *cd, int flags) * If the command works, interpret the result as a 4 byte * number of blocks and a blocksize */ - if (scsipi_command(cd->sc_periph, NULL, + if (scsipi_command(cd->sc_periph, (struct scsipi_generic *)&scsipi_cmd, sizeof(scsipi_cmd), (u_char *)&rdcap, sizeof(rdcap), CDRETRIES, 30000, NULL, flags | XS_CTL_DATA_IN | XS_CTL_DATA_ONSTACK) != 0) @@ -1638,7 +1638,7 @@ cd_play(struct cd_softc *cd, int blkno, int nblks) scsipi_cmd.opcode = PLAY; _lto4b(blkno, scsipi_cmd.blk_addr); _lto2b(nblks, scsipi_cmd.xfer_len); - return (scsipi_command(cd->sc_periph, NULL, + return (scsipi_command(cd->sc_periph, (struct scsipi_generic *)&scsipi_cmd, sizeof(scsipi_cmd), 0, 0, CDRETRIES, 30000, NULL, 0)); } @@ -1694,7 +1694,7 @@ cd_play_msf(struct cd_softc *cd, int startm, int starts, int startf, int endm, scsipi_cmd.end_m = endm; scsipi_cmd.end_s = ends; scsipi_cmd.end_f = endf; - return (scsipi_command(cd->sc_periph, NULL, + return (scsipi_command(cd->sc_periph, (struct scsipi_generic *)&scsipi_cmd, sizeof(scsipi_cmd), 0, 0, CDRETRIES, 30000, NULL, 0)); } @@ -1710,7 +1710,7 @@ cd_pause(struct cd_softc *cd, int go) memset(&scsipi_cmd, 0, sizeof(scsipi_cmd)); scsipi_cmd.opcode = PAUSE; scsipi_cmd.resume = go & 0xff; - return (scsipi_command(cd->sc_periph, NULL, + return (scsipi_command(cd->sc_periph, (struct scsipi_generic *)&scsipi_cmd, sizeof(scsipi_cmd), 0, 0, CDRETRIES, 30000, NULL, 0)); } @@ -1722,7 +1722,7 @@ static int cd_reset(struct cd_softc *cd) { - return (scsipi_command(cd->sc_periph, NULL, 0, 0, 0, 0, + return (scsipi_command(cd->sc_periph, 0, 0, 0, 0, CDRETRIES, 30000, NULL, XS_CTL_RESET)); } @@ -1743,7 +1743,7 @@ cd_read_subchannel(struct cd_softc *cd, int mode, int format, int track, scsipi_cmd.subchan_format = format; scsipi_cmd.track = track; _lto2b(len, scsipi_cmd.data_len); - return (scsipi_command(cd->sc_periph, NULL, + return (scsipi_command(cd->sc_periph, (struct scsipi_generic *)&scsipi_cmd, sizeof(struct scsipi_read_subchannel), (u_char *)data, len, CDRETRIES, 30000, NULL, flags | XS_CTL_DATA_IN | XS_CTL_SILENT)); @@ -1773,7 +1773,7 @@ cd_read_toc(struct cd_softc *cd, int mode, int start, void *data, int len, scsipi_cmd.from_track = start; _lto2b(ntoc, scsipi_cmd.data_len); scsipi_cmd.control = control; - return (scsipi_command(cd->sc_periph, NULL, + return (scsipi_command(cd->sc_periph, (struct scsipi_generic *)&scsipi_cmd, sizeof(struct scsipi_read_toc), (u_char *)data, len, CDRETRIES, 30000, NULL, flags | XS_CTL_DATA_IN)); @@ -1848,7 +1848,7 @@ dvd_auth(struct cd_softc *cd, dvd_authinfo *a) cmd.opcode = GPCMD_REPORT_KEY; cmd.bytes[8] = 8; cmd.bytes[9] = 0 | (0 << 6); - error = scsipi_command(cd->sc_periph, NULL, &cmd, 12, buf, 8, + error = scsipi_command(cd->sc_periph, &cmd, 12, buf, 8, CDRETRIES, 30000, NULL, XS_CTL_DATA_IN|XS_CTL_DATA_ONSTACK); if (error) @@ -1860,7 +1860,7 @@ dvd_auth(struct cd_softc *cd, dvd_authinfo *a) cmd.opcode = GPCMD_REPORT_KEY; cmd.bytes[8] = 16; cmd.bytes[9] = 1 | (a->lsc.agid << 6); - error = scsipi_command(cd->sc_periph, NULL, &cmd, 12, buf, 16, + error = scsipi_command(cd->sc_periph, &cmd, 12, buf, 16, CDRETRIES, 30000, NULL, XS_CTL_DATA_IN|XS_CTL_DATA_ONSTACK); if (error) @@ -1872,7 +1872,7 @@ dvd_auth(struct cd_softc *cd, dvd_authinfo *a) cmd.opcode = GPCMD_REPORT_KEY; cmd.bytes[8] = 12; cmd.bytes[9] = 2 | (a->lsk.agid << 6); - error = scsipi_command(cd->sc_periph, NULL, &cmd, 12, buf, 12, + error = scsipi_command(cd->sc_periph, &cmd, 12, buf, 12, CDRETRIES, 30000, NULL, XS_CTL_DATA_IN|XS_CTL_DATA_ONSTACK); if (error) @@ -1885,7 +1885,7 @@ dvd_auth(struct cd_softc *cd, dvd_authinfo *a) _lto4b(a->lstk.lba, &cmd.bytes[1]); cmd.bytes[8] = 12; cmd.bytes[9] = 4 | (a->lstk.agid << 6); - error = scsipi_command(cd->sc_periph, NULL, &cmd, 12, buf, 12, + error = scsipi_command(cd->sc_periph, &cmd, 12, buf, 12, CDRETRIES, 30000, NULL, XS_CTL_DATA_IN|XS_CTL_DATA_ONSTACK); if (error) @@ -1900,7 +1900,7 @@ dvd_auth(struct cd_softc *cd, dvd_authinfo *a) cmd.opcode = GPCMD_REPORT_KEY; cmd.bytes[8] = 8; cmd.bytes[9] = 5 | (a->lsasf.agid << 6); - error = scsipi_command(cd->sc_periph, NULL, &cmd, 12, buf, 8, + error = scsipi_command(cd->sc_periph, &cmd, 12, buf, 8, CDRETRIES, 30000, NULL, XS_CTL_DATA_IN|XS_CTL_DATA_ONSTACK); if (error) @@ -1914,7 +1914,7 @@ dvd_auth(struct cd_softc *cd, dvd_authinfo *a) cmd.bytes[9] = 1 | (a->hsc.agid << 6); buf[1] = 14; dvd_copy_challenge(&buf[4], a->hsc.chal); - error = scsipi_command(cd->sc_periph, NULL, &cmd, 12, buf, 16, + error = scsipi_command(cd->sc_periph, &cmd, 12, buf, 16, CDRETRIES, 30000, NULL, XS_CTL_DATA_OUT|XS_CTL_DATA_ONSTACK); if (error) @@ -1928,7 +1928,7 @@ dvd_auth(struct cd_softc *cd, dvd_authinfo *a) cmd.bytes[9] = 3 | (a->hsk.agid << 6); buf[1] = 10; dvd_copy_key(&buf[4], a->hsk.key); - error = scsipi_command(cd->sc_periph, NULL, &cmd, 12, buf, 12, + error = scsipi_command(cd->sc_periph, &cmd, 12, buf, 12, CDRETRIES, 30000, NULL, XS_CTL_DATA_OUT|XS_CTL_DATA_ONSTACK); if (error) { @@ -1941,7 +1941,7 @@ dvd_auth(struct cd_softc *cd, dvd_authinfo *a) case DVD_INVALIDATE_AGID: cmd.opcode = GPCMD_REPORT_KEY; cmd.bytes[9] = 0x3f | (a->lsa.agid << 6); - error = scsipi_command(cd->sc_periph, NULL, &cmd, 12, buf, 16, + error = scsipi_command(cd->sc_periph, &cmd, 12, buf, 16, CDRETRIES, 30000, NULL, 0); if (error) return (error); @@ -1951,7 +1951,7 @@ dvd_auth(struct cd_softc *cd, dvd_authinfo *a) cmd.opcode = GPCMD_REPORT_KEY; cmd.bytes[8] = 8; cmd.bytes[9] = 8 | (0 << 6); - error = scsipi_command(cd->sc_periph, NULL, &cmd, 12, buf, 8, + error = scsipi_command(cd->sc_periph, &cmd, 12, buf, 8, CDRETRIES, 30000, NULL, XS_CTL_DATA_IN|XS_CTL_DATA_ONSTACK); if (error) @@ -1969,7 +1969,7 @@ dvd_auth(struct cd_softc *cd, dvd_authinfo *a) cmd.bytes[9] = 6 | (0 << 6); buf[1] = 6; buf[4] = a->hrpcs.pdrc; - error = scsipi_command(cd->sc_periph, NULL, &cmd, 12, buf, 8, + error = scsipi_command(cd->sc_periph, &cmd, 12, buf, 8, CDRETRIES, 30000, NULL, XS_CTL_DATA_OUT|XS_CTL_DATA_ONSTACK); if (error) @@ -1997,7 +1997,7 @@ dvd_read_physical(struct cd_softc *cd, dvd_struct *s) _lto2b(sizeof(buf), &cmd.bytes[7]); cmd.bytes[5] = s->physical.layer_num; - error = scsipi_command(cd->sc_periph, NULL, &cmd, 12, buf, sizeof(buf), + error = scsipi_command(cd->sc_periph, &cmd, 12, buf, sizeof(buf), CDRETRIES, 30000, NULL, XS_CTL_DATA_IN|XS_CTL_DATA_ONSTACK); if (error) return (error); @@ -2035,7 +2035,7 @@ dvd_read_copyright(struct cd_softc *cd, dvd_struct *s) _lto2b(sizeof(buf), &cmd.bytes[7]); cmd.bytes[5] = s->copyright.layer_num; - error = scsipi_command(cd->sc_periph, NULL, &cmd, 12, buf, sizeof(buf), + error = scsipi_command(cd->sc_periph, &cmd, 12, buf, sizeof(buf), CDRETRIES, 30000, NULL, XS_CTL_DATA_IN|XS_CTL_DATA_ONSTACK); if (error) return (error); @@ -2060,7 +2060,7 @@ dvd_read_disckey(struct cd_softc *cd, dvd_struct *s) _lto2b(4 + 2048, &cmd.bytes[7]); cmd.bytes[9] = s->disckey.agid << 6; - error = scsipi_command(cd->sc_periph, NULL, &cmd, 12, buf, 4 + 2048, + error = scsipi_command(cd->sc_periph, &cmd, 12, buf, 4 + 2048, CDRETRIES, 30000, NULL, XS_CTL_DATA_IN|XS_CTL_DATA_ONSTACK); if (error == 0) memcpy(s->disckey.value, &buf[4], 2048); @@ -2081,7 +2081,7 @@ dvd_read_bca(struct cd_softc *cd, dvd_struct *s) cmd.bytes[6] = s->type; _lto2b(sizeof(buf), &cmd.bytes[7]); - error = scsipi_command(cd->sc_periph, NULL, &cmd, 12, buf, sizeof(buf), + error = scsipi_command(cd->sc_periph, &cmd, 12, buf, sizeof(buf), CDRETRIES, 30000, NULL, XS_CTL_DATA_IN|XS_CTL_DATA_ONSTACK); if (error) return (error); @@ -2107,7 +2107,7 @@ dvd_read_manufact(struct cd_softc *cd, dvd_struct *s) cmd.bytes[6] = s->type; _lto2b(4 + 2048, &cmd.bytes[7]); - error = scsipi_command(cd->sc_periph, NULL, &cmd, 12, buf, 4 + 2048, + error = scsipi_command(cd->sc_periph, &cmd, 12, buf, 4 + 2048, CDRETRIES, 30000, NULL, XS_CTL_DATA_IN|XS_CTL_DATA_ONSTACK); if (error == 0) { s->manufact.len = _2btol(&buf[0]); @@ -2383,7 +2383,7 @@ cd_load_unload(struct cd_softc *cd, struct ioc_load_unload *args) scsipi_cmd.options = args->options; /* ioctl uses MMC values */ scsipi_cmd.slot = args->slot; - return (scsipi_command(cd->sc_periph, NULL, + return (scsipi_command(cd->sc_periph, (struct scsipi_generic *)&scsipi_cmd, sizeof(scsipi_cmd), 0, 0, CDRETRIES, 200000, NULL, 0)); } diff --git a/sys/dev/scsipi/ch.c b/sys/dev/scsipi/ch.c index 94cdb7b78f9d..4db4aedf22db 100644 --- a/sys/dev/scsipi/ch.c +++ b/sys/dev/scsipi/ch.c @@ -1,7 +1,7 @@ -/* $NetBSD: ch.c,v 1.62 2004/09/09 19:35:30 bouyer Exp $ */ +/* $NetBSD: ch.c,v 1.63 2004/09/17 23:43:17 mycroft Exp $ */ /*- - * Copyright (c) 1996, 1997, 1998, 1999 The NetBSD Foundation, Inc. + * Copyright (c) 1996, 1997, 1998, 1999, 2004 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ch.c,v 1.62 2004/09/09 19:35:30 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ch.c,v 1.63 2004/09/17 23:43:17 mycroft Exp $"); #include #include @@ -615,7 +615,7 @@ ch_move(struct ch_softc *sc, struct changer_move_request *cm) /* * Send command to changer. */ - return (scsipi_command(sc->sc_periph, NULL, + return (scsipi_command(sc->sc_periph, (struct scsipi_generic *)&cmd, sizeof(cmd), NULL, 0, CHRETRIES, 100000, NULL, 0)); } @@ -670,7 +670,7 @@ ch_exchange(struct ch_softc *sc, struct changer_exchange_request *ce) /* * Send command to changer. */ - return (scsipi_command(sc->sc_periph, NULL, + return (scsipi_command(sc->sc_periph, (struct scsipi_generic *)&cmd, sizeof(cmd), NULL, 0, CHRETRIES, 100000, NULL, 0)); } @@ -707,7 +707,7 @@ ch_position(struct ch_softc *sc, struct changer_position_request *cp) /* * Send command to changer. */ - return (scsipi_command(sc->sc_periph, NULL, + return (scsipi_command(sc->sc_periph, (struct scsipi_generic *)&cmd, sizeof(cmd), NULL, 0, CHRETRIES, 100000, NULL, 0)); } @@ -1047,7 +1047,7 @@ ch_getelemstatus(struct ch_softc *sc, int first, int count, void *data, /* * Send command to changer. */ - return (scsipi_command(sc->sc_periph, NULL, + return (scsipi_command(sc->sc_periph, (struct scsipi_generic *)&cmd, sizeof(cmd), (u_char *)data, datalen, CHRETRIES, 100000, NULL, scsiflags | XS_CTL_DATA_IN)); @@ -1113,7 +1113,7 @@ ch_setvoltag(struct ch_softc *sc, struct changer_set_voltag_request *csvr) /* * Send command to changer. */ - return (scsipi_command(sc->sc_periph, NULL, + return (scsipi_command(sc->sc_periph, (struct scsipi_generic *)&cmd, sizeof(cmd), (u_char *)data, datalen, CHRETRIES, 100000, NULL, datalen ? XS_CTL_DATA_OUT | XS_CTL_DATA_ONSTACK : 0)); @@ -1150,7 +1150,7 @@ ch_ielem(struct ch_softc *sc) tmo *= 5 * 60 * 1000; tmo += (10 * 60 * 1000); - return (scsipi_command(sc->sc_periph, NULL, + return (scsipi_command(sc->sc_periph, (struct scsipi_generic *)&cmd, sizeof(cmd), NULL, 0, CHRETRIES, tmo, NULL, XS_CTL_IGNORE_ILLEGAL_REQUEST)); } diff --git a/sys/dev/scsipi/if_se.c b/sys/dev/scsipi/if_se.c index 3eb7b44b0f5c..d0ce7ab50171 100644 --- a/sys/dev/scsipi/if_se.c +++ b/sys/dev/scsipi/if_se.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_se.c,v 1.48 2004/09/17 23:10:50 mycroft Exp $ */ +/* $NetBSD: if_se.c,v 1.49 2004/09/17 23:43:17 mycroft Exp $ */ /* * Copyright (c) 1997 Ian W. Dall @@ -59,7 +59,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.48 2004/09/17 23:10:50 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.49 2004/09/17 23:43:17 mycroft Exp $"); #include "opt_inet.h" #include "opt_atalk.h" @@ -387,7 +387,7 @@ se_scsipi_cmd(periph, scsipi_cmd, cmdlen, data_addr, datalen, int error; int s = splbio(); - error = scsipi_command(periph, NULL, scsipi_cmd, cmdlen, data_addr, + error = scsipi_command(periph, scsipi_cmd, cmdlen, data_addr, datalen, retries, timeout, bp, flags); splx(s); return (error); diff --git a/sys/dev/scsipi/scsi_base.c b/sys/dev/scsipi/scsi_base.c index 0a64190bfd52..d789bf40aa04 100644 --- a/sys/dev/scsipi/scsi_base.c +++ b/sys/dev/scsipi/scsi_base.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsi_base.c,v 1.82 2004/09/17 23:30:22 mycroft Exp $ */ +/* $NetBSD: scsi_base.c,v 1.83 2004/09/17 23:43:17 mycroft Exp $ */ /*- * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scsi_base.c,v 1.82 2004/09/17 23:30:22 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scsi_base.c,v 1.83 2004/09/17 23:43:17 mycroft Exp $"); #include #include @@ -67,7 +67,7 @@ scsi_change_def(struct scsipi_periph *periph, int flags) scsipi_cmd.opcode = SCSI_CHANGE_DEFINITION; scsipi_cmd.how = SC_SCSI_2; - return (scsipi_command(periph, NULL, + return (scsipi_command(periph, (struct scsipi_generic *) &scsipi_cmd, sizeof(scsipi_cmd), 0, 0, SCSIPIRETRIES, 100000, NULL, flags)); } diff --git a/sys/dev/scsipi/scsipi_base.c b/sys/dev/scsipi/scsipi_base.c index 2f1a276cb684..859cab055daa 100644 --- a/sys/dev/scsipi/scsipi_base.c +++ b/sys/dev/scsipi/scsipi_base.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsipi_base.c,v 1.114 2004/09/17 23:30:22 mycroft Exp $ */ +/* $NetBSD: scsipi_base.c,v 1.115 2004/09/17 23:43:17 mycroft Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.114 2004/09/17 23:30:22 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.115 2004/09/17 23:43:17 mycroft Exp $"); #include "opt_scsi.h" @@ -1040,7 +1040,7 @@ scsipi_size(struct scsipi_periph *periph, int flags) * If the command works, interpret the result as a 4 byte * number of blocks */ - if (scsipi_command(periph, NULL, (struct scsipi_generic *)&scsipi_cmd, + if (scsipi_command(periph, (struct scsipi_generic *)&scsipi_cmd, sizeof(scsipi_cmd), (u_char *)&rdcap, sizeof(rdcap), SCSIPIRETRIES, 20000, NULL, flags | XS_CTL_DATA_IN | XS_CTL_DATA_ONSTACK | XS_CTL_SILENT) != 0) @@ -1072,7 +1072,7 @@ scsipi_test_unit_ready(struct scsipi_periph *periph, int flags) else retries = SCSIPIRETRIES; - return (scsipi_command(periph, NULL, + return (scsipi_command(periph, (struct scsipi_generic *)&scsipi_cmd, sizeof(scsipi_cmd), 0, 0, retries, 10000, NULL, flags)); } @@ -1110,13 +1110,13 @@ scsipi_inquire(struct scsipi_periph *periph, struct scsipi_inquiry_data *inqbuf, * - mycroft, 2003/10/16 */ scsipi_cmd.length = SCSIPI_INQUIRY_LENGTH_SCSI2; - error = scsipi_command(periph, NULL, + error = scsipi_command(periph, (struct scsipi_generic *) &scsipi_cmd, sizeof(scsipi_cmd), (u_char *) inqbuf, SCSIPI_INQUIRY_LENGTH_SCSI2, retries, 10000, NULL, XS_CTL_DATA_IN | flags); if (!error && inqbuf->additional_length > SCSIPI_INQUIRY_LENGTH_SCSI2 - 4) { scsipi_cmd.length = SCSIPI_INQUIRY_LENGTH_SCSI3; - error = scsipi_command(periph, NULL, + error = scsipi_command(periph, (struct scsipi_generic *) &scsipi_cmd, sizeof(scsipi_cmd), (u_char *) inqbuf, SCSIPI_INQUIRY_LENGTH_SCSI3, retries, 10000, NULL, XS_CTL_DATA_IN | flags); @@ -1180,7 +1180,7 @@ scsipi_prevent(struct scsipi_periph *periph, int type, int flags) scsipi_cmd.opcode = PREVENT_ALLOW; scsipi_cmd.how = type; - return (scsipi_command(periph, NULL, + return (scsipi_command(periph, (struct scsipi_generic *) &scsipi_cmd, sizeof(scsipi_cmd), 0, 0, SCSIPIRETRIES, 5000, NULL, flags)); } @@ -1200,7 +1200,7 @@ scsipi_start(struct scsipi_periph *periph, int type, int flags) scsipi_cmd.byte2 = 0x00; scsipi_cmd.how = type; - return (scsipi_command(periph, NULL, + return (scsipi_command(periph, (struct scsipi_generic *) &scsipi_cmd, sizeof(scsipi_cmd), 0, 0, SCSIPIRETRIES, (type & SSS_START) ? 60000 : 10000, NULL, flags)); @@ -1224,7 +1224,7 @@ scsipi_mode_sense(struct scsipi_periph *periph, int byte2, int page, scsipi_cmd.byte2 = byte2; scsipi_cmd.page = page; scsipi_cmd.length = len & 0xff; - error = scsipi_command(periph, NULL, + error = scsipi_command(periph, (struct scsipi_generic *)&scsipi_cmd, sizeof(scsipi_cmd), (void *)data, len, retries, timeout, NULL, flags | XS_CTL_DATA_IN); @@ -1246,7 +1246,7 @@ scsipi_mode_sense_big(struct scsipi_periph *periph, int byte2, int page, scsipi_cmd.byte2 = byte2; scsipi_cmd.page = page; _lto2b(len, scsipi_cmd.length); - error = scsipi_command(periph, NULL, + error = scsipi_command(periph, (struct scsipi_generic *)&scsipi_cmd, sizeof(scsipi_cmd), (void *)data, len, retries, timeout, NULL, flags | XS_CTL_DATA_IN); @@ -1267,7 +1267,7 @@ scsipi_mode_select(struct scsipi_periph *periph, int byte2, scsipi_cmd.opcode = MODE_SELECT; scsipi_cmd.byte2 = byte2; scsipi_cmd.length = len & 0xff; - error = scsipi_command(periph, NULL, + error = scsipi_command(periph, (struct scsipi_generic *)&scsipi_cmd, sizeof(scsipi_cmd), (void *)data, len, retries, timeout, NULL, flags | XS_CTL_DATA_OUT); @@ -1288,7 +1288,7 @@ scsipi_mode_select_big(struct scsipi_periph *periph, int byte2, scsipi_cmd.opcode = MODE_SELECT_BIG; scsipi_cmd.byte2 = byte2; _lto2b(len, scsipi_cmd.length); - error = scsipi_command(periph, NULL, + error = scsipi_command(periph, (struct scsipi_generic *)&scsipi_cmd, sizeof(scsipi_cmd), (void *)data, len, retries, timeout, NULL, flags | XS_CTL_DATA_OUT); @@ -1675,7 +1675,7 @@ scsipi_request_sense(struct scsipi_xfer *xs) cmd.opcode = REQUEST_SENSE; cmd.length = sizeof(struct scsipi_sense_data); - error = scsipi_command(periph, NULL, + error = scsipi_command(periph, (struct scsipi_generic *) &cmd, sizeof(cmd), (u_char*)&xs->sense.scsi_sense, sizeof(struct scsipi_sense_data), 0, 1000, NULL, flags); diff --git a/sys/dev/scsipi/scsipi_ioctl.c b/sys/dev/scsipi/scsipi_ioctl.c index be5908bfad51..61fea7b690c8 100644 --- a/sys/dev/scsipi/scsipi_ioctl.c +++ b/sys/dev/scsipi/scsipi_ioctl.c @@ -1,7 +1,7 @@ -/* $NetBSD: scsipi_ioctl.c,v 1.48 2004/09/09 19:35:31 bouyer Exp $ */ +/* $NetBSD: scsipi_ioctl.c,v 1.49 2004/09/17 23:43:17 mycroft Exp $ */ /*- - * Copyright (c) 1998 The NetBSD Foundation, Inc. + * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -44,7 +44,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scsipi_ioctl.c,v 1.48 2004/09/09 19:35:31 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scsipi_ioctl.c,v 1.49 2004/09/17 23:43:17 mycroft Exp $"); #include "opt_compat_freebsd.h" #include "opt_compat_netbsd.h" @@ -278,7 +278,7 @@ scsistrategy(struct buf *bp) if (screq->flags & SCCMD_ESCAPE) flags |= XS_CTL_ESCAPE; - error = scsipi_command(periph, NULL, + error = scsipi_command(periph, (struct scsipi_generic *)screq->cmd, screq->cmdlen, (u_char *)bp->b_data, screq->datalen, 0, /* user must do the retries *//* ignored */ diff --git a/sys/dev/scsipi/scsipiconf.c b/sys/dev/scsipi/scsipiconf.c index 6bc31b5b2f77..46ff475b0f62 100644 --- a/sys/dev/scsipi/scsipiconf.c +++ b/sys/dev/scsipi/scsipiconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsipiconf.c,v 1.25 2004/09/17 23:30:22 mycroft Exp $ */ +/* $NetBSD: scsipiconf.c,v 1.26 2004/09/17 23:43:17 mycroft Exp $ */ /*- * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc. @@ -55,7 +55,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scsipiconf.c,v 1.25 2004/09/17 23:30:22 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scsipiconf.c,v 1.26 2004/09/17 23:43:17 mycroft Exp $"); #include #include @@ -72,18 +72,16 @@ __KERNEL_RCSID(0, "$NetBSD: scsipiconf.c,v 1.25 2004/09/17 23:30:22 mycroft Exp #define STRVIS_ISWHITE(x) ((x) == ' ' || (x) == '\0' || (x) == (u_char)'\377') int -scsipi_command(struct scsipi_periph *periph, struct scsipi_xfer *xs, - struct scsipi_generic *cmd, int cmdlen, u_char *data_addr, int datalen, - int retries, int timeout, struct buf *bp, int flags) +scsipi_command(struct scsipi_periph *periph, struct scsipi_generic *cmd, + int cmdlen, u_char *data_addr, int datalen, int retries, int timeout, + struct buf *bp, int flags) { + struct scsipi_xfer *xs; - if (xs == NULL) { - if ((xs = scsipi_make_xs(periph, cmd, cmdlen, data_addr, - datalen, retries, timeout, bp, flags)) == NULL) { - /* let the caller deal with this */ - return (ENOMEM); - } - } + xs = scsipi_make_xs(periph, cmd, cmdlen, data_addr, datalen, retries, + timeout, bp, flags); + if (!xs) + return (ENOMEM); return (scsipi_execute_xs(xs)); } diff --git a/sys/dev/scsipi/scsipiconf.h b/sys/dev/scsipi/scsipiconf.h index 83304455b834..db012281b250 100644 --- a/sys/dev/scsipi/scsipiconf.h +++ b/sys/dev/scsipi/scsipiconf.h @@ -1,4 +1,4 @@ -/* $NetBSD: scsipiconf.h,v 1.89 2004/09/17 23:30:22 mycroft Exp $ */ +/* $NetBSD: scsipiconf.h,v 1.90 2004/09/17 23:43:17 mycroft Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2004 The NetBSD Foundation, Inc. @@ -624,9 +624,8 @@ struct scsi_quirk_inquiry_pattern { #ifdef _KERNEL void scsipi_init(void); -int scsipi_command(struct scsipi_periph *, struct scsipi_xfer *, - struct scsipi_generic *, int, u_char *, int, - int, int, struct buf *, int); +int scsipi_command(struct scsipi_periph *, struct scsipi_generic *, int, + u_char *, int, int, int, struct buf *, int); void scsipi_create_completion_thread(void *); caddr_t scsipi_inqmatch(struct scsipi_inquiry_pattern *, caddr_t, int, int, int *); diff --git a/sys/dev/scsipi/sd.c b/sys/dev/scsipi/sd.c index 9cf0af0570d7..32bb5928e3f8 100644 --- a/sys/dev/scsipi/sd.c +++ b/sys/dev/scsipi/sd.c @@ -1,4 +1,4 @@ -/* $NetBSD: sd.c,v 1.225 2004/09/17 23:35:13 mycroft Exp $ */ +/* $NetBSD: sd.c,v 1.226 2004/09/17 23:43:17 mycroft Exp $ */ /*- * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc. @@ -54,7 +54,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.225 2004/09/17 23:35:13 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.226 2004/09/17 23:43:17 mycroft Exp $"); #include "opt_scsi.h" #include "rnd.h" @@ -1645,7 +1645,7 @@ sd_get_capacity(struct sd_softc *sd, struct disk_parms *dp, int flags) cmd.opcode = READ_FORMAT_CAPACITIES; _lto2b(sizeof(data), cmd.length); - error = scsipi_command(sd->sc_periph, NULL, + error = scsipi_command(sd->sc_periph, (void *)&cmd, sizeof(cmd), (void *)&data, sizeof(data), SDRETRIES, 20000, NULL, flags | XS_CTL_DATA_IN | XS_CTL_DATA_ONSTACK); @@ -1934,7 +1934,7 @@ sd_flush(struct sd_softc *sd, int flags) memset(&cmd, 0, sizeof(cmd)); cmd.opcode = SCSI_SYNCHRONIZE_CACHE; - return (scsipi_command(periph, NULL, (void *)&cmd, sizeof(cmd), 0, 0, + return (scsipi_command(periph, (void *)&cmd, sizeof(cmd), 0, 0, SDRETRIES, 100000, NULL, flags | XS_CTL_IGNORE_ILLEGAL_REQUEST)); } diff --git a/sys/dev/scsipi/ses.c b/sys/dev/scsipi/ses.c index f570e84619de..355d67ddd344 100644 --- a/sys/dev/scsipi/ses.c +++ b/sys/dev/scsipi/ses.c @@ -1,4 +1,4 @@ -/* $NetBSD: ses.c,v 1.24 2004/09/09 19:35:33 bouyer Exp $ */ +/* $NetBSD: ses.c,v 1.25 2004/09/17 23:43:17 mycroft Exp $ */ /* * Copyright (C) 2000 National Aeronautics & Space Administration * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ses.c,v 1.24 2004/09/09 19:35:33 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ses.c,v 1.25 2004/09/17 23:43:17 mycroft Exp $"); #include "opt_scsi.h" @@ -500,7 +500,7 @@ ses_runcmd(struct ses_softc *ssc, char *cdb, int cdbl, char *dptr, int *dlenp) #ifndef SCSIDEBUG flg |= XS_CTL_SILENT; #endif - error = scsipi_command(ssc->sc_periph, NULL, &sgen, cdbl, + error = scsipi_command(ssc->sc_periph, &sgen, cdbl, (u_char *) dptr, dl, SCSIPIRETRIES, 30000, NULL, flg); if (error == 0 && dptr) diff --git a/sys/dev/scsipi/ss_mustek.c b/sys/dev/scsipi/ss_mustek.c index 60940efa71d0..71eea0e0abe3 100644 --- a/sys/dev/scsipi/ss_mustek.c +++ b/sys/dev/scsipi/ss_mustek.c @@ -1,4 +1,4 @@ -/* $NetBSD: ss_mustek.c,v 1.22 2004/09/17 23:35:13 mycroft Exp $ */ +/* $NetBSD: ss_mustek.c,v 1.23 2004/09/17 23:43:17 mycroft Exp $ */ /* * Copyright (c) 1995 Joachim Koenig-Baltes. All rights reserved. @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ss_mustek.c,v 1.22 2004/09/17 23:35:13 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ss_mustek.c,v 1.23 2004/09/17 23:43:17 mycroft Exp $"); #include #include @@ -321,7 +321,7 @@ mustek_trigger_scanner(struct ss_softc *ss) /* send the set window command to the scanner */ SC_DEBUG(periph, SCSIPI_DB1, ("mustek_set_parms: set_window\n")); - error = scsipi_command(periph, NULL, + error = scsipi_command(periph, (struct scsipi_generic *) &window_cmd, sizeof(window_cmd), (u_char *) &window_data, sizeof(window_data), MUSTEK_RETRIES, 5000, NULL, XS_CTL_DATA_OUT | XS_CTL_DATA_ONSTACK); @@ -361,7 +361,7 @@ mustek_trigger_scanner(struct ss_softc *ss) SC_DEBUG(periph, SCSIPI_DB1, ("mustek_trigger_scanner: mode_select\n")); /* send the command to the scanner */ - error = scsipi_command(periph, NULL, + error = scsipi_command(periph, (struct scsipi_generic *) &mode_cmd, sizeof(mode_cmd), (u_char *) &mode_data, sizeof(mode_data), MUSTEK_RETRIES, 5000, NULL, XS_CTL_DATA_OUT | XS_CTL_DATA_ONSTACK); @@ -399,7 +399,7 @@ mustek_trigger_scanner(struct ss_softc *ss) /* send the command to the scanner */ SC_DEBUG(periph, SCSIPI_DB1, ("mustek_trigger_scanner: start_scan\n")); - error = scsipi_command(periph, NULL, + error = scsipi_command(periph, (struct scsipi_generic *) &start_scan_cmd, sizeof(start_scan_cmd), NULL, 0, MUSTEK_RETRIES, 5000, NULL, 0); @@ -442,7 +442,7 @@ mustek_rewind_scanner(struct ss_softc *ss) /* send the command to the scanner */ SC_DEBUG(periph, SCSIPI_DB1, ("mustek_rewind_scanner: stop_scan\n")); - error = scsipi_command(periph, NULL, + error = scsipi_command(periph, (struct scsipi_generic *) &cmd, sizeof(cmd), NULL, 0, MUSTEK_RETRIES, 5000, NULL, 0); if (error) @@ -534,7 +534,7 @@ mustek_get_status(struct ss_softc *ss, int timeout, int update) while (1) { SC_DEBUG(periph, SCSIPI_DB1, ("mustek_get_status: stat_cmd\n")); - error = scsipi_command(periph, NULL, + error = scsipi_command(periph, (struct scsipi_generic *) &cmd, sizeof(cmd), (u_char *) &data, sizeof(data), MUSTEK_RETRIES, 5000, NULL, XS_CTL_DATA_IN | XS_CTL_DATA_ONSTACK); diff --git a/sys/dev/scsipi/ss_scanjet.c b/sys/dev/scsipi/ss_scanjet.c index 957a35d75741..99ed246d5f8d 100644 --- a/sys/dev/scsipi/ss_scanjet.c +++ b/sys/dev/scsipi/ss_scanjet.c @@ -1,4 +1,4 @@ -/* $NetBSD: ss_scanjet.c,v 1.33 2004/09/17 23:35:13 mycroft Exp $ */ +/* $NetBSD: ss_scanjet.c,v 1.34 2004/09/17 23:43:17 mycroft Exp $ */ /* * Copyright (c) 1995 Kenneth Stailey. All rights reserved. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ss_scanjet.c,v 1.33 2004/09/17 23:35:13 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ss_scanjet.c,v 1.34 2004/09/17 23:43:17 mycroft Exp $"); #include #include @@ -326,7 +326,7 @@ scanjet_ctl_write(struct ss_softc *ss, char *buf, u_int size) memset(&cmd, 0, sizeof(cmd)); cmd.opcode = WRITE; _lto3b(size, cmd.len); - return (scsipi_command(ss->sc_periph, NULL, + return (scsipi_command(ss->sc_periph, (struct scsipi_generic *) &cmd, sizeof(cmd), (u_char *) buf, size, 0, 100000, NULL, flags | XS_CTL_DATA_OUT | XS_CTL_DATA_ONSTACK)); @@ -349,7 +349,7 @@ scanjet_ctl_read(struct ss_softc *ss, char *buf, u_int size) memset(&cmd, 0, sizeof(cmd)); cmd.opcode = READ; _lto3b(size, cmd.len); - return (scsipi_command(ss->sc_periph, NULL, + return (scsipi_command(ss->sc_periph, (struct scsipi_generic *) &cmd, sizeof(cmd), (u_char *) buf, size, 0, 100000, NULL, flags | XS_CTL_DATA_IN | XS_CTL_DATA_ONSTACK)); diff --git a/sys/dev/scsipi/st.c b/sys/dev/scsipi/st.c index 5a88cfead998..ca50220a5952 100644 --- a/sys/dev/scsipi/st.c +++ b/sys/dev/scsipi/st.c @@ -1,4 +1,4 @@ -/* $NetBSD: st.c,v 1.168 2004/09/17 23:35:13 mycroft Exp $ */ +/* $NetBSD: st.c,v 1.169 2004/09/17 23:43:17 mycroft Exp $ */ /*- * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.168 2004/09/17 23:35:13 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.169 2004/09/17 23:43:17 mycroft Exp $"); #include "opt_scsi.h" @@ -1648,7 +1648,7 @@ st_read(struct st_softc *st, char *buf, int size, int flags) cmd.len); } else _lto3b(size, cmd.len); - return (scsipi_command(st->sc_periph, NULL, + return (scsipi_command(st->sc_periph, (struct scsipi_generic *)&cmd, sizeof(cmd), (u_char *)buf, size, 0, ST_IO_TIME, NULL, flags | XS_CTL_DATA_IN)); } @@ -1684,7 +1684,7 @@ st_erase(struct st_softc *st, int full, int flags) if ((st->quirks & ST_Q_ERASE_NOIMM) == 0) cmd.byte2 |= SE_IMMED; - return (scsipi_command(st->sc_periph, NULL, + return (scsipi_command(st->sc_periph, (struct scsipi_generic *)&cmd, sizeof(cmd), 0, 0, ST_RETRIES, tmo, NULL, flags)); } @@ -1770,7 +1770,7 @@ st_space(struct st_softc *st, int number, u_int what, int flags) st->flags &= ~ST_POSUPDATED; st->last_ctl_resid = 0; - error = scsipi_command(st->sc_periph, NULL, + error = scsipi_command(st->sc_periph, (struct scsipi_generic *)&cmd, sizeof(cmd), 0, 0, 0, ST_SPC_TIME, NULL, flags); @@ -1840,7 +1840,7 @@ st_write_filemarks(struct st_softc *st, int number, int flags) _lto3b(number, cmd.number); /* XXX WE NEED TO BE ABLE TO GET A RESIDIUAL XXX */ - error = scsipi_command(st->sc_periph, NULL, + error = scsipi_command(st->sc_periph, (struct scsipi_generic *)&cmd, sizeof(cmd), 0, 0, 0, ST_IO_TIME * 4, NULL, flags); if (error == 0 && st->fileno != -1) { @@ -1914,7 +1914,7 @@ st_load(struct st_softc *st, u_int type, int flags) cmd.byte2 = SR_IMMED; cmd.how = type; - error = scsipi_command(st->sc_periph, NULL, + error = scsipi_command(st->sc_periph, (struct scsipi_generic *)&cmd, sizeof(cmd), 0, 0, ST_RETRIES, ST_SPC_TIME, NULL, flags); if (error) { @@ -1952,7 +1952,7 @@ st_rewind(struct st_softc *st, u_int immediate, int flags) cmd.opcode = REWIND; cmd.byte2 = immediate; - error = scsipi_command(st->sc_periph, NULL, + error = scsipi_command(st->sc_periph, (struct scsipi_generic *)&cmd, sizeof(cmd), 0, 0, ST_RETRIES, immediate ? ST_CTL_TIME: ST_SPC_TIME, NULL, flags); if (error) { @@ -2003,7 +2003,7 @@ st_rdpos(struct st_softc *st, int hard, u_int32_t *blkptr) if (hard) cmd.byte1 = 1; - error = scsipi_command(st->sc_periph, NULL, + error = scsipi_command(st->sc_periph, (struct scsipi_generic *)&cmd, sizeof(cmd), (u_char *)&posdata, sizeof(posdata), ST_RETRIES, ST_CTL_TIME, NULL, XS_CTL_SILENT | XS_CTL_DATA_IN | XS_CTL_DATA_ONSTACK); @@ -2044,7 +2044,7 @@ st_setpos(struct st_softc *st, int hard, u_int32_t *blkptr) if (hard) cmd.byte2 = 1 << 2; _lto4b(*blkptr, cmd.blkaddr); - error = scsipi_command(st->sc_periph, NULL, + error = scsipi_command(st->sc_periph, (struct scsipi_generic *)&cmd, sizeof(cmd), NULL, 0, ST_RETRIES, ST_SPC_TIME, NULL, 0); /* diff --git a/sys/dev/scsipi/st_scsi.c b/sys/dev/scsipi/st_scsi.c index 3b279fd706dc..a957d0b9b1a6 100644 --- a/sys/dev/scsipi/st_scsi.c +++ b/sys/dev/scsipi/st_scsi.c @@ -1,7 +1,7 @@ -/* $NetBSD: st_scsi.c,v 1.12 2004/09/09 19:35:33 bouyer Exp $ */ +/* $NetBSD: st_scsi.c,v 1.13 2004/09/17 23:43:17 mycroft Exp $ */ /*- - * Copyright (c) 1998 The NetBSD Foundation, Inc. + * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: st_scsi.c,v 1.12 2004/09/09 19:35:33 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: st_scsi.c,v 1.13 2004/09/17 23:43:17 mycroft Exp $"); #include "opt_scsi.h" #include "rnd.h" @@ -155,7 +155,7 @@ st_scsibus_read_block_limits(struct st_softc *st, int flags) /* * do the command, update the global values */ - error = scsipi_command(periph, NULL, (struct scsipi_generic *)&cmd, + error = scsipi_command(periph, (struct scsipi_generic *)&cmd, sizeof(cmd), (u_char *)&block_limits, sizeof(block_limits), ST_RETRIES, ST_CTL_TIME, NULL, flags | XS_CTL_DATA_IN | XS_CTL_DATA_ONSTACK);