summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorJoerg Wunsch <joerg@FreeBSD.org>1996-06-08 11:28:49 +0000
committerJoerg Wunsch <joerg@FreeBSD.org>1996-06-08 11:28:49 +0000
commit7a796ac8d911053b8136c227472ea37568ccba9c (patch)
tree0dff8530c7d3f45126895a5af419c06bec25b56c /sys/scsi
parentc03d25376acf8388e0e5584d76267cbb50647303 (diff)
Notes
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/od.c94
-rw-r--r--sys/scsi/scsi_sense.c44
-rw-r--r--sys/scsi/scsiconf.c39
3 files changed, 75 insertions, 102 deletions
diff --git a/sys/scsi/od.c b/sys/scsi/od.c
index 4086af019068..57287837af3a 100644
--- a/sys/scsi/od.c
+++ b/sys/scsi/od.c
@@ -28,7 +28,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: od.c,v 1.15.1.3 1996/05/06 15:14:57 shun Exp $
+ * $Id: od.c,v 1.16 1996/05/19 19:26:21 joerg Exp $
*/
/*
@@ -44,9 +44,6 @@
#define OD_BOGUS_NOT_READY
*/
-#include "opt_bounce.h"
-#include "opt_scsi.h"
-
#define SPLOD splbio
#include <sys/types.h>
#include <sys/param.h>
@@ -65,9 +62,6 @@
#include <sys/dkstat.h>
#include <sys/disklabel.h>
#include <sys/diskslice.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
#include <scsi/scsi_all.h>
#include <scsi/scsi_disk.h>
#include <scsi/scsiconf.h>
@@ -100,14 +94,8 @@ struct scsi_data {
u_int32_t disksize; /* total number sectors */
} params;
struct diskslices *dk_slices; /* virtual drives */
- struct buf_queue_head buf_queue;
+ struct buf buf_queue;
int dkunit; /* disk stats unit number */
-#ifdef DEVFS
- /* Eventually move all these to common disk struct. */
- void *b_devfs_token;
- void *c_devfs_token;
- void *ctl_devfs_token;
-#endif
};
static void od_get_geometry __P((u_int32_t, u_int16_t *,
@@ -130,24 +118,6 @@ static errval od_close __P((dev_t dev, int fflag, int fmt, struct proc *p,
struct scsi_link *sc_link));
static void od_strategy(struct buf *bp, struct scsi_link *sc_link);
-static d_open_t odopen;
-static d_close_t odclose;
-static d_ioctl_t odioctl;
-static d_strategy_t odstrategy;
-
-#define CDEV_MAJOR 70
-#define BDEV_MAJOR 20
-extern struct cdevsw od_cdevsw;
-static struct bdevsw od_bdevsw =
- { odopen, odclose, odstrategy, odioctl, /*20*/
- nodump, nopsize, 0, "od", &od_cdevsw, -1 };
-
-static struct cdevsw od_cdevsw =
- { odopen, odclose, rawread, rawwrite, /*70*/
- odioctl, nostop, nullreset, nodevtotty,
- seltrue, nommap, odstrategy, "od",
- &od_bdevsw, -1 };
-
/*
* Actually include the interface routines
*/
@@ -177,9 +147,11 @@ static struct scsi_device od_switch =
};
static int
-od_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
+od_externalize(struct proc *p, struct kern_devconf *kdc, void *userp,
+ size_t len)
{
- return scsi_externalize(SCSI_LINK(&od_switch, kdc->kdc_unit), req);
+ return scsi_externalize(SCSI_LINK(&od_switch, kdc->kdc_unit),
+ userp, &len);
}
static struct kern_devconf kdc_od_template = {
@@ -216,14 +188,11 @@ od_registerdev(int unit)
* The routine called by the low level scsi routine when it discovers
* a device suitable for this driver.
*/
-static errval
+errval
odattach(struct scsi_link *sc_link)
{
u_int32_t unit;
struct disk_parms *dp;
-#ifdef DEVFS
- int mynor;
-#endif
struct scsi_data *od = sc_link->sd;
@@ -234,7 +203,6 @@ odattach(struct scsi_link *sc_link)
if (sc_link->opennings > ODOUTSTANDING)
sc_link->opennings = ODOUTSTANDING;
- TAILQ_INIT(&od->buf_queue);
/*
* Use the subdriver to request information regarding
* the drive. We cannot use interrupts yet, so the
@@ -268,22 +236,6 @@ odattach(struct scsi_link *sc_link)
od->flags |= ODINIT;
od_registerdev(unit);
-#ifdef DEVFS
- mynor = dkmakeminor(unit, WHOLE_DISK_SLICE, RAW_PART);
- od->b_devfs_token = devfs_add_devswf(&od_bdevsw, mynor, DV_BLK,
- UID_ROOT, GID_OPERATOR, 0640,
- "od%d", unit);
- od->c_devfs_token = devfs_add_devswf(&od_cdevsw, mynor, DV_CHR,
- UID_ROOT, GID_OPERATOR, 0640,
- "rod%d", unit);
- mynor = dkmakeminor(unit, 0, 0); /* XXX */
- od->ctl_devfs_token = devfs_add_devswf(&od_cdevsw,
- mynor | SCSI_CONTROL_MASK,
- DV_CHR,
- UID_ROOT, GID_WHEEL, 0600,
- "rod%d.ctl", unit);
-#endif
-
return 0;
}
@@ -402,7 +354,7 @@ od_open(dev, mode, fmt, p, sc_link)
/* Initialize slice tables. */
errcode = dsopen("od", dev, fmt, &od->dk_slices, &label, odstrategy1,
- (ds_setgeom_t *)NULL, &od_bdevsw, &od_cdevsw);
+ (ds_setgeom_t *)NULL);
if (errcode != 0)
goto bad;
SC_DEBUG(sc_link, SDEV_DB3, ("Slice tables initialized "));
@@ -450,6 +402,7 @@ od_close(dev, fflag, fmt, p, sc_link)
static void
od_strategy(struct buf *bp, struct scsi_link *sc_link)
{
+ struct buf *dp;
u_int32_t opri;
struct scsi_data *od;
u_int32_t unit;
@@ -480,6 +433,7 @@ od_strategy(struct buf *bp, struct scsi_link *sc_link)
goto done; /* XXX check b_resid */
opri = SPLOD();
+ dp = &od->buf_queue;
/*
* Use a bounce buffer if necessary
@@ -492,7 +446,7 @@ od_strategy(struct buf *bp, struct scsi_link *sc_link)
/*
* Place it in the queue of disk activities for this disk
*/
- TAILQ_INSERT_TAIL(&od->buf_queue, bp, b_act);
+ disksort(dp, bp);
/*
* Tell the device to get going on the transfer if it's
@@ -546,6 +500,7 @@ odstart(u_int32_t unit, u_int32_t flags)
register struct scsi_link *sc_link = SCSI_LINK(&od_switch, unit);
register struct scsi_data *od = sc_link->sd;
struct buf *bp = 0;
+ struct buf *dp;
struct scsi_rw_big cmd;
u_int32_t blkno, nblk;
u_int32_t secsize;
@@ -567,11 +522,11 @@ odstart(u_int32_t unit, u_int32_t flags)
/*
* See if there is a buf with work for us to do..
*/
- bp = od->buf_queue.tqh_first;
- if (bp == NULL) { /* yes, an assign */
+ dp = &od->buf_queue;
+ if ((bp = dp->b_actf) == NULL) { /* yes, an assign */
return;
}
- TAILQ_REMOVE( &od->buf_queue, bp, b_act);
+ dp->b_actf = bp->b_actf;
/*
* If the device has become invalid, abort all the
@@ -929,22 +884,3 @@ od_sense_handler(struct scsi_xfer *xs)
return SCSIRET_DO_RETRY;
}
-
-static od_devsw_installed = 0;
-
-static void od_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! od_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&od_cdevsw, NULL);
- dev = makedev(BDEV_MAJOR, 0);
- bdevsw_add(&dev,&od_bdevsw, NULL);
- od_devsw_installed = 1;
- }
-}
-
-SYSINIT(oddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,od_drvinit,NULL)
-
-
diff --git a/sys/scsi/scsi_sense.c b/sys/scsi/scsi_sense.c
index a21496afce86..b112c6d104af 100644
--- a/sys/scsi/scsi_sense.c
+++ b/sys/scsi/scsi_sense.c
@@ -29,7 +29,7 @@ static struct
{0x3b, 0x0d, "Medium destination element full" },
{0x3b, 0x0e, "Medium source element empty" },
#endif
-#if (NOPMEM > 0)
+#if (NOD > 0)
{0x58, 0x00, "Generation does not exist" },
{0x59, 0x00, "Updated block read" },
#endif
@@ -58,10 +58,10 @@ static struct
{0x18, 0x04, "Recovered data with L-EC" },
{0x57, 0x00, "Unable to recover table-of-contents" },
#endif
-#if (NWORM > 0)||(NOPMEM > 0)
+#if (NWORM > 0)||(NOD > 0)
{0x11, 0x07, "Data resynchronization error" },
#endif
-#if (NWORM > 0)||(NCD > 0)||(NOPMEM > 0)
+#if (NWORM > 0)||(NCD > 0)||(NOD > 0)
{0x11, 0x06, "Circ unrecovered error" },
{0x09, 0x02, "Focus servo failure" },
{0x11, 0x05, "L-EC uncorrectable error" },
@@ -102,7 +102,7 @@ static struct
{0x50, 0x00, "Write append error" },
{0x50, 0x01, "Write append position error" },
#endif
-#if (NST > 0)||(NOPMEM > 0)
+#if (NST > 0)||(NOD > 0)
{0x51, 0x00, "Erase failure" },
#endif
#if (NST > 0)||(NSCAN > 0)
@@ -120,7 +120,7 @@ static struct
{0x42, 0x00, "Power-on or self-test failure (should use 40 nn)" },
{0x40, 0x00, "Ram failure (should use 40 nn)" },
#endif
-#if (NSD > 0)||(NOPMEM > 0)
+#if (NSD > 0)||(NOD > 0)
{0x19, 0x00, "Defect list error" },
{0x19, 0x03, "Defect list error in grown list" },
{0x19, 0x02, "Defect list error in primary list" },
@@ -132,7 +132,7 @@ static struct
{0x5c, 0x02, "Spindles not synchronized" },
{0x5c, 0x01, "Spindles synchronized" },
#endif
-#if (NSD > 0)||(NWORM > 0)||(NOPMEM > 0)
+#if (NSD > 0)||(NWORM > 0)||(NOD > 0)
{0x13, 0x00, "Address mark not found for data field" },
{0x12, 0x00, "Address mark not found for id field" },
{0x16, 0x00, "Data synchronization mark error" },
@@ -151,38 +151,38 @@ static struct
{0x0c, 0x02, "Write error - auto reallocation failed" },
{0x0c, 0x01, "Write error recovered with auto reallocation" },
#endif
-#if (NSD > 0)||(NWORM > 0)||(NCD > 0)||(NOPMEM > 0)
+#if (NSD > 0)||(NWORM > 0)||(NCD > 0)||(NOD > 0)
{0x18, 0x02, "Recovered data - data auto-reallocated" },
{0x18, 0x05, "Recovered data - recommend reassignment" },
{0x18, 0x06, "Recovered data - recommend rewrite" },
{0x17, 0x05, "Recovered data using previous sector id" },
{0x18, 0x01, "Recovered data with error correction & retries applied" },
#endif
-#if (NSD > 0)||(NWORM > 0)||(NCD > 0)||(NOPMEM > 0)||(NCH > 0)
+#if (NSD > 0)||(NWORM > 0)||(NCD > 0)||(NOD > 0)||(NCH > 0)
{0x06, 0x00, "No reference position found" },
{0x02, 0x00, "No seek complete" },
#endif
-#if (NSD > 0)||(NSPRINT > 0)||(NOPMEM > 0)
+#if (NSD > 0)||(NSPRINT > 0)||(NOD > 0)
{0x31, 0x01, "Format command failed" },
#endif
#if (NSD > 0)||(NST > 0)
{0x30, 0x03, "Cleaning cartridge installed" },
#endif
-#if (NSD > 0)||(NST > 0)||(NOPMEM > 0)
+#if (NSD > 0)||(NST > 0)||(NOD > 0)
{0x11, 0x0a, "Miscorrected error" },
#endif
-#if (NSD > 0)||(NST > 0)||(NWORM > 0)||(NOPMEM > 0)
+#if (NSD > 0)||(NST > 0)||(NWORM > 0)||(NOD > 0)
{0x31, 0x00, "Medium format corrupted" },
{0x5a, 0x03, "Operator selected write permit" },
{0x5a, 0x02, "Operator selected write protect" },
{0x27, 0x00, "Write protected" },
#endif
-#if (NSD > 0)||(NST > 0)||(NWORM > 0)||(NSCAN > 0)||(NOPMEM > 0)
+#if (NSD > 0)||(NST > 0)||(NWORM > 0)||(NSCAN > 0)||(NOD > 0)
{0x11, 0x02, "Error too long to correct" },
{0x11, 0x03, "Multiple read errors" },
{0x11, 0x01, "Read retries exhausted" },
#endif
-#if (NSD > 0)||(NST > 0)||(NWORM > 0)||(NCD > 0)||(NOPMEM > 0)
+#if (NSD > 0)||(NST > 0)||(NWORM > 0)||(NCD > 0)||(NOD > 0)
{0x30, 0x02, "Cannot read medium - incompatible format" },
{0x30, 0x01, "Cannot read medium - unknown format" },
{0x15, 0x02, "Positioning error detected by read of medium" },
@@ -192,34 +192,34 @@ static struct
{0x17, 0x02, "Recovered data with positive head offset" },
{0x09, 0x00, "Track following error" },
#endif
-#if (NSD > 0)||(NST > 0)||(NWORM > 0)||(NCD > 0)||(NOPMEM > 0)||(NCH > 0)
+#if (NSD > 0)||(NST > 0)||(NWORM > 0)||(NCD > 0)||(NOD > 0)||(NCH > 0)
{0x30, 0x00, "Incompatible medium installed" },
{0x21, 0x00, "Logical block address out of range" },
{0x53, 0x02, "Medium removal prevented" },
{0x5a, 0x01, "Operator medium removal request" },
#endif
-#if (NSD > 0)||(NST > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOPMEM > 0)
+#if (NSD > 0)||(NST > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOD > 0)
{0x17, 0x00, "Recovered data with no error correction applied" },
{0x17, 0x01, "Recovered data with retries" },
{0x11, 0x00, "Unrecovered read error" },
#endif
-#if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NOPMEM > 0)
+#if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NOD > 0)
{0x04, 0x04, "Logical unit not ready, format in progress" },
#endif
-#if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NWORM > 0)||(NSCAN > 0)||(NOPMEM > 0)
+#if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NWORM > 0)||(NSCAN > 0)||(NOD > 0)
{0x03, 0x00, "Peripheral device write fault" },
#endif
-#if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOPMEM > 0)
+#if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOD > 0)
{0x14, 0x00, "Recorded entity not found" },
#endif
-#if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOPMEM > 0)||(NCH > 0)
+#if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOD > 0)||(NCH > 0)
{0x15, 0x01, "Mechanical positioning error" },
{0x53, 0x00, "Media load or eject failed" },
{0x3a, 0x00, "Medium not present" },
{0x07, 0x00, "Multiple peripheral devices selected" },
{0x15, 0x00, "Random positioning error" },
#endif
-#if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOPMEM > 0)||(NCH > 0)||(ncomm > 0)
+#if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOD > 0)||(NCH > 0)||(ncomm > 0)
{0x2a, 0x02, "Log parameters changed" },
{0x08, 0x00, "Logical unit communication failure" },
{0x08, 0x02, "Logical unit communication parity error" },
@@ -229,10 +229,10 @@ static struct
{0x37, 0x00, "Rounded parameter" },
{0x39, 0x00, "Saving parameters not supported" },
#endif
-#if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NPT > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOPMEM > 0)||(ncomm > 0)
+#if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NPT > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOD > 0)||(ncomm > 0)
{0x2b, 0x00, "Copy cannot execute since host cannot disconnect" },
#endif
-#if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NPT > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOPMEM > 0)||(NCH > 0)
+#if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NPT > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOD > 0)||(NCH > 0)
{0x5b, 0x02, "Log counter at maximum" },
{0x5b, 0x00, "Log exception" },
{0x5b, 0x03, "Log list codes exhausted" },
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c
index ae144fc086ac..85be16221903 100644
--- a/sys/scsi/scsiconf.c
+++ b/sys/scsi/scsiconf.c
@@ -16,7 +16,7 @@
*
* New configuration setup: dufault@hda.com
*
- * $Id: scsiconf.c,v 1.30.4.5 1996/04/01 00:26:10 gibbs Exp $
+ * $Id: scsiconf.c,v 1.30.4.6 1996/04/04 22:43:59 rich Exp $
*/
#include <sys/types.h>
@@ -219,6 +219,27 @@ static st_modes mode_unktape =
static struct scsidevs knowndevs[] =
#ifdef NEW_SCSICONF
{
+/* od's must be probed before sd's since some of them identify as T_DIRECT */
+#if NOD > 0
+ {
+ T_OPTICAL, T_REMOV, "MATSHITA", "PD-1 LF-1000", "*",
+ "od", SC_MORE_LUS
+ },
+ /*
+ * The SONY SMO is not really supported here, since it
+ * identifies as T_DIRECT, and thus doesn't get assigned
+ * to the od driver.
+ * You need to upgrade to the FreeBSD 2.2 line for this.
+ */
+ {
+ T_OPTICAL, T_REMOV, "SONY", "SMO-*", "*",
+ "od", SC_MORE_LUS
+ },
+ {
+ T_OPTICAL, T_REMOV, "*", "*", "*",
+ "od", SC_ONE_LU
+ },
+#endif /* NOD */
#if NSD > 0
{
T_DIRECT, T_FIXED, "MAXTOR", "XT-4170S", "B5A",
@@ -301,6 +322,22 @@ static struct scsidevs knowndevs[] =
};
#else /* !NEW_SCSICONF */
{
+/* od's must be probed before sd's since some of them identify as T_DIRECT */
+#if NOD > 0
+ {
+ T_OPTICAL, T_REMOV, "MATSHITA", "PD-1 LF-1000", "*",
+ "od", SC_MORE_LUS
+ },
+ /* See comments under NEW_SCSICONF above. */
+ {
+ T_OPTICAL, T_REMOV, "SONY", "SMO-*", "*",
+ "od", SC_MORE_LUS
+ },
+ {
+ T_OPTICAL, T_REMOV, "*", "*", "*",
+ "od", SC_ONE_LU
+ },
+#endif /* NOD */
#if NSD > 0
{
T_DIRECT, T_FIXED, "standard", "any"