1996-11-08 08:06:55 +03:00
|
|
|
/* $NetBSD: scsiconf.c,v 1.69 1996/11/08 05:06:55 explorer Exp $ */
|
1994-06-29 10:39:25 +04:00
|
|
|
|
1993-03-21 21:04:42 +03:00
|
|
|
/*
|
1994-03-29 08:29:20 +04:00
|
|
|
* Copyright (c) 1994 Charles Hannum. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by Charles Hannum.
|
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Originally written by Julian Elischer (julian@tfs.com)
|
1993-03-21 21:04:42 +03:00
|
|
|
* for TRW Financial Systems for use under the MACH(2.5) operating system.
|
|
|
|
*
|
|
|
|
* TRW Financial Systems, in accordance with their agreement with Carnegie
|
|
|
|
* Mellon University, makes this software available to CMU to distribute
|
|
|
|
* or use in any manner that they see fit as long as this message is kept with
|
|
|
|
* the software. For this reason TFS also grants any other persons or
|
|
|
|
* organisations permission to use or modify this software.
|
|
|
|
*
|
|
|
|
* TFS supplies this software to be publicly redistributed
|
|
|
|
* on the understanding that TFS is not responsible for the correct
|
|
|
|
* functioning of this software in any circumstances.
|
1993-05-20 07:46:09 +04:00
|
|
|
*
|
1994-03-29 08:29:20 +04:00
|
|
|
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
|
1993-03-21 21:04:42 +03:00
|
|
|
*/
|
|
|
|
|
1993-12-17 10:56:32 +03:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
1994-03-29 08:29:20 +04:00
|
|
|
#include <sys/malloc.h>
|
|
|
|
#include <sys/device.h>
|
1993-12-17 10:56:32 +03:00
|
|
|
|
|
|
|
#include <scsi/scsi_all.h>
|
|
|
|
#include <scsi/scsiconf.h>
|
1993-03-21 21:04:42 +03:00
|
|
|
|
1994-12-28 22:42:47 +03:00
|
|
|
#if 0
|
1993-03-21 21:04:42 +03:00
|
|
|
#if NCALS > 0
|
1994-12-28 22:42:47 +03:00
|
|
|
{ T_PROCESSOR, T_FIXED, 1,
|
|
|
|
0, 0, 0 },
|
1994-03-29 08:29:20 +04:00
|
|
|
#endif /* NCALS */
|
1993-03-21 21:04:42 +03:00
|
|
|
#if NBLL > 0
|
1994-12-28 22:42:47 +03:00
|
|
|
{ T_PROCESSOR, T_FIXED, 1,
|
1994-03-29 08:29:20 +04:00
|
|
|
"AEG ", "READER ", "V1.0" },
|
|
|
|
#endif /* NBLL */
|
1993-03-21 21:04:42 +03:00
|
|
|
#if NKIL > 0
|
1994-12-28 22:42:47 +03:00
|
|
|
{ T_SCANNER, T_FIXED, 0,
|
|
|
|
"KODAK ", "IL Scanner 900 ", 0 },
|
1994-03-29 08:29:20 +04:00
|
|
|
#endif /* NKIL */
|
1994-12-28 22:42:47 +03:00
|
|
|
#endif
|
1993-03-21 21:04:42 +03:00
|
|
|
|
1994-03-29 08:29:20 +04:00
|
|
|
/*
|
|
|
|
* Declarations
|
|
|
|
*/
|
1994-12-28 22:42:47 +03:00
|
|
|
void scsi_probedev __P((struct scsibus_softc *, int, int));
|
|
|
|
int scsi_probe_bus __P((int bus, int target, int lun));
|
1994-03-29 08:29:20 +04:00
|
|
|
|
|
|
|
struct scsi_device probe_switch = {
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
1993-03-21 21:04:42 +03:00
|
|
|
|
1994-11-04 01:05:08 +03:00
|
|
|
int scsibusmatch __P((struct device *, void *, void *));
|
1994-03-29 08:29:20 +04:00
|
|
|
void scsibusattach __P((struct device *, struct device *, void *));
|
1996-02-15 00:46:52 +03:00
|
|
|
int scsibussubmatch __P((struct device *, void *, void *));
|
1994-03-29 08:29:20 +04:00
|
|
|
|
1996-03-17 03:57:14 +03:00
|
|
|
struct cfattach scsibus_ca = {
|
|
|
|
sizeof(struct scsibus_softc), scsibusmatch, scsibusattach
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cfdriver scsibus_cd = {
|
|
|
|
NULL, "scsibus", DV_DULL
|
1994-03-29 08:29:20 +04:00
|
|
|
};
|
|
|
|
|
1996-08-28 01:53:46 +04:00
|
|
|
int scsibusprint __P((void *, const char *));
|
1996-03-05 03:15:09 +03:00
|
|
|
|
1996-08-28 22:47:51 +04:00
|
|
|
int
|
|
|
|
scsiprint(aux, pnp)
|
|
|
|
void *aux;
|
|
|
|
const char *pnp;
|
|
|
|
{
|
|
|
|
struct scsi_link *l = aux;
|
|
|
|
|
|
|
|
/* only "scsibus"es can attach to "scsi"s; easy. */
|
|
|
|
if (pnp)
|
1996-10-13 03:23:13 +04:00
|
|
|
printf("scsibus at %s", pnp);
|
1996-08-28 22:47:51 +04:00
|
|
|
|
|
|
|
/* don't print channel if the controller says there can be only one. */
|
|
|
|
if (l->channel != SCSI_CHANNEL_ONLY_ONE)
|
1996-10-13 03:23:13 +04:00
|
|
|
printf(" channel %d", l->channel);
|
1996-08-28 22:47:51 +04:00
|
|
|
|
|
|
|
return (UNCONF);
|
|
|
|
}
|
|
|
|
|
1994-03-29 08:29:20 +04:00
|
|
|
int
|
1994-11-04 01:09:00 +03:00
|
|
|
scsibusmatch(parent, match, aux)
|
1996-08-28 22:47:51 +04:00
|
|
|
struct device *parent;
|
|
|
|
void *match, *aux;
|
1993-03-21 21:04:42 +03:00
|
|
|
{
|
1996-08-28 22:47:51 +04:00
|
|
|
struct cfdata *cf = match;
|
|
|
|
struct scsi_link *l = aux;
|
|
|
|
int channel;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Allow single-channel controllers to specify their channel
|
|
|
|
* in a special way, so that it's not printed.
|
|
|
|
*/
|
|
|
|
channel = (l->channel != SCSI_CHANNEL_ONLY_ONE) ? l->channel : 0;
|
|
|
|
|
|
|
|
if (cf->scsicf_channel != channel &&
|
|
|
|
cf->scsicf_channel != SCSI_CHANNEL_UNKNOWN)
|
|
|
|
return (0);
|
1993-03-21 21:04:42 +03:00
|
|
|
|
1996-08-28 22:47:51 +04:00
|
|
|
return (1);
|
1994-03-29 08:29:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The routine called by the adapter boards to get all their
|
|
|
|
* devices configured in.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
scsibusattach(parent, self, aux)
|
|
|
|
struct device *parent, *self;
|
|
|
|
void *aux;
|
|
|
|
{
|
1994-12-28 22:42:47 +03:00
|
|
|
struct scsibus_softc *sb = (struct scsibus_softc *)self;
|
1994-03-29 08:29:20 +04:00
|
|
|
struct scsi_link *sc_link_proto = aux;
|
|
|
|
|
|
|
|
sc_link_proto->scsibus = sb->sc_dev.dv_unit;
|
|
|
|
sb->adapter_link = sc_link_proto;
|
1996-10-13 03:23:13 +04:00
|
|
|
printf("\n");
|
1994-03-29 08:29:20 +04:00
|
|
|
|
|
|
|
#if defined(SCSI_DELAY) && SCSI_DELAY > 2
|
1996-10-13 03:23:13 +04:00
|
|
|
printf("%s: waiting for scsi devices to settle\n",
|
1994-03-29 08:29:20 +04:00
|
|
|
sb->sc_dev.dv_xname);
|
|
|
|
#else /* SCSI_DELAY > 2 */
|
|
|
|
#undef SCSI_DELAY
|
|
|
|
#define SCSI_DELAY 2
|
|
|
|
#endif /* SCSI_DELAY */
|
|
|
|
delay(1000000 * SCSI_DELAY);
|
|
|
|
|
|
|
|
scsi_probe_bus(sb->sc_dev.dv_unit, -1, -1);
|
|
|
|
}
|
|
|
|
|
1994-12-28 22:42:47 +03:00
|
|
|
int
|
|
|
|
scsibussubmatch(parent, match, aux)
|
|
|
|
struct device *parent;
|
|
|
|
void *match, *aux;
|
|
|
|
{
|
|
|
|
struct cfdata *cf = match;
|
|
|
|
struct scsibus_attach_args *sa = aux;
|
|
|
|
struct scsi_link *sc_link = sa->sa_sc_link;
|
|
|
|
|
|
|
|
if (cf->cf_loc[0] != -1 && cf->cf_loc[0] != sc_link->target)
|
|
|
|
return 0;
|
|
|
|
if (cf->cf_loc[1] != -1 && cf->cf_loc[1] != sc_link->lun)
|
|
|
|
return 0;
|
1996-03-17 03:57:14 +03:00
|
|
|
return ((*cf->cf_attach->ca_match)(parent, match, aux));
|
1994-12-28 22:42:47 +03:00
|
|
|
}
|
|
|
|
|
1994-03-29 08:29:20 +04:00
|
|
|
/*
|
|
|
|
* Probe the requested scsi bus. It must be already set up.
|
|
|
|
* -1 requests all set up scsi busses.
|
1994-12-28 22:42:47 +03:00
|
|
|
* target and lun optionally narrow the search if not -1
|
1994-03-29 08:29:20 +04:00
|
|
|
*/
|
|
|
|
int
|
1994-12-28 22:42:47 +03:00
|
|
|
scsi_probe_busses(bus, target, lun)
|
|
|
|
int bus, target, lun;
|
1994-03-29 08:29:20 +04:00
|
|
|
{
|
1993-03-21 21:04:42 +03:00
|
|
|
|
1994-03-29 08:29:20 +04:00
|
|
|
if (bus == -1) {
|
1996-03-17 03:57:14 +03:00
|
|
|
for (bus = 0; bus < scsibus_cd.cd_ndevs; bus++)
|
|
|
|
if (scsibus_cd.cd_devs[bus])
|
1994-12-28 22:42:47 +03:00
|
|
|
scsi_probe_bus(bus, target, lun);
|
1994-03-29 08:29:20 +04:00
|
|
|
return 0;
|
|
|
|
} else {
|
1994-12-28 22:42:47 +03:00
|
|
|
return scsi_probe_bus(bus, target, lun);
|
1994-03-29 08:29:20 +04:00
|
|
|
}
|
|
|
|
}
|
1993-03-21 21:04:42 +03:00
|
|
|
|
1994-03-29 08:29:20 +04:00
|
|
|
/*
|
|
|
|
* Probe the requested scsi bus. It must be already set up.
|
1994-12-28 22:42:47 +03:00
|
|
|
* target and lun optionally narrow the search if not -1
|
1994-03-29 08:29:20 +04:00
|
|
|
*/
|
|
|
|
int
|
1994-12-28 22:42:47 +03:00
|
|
|
scsi_probe_bus(bus, target, lun)
|
|
|
|
int bus, target, lun;
|
1994-03-29 08:29:20 +04:00
|
|
|
{
|
1994-12-28 22:42:47 +03:00
|
|
|
struct scsibus_softc *scsi;
|
|
|
|
int maxtarget, mintarget, maxlun, minlun;
|
|
|
|
u_int8_t scsi_addr;
|
1994-03-29 08:29:20 +04:00
|
|
|
|
1996-03-17 03:57:14 +03:00
|
|
|
if (bus < 0 || bus >= scsibus_cd.cd_ndevs)
|
1994-03-29 08:29:20 +04:00
|
|
|
return ENXIO;
|
1996-03-17 03:57:14 +03:00
|
|
|
scsi = scsibus_cd.cd_devs[bus];
|
1994-03-29 08:29:20 +04:00
|
|
|
if (!scsi)
|
|
|
|
return ENXIO;
|
|
|
|
|
1994-12-28 22:42:47 +03:00
|
|
|
scsi_addr = scsi->adapter_link->adapter_target;
|
1994-03-29 08:29:20 +04:00
|
|
|
|
1994-12-28 22:42:47 +03:00
|
|
|
if (target == -1) {
|
|
|
|
maxtarget = 7;
|
|
|
|
mintarget = 0;
|
1994-03-29 08:29:20 +04:00
|
|
|
} else {
|
1994-12-28 22:42:47 +03:00
|
|
|
if (target < 0 || target > 7)
|
1994-03-29 08:29:20 +04:00
|
|
|
return EINVAL;
|
1994-12-28 22:42:47 +03:00
|
|
|
maxtarget = mintarget = target;
|
1994-03-29 08:29:20 +04:00
|
|
|
}
|
1993-04-12 12:19:28 +04:00
|
|
|
|
1994-03-29 08:29:20 +04:00
|
|
|
if (lun == -1) {
|
|
|
|
maxlun = 7;
|
|
|
|
minlun = 0;
|
|
|
|
} else {
|
|
|
|
if (lun < 0 || lun > 7)
|
|
|
|
return EINVAL;
|
|
|
|
maxlun = minlun = lun;
|
|
|
|
}
|
1993-03-21 21:04:42 +03:00
|
|
|
|
1994-12-28 22:42:47 +03:00
|
|
|
for (target = mintarget; target <= maxtarget; target++) {
|
|
|
|
if (target == scsi_addr)
|
1994-03-29 08:29:20 +04:00
|
|
|
continue;
|
|
|
|
for (lun = minlun; lun <= maxlun; lun++) {
|
|
|
|
/*
|
1994-12-28 22:42:47 +03:00
|
|
|
* See if there's a device present, and configure it.
|
1994-03-29 08:29:20 +04:00
|
|
|
*/
|
1994-12-28 22:42:47 +03:00
|
|
|
scsi_probedev(scsi, target, lun);
|
|
|
|
if ((scsi->moreluns & (1 << target)) == 0)
|
|
|
|
break;
|
1994-03-29 08:29:20 +04:00
|
|
|
/* otherwise something says we should look further */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1994-12-28 22:42:47 +03:00
|
|
|
void
|
|
|
|
scsi_strvis(dst, src, len)
|
|
|
|
u_char *dst, *src;
|
|
|
|
int len;
|
1994-03-29 08:29:20 +04:00
|
|
|
{
|
|
|
|
|
1995-12-11 07:43:01 +03:00
|
|
|
/* Trim leading and trailing blanks and NULs. */
|
|
|
|
while (len > 0 && (src[0] == ' ' || src[0] == '\0'))
|
1994-12-28 22:42:47 +03:00
|
|
|
++src, --len;
|
1995-12-11 07:43:01 +03:00
|
|
|
while (len > 0 && (src[len-1] == ' ' || src[len-1] == '\0'))
|
1994-12-28 22:42:47 +03:00
|
|
|
--len;
|
|
|
|
|
|
|
|
while (len > 0) {
|
1994-12-30 08:20:22 +03:00
|
|
|
if (*src < 0x20 || *src >= 0x80) {
|
1994-12-28 22:42:47 +03:00
|
|
|
/* non-printable characters */
|
|
|
|
*dst++ = '\\';
|
1994-12-30 08:14:52 +03:00
|
|
|
*dst++ = ((*src & 0300) >> 6) + '0';
|
|
|
|
*dst++ = ((*src & 0070) >> 3) + '0';
|
|
|
|
*dst++ = ((*src & 0007) >> 0) + '0';
|
1994-12-28 22:42:47 +03:00
|
|
|
} else if (*src == '\\') {
|
|
|
|
/* quote characters */
|
|
|
|
*dst++ = '\\';
|
|
|
|
*dst++ = '\\';
|
|
|
|
} else {
|
|
|
|
/* normal characters */
|
|
|
|
*dst++ = *src;
|
|
|
|
}
|
|
|
|
++src, --len;
|
|
|
|
}
|
1994-03-29 08:29:20 +04:00
|
|
|
|
1994-12-28 22:42:47 +03:00
|
|
|
*dst++ = 0;
|
1994-03-29 08:29:20 +04:00
|
|
|
}
|
|
|
|
|
1994-12-28 22:42:47 +03:00
|
|
|
struct scsi_quirk_inquiry_pattern {
|
|
|
|
struct scsi_inquiry_pattern pattern;
|
|
|
|
u_int8_t quirks;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct scsi_quirk_inquiry_pattern scsi_quirk_patterns[] = {
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"CHINON ", "CD-ROM CDS-431 ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"Chinon ", "CD-ROM CDS-525 ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"CHINON ", "CD-ROM CDS-535 ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"DENON ", "DRD-25X ", "V"}, SDEV_NOLUNS},
|
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"IMS ", "CDD521/10 ", "2.06"}, SDEV_NOLUNS},
|
1996-11-06 08:50:31 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"MATSHITA", "CD-ROM CR-5XX ", "1.0b"}, SDEV_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"MEDIAVIS", "CDR-H93MV ", "1.31"}, SDEV_NOLUNS},
|
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"NEC ", "CD-ROM DRIVE:55 ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"NEC ", "CD-ROM DRIVE:83 ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"NEC ", "CD-ROM DRIVE:84 ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"NEC ", "CD-ROM DRIVE:841", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"SONY ", "CD-ROM CDU-541 ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"SONY ", "CD-ROM CDU-55S ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"SONY ", "CD-ROM CDU-8003A", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"SONY ", "CD-ROM CDU-8012 ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"TEAC ", "CD-ROM ", "1.06"}, SDEV_NOLUNS},
|
1996-11-08 08:06:55 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"TEAC ", "CD-ROM CD-56S ", "1.0B"}, SDEV_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"TEXEL ", "CD-ROM ", "1.06"}, SDEV_NOLUNS},
|
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"TEXEL ", "CD-ROM DM-XX24 K", "1.10"}, SDEV_NOLUNS},
|
1996-05-02 05:09:01 +04:00
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"ShinaKen", "CD-ROM DM-3x1S", "1.04"}, SDEV_NOLUNS},
|
|
|
|
|
1996-03-21 06:29:40 +03:00
|
|
|
{{T_OPTICAL, T_REMOV,
|
|
|
|
"EPSON ", "OMD-5010 ", "3.08"}, SDEV_NOLUNS},
|
1996-10-18 21:22:17 +04:00
|
|
|
{{T_OPTICAL, T_REMOV,
|
|
|
|
"FUJITSU", "M2513A", "0800"}, SDEV_NOMODESENSE},
|
|
|
|
{{T_OPTICAL, T_REMOV,
|
|
|
|
"DELTIS ", "MOS321 ", "3.30"}, SDEV_NOMODESENSE},
|
1996-03-21 06:29:40 +03:00
|
|
|
|
1996-02-23 02:37:27 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"DEC ", "RZ55 (C) DEC", ""}, SDEV_AUTOSAVE},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"EMULEX ", "MD21/S2 ESDI", "A00"}, SDEV_FORCELUNS},
|
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"MAXTOR ", "XT-3280 ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"MAXTOR ", "XT-4380S ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"MAXTOR ", "MXT-1240S ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"MAXTOR ", "XT-4170S ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_DIRECT, T_FIXED,
|
1996-07-25 00:50:23 +04:00
|
|
|
"MAXTOR ", "XT-8760S", ""}, SDEV_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"MAXTOR ", "LXT-213S ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"MAXTOR ", "LXT-213S SUN0207", ""}, SDEV_NOLUNS},
|
1996-03-05 04:45:42 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"MAXTOR ", "LXT-200S ", ""}, SDEV_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"MST ", "SnapLink ", ""}, SDEV_NOLUNS},
|
1996-03-18 19:19:58 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"NEC ", "D3847 ", "0307"}, SDEV_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"QUANTUM ", "LPS525S ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"QUANTUM ", "P105S 910-10-94x", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"QUANTUM ", "PD1225S ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"QUANTUM ", "PD210S SUN0207", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"RODIME ", "RO3000S ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"SEAGATE ", "ST157N ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"SEAGATE ", "ST296 ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"SEAGATE ", "ST296N ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"TOSHIBA ", "MK538FB ", "6027"}, SDEV_NOLUNS},
|
1996-07-05 20:19:02 +04:00
|
|
|
{{T_DIRECT, T_REMOV,
|
|
|
|
"iomega", "jaz 1GB", ""}, SDEV_NOMODESENSE},
|
1996-07-06 01:58:04 +04:00
|
|
|
{{T_DIRECT, T_REMOV,
|
1996-10-23 11:25:39 +04:00
|
|
|
"IOMEGA", "ZIP 100", ""}, SDEV_NOMODESENSE},
|
1996-11-06 08:50:31 +03:00
|
|
|
/* Letting the motor run kills floppy drives and disks quit fast. */
|
1996-10-23 11:25:39 +04:00
|
|
|
{{T_DIRECT, T_REMOV,
|
|
|
|
"TEAC", "FC-1", ""}, SDEV_NOSTARTUNIT},
|
1996-03-21 06:29:40 +03:00
|
|
|
|
1995-07-12 13:56:09 +04:00
|
|
|
/* XXX: QIC-36 tape behind Emulex adapter. Very broken. */
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
|
|
|
" ", " ", " "}, SDEV_NOLUNS},
|
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
|
|
|
"CALIPER ", "CP150 ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
|
|
|
"EXABYTE ", "EXB-8200 ", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
|
|
|
"SONY ", "SDT-2000 ", "2.09"}, SDEV_NOLUNS},
|
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
|
|
|
"SONY ", "SDT-5000 ", "3."}, SDEV_NOSYNCWIDE},
|
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
|
|
|
"SONY ", "SDT-5200 ", "3."}, SDEV_NOLUNS},
|
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
|
|
|
"TANDBERG", " TDC 3600 ", ""}, SDEV_NOLUNS},
|
1996-01-12 14:32:37 +03:00
|
|
|
/* Following entry reported as a Tandberg 3600; ref. PR1933 */
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
|
|
|
"ARCHIVE ", "VIPER 150 21247", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
|
|
|
"WANGTEK ", "5099ES SCSI", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
|
|
|
"WANGTEK ", "5150ES SCSI", ""}, SDEV_NOLUNS},
|
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
|
|
|
"WangDAT ", "Model 1300 ", "02.4"}, SDEV_NOSYNCWIDE},
|
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
|
|
|
"WangDAT ", "Model 2600 ", "01.7"}, SDEV_NOSYNCWIDE},
|
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
|
|
|
"WangDAT ", "Model 3200 ", "02.2"}, SDEV_NOSYNCWIDE},
|
1994-12-28 22:42:47 +03:00
|
|
|
};
|
|
|
|
|
1996-03-05 03:15:09 +03:00
|
|
|
/*
|
|
|
|
* Print out autoconfiguration information for a subdevice.
|
|
|
|
*
|
|
|
|
* This is a slight abuse of 'standard' autoconfiguration semantics,
|
|
|
|
* because 'print' functions don't normally print the colon and
|
|
|
|
* device information. However, in this case that's better than
|
|
|
|
* either printing redundant information before the attach message,
|
|
|
|
* or having the device driver call a special function to print out
|
|
|
|
* the standard device information.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
scsibusprint(aux, pnp)
|
|
|
|
void *aux;
|
1996-08-28 01:53:46 +04:00
|
|
|
const char *pnp;
|
1996-03-05 03:15:09 +03:00
|
|
|
{
|
|
|
|
struct scsibus_attach_args *sa = aux;
|
|
|
|
struct scsi_inquiry_data *inqbuf;
|
|
|
|
u_int8_t type;
|
|
|
|
boolean removable;
|
|
|
|
char *dtype, *qtype;
|
|
|
|
char vendor[33], product[65], revision[17];
|
|
|
|
int target, lun;
|
|
|
|
|
|
|
|
if (pnp != NULL)
|
1996-10-13 03:23:13 +04:00
|
|
|
printf("%s", pnp);
|
1996-03-05 03:15:09 +03:00
|
|
|
|
|
|
|
inqbuf = sa->sa_inqbuf;
|
|
|
|
|
|
|
|
target = sa->sa_sc_link->target;
|
|
|
|
lun = sa->sa_sc_link->lun;
|
|
|
|
|
|
|
|
type = inqbuf->device & SID_TYPE;
|
|
|
|
removable = inqbuf->dev_qual2 & SID_REMOVABLE ? 1 : 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Figure out basic device type and qualifier.
|
|
|
|
*/
|
|
|
|
dtype = 0;
|
|
|
|
switch (inqbuf->device & SID_QUAL) {
|
|
|
|
case SID_QUAL_LU_OK:
|
|
|
|
qtype = "";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_QUAL_LU_OFFLINE:
|
|
|
|
qtype = " offline";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_QUAL_RSVD:
|
|
|
|
case SID_QUAL_BAD_LU:
|
|
|
|
panic("scsibusprint: impossible qualifier");
|
|
|
|
|
|
|
|
default:
|
|
|
|
qtype = "";
|
|
|
|
dtype = "vendor-unique";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (dtype == 0) {
|
|
|
|
switch (type) {
|
|
|
|
case T_DIRECT:
|
|
|
|
dtype = "direct";
|
|
|
|
break;
|
|
|
|
case T_SEQUENTIAL:
|
|
|
|
dtype = "sequential";
|
|
|
|
break;
|
|
|
|
case T_PRINTER:
|
|
|
|
dtype = "printer";
|
|
|
|
break;
|
|
|
|
case T_PROCESSOR:
|
|
|
|
dtype = "processor";
|
|
|
|
break;
|
|
|
|
case T_CDROM:
|
|
|
|
dtype = "cdrom";
|
|
|
|
break;
|
|
|
|
case T_WORM:
|
|
|
|
dtype = "worm";
|
|
|
|
break;
|
|
|
|
case T_SCANNER:
|
|
|
|
dtype = "scanner";
|
|
|
|
break;
|
|
|
|
case T_OPTICAL:
|
|
|
|
dtype = "optical";
|
|
|
|
break;
|
|
|
|
case T_CHANGER:
|
|
|
|
dtype = "changer";
|
|
|
|
break;
|
|
|
|
case T_COMM:
|
|
|
|
dtype = "communication";
|
|
|
|
break;
|
|
|
|
case T_NODEVICE:
|
|
|
|
panic("scsibusprint: impossible device type");
|
|
|
|
default:
|
|
|
|
dtype = "unknown";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
scsi_strvis(vendor, inqbuf->vendor, 8);
|
|
|
|
scsi_strvis(product, inqbuf->product, 16);
|
|
|
|
scsi_strvis(revision, inqbuf->revision, 4);
|
|
|
|
|
1996-10-13 03:23:13 +04:00
|
|
|
printf(" targ %d lun %d: <%s, %s, %s> SCSI%d %d/%s %s%s",
|
1996-03-05 03:15:09 +03:00
|
|
|
target, lun, vendor, product, revision,
|
|
|
|
inqbuf->version & SID_ANSII, type, dtype,
|
|
|
|
removable ? "removable" : "fixed", qtype);
|
|
|
|
|
|
|
|
return (UNCONF);
|
|
|
|
}
|
|
|
|
|
1994-03-29 08:29:20 +04:00
|
|
|
/*
|
|
|
|
* given a target and lu, ask the device what
|
|
|
|
* it is, and find the correct driver table
|
|
|
|
* entry.
|
|
|
|
*/
|
1994-12-28 22:42:47 +03:00
|
|
|
void
|
|
|
|
scsi_probedev(scsi, target, lun)
|
|
|
|
struct scsibus_softc *scsi;
|
|
|
|
int target, lun;
|
1994-03-29 08:29:20 +04:00
|
|
|
{
|
1994-12-28 22:42:47 +03:00
|
|
|
struct scsi_link *sc_link;
|
1994-03-29 08:29:20 +04:00
|
|
|
static struct scsi_inquiry_data inqbuf;
|
1994-12-28 22:42:47 +03:00
|
|
|
struct scsi_quirk_inquiry_pattern *finger;
|
1996-03-05 03:15:09 +03:00
|
|
|
int checkdtype, priority;
|
1994-12-28 22:42:47 +03:00
|
|
|
struct scsibus_attach_args sa;
|
|
|
|
struct cfdata *cf;
|
|
|
|
|
|
|
|
/* Skip this slot if it is already attached. */
|
|
|
|
if (scsi->sc_link[target][lun])
|
|
|
|
return;
|
|
|
|
|
|
|
|
sc_link = malloc(sizeof(*sc_link), M_DEVBUF, M_NOWAIT);
|
|
|
|
*sc_link = *scsi->adapter_link;
|
|
|
|
sc_link->target = target;
|
|
|
|
sc_link->lun = lun;
|
|
|
|
sc_link->device = &probe_switch;
|
1994-03-29 08:29:20 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Ask the device what it is
|
|
|
|
*/
|
1995-01-17 00:13:40 +03:00
|
|
|
#ifdef SCSIDEBUG
|
1994-12-28 22:42:47 +03:00
|
|
|
if (target == DEBUGTARGET && lun == DEBUGLUN)
|
1994-03-29 08:29:20 +04:00
|
|
|
sc_link->flags |= DEBUGLEVEL;
|
1995-01-17 00:13:40 +03:00
|
|
|
#endif /* SCSIDEBUG */
|
1993-03-21 21:04:42 +03:00
|
|
|
|
1994-12-28 22:42:47 +03:00
|
|
|
(void) scsi_test_unit_ready(sc_link,
|
|
|
|
SCSI_AUTOCONF | SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_NOT_READY | SCSI_IGNORE_MEDIA_CHANGE);
|
|
|
|
|
1995-01-17 00:13:40 +03:00
|
|
|
#ifdef SCSI_2_DEF
|
1994-03-29 08:29:20 +04:00
|
|
|
/* some devices need to be told to go to SCSI2 */
|
|
|
|
/* However some just explode if you tell them this.. leave it out */
|
1994-12-28 22:42:47 +03:00
|
|
|
scsi_change_def(sc_link, SCSI_AUTOCONF | SCSI_SILENT);
|
|
|
|
#endif /* SCSI_2_DEF */
|
1994-03-29 08:29:20 +04:00
|
|
|
|
1994-12-28 22:42:47 +03:00
|
|
|
/* Now go ask the device all about itself. */
|
|
|
|
bzero(&inqbuf, sizeof(inqbuf));
|
|
|
|
if (scsi_inquire(sc_link, &inqbuf, SCSI_AUTOCONF) != 0)
|
|
|
|
goto bad;
|
|
|
|
|
|
|
|
{
|
|
|
|
int len = inqbuf.additional_length;
|
1994-12-30 08:20:22 +03:00
|
|
|
while (len < 3)
|
|
|
|
inqbuf.unused[len++] = '\0';
|
|
|
|
while (len < 3 + 28)
|
|
|
|
inqbuf.unused[len++] = ' ';
|
1994-12-28 22:42:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
finger = (struct scsi_quirk_inquiry_pattern *)scsi_inqmatch(&inqbuf,
|
|
|
|
(caddr_t)scsi_quirk_patterns,
|
|
|
|
sizeof(scsi_quirk_patterns)/sizeof(scsi_quirk_patterns[0]),
|
|
|
|
sizeof(scsi_quirk_patterns[0]), &priority);
|
|
|
|
if (priority != 0)
|
|
|
|
sc_link->quirks |= finger->quirks;
|
1995-07-12 13:43:29 +04:00
|
|
|
if ((inqbuf.version & SID_ANSII) == 0 &&
|
|
|
|
(sc_link->quirks & SDEV_FORCELUNS) == 0)
|
1994-12-28 22:42:47 +03:00
|
|
|
sc_link->quirks |= SDEV_NOLUNS;
|
1996-09-03 22:20:31 +04:00
|
|
|
sc_link->scsi_version = inqbuf.version;
|
1994-12-28 22:42:47 +03:00
|
|
|
|
|
|
|
if ((sc_link->quirks & SDEV_NOLUNS) == 0)
|
|
|
|
scsi->moreluns |= (1 << target);
|
1994-03-29 08:29:20 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* note what BASIC type of device it is
|
|
|
|
*/
|
1996-03-05 03:15:09 +03:00
|
|
|
if ((inqbuf.dev_qual2 & SID_REMOVABLE) != 0)
|
1994-12-28 22:42:47 +03:00
|
|
|
sc_link->flags |= SDEV_REMOVABLE;
|
1994-03-29 08:29:20 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Any device qualifier that has the top bit set (qualifier&4 != 0)
|
|
|
|
* is vendor specific and won't match in this switch.
|
1996-03-05 03:15:09 +03:00
|
|
|
* All we do here is throw out bad/negative responses.
|
1994-03-29 08:29:20 +04:00
|
|
|
*/
|
1996-03-05 03:15:09 +03:00
|
|
|
checkdtype = 0;
|
1994-12-28 22:42:47 +03:00
|
|
|
switch (inqbuf.device & SID_QUAL) {
|
1994-03-29 08:29:20 +04:00
|
|
|
case SID_QUAL_LU_OK:
|
|
|
|
case SID_QUAL_LU_OFFLINE:
|
1996-03-05 03:15:09 +03:00
|
|
|
checkdtype = 1;
|
1993-03-21 21:04:42 +03:00
|
|
|
break;
|
1994-03-29 08:29:20 +04:00
|
|
|
|
|
|
|
case SID_QUAL_RSVD:
|
|
|
|
case SID_QUAL_BAD_LU:
|
1994-12-28 22:42:47 +03:00
|
|
|
goto bad;
|
1994-03-29 08:29:20 +04:00
|
|
|
|
1993-04-12 12:19:28 +04:00
|
|
|
default:
|
1993-03-21 21:04:42 +03:00
|
|
|
break;
|
|
|
|
}
|
1996-03-05 03:15:09 +03:00
|
|
|
if (checkdtype) {
|
|
|
|
switch (inqbuf.device & SID_TYPE) {
|
1993-04-12 12:19:28 +04:00
|
|
|
case T_DIRECT:
|
|
|
|
case T_SEQUENTIAL:
|
|
|
|
case T_PRINTER:
|
|
|
|
case T_PROCESSOR:
|
1994-12-28 22:42:47 +03:00
|
|
|
case T_CDROM:
|
1993-04-12 12:19:28 +04:00
|
|
|
case T_WORM:
|
|
|
|
case T_SCANNER:
|
|
|
|
case T_OPTICAL:
|
|
|
|
case T_CHANGER:
|
|
|
|
case T_COMM:
|
1996-03-05 03:15:09 +03:00
|
|
|
default:
|
1993-04-12 12:19:28 +04:00
|
|
|
break;
|
1994-03-29 08:29:20 +04:00
|
|
|
case T_NODEVICE:
|
1994-12-28 22:42:47 +03:00
|
|
|
goto bad;
|
1993-03-21 21:04:42 +03:00
|
|
|
}
|
1993-04-12 12:19:28 +04:00
|
|
|
}
|
1993-03-21 21:04:42 +03:00
|
|
|
|
1994-12-28 22:42:47 +03:00
|
|
|
sa.sa_sc_link = sc_link;
|
|
|
|
sa.sa_inqbuf = &inqbuf;
|
|
|
|
|
|
|
|
if ((cf = config_search(scsibussubmatch, (struct device *)scsi, &sa)) != 0) {
|
|
|
|
scsi->sc_link[target][lun] = sc_link;
|
1996-03-05 03:15:09 +03:00
|
|
|
config_attach((struct device *)scsi, cf, &sa, scsibusprint);
|
|
|
|
} else {
|
|
|
|
scsibusprint(&sa, scsi->sc_dev.dv_xname);
|
1996-10-13 03:23:13 +04:00
|
|
|
printf(" not configured\n");
|
1994-12-28 22:42:47 +03:00
|
|
|
goto bad;
|
1996-03-05 03:15:09 +03:00
|
|
|
}
|
1994-03-29 08:29:20 +04:00
|
|
|
|
1994-12-28 22:42:47 +03:00
|
|
|
return;
|
|
|
|
|
|
|
|
bad:
|
|
|
|
free(sc_link, M_DEVBUF);
|
|
|
|
return;
|
1993-04-12 12:19:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1994-12-28 22:42:47 +03:00
|
|
|
* Return a priority based on how much of the inquiry data matches
|
|
|
|
* the patterns for the particular driver.
|
1993-04-12 12:19:28 +04:00
|
|
|
*/
|
1994-12-28 22:42:47 +03:00
|
|
|
caddr_t
|
|
|
|
scsi_inqmatch(inqbuf, base, nmatches, matchsize, bestpriority)
|
|
|
|
struct scsi_inquiry_data *inqbuf;
|
|
|
|
caddr_t base;
|
|
|
|
int nmatches, matchsize;
|
|
|
|
int *bestpriority;
|
1993-04-12 12:19:28 +04:00
|
|
|
{
|
1994-12-28 22:42:47 +03:00
|
|
|
u_int8_t type;
|
|
|
|
boolean removable;
|
|
|
|
caddr_t bestmatch;
|
|
|
|
|
|
|
|
/* Include the qualifier to catch vendor-unique types. */
|
|
|
|
type = inqbuf->device;
|
|
|
|
removable = inqbuf->dev_qual2 & SID_REMOVABLE ? T_REMOV : T_FIXED;
|
|
|
|
|
|
|
|
for (*bestpriority = 0, bestmatch = 0; nmatches--; base += matchsize) {
|
|
|
|
struct scsi_inquiry_pattern *match = (void *)base;
|
|
|
|
int priority, len;
|
|
|
|
|
|
|
|
if (type != match->type)
|
1993-03-21 21:04:42 +03:00
|
|
|
continue;
|
1994-12-28 22:42:47 +03:00
|
|
|
if (removable != match->removable)
|
1993-03-21 21:04:42 +03:00
|
|
|
continue;
|
1994-12-28 22:42:47 +03:00
|
|
|
priority = 2;
|
|
|
|
len = strlen(match->vendor);
|
|
|
|
if (bcmp(inqbuf->vendor, match->vendor, len))
|
1993-04-12 12:19:28 +04:00
|
|
|
continue;
|
1994-12-28 22:42:47 +03:00
|
|
|
priority += len;
|
|
|
|
len = strlen(match->product);
|
|
|
|
if (bcmp(inqbuf->product, match->product, len))
|
1993-03-21 21:04:42 +03:00
|
|
|
continue;
|
1994-12-28 22:42:47 +03:00
|
|
|
priority += len;
|
|
|
|
len = strlen(match->revision);
|
|
|
|
if (bcmp(inqbuf->revision, match->revision, len))
|
1993-04-12 12:19:28 +04:00
|
|
|
continue;
|
1994-12-28 22:42:47 +03:00
|
|
|
priority += len;
|
|
|
|
|
1995-11-01 04:15:07 +03:00
|
|
|
#if SCSIDEBUG
|
1996-10-13 03:23:13 +04:00
|
|
|
printf("scsi_inqmatch: %d/%d/%d <%s, %s, %s>\n",
|
1994-12-28 22:42:47 +03:00
|
|
|
priority, match->type, match->removable,
|
|
|
|
match->vendor, match->product, match->revision);
|
|
|
|
#endif
|
|
|
|
if (priority > *bestpriority) {
|
|
|
|
*bestpriority = priority;
|
|
|
|
bestmatch = base;
|
1993-03-21 21:04:42 +03:00
|
|
|
}
|
|
|
|
}
|
1994-12-28 22:42:47 +03:00
|
|
|
|
|
|
|
return (bestmatch);
|
1993-03-21 21:04:42 +03:00
|
|
|
}
|