Use SCSI/ATAPI common definition for MODE_{SELECT,SENSE}{,_BIG}. Define

functions to send theses commands in scsipi_base.c and use them instead
of ad-hoc commands setups.
This commit is contained in:
bouyer 2001-05-14 20:35:27 +00:00
parent 26882092f4
commit bc980d7eba
19 changed files with 312 additions and 404 deletions

View File

@ -1,69 +0,0 @@
/* $NetBSD: atapi_all.h,v 1.3 1998/02/13 08:28:16 enami Exp $ */
/*
* Copyright (c) 1996 Manuel Bouyer. 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 Manuel Bouyer.
* 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.
*/
#define ATAPI_MODE_SELECT 0x55
struct atapi_mode_select {
u_int8_t opcode;
u_int8_t byte2;
#define AMS_SP 0x01 /* save pages */
#define AMS_PF 0x10 /* must be set in byte2 */
u_int8_t reserved1[5];
u_int8_t length[2];
u_int8_t reserved2[3];
};
#define ATAPI_MODE_SENSE 0x5a
struct atapi_mode_sense {
u_int8_t opcode;
u_int8_t byte2;
u_int8_t page;
u_int8_t reserved1[4];
u_int8_t length[2];
u_int8_t reserved2[3];
};
struct atapi_mode_header {
u_int8_t length[2];
u_int8_t medium;
#define MDT_UNKNOWN 0x00
#define MDT_DATA_120 0x01
#define MDT_AUDIO_120 0x02
#define MDT_COMB_120 0x03
#define MDT_PHOTO_120 0x04
#define MDT_DATA_80 0x05
#define MDT_AUDIO_80 0x06
#define MDT_COMB_80 0x07
#define MDT_PHOTO_80 0x08
#define MDT_NO_DISC 0x70
#define MDT_DOOR_OPEN 0x71
#define MDT_FMT_ERROR 0x72
u_int8_t reserved[5];
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: atapi_base.c,v 1.15 2001/04/25 17:53:38 bouyer Exp $ */
/* $NetBSD: atapi_base.c,v 1.16 2001/05/14 20:35:27 bouyer Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -49,7 +49,6 @@
#include <sys/proc.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/atapi_all.h>
#include <dev/scsipi/scsipiconf.h>
#include <dev/scsipi/atapiconf.h>
#include <dev/scsipi/scsipi_base.h>
@ -246,48 +245,3 @@ atapi_scsipi_cmd(periph, scsipi_cmd, cmdlen, data, datalen,
return (0);
return (error);
}
int
atapi_mode_select(periph, data, len, flags, retries, timeout)
struct scsipi_periph *periph;
struct atapi_mode_header *data;
int len, flags, retries, timeout;
{
struct atapi_mode_select scsipi_cmd;
int error;
bzero(&scsipi_cmd, sizeof(scsipi_cmd));
scsipi_cmd.opcode = ATAPI_MODE_SELECT;
scsipi_cmd.byte2 = AMS_PF;
_lto2b(len, scsipi_cmd.length);
/* length is reserved when doing mode select; zero it */
_lto2l(0, data->length);
error = scsipi_command(periph, (struct scsipi_generic *)&scsipi_cmd,
sizeof(scsipi_cmd), (void *)data, len, retries, timeout, NULL,
flags | XS_CTL_DATA_OUT);
SC_DEBUG(periph, SCSIPI_DB2, ("atapi_mode_select: error=%d\n", error));
return (error);
}
int
atapi_mode_sense(periph, page, data, len, flags, retries, timeout)
struct scsipi_periph *periph;
int page, len, flags, retries, timeout;
struct atapi_mode_header *data;
{
struct atapi_mode_sense scsipi_cmd;
int error;
bzero(&scsipi_cmd, sizeof(scsipi_cmd));
scsipi_cmd.opcode = ATAPI_MODE_SENSE;
scsipi_cmd.page = page;
_lto2b(len, scsipi_cmd.length);
error = scsipi_command(periph, (struct scsipi_generic *)&scsipi_cmd,
sizeof(scsipi_cmd), (void *)data, len, retries, timeout, NULL,
flags | XS_CTL_DATA_IN);
SC_DEBUG(periph, SCSIPI_DB2, ("atapi_mode_sense: error=%d\n", error));
return (error);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: atapi_cd.h,v 1.9 1998/07/13 16:50:56 thorpej Exp $ */
/* $NetBSD: atapi_cd.h,v 1.10 2001/05/14 20:35:27 bouyer Exp $ */
/*
* Copyright (c) 1996 Manuel Bouyer. All rights reserved.
@ -109,13 +109,28 @@ union atapi_cd_pages {
};
struct atapi_cd_mode_data {
struct atapi_mode_header header;
struct scsipi_mode_header_big header;
union atapi_cd_pages pages;
};
/* medium type in scsipi_mode_header_big */
#define MDT_UNKNOWN 0x00
#define MDT_DATA_120 0x01
#define MDT_AUDIO_120 0x02
#define MDT_COMB_120 0x03
#define MDT_PHOTO_120 0x04
#define MDT_DATA_80 0x05
#define MDT_AUDIO_80 0x06
#define MDT_COMB_80 0x07
#define MDT_PHOTO_80 0x08
#define MDT_NO_DISC 0x70
#define MDT_DOOR_OPEN 0x71
#define MDT_FMT_ERROR 0x72
#define AUDIOPAGESIZE \
(sizeof(struct atapi_mode_header) + sizeof(struct cd_audio_page))
(sizeof(struct scsipi_mode_header_big) + sizeof(struct cd_audio_page))
#define CDROMPAGESIZE \
(sizeof(struct atapi_mode_header) + sizeof(struct atapi_cdrom_page))
(sizeof(struct scsipi_mode_header_big) + sizeof(struct atapi_cdrom_page))
#define CAPPAGESIZE \
(sizeof(struct atapi_mode_header) + sizeof(struct atapi_cap_page))
(sizeof(struct scsipi_mode_header_big) + sizeof(struct atapi_cap_page))

View File

@ -1,4 +1,4 @@
/* $NetBSD: atapi_disk.h,v 1.3 1998/02/13 08:28:21 enami Exp $ */
/* $NetBSD: atapi_disk.h,v 1.4 2001/05/14 20:35:27 bouyer Exp $ */
/*
* Copyright 1998
@ -92,9 +92,9 @@ union atapi_sd_pages {
};
struct atapi_sd_mode_data {
struct atapi_mode_header header;
struct scsipi_mode_header_big header;
union atapi_sd_pages pages;
};
#define FLEXGEOMETRYPAGESIZE \
(sizeof(struct atapi_mode_header) + sizeof(struct atapi_flex_geometry_page))
(sizeof(struct scsipi_mode_header_big) + sizeof(struct atapi_flex_geometry_page))

View File

@ -1,4 +1,4 @@
/* $NetBSD: atapiconf.c,v 1.39 2001/04/25 17:53:38 bouyer Exp $ */
/* $NetBSD: atapiconf.c,v 1.40 2001/05/14 20:35:27 bouyer Exp $ */
/*
* Copyright (c) 1996 Manuel Bouyer. All rights reserved.
@ -40,7 +40,6 @@
#include <dev/ata/atavar.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/atapi_all.h>
#include <dev/scsipi/scsipiconf.h>
#include <dev/scsipi/atapiconf.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: atapiconf.h,v 1.11 2001/04/25 17:53:38 bouyer Exp $ */
/* $NetBSD: atapiconf.h,v 1.12 2001/05/14 20:35:28 bouyer Exp $ */
/*
* Copyright (c) 1996 Manuel Bouyer. All rights reserved.
@ -31,8 +31,6 @@
#include <dev/scsipi/scsipiconf.h>
struct atapi_mode_header;
struct atapibus_softc {
struct device sc_dev;
struct scsipi_channel *sc_channel; /* our scsipi_channel */
@ -59,8 +57,4 @@ void atapi_print_addr __P((struct scsipi_periph *));
int atapi_interpret_sense __P((struct scsipi_xfer *));
int atapi_scsipi_cmd __P((struct scsipi_periph *, struct scsipi_generic *,
int, void *, size_t, int, int, struct buf *, int));
int atapi_mode_select __P((struct scsipi_periph *,
struct atapi_mode_header *, int, int, int, int));
int atapi_mode_sense __P((struct scsipi_periph *, int,
struct atapi_mode_header *, int, int, int, int));
void atapi_kill_pending __P((struct scsipi_periph *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd_atapi.c,v 1.14 2001/04/25 17:53:38 bouyer Exp $ */
/* $NetBSD: cd_atapi.c,v 1.15 2001/05/14 20:35:28 bouyer Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer. All rights reserved.
@ -64,7 +64,6 @@
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsipi_cd.h>
#include <dev/scsipi/atapi_all.h>
#include <dev/scsipi/atapi_cd.h>
#include <dev/scsipi/atapiconf.h>
#include <dev/scsipi/cdvar.h>
@ -150,16 +149,16 @@ cd_atapibus_setchan(cd, p0, p1, p2, p3, flags)
struct atapi_cd_mode_data data;
int error;
if ((error = atapi_mode_sense(cd->sc_periph, ATAPI_AUDIO_PAGE,
(struct atapi_mode_header *)&data, AUDIOPAGESIZE,
if ((error = scsipi_mode_sense_big(cd->sc_periph, 0, ATAPI_AUDIO_PAGE,
&data.header, AUDIOPAGESIZE,
flags | XS_CTL_DATA_ONSTACK, CDRETRIES, 20000)) != 0)
return (error);
data.pages.audio.port[LEFT_PORT].channels = p0;
data.pages.audio.port[RIGHT_PORT].channels = p1;
data.pages.audio.port[2].channels = p2;
data.pages.audio.port[3].channels = p3;
return (atapi_mode_select(cd->sc_periph,
(struct atapi_mode_header *)&data, AUDIOPAGESIZE,
return (scsipi_mode_select_big(cd->sc_periph, SMS_PF,
&data.header, AUDIOPAGESIZE,
flags | XS_CTL_DATA_ONSTACK, CDRETRIES, 20000));
}
@ -172,8 +171,8 @@ cd_atapibus_getvol(cd, arg, flags)
struct atapi_cd_mode_data data;
int error;
if ((error = atapi_mode_sense(cd->sc_periph, ATAPI_AUDIO_PAGE,
(struct atapi_mode_header *)&data, AUDIOPAGESIZE,
if ((error = scsipi_mode_sense_big(cd->sc_periph, 0, ATAPI_AUDIO_PAGE,
&data.header, AUDIOPAGESIZE,
flags | XS_CTL_DATA_ONSTACK, CDRETRIES, 20000)) != 0)
return (error);
arg->vol[0] = data.pages.audio.port[0].volume;
@ -192,12 +191,12 @@ cd_atapibus_setvol(cd, arg, flags)
struct atapi_cd_mode_data data, mask;
int error;
if ((error = atapi_mode_sense(cd->sc_periph, ATAPI_AUDIO_PAGE,
(struct atapi_mode_header *)&data, AUDIOPAGESIZE,
if ((error = scsipi_mode_sense_big(cd->sc_periph, 0, ATAPI_AUDIO_PAGE,
&data.header, AUDIOPAGESIZE,
flags | XS_CTL_DATA_ONSTACK, CDRETRIES, 20000)) != 0)
return (error);
if ((error = atapi_mode_sense(cd->sc_periph, ATAPI_AUDIO_PAGE_MASK,
(struct atapi_mode_header *)&mask, AUDIOPAGESIZE,
if ((error = scsipi_mode_sense_big(cd->sc_periph, 0,
ATAPI_AUDIO_PAGE_MASK, &mask.header, AUDIOPAGESIZE,
flags | XS_CTL_DATA_ONSTACK, CDRETRIES, 20000)) != 0)
return (error);
@ -210,8 +209,8 @@ cd_atapibus_setvol(cd, arg, flags)
data.pages.audio.port[3].volume = arg->vol[3] &
mask.pages.audio.port[3].volume;
return (atapi_mode_select(cd->sc_periph,
(struct atapi_mode_header *)&data, AUDIOPAGESIZE,
return (scsipi_mode_select_big(cd->sc_periph, SMS_PF,
&data.header, AUDIOPAGESIZE,
flags | XS_CTL_DATA_ONSTACK, CDRETRIES, 20000));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd_scsi.c,v 1.19 2001/04/25 17:53:38 bouyer Exp $ */
/* $NetBSD: cd_scsi.c,v 1.20 2001/05/14 20:35:28 bouyer Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -78,10 +78,6 @@
int cd_scsibus_match __P((struct device *, struct cfdata *, void *));
void cd_scsibus_attach __P((struct device *, struct device *, void *));
int cd_scsibus_get_mode __P((struct cd_softc *,
struct scsi_cd_mode_data *, int, int, int));
int cd_scsibus_set_mode __P((struct cd_softc *,
struct scsi_cd_mode_data *, int, int));
struct cfattach cd_scsibus_ca = {
sizeof(struct cd_softc), cd_scsibus_match, cd_scsibus_attach,
@ -162,50 +158,6 @@ cd_scsibus_attach(parent, self, aux)
/* should I get the SCSI_CAP_PAGE here ? */
}
/*
* Get the requested page into the buffer given
*/
int
cd_scsibus_get_mode(cd, data, page, len, flags)
struct cd_softc *cd;
struct scsi_cd_mode_data *data;
int page, len, flags;
{
struct scsi_mode_sense scsipi_cmd;
bzero(&scsipi_cmd, sizeof(scsipi_cmd));
bzero(data, sizeof(*data));
scsipi_cmd.opcode = SCSI_MODE_SENSE;
scsipi_cmd.page = page;
scsipi_cmd.length = len & 0xff;
return (scsipi_command(cd->sc_periph,
(struct scsipi_generic *)&scsipi_cmd, sizeof(scsipi_cmd),
(u_char *)data, sizeof(*data), CDRETRIES, 20000, NULL,
XS_CTL_DATA_IN));
}
/*
* Get the requested page into the buffer given
*/
int
cd_scsibus_set_mode(cd, data, len, flags)
struct cd_softc *cd;
struct scsi_cd_mode_data *data;
int len, flags;
{
struct scsi_mode_select scsipi_cmd;
bzero(&scsipi_cmd, sizeof(scsipi_cmd));
scsipi_cmd.opcode = SCSI_MODE_SELECT;
scsipi_cmd.byte2 |= SMS_PF;
scsipi_cmd.length = len & 0xff;
data->header.data_length = 0;
return (scsipi_command(cd->sc_periph,
(struct scsipi_generic *)&scsipi_cmd, sizeof(scsipi_cmd),
(u_char *)data, sizeof(*data), CDRETRIES, 20000, NULL,
XS_CTL_DATA_OUT));
}
int
cd_scsibus_set_pa_immed(cd, flags)
struct cd_softc *cd;
@ -214,13 +166,15 @@ cd_scsibus_set_pa_immed(cd, flags)
struct scsi_cd_mode_data data;
int error;
if ((error = cd_scsibus_get_mode(cd, &data, SCSI_AUDIO_PAGE,
AUDIOPAGESIZE, flags | XS_CTL_DATA_ONSTACK)) != 0)
if ((error = scsipi_mode_sense(cd->sc_periph, 0, SCSI_AUDIO_PAGE,
&data.header, AUDIOPAGESIZE, flags | XS_CTL_DATA_ONSTACK,
CDRETRIES, 20000)) != 0)
return (error);
data.page.audio.flags &= ~CD_PA_SOTC;
data.page.audio.flags |= CD_PA_IMMED;
return (cd_scsibus_set_mode(cd, &data, AUDIOPAGESIZE,
flags | XS_CTL_DATA_ONSTACK));
return (scsipi_mode_select(cd->sc_periph, SMS_PF,
&data.header, AUDIOPAGESIZE,
flags | XS_CTL_DATA_ONSTACK, CDRETRIES, 20000));
}
int
@ -232,15 +186,17 @@ cd_scsibus_setchan(cd, p0, p1, p2, p3, flags)
struct scsi_cd_mode_data data;
int error;
if ((error = cd_scsibus_get_mode(cd, &data, SCSI_AUDIO_PAGE,
AUDIOPAGESIZE, flags | XS_CTL_DATA_ONSTACK)) != 0)
if ((error = scsipi_mode_sense(cd->sc_periph, 0, SCSI_AUDIO_PAGE,
&data.header, AUDIOPAGESIZE, flags | XS_CTL_DATA_ONSTACK,
CDRETRIES, 20000)) != 0)
return (error);
data.page.audio.port[LEFT_PORT].channels = p0;
data.page.audio.port[RIGHT_PORT].channels = p1;
data.page.audio.port[2].channels = p2;
data.page.audio.port[3].channels = p3;
return (cd_scsibus_set_mode(cd, &data, AUDIOPAGESIZE,
flags | XS_CTL_DATA_ONSTACK));
return (scsipi_mode_select(cd->sc_periph, SMS_PF,
&data.header, AUDIOPAGESIZE,
flags | XS_CTL_DATA_ONSTACK, CDRETRIES, 20000));
}
int
@ -253,8 +209,9 @@ cd_scsibus_getvol(cd, arg, flags)
struct scsi_cd_mode_data data;
int error;
if ((error = cd_scsibus_get_mode(cd, &data, SCSI_AUDIO_PAGE,
AUDIOPAGESIZE, flags | XS_CTL_DATA_ONSTACK)) != 0)
if ((error = scsipi_mode_sense(cd->sc_periph, 0, SCSI_AUDIO_PAGE,
&data.header, AUDIOPAGESIZE,
flags | XS_CTL_DATA_ONSTACK, CDRETRIES, 20000)) != 0)
return (error);
arg->vol[LEFT_PORT] = data.page.audio.port[LEFT_PORT].volume;
arg->vol[RIGHT_PORT] = data.page.audio.port[RIGHT_PORT].volume;
@ -272,8 +229,9 @@ cd_scsibus_setvol(cd, arg, flags)
struct scsi_cd_mode_data data;
int error;
if ((error = cd_scsibus_get_mode(cd, &data, SCSI_AUDIO_PAGE,
AUDIOPAGESIZE, flags | XS_CTL_DATA_ONSTACK)) != 0)
if ((error = scsipi_mode_sense(cd->sc_periph, 0, SCSI_AUDIO_PAGE,
&data.header, AUDIOPAGESIZE,
flags | XS_CTL_DATA_ONSTACK, CDRETRIES, 20000)) != 0)
return (error);
data.page.audio.port[LEFT_PORT].channels = CHANNEL_0;
data.page.audio.port[LEFT_PORT].volume = arg->vol[LEFT_PORT];
@ -281,8 +239,9 @@ cd_scsibus_setvol(cd, arg, flags)
data.page.audio.port[RIGHT_PORT].volume = arg->vol[RIGHT_PORT];
data.page.audio.port[2].volume = arg->vol[2];
data.page.audio.port[3].volume = arg->vol[3];
return (cd_scsibus_set_mode(cd, &data, AUDIOPAGESIZE,
flags | XS_CTL_DATA_ONSTACK));
return (scsipi_mode_select(cd->sc_periph, SMS_PF,
&data.header, AUDIOPAGESIZE,
flags | XS_CTL_DATA_ONSTACK, CDRETRIES, 20000));
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: ch.c,v 1.44 2001/04/25 17:53:39 bouyer Exp $ */
/* $NetBSD: ch.c,v 1.45 2001/05/14 20:35:28 bouyer Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999 The NetBSD Foundation, Inc.
@ -1140,9 +1140,8 @@ ch_get_params(sc, scsiflags)
struct ch_softc *sc;
int scsiflags;
{
struct scsi_mode_sense cmd;
struct scsi_mode_sense_data {
struct scsi_mode_header header;
struct scsipi_mode_header header;
union {
struct page_element_address_assignment ea;
struct page_transport_geometry_parameters tg;
@ -1155,16 +1154,10 @@ ch_get_params(sc, scsiflags)
/*
* Grab info from the element address assignment page.
*/
bzero(&cmd, sizeof(cmd));
bzero(&sense_data, sizeof(sense_data));
cmd.opcode = SCSI_MODE_SENSE;
cmd.byte2 |= 0x08; /* disable block descriptors */
cmd.page = 0x1d;
cmd.length = (sizeof(sense_data) & 0xff);
error = scsipi_command(sc->sc_periph,
(struct scsipi_generic *)&cmd, sizeof(cmd), (u_char *)&sense_data,
sizeof(sense_data), CHRETRIES, 6000, NULL,
scsiflags | XS_CTL_DATA_IN | XS_CTL_DATA_ONSTACK);
error = scsipi_mode_sense(sc->sc_periph, SMS_DBD, 0x1d,
&sense_data.header, sizeof(sense_data),
scsiflags | XS_CTL_DATA_ONSTACK, CHRETRIES, 6000);
if (error) {
printf("%s: could not sense element address page\n",
sc->sc_dev.dv_xname);
@ -1185,19 +1178,13 @@ ch_get_params(sc, scsiflags)
/*
* Grab info from the capabilities page.
*/
bzero(&cmd, sizeof(cmd));
bzero(&sense_data, sizeof(sense_data));
cmd.opcode = SCSI_MODE_SENSE;
/*
* XXX: Note: not all changers can deal with disabled block descriptors
*/
cmd.byte2 = 0x08; /* disable block descriptors */
cmd.page = 0x1f;
cmd.length = (sizeof(sense_data) & 0xff);
error = scsipi_command(sc->sc_periph,
(struct scsipi_generic *)&cmd, sizeof(cmd), (u_char *)&sense_data,
sizeof(sense_data), CHRETRIES, 6000, NULL,
scsiflags | XS_CTL_DATA_IN | XS_CTL_DATA_ONSTACK);
error = scsipi_mode_sense(sc->sc_periph, SMS_DBD, 0x1f,
&sense_data.header, sizeof(sense_data),
scsiflags | XS_CTL_DATA_ONSTACK, CHRETRIES, 6000);
if (error) {
printf("%s: could not sense capabilities page\n",
sc->sc_dev.dv_xname);

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsi_all.h,v 1.17 2001/04/19 10:16:25 augustss Exp $ */
/* $NetBSD: scsi_all.h,v 1.18 2001/05/14 20:35:28 bouyer Exp $ */
/*
* SCSI-specific interface description.
@ -64,53 +64,6 @@ struct scsi_send_diag {
u_int8_t control;
};
#define SCSI_MODE_SENSE 0x1a
struct scsi_mode_sense {
u_int8_t opcode;
u_int8_t byte2;
#define SMS_DBD 0x08
u_int8_t page;
#define SMS_PAGE_CODE 0x3F
#define SMS_PAGE_CTRL 0xC0
#define SMS_PAGE_CTRL_CURRENT 0x00
#define SMS_PAGE_CTRL_CHANGEABLE 0x40
#define SMS_PAGE_CTRL_DEFAULT 0x80
#define SMS_PAGE_CTRL_SAVED 0xC0
u_int8_t unused;
u_int8_t length;
u_int8_t control;
};
#define SCSI_MODE_SENSE_BIG 0x5A
struct scsi_mode_sense_big {
u_int8_t opcode;
u_int8_t byte2; /* same bits as small version */
u_int8_t page; /* same bits as small version */
u_int8_t unused[4];
u_int8_t length[2];
u_int8_t control;
};
#define SCSI_MODE_SELECT 0x15
struct scsi_mode_select {
u_int8_t opcode;
u_int8_t byte2;
#define SMS_SP 0x01
#define SMS_PF 0x10
u_int8_t unused[2];
u_int8_t length;
u_int8_t control;
};
#define SCSI_MODE_SELECT_BIG 0x55
struct scsi_mode_select_big {
u_int8_t opcode;
u_int8_t byte2; /* same bits as small version */
u_int8_t unused[5];
u_int8_t length[2];
u_int8_t control;
};
#define SCSI_RESERVE 0x16
struct scsi_reserve {
u_int8_t opcode;
@ -142,6 +95,7 @@ struct scsi_changedef {
#define SC_SCSI_1 0x01
#define SC_SCSI_2 0x03
/* block descriptor, for mode sense/mode select */
struct scsi_blk_desc {
u_int8_t density;
u_int8_t nblocks[3];
@ -149,22 +103,6 @@ struct scsi_blk_desc {
u_int8_t blklen[3];
};
struct scsi_mode_header {
u_int8_t data_length; /* Sense data length */
u_int8_t medium_type;
u_int8_t dev_spec;
u_int8_t blk_desc_len;
};
struct scsi_mode_header_big {
u_int8_t data_length[2]; /* Sense data length */
u_int8_t medium_type;
u_int8_t dev_spec;
u_int8_t unused[2];
u_int8_t blk_desc_len[2];
};
/*
* Status Byte
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsi_cd.h,v 1.12 1998/02/13 08:28:30 enami Exp $ */
/* $NetBSD: scsi_cd.h,v 1.13 2001/05/14 20:35:28 bouyer Exp $ */
/*
* Written by Julian Elischer (julian@tfs.com)
@ -77,11 +77,11 @@ union scsi_cd_pages {
};
struct scsi_cd_mode_data {
struct scsi_mode_header header;
struct scsipi_mode_header header;
struct scsi_blk_desc blk_desc;
union scsi_cd_pages page;
};
#define AUDIOPAGESIZE \
(sizeof(struct scsi_mode_header) + sizeof(struct scsi_blk_desc) \
(sizeof(struct scsipi_mode_header) + sizeof(struct scsi_blk_desc) \
+ sizeof(struct cd_audio_page))

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsipi_all.h,v 1.16 2001/04/25 17:53:39 bouyer Exp $ */
/* $NetBSD: scsipi_all.h,v 1.17 2001/05/14 20:35:28 bouyer Exp $ */
/*
* SCSI and SCSI-like general interface description
@ -71,6 +71,68 @@ struct scsipi_sense {
u_int8_t control;
};
#define MODE_SENSE 0x1a
struct scsipi_mode_sense {
u_int8_t opcode;
u_int8_t byte2;
#define SMS_DBD 0x08 /* disable block descriptors */
u_int8_t page;
#define SMS_PAGE_CODE 0x3F
#define SMS_PAGE_CTRL 0xC0
#define SMS_PAGE_CTRL_CURRENT 0x00
#define SMS_PAGE_CTRL_CHANGEABLE 0x40
#define SMS_PAGE_CTRL_DEFAULT 0x80
#define SMS_PAGE_CTRL_SAVED 0xC0
union {
struct {
u_int8_t unused;
u_int8_t length;
} scsi;
struct {
u_int8_t length[2];
} atapi;
} u_len;
u_int8_t control;
};
#define MODE_SENSE_BIG 0x5A
struct scsipi_mode_sense_big {
u_int8_t opcode;
u_int8_t byte2; /* same bits as small version */
u_int8_t page; /* same bits as small version */
u_int8_t unused[4];
u_int8_t length[2];
u_int8_t control;
};
#define MODE_SELECT 0x15
struct scsipi_mode_select {
u_int8_t opcode;
u_int8_t byte2;
#define SMS_SP 0x01 /* save page */
#define SMS_PF 0x10
u_int8_t unused[2];
union {
struct {
u_int8_t unused;
u_int8_t length;
} scsi;
struct {
u_int8_t length[2];
} atapi;
} u_len;
u_int8_t control;
};
#define MODE_SELECT_BIG 0x55
struct scsipi_mode_select_big {
u_int8_t opcode;
u_int8_t byte2; /* same bits as small version */
u_int8_t unused[5];
u_int8_t length[2];
u_int8_t control;
};
#define INQUIRY 0x12
struct scsipi_inquiry {
u_int8_t opcode;
@ -233,4 +295,21 @@ struct scsipi_inquiry_data {
/*59*/ char version_descriptor[8][2];
}; /* 74 Bytes */
/* Data structures for mode select/mode sense */
struct scsipi_mode_header {
u_int8_t data_length; /* Sense data length */
u_int8_t medium_type;
u_int8_t dev_spec;
u_int8_t blk_desc_len; /* unused on ATAPI */
};
struct scsipi_mode_header_big {
u_int8_t data_length[2]; /* Sense data length */
u_int8_t medium_type;
u_int8_t dev_spec;
u_int8_t unused[2]; /* unused on ATAPI */
u_int8_t blk_desc_len[2]; /* unused on ATAPI */
};
#endif /* _DEV_SCSIPI_SCSIPI_ALL_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsipi_base.c,v 1.40 2001/04/27 21:36:58 bouyer Exp $ */
/* $NetBSD: scsipi_base.c,v 1.41 2001/05/14 20:35:28 bouyer Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -1062,6 +1062,103 @@ scsipi_start(periph, type, flags)
NULL, flags));
}
/*
* scsipi_mode_sense, scsipi_mode_sense_big:
* get a sense page from a device
*/
int
scsipi_mode_sense(periph, byte2, page, data, len, flags, retries, timeout)
struct scsipi_periph *periph;
int byte2, page, len, flags, retries, timeout;
struct scsipi_mode_header *data;
{
struct scsipi_mode_sense scsipi_cmd;
int error;
bzero(&scsipi_cmd, sizeof(scsipi_cmd));
scsipi_cmd.opcode = MODE_SENSE;
scsipi_cmd.byte2 = byte2;
scsipi_cmd.page = page;
if (scsipi_periph_bustype(periph) == SCSIPI_BUSTYPE_ATAPI)
_lto2b(len, scsipi_cmd.u_len.atapi.length);
else
scsipi_cmd.u_len.scsi.length = len & 0xff;
error = scsipi_command(periph, (struct scsipi_generic *)&scsipi_cmd,
sizeof(scsipi_cmd), (void *)data, len, retries, timeout, NULL,
flags | XS_CTL_DATA_IN);
SC_DEBUG(periph, SCSIPI_DB2,
("scsipi_mode_sense: error=%d\n", error));
return (error);
}
int
scsipi_mode_sense_big(periph, byte2, page, data, len, flags, retries, timeout)
struct scsipi_periph *periph;
int byte2, page, len, flags, retries, timeout;
struct scsipi_mode_header_big *data;
{
struct scsipi_mode_sense_big scsipi_cmd;
int error;
bzero(&scsipi_cmd, sizeof(scsipi_cmd));
scsipi_cmd.opcode = MODE_SENSE_BIG;
scsipi_cmd.byte2 = byte2;
scsipi_cmd.page = page;
_lto2b(len, scsipi_cmd.length);
error = scsipi_command(periph, (struct scsipi_generic *)&scsipi_cmd,
sizeof(scsipi_cmd), (void *)data, len, retries, timeout, NULL,
flags | XS_CTL_DATA_IN);
SC_DEBUG(periph, SCSIPI_DB2,
("scsipi_mode_sense_big: error=%d\n", error));
return (error);
}
int
scsipi_mode_select(periph, byte2, data, len, flags, retries, timeout)
struct scsipi_periph *periph;
int byte2, len, flags, retries, timeout;
struct scsipi_mode_header *data;
{
struct scsipi_mode_select scsipi_cmd;
int error;
bzero(&scsipi_cmd, sizeof(scsipi_cmd));
scsipi_cmd.opcode = MODE_SELECT;
scsipi_cmd.byte2 = byte2;
if (scsipi_periph_bustype(periph) == SCSIPI_BUSTYPE_ATAPI)
_lto2b(len, scsipi_cmd.u_len.atapi.length);
else
scsipi_cmd.u_len.scsi.length = len & 0xff;
error = scsipi_command(periph, (struct scsipi_generic *)&scsipi_cmd,
sizeof(scsipi_cmd), (void *)data, len, retries, timeout, NULL,
flags | XS_CTL_DATA_OUT);
SC_DEBUG(periph, SCSIPI_DB2,
("scsipi_mode_select: error=%d\n", error));
return (error);
}
int
scsipi_mode_select_big(periph, byte2, data, len, flags, retries, timeout)
struct scsipi_periph *periph;
int byte2, len, flags, retries, timeout;
struct scsipi_mode_header_big *data;
{
struct scsipi_mode_select_big scsipi_cmd;
int error;
bzero(&scsipi_cmd, sizeof(scsipi_cmd));
scsipi_cmd.opcode = MODE_SELECT_BIG;
scsipi_cmd.byte2 = byte2;
_lto2b(len, scsipi_cmd.length);
error = scsipi_command(periph, (struct scsipi_generic *)&scsipi_cmd,
sizeof(scsipi_cmd), (void *)data, len, retries, timeout, NULL,
flags | XS_CTL_DATA_OUT);
SC_DEBUG(periph, SCSIPI_DB2,
("scsipi_mode_select: error=%d\n", error));
return (error);
}
/*
* scsipi_done:
*

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsipiconf.h,v 1.50 2001/05/02 09:47:45 bouyer Exp $ */
/* $NetBSD: scsipiconf.h,v 1.51 2001/05/14 20:35:28 bouyer Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -605,6 +605,14 @@ int scsipi_test_unit_ready __P((struct scsipi_periph *, int));
int scsipi_prevent __P((struct scsipi_periph *, int, int));
int scsipi_inquire __P((struct scsipi_periph *,
struct scsipi_inquiry_data *, int));
int scsipi_mode_select __P((struct scsipi_periph *, int,
struct scsipi_mode_header *, int, int, int, int));
int scsipi_mode_select_big __P((struct scsipi_periph *, int,
struct scsipi_mode_header_big *, int, int, int, int));
int scsipi_mode_sense __P((struct scsipi_periph *, int, int,
struct scsipi_mode_header *, int, int, int, int));
int scsipi_mode_sense_big __P((struct scsipi_periph *, int, int,
struct scsipi_mode_header_big *, int, int, int, int));
int scsipi_start __P((struct scsipi_periph *, int, int));
void scsipi_done __P((struct scsipi_xfer *));
void scsipi_user_done __P((struct scsipi_xfer *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: sd_atapi.c,v 1.9 2001/04/25 17:53:41 bouyer Exp $ */
/* $NetBSD: sd_atapi.c,v 1.10 2001/05/14 20:35:29 bouyer Exp $ */
/*
* Copyright 1998
@ -52,7 +52,6 @@
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsipi_disk.h>
#include <dev/scsipi/atapi_all.h>
#include <dev/scsipi/atapi_disk.h>
#include <dev/scsipi/atapiconf.h>
#include <dev/scsipi/sdvar.h>
@ -192,8 +191,8 @@ sd_atapibus_get_parms(sd, dp, flags)
*/
if (sd->sc_periph->periph_quirks & PQUIRK_NO_FLEX_PAGE)
return (SDGP_RESULT_OK);
error = atapi_mode_sense(sd->sc_periph, ATAPI_FLEX_GEOMETRY_PAGE,
(struct atapi_mode_header *)&sense_data, FLEXGEOMETRYPAGESIZE,
error = scsipi_mode_sense_big(sd->sc_periph, 0,
ATAPI_FLEX_GEOMETRY_PAGE, &sense_data.header, FLEXGEOMETRYPAGESIZE,
flags | XS_CTL_DATA_ONSTACK, SDRETRIES, 20000);
SC_DEBUG(sd->sc_periph, SCSIPI_DB2,
("sd_atapibus_get_parms: mode sense (flex) error=%d\n", error));

View File

@ -1,4 +1,4 @@
/* $NetBSD: sd_scsi.c,v 1.16 2001/04/25 17:53:41 bouyer Exp $ */
/* $NetBSD: sd_scsi.c,v 1.17 2001/05/14 20:35:29 bouyer Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -90,7 +90,7 @@ struct scsipi_inquiry_pattern sd_scsibus_patterns[] = {
};
struct sd_scsibus_mode_sense_data {
struct scsi_mode_header header;
struct scsipi_mode_header header;
struct scsi_blk_desc blk_desc;
union scsi_disk_pages pages;
};
@ -160,11 +160,6 @@ sd_scsibus_mode_sense(sd, scsipi_sense, page, flags)
struct sd_scsibus_mode_sense_data *scsipi_sense;
int page, flags;
{
struct scsi_mode_sense sense_cmd;
struct scsi_mode_sense_big sensebig_cmd;
struct scsipi_generic *cmd;
int len;
/*
* Make sure the sense buffer is clean before we do
* the mode sense, so that checks for bogus values of
@ -173,29 +168,18 @@ sd_scsibus_mode_sense(sd, scsipi_sense, page, flags)
bzero(scsipi_sense, sizeof(*scsipi_sense));
if (sd->sc_periph->periph_quirks & PQUIRK_ONLYBIG) {
memset(&sensebig_cmd, 0, sizeof(sensebig_cmd));
sensebig_cmd.opcode = SCSI_MODE_SENSE_BIG;
sensebig_cmd.page = page;
_lto2b(0x20, sensebig_cmd.length);
cmd = (struct scsipi_generic *)&sensebig_cmd;
len = sizeof(sensebig_cmd);
return scsipi_mode_sense_big(sd->sc_periph, 0, page,
(struct scsipi_mode_header_big*)&scsipi_sense->header,
sizeof(*scsipi_sense),
flags | XS_CTL_SILENT | XS_CTL_DATA_ONSTACK,
SDRETRIES, 6000);
} else {
memset(&sense_cmd, 0, sizeof(sense_cmd));
sense_cmd.opcode = SCSI_MODE_SENSE;
sense_cmd.page = page;
sense_cmd.length = 0x20;
cmd = (struct scsipi_generic *)&sense_cmd;
len = sizeof(sense_cmd);
return scsipi_mode_sense(sd->sc_periph, 0, page,
&scsipi_sense->header, sizeof(*scsipi_sense),
flags | XS_CTL_SILENT | XS_CTL_DATA_ONSTACK,
SDRETRIES, 6000);
}
/*
* If the command worked, use the results to fill out
* the parameter structure
*/
return (scsipi_command(sd->sc_periph,
cmd, len, (u_char *)scsipi_sense, sizeof(*scsipi_sense),
SDRETRIES, 6000, NULL,
flags | XS_CTL_DATA_IN | XS_CTL_SILENT | XS_CTL_DATA_ONSTACK));
}
static int
@ -204,7 +188,6 @@ sd_scsibus_get_optparms(sd, dp, flags)
struct disk_parms *dp;
int flags;
{
struct scsi_mode_sense scsipi_cmd;
struct sd_scsibus_mode_sense_data scsipi_sense;
u_long sectors;
int error;
@ -219,16 +202,11 @@ sd_scsibus_get_optparms(sd, dp, flags)
* However, there are stupid optical devices which does NOT
* support the page 6. Ghaa....
*/
bzero(&scsipi_cmd, sizeof(scsipi_cmd));
scsipi_cmd.opcode = SCSI_MODE_SENSE;
scsipi_cmd.page = 0x3f; /* all pages */
scsipi_cmd.length = sizeof(struct scsi_mode_header) +
sizeof(struct scsi_blk_desc);
error = scsipi_mode_sense(sd->sc_periph, 0, 0x3f, &scsipi_sense.header,
sizeof(struct scsipi_mode_header) + sizeof(struct scsi_blk_desc),
flags | XS_CTL_DATA_ONSTACK, SDRETRIES, 6000);
if ((error = scsipi_command(sd->sc_periph,
(struct scsipi_generic *)&scsipi_cmd, sizeof(scsipi_cmd),
(u_char *)&scsipi_sense, sizeof(scsipi_sense), SDRETRIES,
6000, NULL, flags | XS_CTL_DATA_IN | XS_CTL_DATA_ONSTACK)) != 0)
if (error != 0)
return (SDGP_RESULT_OFFLINE); /* XXX? */
dp->blksize = _3btol(scsipi_sense.blk_desc.blklen);

View File

@ -1,4 +1,4 @@
/* $NetBSD: st.c,v 1.137 2001/05/06 11:31:08 hannken Exp $ */
/* $NetBSD: st.c,v 1.138 2001/05/14 20:35:29 bouyer Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -1596,9 +1596,8 @@ st_mode_sense(st, flags)
{
u_int scsipi_sense_len;
int error;
struct scsi_mode_sense cmd;
struct scsipi_sense {
struct scsi_mode_header header;
struct scsipi_mode_header header;
struct scsi_blk_desc blk_desc;
u_char sense_data[MAX_PAGE_0_SIZE];
} scsipi_sense;
@ -1608,21 +1607,14 @@ st_mode_sense(st, flags)
/*
* Set up a mode sense
* We don't need the results. Just print them for our interest's sake,
* if asked, or if we need it as a template for the mode select store
* it away.
*/
bzero(&cmd, sizeof(cmd));
cmd.opcode = SCSI_MODE_SENSE;
cmd.length = scsipi_sense_len;
error = scsipi_mode_sense(st->sc_periph, 0, SMS_PAGE_CTRL_CURRENT,
&scsipi_sense.header, scsipi_sense_len, flags | XS_CTL_DATA_ONSTACK,
ST_RETRIES, ST_CTL_TIME);
/*
* do the command, but we don't need the results
* just print them for our interest's sake, if asked,
* or if we need it as a template for the mode select
* store it away.
*/
error = scsipi_command(periph, (struct scsipi_generic *)&cmd,
sizeof(cmd), (u_char *)&scsipi_sense, scsipi_sense_len,
ST_RETRIES, ST_CTL_TIME, NULL,
flags | XS_CTL_DATA_IN | XS_CTL_DATA_ONSTACK);
if (error)
return (error);
@ -1657,9 +1649,8 @@ st_mode_select(st, flags)
int flags;
{
u_int scsi_select_len;
struct scsi_mode_select cmd;
struct scsi_select {
struct scsi_mode_header header;
struct scsipi_mode_header header;
struct scsi_blk_desc blk_desc;
u_char sense_data[MAX_PAGE_0_SIZE];
} scsi_select;
@ -1682,10 +1673,6 @@ st_mode_select(st, flags)
/*
* Set up for a mode select
*/
bzero(&cmd, sizeof(cmd));
cmd.opcode = SCSI_MODE_SELECT;
cmd.length = scsi_select_len;
bzero(&scsi_select, scsi_select_len);
scsi_select.header.blk_desc_len = sizeof(struct scsi_blk_desc);
scsi_select.header.dev_spec &= ~SMH_DSP_BUFF_MODE;
@ -1702,10 +1689,9 @@ st_mode_select(st, flags)
/*
* do the command
*/
return (scsipi_command(periph, (struct scsipi_generic *)&cmd,
sizeof(cmd), (u_char *)&scsi_select, scsi_select_len,
ST_RETRIES, ST_CTL_TIME, NULL,
flags | XS_CTL_DATA_OUT | XS_CTL_DATA_ONSTACK));
return scsipi_mode_select(periph, 0, &scsi_select.header,
scsi_select_len, flags | XS_CTL_DATA_ONSTACK,
ST_RETRIES, ST_CTL_TIME);
}
int
@ -1714,10 +1700,9 @@ st_cmprss(st, onoff)
int onoff;
{
u_int scsi_dlen;
struct scsi_mode_select mcmd;
struct scsi_mode_sense scmd;
int byte2, page;
struct scsi_select {
struct scsi_mode_header header;
struct scsipi_mode_header header;
struct scsi_blk_desc blk_desc;
u_char pdata[max(sizeof(struct scsi_tape_dev_conf_page),
sizeof(struct scsi_tape_dev_compression_page))];
@ -1728,41 +1713,33 @@ st_cmprss(st, onoff)
int error, ison, flags;
scsi_dlen = sizeof(scsi_pdata);
bzero(&scsi_pdata, scsi_dlen);
/*
* Set up for a mode sense.
* Do DATA COMPRESSION page first.
*/
bzero(&scmd, sizeof(scmd));
scmd.opcode = SCSI_MODE_SENSE;
scmd.page = SMS_PAGE_CTRL_CURRENT | 0xf;
scmd.length = scsi_dlen;
flags = XS_CTL_SILENT;
page = SMS_PAGE_CTRL_CURRENT | 0xf;
byte2 = 0;
/*
* Do the MODE SENSE command...
*/
again:
bzero(&scsi_pdata, scsi_dlen);
error = scsipi_command(periph,
(struct scsipi_generic *)&scmd, sizeof(scmd),
(u_char *)&scsi_pdata, scsi_dlen,
ST_RETRIES, ST_CTL_TIME, NULL,
flags | XS_CTL_DATA_IN | XS_CTL_DATA_ONSTACK);
error = scsipi_mode_sense(periph, byte2, page,
&scsi_pdata.header, scsi_dlen, flags | XS_CTL_DATA_ONSTACK,
ST_RETRIES, ST_CTL_TIME);
if (error) {
if (scmd.byte2 != SMS_DBD) {
scmd.byte2 = SMS_DBD;
if (byte2 != SMS_DBD) {
byte2 = SMS_DBD;
goto again;
}
/*
* Try a different page?
*/
if (scmd.page == (SMS_PAGE_CTRL_CURRENT | 0xf)) {
scmd.page = SMS_PAGE_CTRL_CURRENT | 0x10;
scmd.byte2 = 0;
if (page == (SMS_PAGE_CTRL_CURRENT | 0xf)) {
page = SMS_PAGE_CTRL_CURRENT | 0x10;
byte2 = 0;
goto again;
}
return (error);
@ -1773,7 +1750,7 @@ again:
else
ptr = (struct scsi_tape_dev_conf_page *) &scsi_pdata.blk_desc;
if ((scmd.page & SMS_PAGE_CODE) == 0xf) {
if ((page & SMS_PAGE_CODE) == 0xf) {
cptr = (struct scsi_tape_dev_compression_page *) ptr;
ison = (cptr->dce_dcc & DCP_DCE) != 0;
if (onoff)
@ -1819,10 +1796,6 @@ again:
else
scsi_pdata.header.dev_spec = 0;
bzero(&mcmd, sizeof(mcmd));
mcmd.opcode = SCSI_MODE_SELECT;
mcmd.byte2 = SMS_PF;
mcmd.length = scsi_dlen;
if (scsi_pdata.header.blk_desc_len) {
scsi_pdata.blk_desc.density = 0;
scsi_pdata.blk_desc.nblocks[0] = 0;
@ -1833,17 +1806,14 @@ again:
/*
* Do the command
*/
error = scsipi_command(periph,
(struct scsipi_generic *)&mcmd, sizeof(mcmd),
(u_char *)&scsi_pdata, scsi_dlen,
ST_RETRIES, ST_CTL_TIME, NULL,
flags | XS_CTL_DATA_OUT | XS_CTL_DATA_ONSTACK);
error = scsipi_mode_select(periph, SMS_PF, &scsi_pdata.header,
scsi_dlen, flags | XS_CTL_DATA_ONSTACK, ST_RETRIES, ST_CTL_TIME);
if (error && (scmd.page & SMS_PAGE_CODE) == 0xf) {
if (error && (page & SMS_PAGE_CODE) == 0xf) {
/*
* Try DEVICE CONFIGURATION page.
*/
scmd.page = SMS_PAGE_CTRL_CURRENT | 0x10;
page = SMS_PAGE_CTRL_CURRENT | 0x10;
goto again;
}
return (error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: umassbus.h,v 1.2 2001/04/25 17:53:43 bouyer Exp $ */
/* $NetBSD: umassbus.h,v 1.3 2001/05/14 20:35:29 bouyer Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -42,7 +42,6 @@
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsiconf.h>
#include <dev/scsipi/atapi_all.h>
#include <dev/scsipi/atapiconf.h>
#include <dev/scsipi/scsipi_disk.h>

View File

@ -1,5 +1,5 @@
/* $OpenBSD: usb_port.h,v 1.18 2000/09/06 22:42:10 rahnds Exp $ */
/* $NetBSD: usb_port.h,v 1.43 2001/04/12 01:39:04 thorpej Exp $ */
/* $NetBSD: usb_port.h,v 1.44 2001/05/14 20:35:29 bouyer Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_port.h,v 1.21 1999/11/17 22:33:47 n_hibma Exp $ */
/*
@ -84,6 +84,8 @@
#define Static static
#endif
#define SCSI_MODE_SENSE MODE_SENSE
typedef struct device *device_ptr_t;
#define USBBASEDEVICE struct device
#define USBDEV(bdev) (&(bdev))