diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-02-16 21:19:08 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-02-16 21:19:08 +0000 |
commit | 2da99529039b177155c4f8b121a56af665bbc013 (patch) | |
tree | 164ac14d81166b8b640ca50ae2bfbd661def8e85 /sys/scsi | |
parent | 02ba6ef4276aced0ecad6ed5dc9b0a7e1cd1d4ad (diff) |
Extend the scsi_adapter minphys() callback to take a struct scsi_link *
as additional argument. This will allow intermediate layers between
scsi devices such as sd and scsi host adapters to take appropriate
action if necessary.
Diffstat (limited to 'sys/scsi')
-rw-r--r-- | sys/scsi/cd.c | 4 | ||||
-rw-r--r-- | sys/scsi/scsi_ioctl.c | 23 | ||||
-rw-r--r-- | sys/scsi/scsiconf.c | 13 | ||||
-rw-r--r-- | sys/scsi/scsiconf.h | 5 | ||||
-rw-r--r-- | sys/scsi/sd.c | 4 | ||||
-rw-r--r-- | sys/scsi/ss.c | 4 | ||||
-rw-r--r-- | sys/scsi/st.c | 23 |
7 files changed, 60 insertions, 16 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index d50e5db0787..560bd202e1f 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd.c,v 1.145 2009/01/10 18:00:59 robert Exp $ */ +/* $OpenBSD: cd.c,v 1.146 2009/02/16 21:19:07 miod Exp $ */ /* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */ /* @@ -716,7 +716,7 @@ cdminphys(struct buf *bp) bp->b_bcount = max; } - (*cd->sc_link->adapter->scsi_minphys)(bp); + (*cd->sc_link->adapter->scsi_minphys)(bp, cd->sc_link); device_unref(&cd->sc_dev); } diff --git a/sys/scsi/scsi_ioctl.c b/sys/scsi/scsi_ioctl.c index cfea976dea6..49d1f27d6cc 100644 --- a/sys/scsi/scsi_ioctl.c +++ b/sys/scsi/scsi_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi_ioctl.c,v 1.30 2007/09/16 01:30:24 krw Exp $ */ +/* $OpenBSD: scsi_ioctl.c,v 1.31 2009/02/16 21:19:07 miod Exp $ */ /* $NetBSD: scsi_ioctl.c,v 1.23 1996/10/12 23:23:17 christos Exp $ */ /* @@ -67,6 +67,7 @@ struct scsi_ioctl *si_get(void); void si_free(struct scsi_ioctl *); struct scsi_ioctl *si_find(struct buf *); void scsistrategy(struct buf *); +void scsiminphys(struct buf *); const unsigned char scsi_readsafe_cmd[256] = { [0x00] = 1, /* TEST UNIT READY */ @@ -324,6 +325,24 @@ bad: splx(s); } +void +scsiminphys(struct buf *bp) +{ + struct scsi_ioctl *si; + struct scsi_link *sc_link; + + si = si_find(bp); + if (si == NULL) { + /* should not happen */ + bp->b_flags |= B_ERROR; + bp->b_error = EINVAL; + return; + } + + sc_link = si->si_sc_link; + (*sc_link->adapter->scsi_minphys)(bp, sc_link); +} + /* * Something (e.g. another driver) has called us * with an sc_link for a target/lun/adapter, and a scsi @@ -392,7 +411,7 @@ scsi_do_ioctl(struct scsi_link *sc_link, dev_t dev, u_long cmd, caddr_t addr, si->si_uio.uio_procp = p; error = physio(scsistrategy, &si->si_bp, dev, (screq->flags & SCCMD_READ) ? B_READ : B_WRITE, - sc_link->adapter->scsi_minphys, &si->si_uio); + scsiminphys, &si->si_uio); } else { /* if no data, no need to translate it.. */ si->si_bp.b_flags = 0; diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c index 11b979d9ba3..c6e437e307f 100644 --- a/sys/scsi/scsiconf.c +++ b/sys/scsi/scsiconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.c,v 1.137 2009/02/16 21:13:31 krw Exp $ */ +/* $OpenBSD: scsiconf.c,v 1.138 2009/02/16 21:19:07 miod Exp $ */ /* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */ /* @@ -54,6 +54,7 @@ #include <sys/systm.h> #include <sys/malloc.h> #include <sys/device.h> +#include <sys/buf.h> #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> @@ -1058,3 +1059,13 @@ err: free(pg, M_TEMP); return (rv); } + +/* + * scsi_minphys member of struct scsi_adapter for drivers which don't + * need any specific routine. + */ +void +scsi_minphys(struct buf *bp, struct scsi_link *sl) +{ + minphys(bp); +} diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h index a38f054540f..393301c4072 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.h,v 1.97 2008/11/10 18:04:41 deraadt Exp $ */ +/* $OpenBSD: scsiconf.h,v 1.98 2009/02/16 21:19:07 miod Exp $ */ /* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */ /* @@ -293,7 +293,7 @@ extern int scsi_autoconf; */ struct scsi_adapter { int (*scsi_cmd)(struct scsi_xfer *); - void (*scsi_minphys)(struct buf *); + void (*scsi_minphys)(struct buf *, struct scsi_link *); int (*dev_probe)(struct scsi_link *); void (*dev_free)(struct scsi_link *); int (*ioctl)(struct scsi_link *, u_long, caddr_t, int, @@ -538,6 +538,7 @@ int scsi_do_ioctl(struct scsi_link *, dev_t, u_long, caddr_t, void sc_print_addr(struct scsi_link *); int scsi_report_luns(struct scsi_link *, int, struct scsi_report_luns_data *, u_int32_t, int, int); +void scsi_minphys(struct buf *, struct scsi_link *); void show_scsi_xs(struct scsi_xfer *); void scsi_print_sense(struct scsi_xfer *); diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 6b44d1c2381..e291af5815e 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.153 2008/08/24 09:08:49 dlg Exp $ */ +/* $OpenBSD: sd.c,v 1.154 2009/02/16 21:19:07 miod Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -808,7 +808,7 @@ sdminphys(struct buf *bp) bp->b_bcount = max; } - (*sd->sc_link->adapter->scsi_minphys)(bp); + (*sd->sc_link->adapter->scsi_minphys)(bp, sd->sc_link); device_unref(&sd->sc_dev); } diff --git a/sys/scsi/ss.c b/sys/scsi/ss.c index d38ca4931e8..797469411a2 100644 --- a/sys/scsi/ss.c +++ b/sys/scsi/ss.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ss.c,v 1.62 2008/06/22 16:32:05 krw Exp $ */ +/* $OpenBSD: ss.c,v 1.63 2009/02/16 21:19:07 miod Exp $ */ /* $NetBSD: ss.c,v 1.10 1996/05/05 19:52:55 christos Exp $ */ /* @@ -501,7 +501,7 @@ ssminphys(bp) { struct ss_softc *ss = ss_cd.cd_devs[SSUNIT(bp->b_dev)]; - (ss->sc_link->adapter->scsi_minphys)(bp); + (ss->sc_link->adapter->scsi_minphys)(bp, ss->sc_link); /* * trim the transfer further for special devices this is diff --git a/sys/scsi/st.c b/sys/scsi/st.c index 70e49277b7d..82dc5f39bb1 100644 --- a/sys/scsi/st.c +++ b/sys/scsi/st.c @@ -1,4 +1,4 @@ -/* $OpenBSD: st.c,v 1.85 2008/09/22 19:44:41 miod Exp $ */ +/* $OpenBSD: st.c,v 1.86 2009/02/16 21:19:07 miod Exp $ */ /* $NetBSD: st.c,v 1.71 1997/02/21 23:03:49 thorpej Exp $ */ /* @@ -226,6 +226,7 @@ void stattach(struct device *, struct device *, void *); int stactivate(struct device *, enum devact); int stdetach(struct device *, int); +void stminphys(struct buf *); void st_kill_buffers(struct st_softc *); void st_identify_drive(struct st_softc *, struct scsi_inquiry_data *); void st_loadquirks(struct st_softc *); @@ -1088,6 +1089,20 @@ strestart(void *v) splx(s); } +void +stminphys(struct buf *bp) +{ + struct st_softc *st; + + st = stlookup(STUNIT(bp->b_dev)); + if (st == NULL) + return; /* can't happen */ + + (*st->sc_link->adapter->scsi_minphys)(bp, st->sc_link); + + device_unref(&st->sc_dev); +} + int stread(dev_t dev, struct uio *uio, int iomode) { @@ -1102,8 +1117,7 @@ stread(dev_t dev, struct uio *uio, int iomode) return (ENXIO); } - return (physio(ststrategy, NULL, dev, B_READ, - st->sc_link->adapter->scsi_minphys, uio)); + return (physio(ststrategy, NULL, dev, B_READ, stminphys, uio)); } int @@ -1120,8 +1134,7 @@ stwrite(dev_t dev, struct uio *uio, int iomode) return (ENXIO); } - return (physio(ststrategy, NULL, dev, B_WRITE, - st->sc_link->adapter->scsi_minphys, uio)); + return (physio(ststrategy, NULL, dev, B_WRITE, stminphys, uio)); } /* |