summaryrefslogtreecommitdiffstats
path: root/sys/scsi
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1995-10-31 17:21:00 +0000
committerjoerg <joerg@FreeBSD.org>1995-10-31 17:21:00 +0000
commitd24010b5b891b2848ea8f4543d00c2257f28a7c0 (patch)
treec8cfdb57d230f15ebd6cbac78dd76dbcc4da26d3 /sys/scsi
parent51c1be034e342c3386f10ee7738e4187e115c75d (diff)
downloadFreeBSD-src-d24010b5b891b2848ea8f4543d00c2257f28a7c0.zip
FreeBSD-src-d24010b5b891b2848ea8f4543d00c2257f28a7c0.tar.gz
Include the "od" driver. (Oops, forgot to cvs add the driver file
itself. Will do this after this commit.) Make scsiconf more flexible about recognizing ``foreign'' devices. This part needs to be rewritten some day to allow for matches whithou strict version number checks, but either Julian as Peter seem to be too busy right now, so i'm finally commiting the version that's working for me stable now for several months, as an interim workaround. Submitted by: akiyama@kme.mei.co.jp (Shunsuke Akiyama)
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/scsi_sense.c46
-rw-r--r--sys/scsi/scsiconf.c103
2 files changed, 100 insertions, 49 deletions
diff --git a/sys/scsi/scsi_sense.c b/sys/scsi/scsi_sense.c
index 94c5cdf..9fb2faf 100644
--- a/sys/scsi/scsi_sense.c
+++ b/sys/scsi/scsi_sense.c
@@ -13,7 +13,7 @@
#include "worm.h"
#include "cd.h"
#define NSCAN 0
-#define NOPMEM 0
+#include "od.h"
#include "ch.h"
#define NCOMM 0
@@ -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 635620e..c364eab 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.34 1995/08/23 23:03:33 gibbs Exp $
+ * $Id: scsiconf.c,v 1.35 1995/10/09 15:14:59 joerg Exp $
*/
#include <sys/types.h>
@@ -36,6 +36,7 @@
#include "st.h"
#include "cd.h"
#include "ch.h"
+#include "od.h"
#include "worm.h"
#include "su.h"
@@ -63,7 +64,8 @@ struct extend_array
static errval scsi_attach_sctarg __P((void));
-static void *extend_alloc(size_t s)
+static void *
+extend_alloc(size_t s)
{
void *p = malloc(s, M_DEVBUF, M_NOWAIT);
if (!p)
@@ -71,7 +73,8 @@ static void *extend_alloc(size_t s)
return p;
}
-static void extend_free(void *p) { free(p, M_DEVBUF); }
+static void
+extend_free(void *p) { free(p, M_DEVBUF); }
/* EXTEND_CHUNK: Number of extend slots to allocate whenever we need a new
* one.
@@ -80,7 +83,8 @@ static void extend_free(void *p) { free(p, M_DEVBUF); }
#define EXTEND_CHUNK 8
#endif
-struct extend_array *extend_new(void)
+struct extend_array *
+extend_new(void)
{
struct extend_array *p = extend_alloc(sizeof(*p));
if (p) {
@@ -91,7 +95,8 @@ struct extend_array *extend_new(void)
return p;
}
-void *extend_set(struct extend_array *ea, int index, void *value)
+void *
+extend_set(struct extend_array *ea, int index, void *value)
{
if (index >= ea->nelem) {
void **space;
@@ -117,14 +122,16 @@ void *extend_set(struct extend_array *ea, int index, void *value)
return value;
}
-void *extend_get(struct extend_array *ea, int index)
+void *
+extend_get(struct extend_array *ea, int index)
{
if (ea == NULL || index >= ea->nelem || index < 0)
return NULL;
return ea->ps[index];
}
-void extend_release(struct extend_array *ea, int index)
+void
+extend_release(struct extend_array *ea, int index)
{
void *p = extend_get(ea, index);
if (p) {
@@ -149,6 +156,9 @@ struct extend_array *scbusses;
*/
struct scsidevs {
u_int32 type;
+#ifdef NEW_SCSICONF
+ u_int32 driver; /* normally the same as type */
+#endif
boolean removable;
char *manufacturer;
char *model;
@@ -165,11 +175,19 @@ struct scsidevs {
#define SC_ONE_LU 0x00
#define SC_MORE_LUS 0x02
+#ifdef NEW_SCSICONF
+static struct scsidevs unknowndev =
+ {
+ T_UNKNOWN, T_UNKNOWN, 0, "*", "*", "*",
+ "uk", SC_MORE_LUS
+ };
+#else /* !NEW_SCSICONF */
static struct scsidevs unknowndev =
{
T_UNKNOWN, 0, "*", "*", "*",
"uk", SC_MORE_LUS
};
+#endif /* NEW_SCSICONF */
#ifdef NEW_SCSICONF
static st_modes mode_tandberg3600 =
@@ -219,75 +237,90 @@ 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_OPTICAL, T_REMOV, "MATSHITA", "PD-1 LF-1000", "*",
+ "od", SC_MORE_LUS
+ },
+ {
+ T_DIRECT, T_OPTICAL, T_REMOV, "SONY", "SMO-*", "*",
+ "od", SC_MORE_LUS
+ },
+ {
+ T_OPTICAL, T_OPTICAL, T_REMOV, "*", "*", "*",
+ "od", SC_ONE_LU
+ },
+#endif /* NOD */
#if NSD > 0
{
- T_DIRECT, T_FIXED, "MAXTOR", "XT-4170S", "B5A",
+ T_DIRECT, T_DIRECT, T_FIXED, "MAXTOR", "XT-4170S", "B5A",
"mx1", SC_ONE_LU
},
{
- T_DIRECT, T_FIXED, "*", "*", "*",
+ T_DIRECT, T_DIRECT, T_FIXED, "*", "*", "*",
"sd", SC_ONE_LU
},
#endif /* NSD */
#if NST > 0
{
- T_SEQUENTIAL, T_REMOV, "TANDBERG", " TDC 3600", "*",
+ T_SEQUENTIAL, T_SEQUENTIAL, T_REMOV, "TANDBERG", " TDC 3600", "*",
"st", SC_ONE_LU, ST_Q_NEEDS_PAGE_0, mode_tandberg3600
},
{
- T_SEQUENTIAL, T_REMOV, "ARCHIVE", "VIPER 2525*", "-005",
+ T_SEQUENTIAL, T_SEQUENTIAL, T_REMOV, "ARCHIVE", "VIPER 2525*", "-005",
"st", SC_ONE_LU, 0, mode_archive2525
},
{
- T_SEQUENTIAL, T_REMOV, "ARCHIVE", "VIPER 150", "*",
+ T_SEQUENTIAL, T_SEQUENTIAL, T_REMOV, "ARCHIVE", "VIPER 150", "*",
"st", SC_ONE_LU, ST_Q_NEEDS_PAGE_0, mode_archive150
},
{
- T_SEQUENTIAL, T_REMOV, "WANGTEK", "5525ES*", "*",
+ T_SEQUENTIAL, T_SEQUENTIAL, T_REMOV, "WANGTEK", "5525ES*", "*",
"st", SC_ONE_LU, 0, mode_wangtek5525
},
{
- T_SEQUENTIAL, T_REMOV, "WangDAT", "Model 1300", "*",
+ T_SEQUENTIAL, T_SEQUENTIAL, T_REMOV, "WangDAT", "Model 1300", "*",
"st", SC_ONE_LU, 0, mode_wangdat1300
},
{
- T_SEQUENTIAL, T_REMOV, "*", "*", "*",
+ T_SEQUENTIAL, T_SEQUENTIAL, T_REMOV, "*", "*", "*",
"st", SC_ONE_LU, 0, mode_unktape
},
#endif /* NST */
#if NCH > 0
{
- T_CHANGER, T_REMOV, "*", "*", "*",
+ T_CHANGER, T_CHANGER, T_REMOV, "*", "*", "*",
"ch", SC_ONE_LU
},
#endif /* NCH */
#if NCD > 0
#ifndef UKTEST /* make cdroms unrecognised to test the uk driver */
{
- T_READONLY, T_REMOV, "SONY", "CD-ROM CDU-8012", "3.1a",
+ T_READONLY, T_READONLY, T_REMOV, "SONY", "CD-ROM CDU-8012", "3.1a",
"cd", SC_ONE_LU
},
{
- T_READONLY, T_REMOV, "PIONEER", "CD-ROM DRM-600", "*",
+ T_READONLY, T_READONLY, T_REMOV, "PIONEER", "CD-ROM DRM-600", "*",
"cd", SC_MORE_LUS
},
{
- T_READONLY, T_REMOV, "PIONEER", "CD-ROM DRM-602X" ,"*",
+ T_READONLY, T_READONLY, T_REMOV, "PIONEER", "CD-ROM DRM-602X" ,"*",
"cd", SC_MORE_LUS
},
{
- T_READONLY, T_REMOV, "CHINON", "CD-ROM CDS-535","*",
+ T_READONLY, T_READONLY, T_REMOV, "CHINON", "CD-ROM CDS-535","*",
"cd", SC_ONE_LU
},
#endif /* !UKTEST */
#endif /* NCD */
#if NWORM > 0
{
- T_WORM, T_REMOV, "YAMAHA", "CDR100", "*",
+ T_WORM, T_WORM, T_REMOV, "YAMAHA", "CDR100", "*",
"worm", SC_ONE_LU
},
{
- T_WORM, T_REMOV, "*", "*", "*",
+ T_WORM, T_WORM, T_REMOV, "*", "*", "*",
"worm", SC_ONE_LU
},
#endif /* NWORM */
@@ -307,6 +340,16 @@ static struct scsidevs knowndevs[] =
,"B5A ", "mx1", SC_ONE_LU
},
#endif /* NSD */
+#if NOD > 0
+ {
+ T_OPTICAL, T_REMOV, "standard", "any"
+ ,"any", "od", SC_ONE_LU
+ },
+ {
+ T_OPTICAL, T_REMOV, "MATSHITA", "PD-1 LF-1000"
+ ,"any", "od", SC_MORE_LUS
+ },
+#endif /* NOD */
#if NST > 0
{
T_SEQUENTIAL, T_REMOV, "standard", "any"
@@ -634,13 +677,16 @@ scsi_sctarg_lookup(char *name, int unit, int *target, int *lun, int *bus)
}
#endif /* NSCTARG > 0 */
-void scsi_configure_start(void)
+void
+scsi_configure_start(void)
{
scsi_init();
}
-void scsi_configure_finish(void)
+void
+scsi_configure_finish(void)
{
+
#if NSCTARG > 0
scsi_attach_sctarg();
#endif
@@ -809,7 +855,7 @@ scsi_set_bus(int bus, struct scsi_link *sc_link)
* 2. Via the minor number. That takes precedence over the config file.
*/
static errval
- scsi_attach_sctarg()
+scsi_attach_sctarg()
{
struct scsi_link *sc_link = NULL;
int dev_unit;
@@ -1214,7 +1260,12 @@ scsi_probedev(sc_link, maybe_more, type_p)
if (bestmatch == &unknowndev)
*type_p = type;
else
- *type_p = bestmatch->type;
+ *type_p =
+#ifdef NEW_SCSICONF
+ bestmatch->driver;
+#else
+ bestmatch->type;
+#endif
return bestmatch;
}
OpenPOWER on IntegriCloud