2001-06-11 17:58:18 +04:00
|
|
|
/* $NetBSD: scsiconf.c,v 1.158 2001/06/11 13:58:18 pk Exp $ */
|
1994-06-29 10:39:25 +04:00
|
|
|
|
1998-08-17 04:49:01 +04:00
|
|
|
/*-
|
2001-04-25 21:53:04 +04:00
|
|
|
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
|
1998-08-17 04:49:01 +04:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
1998-10-10 05:14:26 +04:00
|
|
|
* by Charles M. Hannum; Jason R. Thorpe of the Numerical Aerospace
|
|
|
|
* Simulation Facility, NASA Ames Research Center.
|
1994-03-29 08:29:20 +04:00
|
|
|
*
|
|
|
|
* 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:
|
1998-08-17 04:49:01 +04:00
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
1994-03-29 08:29:20 +04:00
|
|
|
*
|
1998-08-17 04:49:01 +04:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``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 FOUNDATION OR CONTRIBUTORS
|
|
|
|
* 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.
|
1994-03-29 08:29:20 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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>
|
1999-10-01 02:57:52 +04:00
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/proc.h>
|
2001-04-25 21:53:04 +04:00
|
|
|
#include <sys/kthread.h>
|
1994-03-29 08:29:20 +04:00
|
|
|
#include <sys/malloc.h>
|
|
|
|
#include <sys/device.h>
|
1998-10-10 05:14:26 +04:00
|
|
|
#include <sys/conf.h>
|
1998-10-10 07:33:01 +04:00
|
|
|
#include <sys/fcntl.h>
|
1998-10-10 06:34:15 +04:00
|
|
|
#include <sys/scsiio.h>
|
1993-12-17 10:56:32 +03:00
|
|
|
|
1997-08-27 15:22:52 +04:00
|
|
|
#include <dev/scsipi/scsi_all.h>
|
|
|
|
#include <dev/scsipi/scsipi_all.h>
|
|
|
|
#include <dev/scsipi/scsiconf.h>
|
1997-10-01 05:18:38 +04:00
|
|
|
|
1997-08-27 15:22:52 +04:00
|
|
|
#include "locators.h"
|
1993-03-21 21:04:42 +03:00
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
const struct scsipi_periphsw scsi_probe_dev = {
|
1994-03-29 08:29:20 +04:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
1993-03-21 21:04:42 +03:00
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
int scsi_probe_device __P((struct scsibus_softc *, int, int));
|
1999-09-12 01:25:26 +04:00
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
int scsibusmatch __P((struct device *, struct cfdata *, void *));
|
|
|
|
void scsibusattach __P((struct device *, struct device *, void *));
|
|
|
|
int scsibusactivate __P((struct device *, enum devact));
|
|
|
|
int scsibusdetach __P((struct device *, int flags));
|
|
|
|
|
|
|
|
int scsibussubmatch __P((struct device *, struct cfdata *, void *));
|
1994-03-29 08:29:20 +04:00
|
|
|
|
1996-03-17 03:57:14 +03:00
|
|
|
struct cfattach scsibus_ca = {
|
1999-09-12 01:25:26 +04:00
|
|
|
sizeof(struct scsibus_softc), scsibusmatch, scsibusattach,
|
|
|
|
scsibusdetach, scsibusactivate,
|
1996-03-17 03:57:14 +03:00
|
|
|
};
|
|
|
|
|
1998-01-12 12:49:10 +03:00
|
|
|
extern struct cfdriver scsibus_cd;
|
1994-03-29 08:29:20 +04:00
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
int scsibusprint __P((void *, const char *));
|
|
|
|
void scsibus_config_interrupts __P((struct device *));
|
1996-03-05 03:15:09 +03:00
|
|
|
|
1998-10-10 05:14:26 +04:00
|
|
|
cdev_decl(scsibus);
|
1997-08-27 15:22:52 +04:00
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
const struct scsipi_bustype scsi_bustype = {
|
|
|
|
SCSIPI_BUSTYPE_SCSI,
|
|
|
|
scsi_scsipi_cmd,
|
|
|
|
scsipi_interpret_sense,
|
|
|
|
scsi_print_addr,
|
|
|
|
scsi_kill_pending,
|
|
|
|
};
|
|
|
|
|
|
|
|
int
|
|
|
|
scsiprint(aux, pnp)
|
|
|
|
void *aux;
|
|
|
|
const char *pnp;
|
|
|
|
{
|
|
|
|
struct scsipi_channel *chan = aux;
|
|
|
|
struct scsipi_adapter *adapt = chan->chan_adapter;
|
|
|
|
|
|
|
|
/* only "scsibus"es can attach to "scsi"s; easy. */
|
|
|
|
if (pnp)
|
|
|
|
printf("scsibus at %s", pnp);
|
|
|
|
|
|
|
|
/* don't print channel if the controller says there can be only one. */
|
|
|
|
if (adapt->adapt_nchannels != 1)
|
|
|
|
printf(" channel %d", chan->chan_channel);
|
|
|
|
|
|
|
|
return (UNCONF);
|
|
|
|
}
|
|
|
|
|
1994-03-29 08:29:20 +04:00
|
|
|
int
|
1996-12-05 04:06:39 +03:00
|
|
|
scsibusmatch(parent, cf, aux)
|
1996-08-28 22:47:51 +04:00
|
|
|
struct device *parent;
|
1996-12-05 04:06:39 +03:00
|
|
|
struct cfdata *cf;
|
|
|
|
void *aux;
|
1993-03-21 21:04:42 +03:00
|
|
|
{
|
2001-04-25 21:53:04 +04:00
|
|
|
struct scsipi_channel *chan = aux;
|
2000-04-02 21:25:52 +04:00
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
if (chan->type != BUS_SCSI)
|
|
|
|
return 0;
|
1996-08-28 22:47:51 +04:00
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
if (cf->cf_loc[SCSICF_CHANNEL] != chan->chan_channel &&
|
1997-10-01 05:18:38 +04:00
|
|
|
cf->cf_loc[SCSICF_CHANNEL] != SCSICF_CHANNEL_DEFAULT)
|
1996-08-28 22:47:51 +04:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
scsibusattach(parent, self, aux)
|
1997-08-27 15:22:52 +04:00
|
|
|
struct device *parent, *self;
|
|
|
|
void *aux;
|
1994-03-29 08:29:20 +04:00
|
|
|
{
|
2001-04-25 21:53:04 +04:00
|
|
|
struct scsibus_softc *sc = (void *) self;
|
|
|
|
struct scsipi_channel *chan = aux;
|
|
|
|
|
|
|
|
sc->sc_channel = chan;
|
|
|
|
|
|
|
|
/* Initialize the channel structure first */
|
|
|
|
if (scsipi_channel_init(chan)) {
|
|
|
|
printf(": failed to init channel\n");
|
|
|
|
return;
|
1996-12-11 00:06:29 +03:00
|
|
|
}
|
1994-03-29 08:29:20 +04:00
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
printf(": %d targets, %d luns per target\n",
|
|
|
|
chan->chan_ntargets, chan->chan_nluns);
|
|
|
|
|
|
|
|
|
1999-10-01 02:57:52 +04:00
|
|
|
/*
|
|
|
|
* Defer configuration of the children until interrupts
|
|
|
|
* are enabled.
|
|
|
|
*/
|
|
|
|
config_interrupts(self, scsibus_config_interrupts);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
scsibus_config_interrupts(self)
|
|
|
|
struct device *self;
|
|
|
|
{
|
2001-04-25 21:53:04 +04:00
|
|
|
struct scsibus_softc *sc = (void *) self;
|
|
|
|
|
1999-11-14 21:06:09 +03:00
|
|
|
#ifndef SCSI_DELAY
|
1994-03-29 08:29:20 +04:00
|
|
|
#define SCSI_DELAY 2
|
1999-11-14 21:06:09 +03:00
|
|
|
#endif
|
2001-04-25 21:53:04 +04:00
|
|
|
|
|
|
|
if ((sc->sc_channel->chan_flags & SCSIPI_CHAN_NOSETTLE) == 0 &&
|
|
|
|
SCSI_DELAY > 0) {
|
1999-10-01 02:57:52 +04:00
|
|
|
printf("%s: waiting %d seconds for devices to settle...\n",
|
|
|
|
self->dv_xname, SCSI_DELAY);
|
|
|
|
/* ...an identifier we know no one will use... */
|
|
|
|
(void) tsleep(scsibus_config_interrupts, PRIBIO,
|
|
|
|
"scsidly", SCSI_DELAY * hz);
|
|
|
|
}
|
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
scsi_probe_bus(sc, -1, -1);
|
1994-03-29 08:29:20 +04:00
|
|
|
}
|
|
|
|
|
1994-12-28 22:42:47 +03:00
|
|
|
int
|
1996-12-05 04:06:39 +03:00
|
|
|
scsibussubmatch(parent, cf, aux)
|
1994-12-28 22:42:47 +03:00
|
|
|
struct device *parent;
|
1996-12-05 04:06:39 +03:00
|
|
|
struct cfdata *cf;
|
|
|
|
void *aux;
|
1994-12-28 22:42:47 +03:00
|
|
|
{
|
1997-08-27 15:22:52 +04:00
|
|
|
struct scsipibus_attach_args *sa = aux;
|
2001-04-25 21:53:04 +04:00
|
|
|
struct scsipi_periph *periph = sa->sa_periph;
|
1994-12-28 22:42:47 +03:00
|
|
|
|
1997-08-27 15:22:52 +04:00
|
|
|
if (cf->cf_loc[SCSIBUSCF_TARGET] != SCSIBUSCF_TARGET_DEFAULT &&
|
2001-04-25 21:53:04 +04:00
|
|
|
cf->cf_loc[SCSIBUSCF_TARGET] != periph->periph_target)
|
1997-10-01 05:18:38 +04:00
|
|
|
return (0);
|
1997-08-27 15:22:52 +04:00
|
|
|
if (cf->cf_loc[SCSIBUSCF_LUN] != SCSIBUSCF_LUN_DEFAULT &&
|
2001-04-25 21:53:04 +04:00
|
|
|
cf->cf_loc[SCSIBUSCF_LUN] != periph->periph_lun)
|
1997-10-01 05:18:38 +04:00
|
|
|
return (0);
|
1996-12-05 04:06:39 +03:00
|
|
|
return ((*cf->cf_attach->ca_match)(parent, cf, aux));
|
1994-12-28 22:42:47 +03:00
|
|
|
}
|
|
|
|
|
1999-09-12 01:25:26 +04:00
|
|
|
int
|
|
|
|
scsibusactivate(self, act)
|
|
|
|
struct device *self;
|
|
|
|
enum devact act;
|
|
|
|
{
|
2001-04-25 21:53:04 +04:00
|
|
|
struct scsibus_softc *sc = (void *) self;
|
|
|
|
struct scsipi_channel *chan = sc->sc_channel;
|
|
|
|
struct scsipi_periph *periph;
|
1999-09-12 01:25:26 +04:00
|
|
|
int target, lun, error = 0, s;
|
|
|
|
|
|
|
|
s = splbio();
|
|
|
|
switch (act) {
|
|
|
|
case DVACT_ACTIVATE:
|
|
|
|
error = EOPNOTSUPP;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DVACT_DEACTIVATE:
|
2001-04-25 21:53:04 +04:00
|
|
|
for (target = 0; target < chan->chan_ntargets;
|
|
|
|
target++) {
|
|
|
|
if (target == chan->chan_id)
|
1999-09-12 01:25:26 +04:00
|
|
|
continue;
|
2001-04-25 21:53:04 +04:00
|
|
|
for (lun = 0; lun < chan->chan_nluns; lun++) {
|
|
|
|
periph = scsipi_lookup_periph(chan,
|
|
|
|
target, lun);
|
|
|
|
if (periph == NULL)
|
1999-09-12 01:25:26 +04:00
|
|
|
continue;
|
2001-04-25 21:53:04 +04:00
|
|
|
error = config_deactivate(periph->periph_dev);
|
1999-09-12 01:25:26 +04:00
|
|
|
if (error)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
out:
|
|
|
|
splx(s);
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
scsibusdetach(self, flags)
|
|
|
|
struct device *self;
|
|
|
|
int flags;
|
|
|
|
{
|
2001-04-25 21:53:04 +04:00
|
|
|
struct scsibus_softc *sc = (void *) self;
|
|
|
|
struct scsipi_channel *chan = sc->sc_channel;
|
|
|
|
struct scsipi_periph *periph;
|
1999-09-12 01:25:26 +04:00
|
|
|
int target, lun, error;
|
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
/*
|
|
|
|
* Shut down the channel.
|
|
|
|
*/
|
|
|
|
scsipi_channel_shutdown(chan);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Now detach all of the periphs.
|
|
|
|
*/
|
|
|
|
for (target = 0; target < chan->chan_ntargets; target++) {
|
|
|
|
if (target == chan->chan_id)
|
1999-09-12 01:25:26 +04:00
|
|
|
continue;
|
2001-04-25 21:53:04 +04:00
|
|
|
for (lun = 0; lun < chan->chan_nluns; lun++) {
|
|
|
|
periph = scsipi_lookup_periph(chan, target, lun);
|
|
|
|
if (periph == NULL)
|
1999-09-12 01:25:26 +04:00
|
|
|
continue;
|
2001-04-25 21:53:04 +04:00
|
|
|
error = config_detach(periph->periph_dev, flags);
|
1999-09-12 01:25:26 +04:00
|
|
|
if (error)
|
|
|
|
return (error);
|
2001-04-25 21:53:04 +04:00
|
|
|
scsipi_remove_periph(chan, periph);
|
|
|
|
free(periph, M_DEVBUF);
|
1999-09-12 01:25:26 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
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
|
2001-04-25 21:53:04 +04:00
|
|
|
scsi_probe_bus(sc, target, lun)
|
|
|
|
struct scsibus_softc *sc;
|
|
|
|
int target, lun;
|
1994-03-29 08:29:20 +04:00
|
|
|
{
|
2001-04-25 21:53:04 +04:00
|
|
|
struct scsipi_channel *chan = sc->sc_channel;
|
1994-12-28 22:42:47 +03:00
|
|
|
int maxtarget, mintarget, maxlun, minlun;
|
1998-11-20 01:25:56 +03:00
|
|
|
int error;
|
1994-03-29 08:29:20 +04:00
|
|
|
|
1994-12-28 22:42:47 +03:00
|
|
|
if (target == -1) {
|
2001-04-25 21:53:04 +04:00
|
|
|
maxtarget = chan->chan_ntargets - 1;
|
1994-12-28 22:42:47 +03:00
|
|
|
mintarget = 0;
|
1994-03-29 08:29:20 +04:00
|
|
|
} else {
|
2001-04-25 21:53:04 +04:00
|
|
|
if (target < 0 || target >= chan->chan_ntargets)
|
1997-10-01 05:18:38 +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) {
|
2001-04-25 21:53:04 +04:00
|
|
|
maxlun = chan->chan_nluns - 1;
|
1994-03-29 08:29:20 +04:00
|
|
|
minlun = 0;
|
|
|
|
} else {
|
2001-04-25 21:53:04 +04:00
|
|
|
if (lun < 0 || lun >= chan->chan_nluns)
|
1997-10-01 05:18:38 +04:00
|
|
|
return (EINVAL);
|
1994-03-29 08:29:20 +04:00
|
|
|
maxlun = minlun = lun;
|
|
|
|
}
|
1993-03-21 21:04:42 +03:00
|
|
|
|
2000-12-03 16:30:36 +03:00
|
|
|
/*
|
|
|
|
* Some HBAs provide an abstracted view of the bus; give them an
|
|
|
|
* oppertunity to re-scan it before we do.
|
|
|
|
*/
|
2001-04-25 21:53:04 +04:00
|
|
|
if (chan->chan_adapter->adapt_ioctl != NULL)
|
|
|
|
(*chan->chan_adapter->adapt_ioctl)(chan, SCBUSIOLLSCAN, NULL,
|
2000-12-03 16:30:36 +03:00
|
|
|
0, curproc);
|
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
if ((error = scsipi_adapter_addref(chan->chan_adapter)) != 0)
|
1998-11-20 01:25:56 +03:00
|
|
|
return (error);
|
1994-12-28 22:42:47 +03:00
|
|
|
for (target = mintarget; target <= maxtarget; target++) {
|
2001-04-25 21:53:04 +04:00
|
|
|
if (target == chan->chan_id)
|
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
|
|
|
*/
|
2001-04-25 21:53:04 +04:00
|
|
|
if (scsi_probe_device(sc, target, lun) == 0)
|
1994-12-28 22:42:47 +03:00
|
|
|
break;
|
1994-03-29 08:29:20 +04:00
|
|
|
/* otherwise something says we should look further */
|
|
|
|
}
|
2001-04-25 21:53:04 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Now that we've discovered all of the LUNs on this
|
|
|
|
* I_T Nexus, update the xfer mode for all of them
|
|
|
|
* that we know about.
|
|
|
|
*/
|
|
|
|
scsipi_set_xfer_mode(chan, target, 1);
|
1994-03-29 08:29:20 +04:00
|
|
|
}
|
2001-04-25 21:53:04 +04:00
|
|
|
scsipi_adapter_delref(chan->chan_adapter);
|
1997-10-01 05:18:38 +04:00
|
|
|
return (0);
|
1994-03-29 08:29:20 +04:00
|
|
|
}
|
|
|
|
|
1997-08-27 15:22:52 +04: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;
|
|
|
|
const char *pnp;
|
1994-03-29 08:29:20 +04:00
|
|
|
{
|
1997-08-27 15:22:52 +04:00
|
|
|
struct scsipibus_attach_args *sa = aux;
|
|
|
|
struct scsipi_inquiry_pattern *inqbuf;
|
|
|
|
u_int8_t type;
|
2001-04-25 21:53:04 +04:00
|
|
|
const char *dtype, *qtype;
|
1997-08-27 15:22:52 +04:00
|
|
|
char vendor[33], product[65], revision[17];
|
|
|
|
int target, lun;
|
1994-03-29 08:29:20 +04:00
|
|
|
|
1997-08-27 15:22:52 +04:00
|
|
|
if (pnp != NULL)
|
|
|
|
printf("%s", pnp);
|
|
|
|
|
|
|
|
inqbuf = &sa->sa_inqbuf;
|
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
target = sa->sa_periph->periph_target;
|
|
|
|
lun = sa->sa_periph->periph_lun;
|
1997-08-27 15:22:52 +04:00
|
|
|
type = inqbuf->type & SID_TYPE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Figure out basic device type and qualifier.
|
|
|
|
*/
|
|
|
|
dtype = 0;
|
|
|
|
switch (inqbuf->type & SID_QUAL) {
|
2001-04-25 21:53:04 +04:00
|
|
|
case SID_QUAL_LU_PRESENT:
|
1997-08-27 15:22:52 +04:00
|
|
|
qtype = "";
|
|
|
|
break;
|
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
case SID_QUAL_LU_NOTPRESENT:
|
1997-08-27 15:22:52 +04:00
|
|
|
qtype = " offline";
|
|
|
|
break;
|
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
case SID_QUAL_reserved:
|
|
|
|
case SID_QUAL_LU_NOT_SUPP:
|
1997-08-27 15:22:52 +04:00
|
|
|
panic("scsibusprint: impossible qualifier");
|
|
|
|
|
|
|
|
default:
|
|
|
|
qtype = "";
|
|
|
|
dtype = "vendor-unique";
|
|
|
|
break;
|
|
|
|
}
|
2001-04-25 21:53:04 +04:00
|
|
|
if (dtype == NULL)
|
1997-08-27 15:22:52 +04:00
|
|
|
dtype = scsipi_dtype(type);
|
1994-03-29 08:29:20 +04:00
|
|
|
|
1998-08-05 20:29:04 +04:00
|
|
|
scsipi_strvis(vendor, 33, inqbuf->vendor, 8);
|
|
|
|
scsipi_strvis(product, 65, inqbuf->product, 16);
|
|
|
|
scsipi_strvis(revision, 17, inqbuf->revision, 4);
|
1994-03-29 08:29:20 +04:00
|
|
|
|
2000-03-27 15:45:42 +04:00
|
|
|
printf(" target %d lun %d: <%s, %s, %s> SCSI%d %d/%s %s%s",
|
1997-10-01 05:18:38 +04:00
|
|
|
target, lun, vendor, product, revision,
|
|
|
|
sa->scsipi_info.scsi_version & SID_ANSII, type, dtype,
|
|
|
|
inqbuf->removable ? "removable" : "fixed", qtype);
|
1997-08-27 15:22:52 +04:00
|
|
|
|
|
|
|
return (UNCONF);
|
|
|
|
}
|
1994-12-28 22:42:47 +03:00
|
|
|
|
2001-01-18 23:28:15 +03:00
|
|
|
const struct scsi_quirk_inquiry_pattern scsi_quirk_patterns[] = {
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"CHINON ", "CD-ROM CDS-431 ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"Chinon ", "CD-ROM CDS-525 ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"CHINON ", "CD-ROM CDS-535 ", ""}, PQUIRK_NOLUNS},
|
1998-05-04 09:56:31 +04:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"DEC ", "RRD42 (C) DEC ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"DENON ", "DRD-25X ", "V"}, PQUIRK_NOLUNS},
|
2000-08-03 16:36:08 +04:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"GENERIC ", "CRD-BP2 ", ""}, PQUIRK_NOLUNS},
|
1997-04-24 04:49:14 +04:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"HP ", "C4324/C4325 ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"IMS ", "CDD521/10 ", "2.06"}, PQUIRK_NOLUNS},
|
1996-11-06 08:50:31 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"MATSHITA", "CD-ROM CR-5XX ", "1.0b"}, PQUIRK_NOLUNS},
|
1997-07-17 04:46:50 +04:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"MEDAVIS ", "RENO CD-ROMX2A ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"MEDIAVIS", "CDR-H93MV ", "1.3"}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"NEC ", "CD-ROM DRIVE:55 ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"NEC ", "CD-ROM DRIVE:83 ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"NEC ", "CD-ROM DRIVE:84 ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"NEC ", "CD-ROM DRIVE:841", ""}, PQUIRK_NOLUNS},
|
1996-11-29 22:51:14 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"PIONEER ", "CD-ROM DR-124X ", "1.01"}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SONY ", "CD-ROM CDU-541 ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SONY ", "CD-ROM CDU-55S ", ""}, PQUIRK_NOLUNS},
|
1999-10-11 19:28:57 +04:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SONY ", "CD-ROM CDU-561 ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SONY ", "CD-ROM CDU-8003A", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SONY ", "CD-ROM CDU-8012 ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"TEAC ", "CD-ROM ", "1.06"}, PQUIRK_NOLUNS},
|
1996-11-08 08:06:55 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"TEAC ", "CD-ROM CD-56S ", "1.0B"}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"TEXEL ", "CD-ROM ", "1.06"}, PQUIRK_NOLUNS},
|
1999-09-20 03:45:28 +04:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"TEXEL ", "CD-ROM DM-XX24 K", "1.09"}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"TEXEL ", "CD-ROM DM-XX24 K", "1.10"}, PQUIRK_NOLUNS},
|
1997-09-10 01:56:01 +04:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"TOSHIBA ", "XM-4101TASUNSLCD", "1755"}, PQUIRK_NOLUNS|PQUIRK_NOSYNC},
|
2001-06-11 17:58:18 +04:00
|
|
|
/* "IBM CDRM00201 !F" 0724 is an IBM OEM Toshiba XM-4101BME */
|
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"IBM ", "CDRM00201 !F", "0724"}, PQUIRK_NOLUNS|PQUIRK_NOSYNC},
|
1997-10-01 05:18:38 +04:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"ShinaKen", "CD-ROM DM-3x1S", "1.04"}, PQUIRK_NOLUNS},
|
1998-04-23 04:38:01 +04:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"JVC ", "R2626", ""}, PQUIRK_NOLUNS},
|
2000-03-19 13:33:26 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"YAMAHA", "CRW8424S", ""}, PQUIRK_NOLUNS},
|
2001-02-27 01:31:27 +03:00
|
|
|
{{T_CDROM, T_REMOV,
|
|
|
|
"VMware", "Virtual", "1.0"},
|
2001-04-25 21:53:04 +04:00
|
|
|
PQUIRK_NOSTARTUNIT|PQUIRK_NODOORLOCK},
|
2001-02-27 01:31:27 +03:00
|
|
|
|
1997-04-20 01:32:37 +04:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"MICROP ", "1588-15MBSUN0669", ""}, PQUIRK_AUTOSAVE},
|
1998-10-09 00:24:10 +04:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"MICROP ", "2217-15MQ1091501", ""}, PQUIRK_NOSYNCCACHE},
|
1996-03-21 06:29:40 +03:00
|
|
|
{{T_OPTICAL, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"EPSON ", "OMD-5010 ", "3.08"}, PQUIRK_NOLUNS},
|
1999-10-10 22:49:15 +04:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"TOSHIBA ","CD-ROM XM-3401TA", "0283"}, PQUIRK_CDROM|PQUIRK_NOLUNS},
|
2000-05-28 11:03:59 +04:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"TOSHIBA ", "CD-ROM DRIVE:XM", "1971"}, PQUIRK_CDROM|PQUIRK_NOLUNS},
|
1998-12-10 21:13:29 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"ADAPTEC ", "AEC-4412BD", "1.2A"}, PQUIRK_NOMODESENSE},
|
1996-02-23 02:37:27 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"DEC ", "RZ55 (C) DEC", ""}, PQUIRK_AUTOSAVE},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"EMULEX ", "MD21/S2 ESDI", "A00"}, PQUIRK_FORCELUNS|PQUIRK_AUTOSAVE},
|
1997-09-29 15:00:36 +04:00
|
|
|
/* Gives non-media hardware failure in response to start-unit command */
|
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"HITACHI", "DK515C", "CP16"}, PQUIRK_NOSTARTUNIT},
|
1997-09-29 15:00:36 +04:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"HITACHI", "DK515C", "CP15"}, PQUIRK_NOSTARTUNIT},
|
1998-09-08 11:34:02 +04:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"HP ", "C372", ""}, PQUIRK_NOTAG},
|
1997-03-27 10:37:54 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"IBMRAID ", "0662S", ""}, PQUIRK_AUTOSAVE},
|
1997-03-27 10:37:54 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"IBM ", "0663H", ""}, PQUIRK_AUTOSAVE},
|
1997-04-20 05:30:30 +04:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"IBM", "0664", ""}, PQUIRK_AUTOSAVE},
|
1997-07-17 04:46:50 +04:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"IBM ", "H3171-S2", ""}, PQUIRK_NOLUNS|PQUIRK_AUTOSAVE},
|
1998-03-07 09:34:59 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"IBM ", "KZ-C", ""}, PQUIRK_AUTOSAVE},
|
1997-04-20 04:55:05 +04:00
|
|
|
/* Broken IBM disk */
|
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"" , "DFRSS2F", ""}, PQUIRK_AUTOSAVE},
|
1997-08-17 20:25:11 +04:00
|
|
|
{{T_DIRECT, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"MPL ", "MC-DISK- ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"MAXTOR ", "XT-3280 ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"MAXTOR ", "XT-4380S ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"MAXTOR ", "MXT-1240S ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"MAXTOR ", "XT-4170S ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"MAXTOR ", "XT-8760S", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"MAXTOR ", "LXT-213S ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"MAXTOR ", "LXT-213S SUN0207", ""}, PQUIRK_NOLUNS},
|
1996-03-05 04:45:42 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"MAXTOR ", "LXT-200S ", ""}, PQUIRK_NOLUNS},
|
1997-09-19 18:08:48 +04:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"MEGADRV ", "EV1000", ""}, PQUIRK_NOMODESENSE},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"MST ", "SnapLink ", ""}, PQUIRK_NOLUNS},
|
1996-03-18 19:19:58 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"NEC ", "D3847 ", "0307"}, PQUIRK_NOLUNS},
|
1998-03-07 09:34:59 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"QUANTUM ", "ELS85S ", ""}, PQUIRK_AUTOSAVE},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"QUANTUM ", "LPS525S ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"QUANTUM ", "P105S 910-10-94x", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"QUANTUM ", "PD1225S ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"QUANTUM ", "PD210S SUN0207", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"RODIME ", "RO3000S ", ""}, PQUIRK_NOLUNS},
|
1997-03-26 01:33:50 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SEAGATE ", "ST125N ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SEAGATE ", "ST157N ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SEAGATE ", "ST296 ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SEAGATE ", "ST296N ", ""}, PQUIRK_NOLUNS},
|
1997-08-16 05:05:51 +04:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SEAGATE ", "ST19171", ""}, PQUIRK_NOMODESENSE},
|
1997-09-19 18:08:48 +04:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SEAGATE ", "ST34501FC ", ""}, PQUIRK_NOMODESENSE},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"TOSHIBA ", "MK538FB ", "6027"}, PQUIRK_NOLUNS},
|
2001-02-27 01:31:27 +03:00
|
|
|
{{T_DIRECT, T_FIXED,
|
|
|
|
"VMware", "Virtual", "1.0"},
|
2001-04-25 21:53:04 +04:00
|
|
|
PQUIRK_NOSTARTUNIT|PQUIRK_NODOORLOCK},
|
2001-02-27 01:31:27 +03:00
|
|
|
|
1996-07-05 20:19:02 +04:00
|
|
|
{{T_DIRECT, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"iomega", "jaz 1GB", ""}, PQUIRK_NOMODESENSE},
|
1996-07-06 01:58:04 +04:00
|
|
|
{{T_DIRECT, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"IOMEGA", "ZIP 100", ""}, PQUIRK_NOMODESENSE},
|
1998-11-26 16:39:14 +03:00
|
|
|
{{T_DIRECT, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"IOMEGA", "ZIP 100", "J.03"}, PQUIRK_NOMODESENSE|PQUIRK_NOLUNS},
|
1997-08-15 02:17:32 +04:00
|
|
|
/* Letting the motor run kills floppy drives and disks quite fast. */
|
1996-10-23 11:25:39 +04:00
|
|
|
{{T_DIRECT, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"TEAC", "FC-1", ""}, PQUIRK_NOSTARTUNIT},
|
1996-03-21 06:29:40 +03:00
|
|
|
|
2000-05-30 05:49:19 +04:00
|
|
|
{{T_DIRECT, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"Y-E DATA", "USB-FDU", "3.04"}, PQUIRK_NOMODESENSE},
|
2000-05-30 19:16:41 +04:00
|
|
|
{{T_DIRECT, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"TEAC", "FD-05PUB", "1026"}, PQUIRK_NOMODESENSE},
|
2000-05-30 05:49:19 +04: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,
|
2001-04-25 21:53:04 +04:00
|
|
|
" ", " ", " "}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"CALIPER ", "CP150 ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"EXABYTE ", "EXB-8200 ", ""}, PQUIRK_NOLUNS},
|
1997-08-17 20:25:11 +04:00
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SONY ", "GY-10C ", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SONY ", "SDT-2000 ", "2.09"}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SONY ", "SDT-5000 ", "3."}, PQUIRK_NOSYNC|PQUIRK_NOWIDE},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SONY ", "SDT-5200 ", "3."}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"TANDBERG", " TDC 3600 ", ""}, PQUIRK_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,
|
2001-04-25 21:53:04 +04:00
|
|
|
"ARCHIVE ", "VIPER 150 21247", ""}, PQUIRK_NOLUNS},
|
1997-09-29 15:00:36 +04:00
|
|
|
/* Following entry for a Cipher ST150S; ref. PR4171 */
|
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"ARCHIVE ", "VIPER 1500 21247", "2.2G"}, PQUIRK_NOLUNS},
|
1997-04-20 01:32:37 +04:00
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"ARCHIVE ", "Python 28454-XXX", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"WANGTEK ", "5099ES SCSI", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"WANGTEK ", "5150ES SCSI", ""}, PQUIRK_NOLUNS},
|
1999-09-10 00:06:52 +04:00
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"WANGTEK ", "SCSI-36", ""}, PQUIRK_NOLUNS},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"WangDAT ", "Model 1300 ", "02.4"}, PQUIRK_NOSYNC|PQUIRK_NOWIDE},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"WangDAT ", "Model 2600 ", "01.7"}, PQUIRK_NOSYNC|PQUIRK_NOWIDE},
|
1996-02-15 00:46:52 +03:00
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"WangDAT ", "Model 3200 ", "02.2"}, PQUIRK_NOSYNC|PQUIRK_NOWIDE},
|
2000-01-13 03:18:27 +03:00
|
|
|
{{T_SEQUENTIAL, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"TEAC ", "MT-2ST/N50 ", ""}, PQUIRK_NOLUNS},
|
1997-08-17 20:25:11 +04:00
|
|
|
|
1998-06-22 17:19:09 +04:00
|
|
|
{{T_SCANNER, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"RICOH ", "IS60 ", "1R08"}, PQUIRK_NOLUNS},
|
1998-05-04 09:54:09 +04:00
|
|
|
{{T_SCANNER, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"UMAX ", "Astra 1200S ", "V2.9"}, PQUIRK_NOLUNS},
|
1998-07-30 04:00:06 +04:00
|
|
|
{{T_SCANNER, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"UMAX ", "Astra 1220S ", ""}, PQUIRK_NOLUNS},
|
1997-08-15 02:17:32 +04:00
|
|
|
{{T_SCANNER, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"UMAX ", "UMAX S-6E ", "V2.0"}, PQUIRK_NOLUNS},
|
1998-01-21 11:41:28 +03:00
|
|
|
{{T_SCANNER, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"UMAX ", "UMAX S-12 ", "V2.1"}, PQUIRK_NOLUNS},
|
2000-03-13 12:56:26 +03:00
|
|
|
{{T_SCANNER, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"ULTIMA ", "A6000C ", ""}, PQUIRK_NOLUNS},
|
2000-08-13 04:03:01 +04:00
|
|
|
{{T_PROCESSOR, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SYMBIOS", "", ""}, PQUIRK_NOLUNS},
|
1997-08-17 20:25:11 +04:00
|
|
|
{{T_PROCESSOR, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"LITRONIC", "PCMCIA ", ""}, PQUIRK_NOLUNS},
|
1998-10-08 22:46:15 +04:00
|
|
|
{{T_CHANGER, T_REMOV,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SONY ", "CDL1100 ", ""}, PQUIRK_NOLUNS},
|
1998-12-05 22:39:23 +03:00
|
|
|
{{T_ENCLOSURE, T_FIXED,
|
2001-04-25 21:53:04 +04:00
|
|
|
"SUN ", "SENA ", ""}, PQUIRK_NOLUNS},
|
1994-12-28 22:42:47 +03:00
|
|
|
};
|
|
|
|
|
1994-03-29 08:29:20 +04:00
|
|
|
/*
|
1998-01-21 11:41:28 +03:00
|
|
|
* given a target and lun, ask the device what
|
1994-03-29 08:29:20 +04:00
|
|
|
* it is, and find the correct driver table
|
|
|
|
* entry.
|
|
|
|
*/
|
1998-12-05 22:39:23 +03:00
|
|
|
int
|
2001-04-25 21:53:04 +04:00
|
|
|
scsi_probe_device(sc, target, lun)
|
|
|
|
struct scsibus_softc *sc;
|
1994-12-28 22:42:47 +03:00
|
|
|
int target, lun;
|
1994-03-29 08:29:20 +04:00
|
|
|
{
|
2001-04-25 21:53:04 +04:00
|
|
|
struct scsipi_channel *chan = sc->sc_channel;
|
|
|
|
struct scsipi_periph *periph;
|
2000-04-19 08:49:50 +04:00
|
|
|
struct scsipi_inquiry_data inqbuf;
|
1994-12-28 22:42:47 +03:00
|
|
|
struct scsi_quirk_inquiry_pattern *finger;
|
2001-04-25 21:53:04 +04:00
|
|
|
int checkdtype, priority, docontinue, quirks;
|
1997-08-27 15:22:52 +04:00
|
|
|
struct scsipibus_attach_args sa;
|
1994-12-28 22:42:47 +03:00
|
|
|
struct cfdata *cf;
|
|
|
|
|
1998-12-05 22:39:23 +03:00
|
|
|
/*
|
|
|
|
* Assume no more luns to search after this one.
|
|
|
|
* If we successfully get Inquiry data and after
|
|
|
|
* merging quirks we find we can probe for more
|
|
|
|
* luns, we will.
|
|
|
|
*/
|
|
|
|
docontinue = 0;
|
|
|
|
|
1994-12-28 22:42:47 +03:00
|
|
|
/* Skip this slot if it is already attached. */
|
2001-04-25 21:53:04 +04:00
|
|
|
if (scsipi_lookup_periph(chan, target, lun) != NULL)
|
1998-12-05 22:39:23 +03:00
|
|
|
return (docontinue);
|
1994-12-28 22:42:47 +03:00
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
periph = scsipi_alloc_periph(M_NOWAIT);
|
|
|
|
if (periph == NULL) {
|
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
printf("%s: cannot allocate periph for target %d lun %d\n",
|
|
|
|
sc->sc_dev.dv_xname, target, lun);
|
|
|
|
#endif
|
|
|
|
return (ENOMEM);
|
|
|
|
}
|
|
|
|
periph->periph_channel = chan;
|
|
|
|
periph->periph_switch = &scsi_probe_dev;
|
|
|
|
|
|
|
|
periph->periph_target = target;
|
|
|
|
periph->periph_lun = lun;
|
|
|
|
periph->periph_quirks = chan->chan_defquirks;
|
|
|
|
|
|
|
|
#ifdef SCSIPI_DEBUG
|
|
|
|
if (SCSIPI_DEBUG_TYPE == SCSIPI_BUSTYPE_SCSI &&
|
|
|
|
SCSIPI_DEBUG_TARGET == target &&
|
|
|
|
SCSIPI_DEBUG_LUN == lun)
|
|
|
|
periph->periph_dbflags |= SCSIPI_DEBUG_FLAGS;
|
|
|
|
#endif
|
1994-03-29 08:29:20 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Ask the device what it is
|
|
|
|
*/
|
2001-04-25 21:53:04 +04:00
|
|
|
(void) scsipi_test_unit_ready(periph,
|
1999-10-01 02:57:52 +04:00
|
|
|
XS_CTL_DISCOVERY | XS_CTL_IGNORE_ILLEGAL_REQUEST |
|
|
|
|
XS_CTL_IGNORE_NOT_READY | XS_CTL_IGNORE_MEDIA_CHANGE);
|
1994-12-28 22:42:47 +03:00
|
|
|
|
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 */
|
2001-04-25 21:53:04 +04:00
|
|
|
scsi_change_def(periph, XS_CTL_DISCOVERY | XS_CTL_SILENT);
|
1994-12-28 22:42:47 +03:00
|
|
|
#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. */
|
2001-04-25 21:53:04 +04:00
|
|
|
memset(&inqbuf, 0, sizeof(inqbuf));
|
|
|
|
if (scsipi_inquire(periph, &inqbuf,
|
2000-06-09 12:54:19 +04:00
|
|
|
XS_CTL_DISCOVERY | XS_CTL_DATA_ONSTACK) != 0)
|
1994-12-28 22:42:47 +03:00
|
|
|
goto bad;
|
|
|
|
{
|
2000-05-14 22:20:11 +04:00
|
|
|
u_int8_t *extension = &inqbuf.flags1;
|
1994-12-28 22:42:47 +03:00
|
|
|
int len = inqbuf.additional_length;
|
1994-12-30 08:20:22 +03:00
|
|
|
while (len < 3)
|
2000-05-14 22:20:11 +04:00
|
|
|
extension[len++] = '\0';
|
1994-12-30 08:20:22 +03:00
|
|
|
while (len < 3 + 28)
|
2000-05-14 22:20:11 +04:00
|
|
|
extension[len++] = ' ';
|
|
|
|
while (len < 3 + 28 + 20)
|
|
|
|
extension[len++] = '\0';
|
|
|
|
while (len < 3 + 28 + 20 + 1)
|
|
|
|
extension[len++] = '\0';
|
2000-05-15 20:35:49 +04:00
|
|
|
while (len < 3 + 28 + 20 + 1 + 1)
|
|
|
|
extension[len++] = '\0';
|
|
|
|
while (len < 3 + 28 + 20 + 1 + 1 + (8*2))
|
|
|
|
extension[len++] = ' ';
|
1994-12-28 22:42:47 +03:00
|
|
|
}
|
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
periph->periph_type = inqbuf.device & SID_TYPE;
|
|
|
|
if (inqbuf.dev_qual2 & SID_REMOVABLE)
|
|
|
|
periph->periph_flags |= PERIPH_REMOVABLE;
|
|
|
|
periph->periph_version = inqbuf.version & SID_ANSII;
|
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) {
|
2001-04-25 21:53:04 +04:00
|
|
|
case SID_QUAL_LU_PRESENT:
|
|
|
|
case SID_QUAL_LU_NOTPRESENT:
|
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
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
case SID_QUAL_reserved:
|
|
|
|
case SID_QUAL_LU_NOT_SUPP:
|
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;
|
|
|
|
}
|
2000-09-22 20:45:17 +04:00
|
|
|
|
|
|
|
/* Let the adapter driver handle the device separatley if it wants. */
|
2001-04-25 21:53:04 +04:00
|
|
|
if (chan->chan_adapter->adapt_accesschk != NULL &&
|
|
|
|
(*chan->chan_adapter->adapt_accesschk)(periph, &sa.sa_inqbuf))
|
2000-09-22 20:45:17 +04:00
|
|
|
goto bad;
|
|
|
|
|
2000-08-09 02:46:03 +04:00
|
|
|
if (checkdtype) {
|
2001-04-25 21:53:04 +04:00
|
|
|
switch (periph->periph_type) {
|
1993-04-12 12:19:28 +04:00
|
|
|
case T_DIRECT:
|
|
|
|
case T_SEQUENTIAL:
|
|
|
|
case T_PRINTER:
|
|
|
|
case T_PROCESSOR:
|
|
|
|
case T_WORM:
|
1997-10-03 06:04:17 +04:00
|
|
|
case T_CDROM:
|
1993-04-12 12:19:28 +04:00
|
|
|
case T_SCANNER:
|
|
|
|
case T_OPTICAL:
|
|
|
|
case T_CHANGER:
|
|
|
|
case T_COMM:
|
1997-10-03 06:04:17 +04:00
|
|
|
case T_IT8_1:
|
|
|
|
case T_IT8_2:
|
|
|
|
case T_STORARRAY:
|
|
|
|
case T_ENCLOSURE:
|
2000-05-15 20:35:49 +04:00
|
|
|
case T_SIMPLE_DIRECT:
|
|
|
|
case T_OPTIC_CARD_RW:
|
|
|
|
case T_OBJECT_STORED:
|
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
|
|
|
}
|
2000-08-09 02:46:03 +04:00
|
|
|
}
|
1993-03-21 21:04:42 +03:00
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
sa.sa_periph = periph;
|
|
|
|
sa.sa_inqbuf.type = inqbuf.device;
|
|
|
|
sa.sa_inqbuf.removable = inqbuf.dev_qual2 & SID_REMOVABLE ?
|
|
|
|
T_REMOV : T_FIXED;
|
|
|
|
sa.sa_inqbuf.vendor = inqbuf.vendor;
|
|
|
|
sa.sa_inqbuf.product = inqbuf.product;
|
|
|
|
sa.sa_inqbuf.revision = inqbuf.revision;
|
|
|
|
sa.scsipi_info.scsi_version = inqbuf.version;
|
|
|
|
sa.sa_inqptr = &inqbuf;
|
|
|
|
|
|
|
|
finger = (struct scsi_quirk_inquiry_pattern *)scsipi_inqmatch(
|
|
|
|
&sa.sa_inqbuf, (caddr_t)scsi_quirk_patterns,
|
|
|
|
sizeof(scsi_quirk_patterns)/sizeof(scsi_quirk_patterns[0]),
|
|
|
|
sizeof(scsi_quirk_patterns[0]), &priority);
|
|
|
|
|
|
|
|
if (finger != NULL)
|
|
|
|
quirks = finger->quirks;
|
|
|
|
else
|
|
|
|
quirks = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Determine the operating mode capabilities of the device.
|
|
|
|
*/
|
|
|
|
if (periph->periph_version >= 2) {
|
|
|
|
if ((inqbuf.flags3 & SID_CmdQue) != 0 &&
|
|
|
|
(quirks & PQUIRK_NOTAG) == 0)
|
|
|
|
periph->periph_cap |= PERIPH_CAP_TQING;
|
|
|
|
if ((inqbuf.flags3 & SID_Linked) != 0)
|
|
|
|
periph->periph_cap |= PERIPH_CAP_LINKCMDS;
|
|
|
|
if ((inqbuf.flags3 & SID_Sync) != 0 &&
|
|
|
|
(quirks & PQUIRK_NOSYNC) == 0)
|
|
|
|
periph->periph_cap |= PERIPH_CAP_SYNC;
|
|
|
|
if ((inqbuf.flags3 & SID_WBus16) != 0 &&
|
|
|
|
(quirks & PQUIRK_NOWIDE) == 0)
|
|
|
|
periph->periph_cap |= PERIPH_CAP_WIDE16;
|
|
|
|
if ((inqbuf.flags3 & SID_WBus32) != 0 &&
|
|
|
|
(quirks & PQUIRK_NOWIDE) == 0)
|
|
|
|
periph->periph_cap |= PERIPH_CAP_WIDE32;
|
|
|
|
if ((inqbuf.flags3 & SID_SftRe) != 0)
|
|
|
|
periph->periph_cap |= PERIPH_CAP_SFTRESET;
|
|
|
|
if ((inqbuf.flags3 & SID_RelAdr) != 0)
|
|
|
|
periph->periph_cap |= PERIPH_CAP_RELADR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Now apply any quirks from the table.
|
|
|
|
*/
|
|
|
|
periph->periph_quirks |= quirks;
|
|
|
|
if (periph->periph_version == 0 &&
|
|
|
|
(periph->periph_quirks & PQUIRK_FORCELUNS) == 0)
|
|
|
|
periph->periph_quirks |= PQUIRK_NOLUNS;
|
|
|
|
|
|
|
|
if (periph->periph_quirks & PQUIRK_CDROM) {
|
|
|
|
periph->periph_quirks ^= PQUIRK_CDROM;
|
|
|
|
inqbuf.dev_qual2 |= SID_REMOVABLE;
|
|
|
|
sa.sa_inqbuf.type = inqbuf.device = ((inqbuf.device & ~SID_REMOVABLE) | T_CDROM);
|
|
|
|
sa.sa_inqbuf.removable = T_REMOV;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((periph->periph_quirks & PQUIRK_NOLUNS) == 0)
|
|
|
|
docontinue = 1;
|
|
|
|
|
|
|
|
if ((cf = config_search(scsibussubmatch, &sc->sc_dev, &sa)) != NULL) {
|
|
|
|
scsipi_insert_periph(chan, periph);
|
|
|
|
/*
|
|
|
|
* XXX Can't assign periph_dev here, because we'll
|
|
|
|
* XXX need it before config_attach() returns. Must
|
|
|
|
* XXX assign it in periph driver.
|
|
|
|
*/
|
|
|
|
(void) config_attach(&sc->sc_dev, cf, &sa, scsibusprint);
|
1996-03-05 03:15:09 +03:00
|
|
|
} else {
|
2001-04-25 21:53:04 +04:00
|
|
|
scsibusprint(&sa, sc->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
|
|
|
|
1998-12-05 22:39:23 +03:00
|
|
|
return (docontinue);
|
1994-12-28 22:42:47 +03:00
|
|
|
|
|
|
|
bad:
|
2001-04-25 21:53:04 +04:00
|
|
|
free(periph, M_DEVBUF);
|
1998-12-05 22:39:23 +03:00
|
|
|
return (docontinue);
|
1993-04-12 12:19:28 +04:00
|
|
|
}
|
1998-10-10 05:14:26 +04:00
|
|
|
|
|
|
|
/****** Entry points for user control of the SCSI bus. ******/
|
|
|
|
|
|
|
|
int
|
|
|
|
scsibusopen(dev, flag, fmt, p)
|
|
|
|
dev_t dev;
|
|
|
|
int flag, fmt;
|
|
|
|
struct proc *p;
|
|
|
|
{
|
|
|
|
struct scsibus_softc *sc;
|
1998-11-20 01:28:20 +03:00
|
|
|
int error, unit = minor(dev);
|
1998-10-10 05:14:26 +04:00
|
|
|
|
|
|
|
if (unit >= scsibus_cd.cd_ndevs ||
|
|
|
|
(sc = scsibus_cd.cd_devs[unit]) == NULL)
|
|
|
|
return (ENXIO);
|
|
|
|
|
1998-10-21 02:26:04 +04:00
|
|
|
if (sc->sc_flags & SCSIBUSF_OPEN)
|
1998-10-10 05:14:26 +04:00
|
|
|
return (EBUSY);
|
1998-11-20 01:28:20 +03:00
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
if ((error = scsipi_adapter_addref(sc->sc_channel->chan_adapter)) != 0)
|
1998-11-20 01:28:20 +03:00
|
|
|
return (error);
|
|
|
|
|
1998-10-21 02:26:04 +04:00
|
|
|
sc->sc_flags |= SCSIBUSF_OPEN;
|
1998-10-10 05:14:26 +04:00
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
scsibusclose(dev, flag, fmt, p)
|
|
|
|
dev_t dev;
|
|
|
|
int flag, fmt;
|
|
|
|
struct proc *p;
|
|
|
|
{
|
|
|
|
struct scsibus_softc *sc = scsibus_cd.cd_devs[minor(dev)];
|
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
scsipi_adapter_delref(sc->sc_channel->chan_adapter);
|
1998-11-20 01:28:20 +03:00
|
|
|
|
1998-10-21 02:26:04 +04:00
|
|
|
sc->sc_flags &= ~SCSIBUSF_OPEN;
|
1998-10-10 05:14:26 +04:00
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
scsibusioctl(dev, cmd, addr, flag, p)
|
|
|
|
dev_t dev;
|
|
|
|
u_long cmd;
|
|
|
|
caddr_t addr;
|
|
|
|
int flag;
|
|
|
|
struct proc *p;
|
|
|
|
{
|
|
|
|
struct scsibus_softc *sc = scsibus_cd.cd_devs[minor(dev)];
|
2001-04-25 21:53:04 +04:00
|
|
|
struct scsipi_channel *chan = sc->sc_channel;
|
1998-10-10 05:14:26 +04:00
|
|
|
int error;
|
|
|
|
|
1998-10-10 07:33:01 +04:00
|
|
|
/*
|
|
|
|
* Enforce write permission for ioctls that change the
|
|
|
|
* state of the bus. Host adapter specific ioctls must
|
|
|
|
* be checked by the adapter driver.
|
|
|
|
*/
|
|
|
|
switch (cmd) {
|
|
|
|
case SCBUSIOSCAN:
|
|
|
|
case SCBUSIORESET:
|
|
|
|
if ((flag & FWRITE) == 0)
|
|
|
|
return (EBADF);
|
|
|
|
}
|
|
|
|
|
1998-10-10 05:14:26 +04:00
|
|
|
switch (cmd) {
|
1998-10-10 06:34:15 +04:00
|
|
|
case SCBUSIOSCAN:
|
|
|
|
{
|
|
|
|
struct scbusioscan_args *a =
|
|
|
|
(struct scbusioscan_args *)addr;
|
|
|
|
|
2001-04-25 21:53:04 +04:00
|
|
|
error = scsi_probe_bus(sc, a->sa_target, a->sa_lun);
|
1998-10-10 06:34:15 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1998-10-10 07:33:01 +04:00
|
|
|
case SCBUSIORESET:
|
|
|
|
/* FALLTHROUGH */
|
1998-10-10 05:14:26 +04:00
|
|
|
default:
|
2001-04-25 21:53:04 +04:00
|
|
|
if (chan->chan_adapter->adapt_ioctl == NULL)
|
1998-10-10 07:33:01 +04:00
|
|
|
error = ENOTTY;
|
|
|
|
else
|
2001-04-25 21:53:04 +04:00
|
|
|
error = (*chan->chan_adapter->adapt_ioctl)(chan,
|
1998-10-10 07:33:01 +04:00
|
|
|
cmd, addr, flag, p);
|
|
|
|
break;
|
1998-10-10 05:14:26 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return (error);
|
|
|
|
}
|