summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/scsi/cd.c24
-rw-r--r--sys/scsi/scsi_all.h10
-rw-r--r--sys/scsi/scsi_base.c10
-rw-r--r--sys/scsi/scsiconf.h4
-rw-r--r--sys/scsi/sd_atapi.c4
-rw-r--r--sys/scsi/sd_scsi.c8
6 files changed, 28 insertions, 32 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index 1c4ab86bcb9..85ea941a7ac 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.81 2005/05/27 23:51:53 krw Exp $ */
+/* $OpenBSD: cd.c,v 1.82 2005/06/03 15:50:10 krw Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -1368,10 +1368,10 @@ cd_setchan(cd, p0, p1, p2, p3, flags)
{
struct scsi_mode_sense_buf data;
struct cd_audio_page *audio = NULL;
- int error;
+ int error, big;
error = scsi_do_mode_sense(cd->sc_link, AUDIO_PAGE, &data,
- (void **)&audio, NULL, NULL, NULL, sizeof(*audio), flags);
+ (void **)&audio, NULL, NULL, NULL, sizeof(*audio), flags, &big);
if (error != 0)
return (error);
if (audio == NULL)
@@ -1382,7 +1382,7 @@ cd_setchan(cd, p0, p1, p2, p3, flags)
audio->port[2].channels = p2;
audio->port[3].channels = p3;
- if (MODE_HEADER_IS_BIG(&data, audio))
+ if (big)
error = scsi_mode_select_big(cd->sc_link, SMS_PF,
(struct scsi_mode_header_big *)&data, sizeof(data), flags,
20000);
@@ -1405,7 +1405,7 @@ cd_getvol(cd, arg, flags)
int error;
error = scsi_do_mode_sense(cd->sc_link, AUDIO_PAGE, &data,
- (void **)&audio, NULL, NULL, NULL, sizeof(*audio), flags);
+ (void **)&audio, NULL, NULL, NULL, sizeof(*audio), flags, NULL);
if (error != 0)
return (error);
if (audio == NULL)
@@ -1428,11 +1428,11 @@ cd_setvol(cd, arg, flags)
struct scsi_mode_sense_buf data;
struct cd_audio_page *audio = NULL;
u_int8_t mask_volume[4];
- int error;
+ int error, big;
error = scsi_do_mode_sense(cd->sc_link,
AUDIO_PAGE | SMS_PAGE_CTRL_CHANGEABLE, &data, (void **)&audio, NULL,
- NULL, NULL, sizeof(*audio), flags);
+ NULL, NULL, sizeof(*audio), flags, NULL);
if (error != 0)
return (error);
if (audio == NULL)
@@ -1444,7 +1444,7 @@ cd_setvol(cd, arg, flags)
mask_volume[3] = audio->port[3].volume;
error = scsi_do_mode_sense(cd->sc_link, AUDIO_PAGE, &data,
- (void **)&audio, NULL, NULL, NULL, sizeof(*audio), flags);
+ (void **)&audio, NULL, NULL, NULL, sizeof(*audio), flags, &big);
if (error != 0)
return (error);
if (audio == NULL)
@@ -1455,7 +1455,7 @@ cd_setvol(cd, arg, flags)
audio->port[2].volume = arg->vol[2] & mask_volume[2];
audio->port[3].volume = arg->vol[3] & mask_volume[3];
- if (MODE_HEADER_IS_BIG(&data, audio))
+ if (big)
error = scsi_mode_select_big(cd->sc_link, SMS_PF,
(struct scsi_mode_header_big *)&data, sizeof(data), flags,
20000);
@@ -1490,14 +1490,14 @@ cd_set_pa_immed(cd, flags)
{
struct scsi_mode_sense_buf data;
struct cd_audio_page *audio = NULL;
- int error, oflags;
+ int error, oflags, big;
if (cd->sc_link->flags & SDEV_ATAPI)
/* XXX Noop? */
return (0);
error = scsi_do_mode_sense(cd->sc_link, AUDIO_PAGE, &data,
- (void **)&audio, NULL, NULL, NULL, sizeof(*audio), flags);
+ (void **)&audio, NULL, NULL, NULL, sizeof(*audio), flags, &big);
if (error != 0)
return (error);
if (audio == NULL)
@@ -1509,7 +1509,7 @@ cd_set_pa_immed(cd, flags)
if (audio->flags == oflags)
return (0);
- if (MODE_HEADER_IS_BIG(&data, audio))
+ if (big)
error = scsi_mode_select_big(cd->sc_link, SMS_PF,
(struct scsi_mode_header_big *)&data, sizeof(data), flags,
20000);
diff --git a/sys/scsi/scsi_all.h b/sys/scsi/scsi_all.h
index 87fdc6e9c38..16dee41469c 100644
--- a/sys/scsi/scsi_all.h
+++ b/sys/scsi/scsi_all.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_all.h,v 1.24 2005/05/27 00:14:50 krw Exp $ */
+/* $OpenBSD: scsi_all.h,v 1.25 2005/06/03 15:50:10 krw Exp $ */
/* $NetBSD: scsi_all.h,v 1.10 1996/09/12 01:57:17 thorpej Exp $ */
/*
@@ -324,14 +324,6 @@ struct scsi_mode_header_big {
u_int8_t blk_desc_len[2];
};
-/*
- * Block descriptors are 8 or 16 bytes. scsi_mode_header_big is 8 bytes. But
- * scsi_mode_header is 4 bytes, so if the page data starts at an offset that is
- * a multiple of 8 the header is scsi_mode_header_big.
- */
-#define MODE_HEADER_IS_BIG(hdr, pgdata) \
- (((u_int8_t *)pgdata - (u_int8_t *)hdr) % 8 == 0)
-
struct scsi_mode_sense_buf {
union {
struct scsi_mode_header hdr;
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index 0f1c4af2459..d8dea358476 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.77 2005/06/02 23:49:28 krw Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.78 2005/06/03 15:50:10 krw Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -456,10 +456,10 @@ scsi_mode_sense_big_page(hdr, page_len)
int
scsi_do_mode_sense(sc_link, page, buf, page_data, density, block_count,
- block_size, page_len, flags)
+ block_size, page_len, flags, big)
struct scsi_link *sc_link;
struct scsi_mode_sense_buf *buf;
- int page, page_len, flags;
+ int page, page_len, flags, *big;
u_int32_t *density, *block_size;
u_int64_t *block_count;
void **page_data;
@@ -479,12 +479,16 @@ scsi_do_mode_sense(sc_link, page, buf, page_data, density, block_count,
*block_count = 0;
if (block_size)
*block_size = 0;
+ if (big)
+ *big = 0;
/* Try 10 byte mode sense request. Don't bother with SMS_DBD. */
error = scsi_mode_sense_big(sc_link, 0, page, &buf->headers.hdr_big,
sizeof(*buf), flags, 20000);
hdr_big = &buf->headers.hdr_big;
if (error == 0 && _2btol(hdr_big->data_length) > 0) {
+ if (big)
+ *big = 1;
cbuf += sizeof(struct scsi_mode_header_big);
*page_data = scsi_mode_sense_big_page(hdr_big, page_len);
blk_desc_len = _2btol(hdr_big->blk_desc_len);
diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h
index 5d49c6f3081..3d169a875fc 100644
--- a/sys/scsi/scsiconf.h
+++ b/sys/scsi/scsiconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.h,v 1.56 2005/06/03 15:24:05 krw Exp $ */
+/* $OpenBSD: scsiconf.h,v 1.57 2005/06/03 15:50:10 krw Exp $ */
/* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */
/*
@@ -339,7 +339,7 @@ void * scsi_mode_sense_page(struct scsi_mode_header *, int);
void * scsi_mode_sense_big_page(struct scsi_mode_header_big *, int);
int scsi_do_mode_sense(struct scsi_link *, int,
struct scsi_mode_sense_buf *, void **, u_int32_t *, u_int64_t *,
- u_int32_t *, int, int);
+ u_int32_t *, int, int, int *);
int scsi_mode_select(struct scsi_link *, int, struct scsi_mode_header *,
size_t, int, int);
int scsi_mode_select_big(struct scsi_link *, int,
diff --git a/sys/scsi/sd_atapi.c b/sys/scsi/sd_atapi.c
index a406a5685c1..cdbca3dfd15 100644
--- a/sys/scsi/sd_atapi.c
+++ b/sys/scsi/sd_atapi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd_atapi.c,v 1.8 2005/05/26 02:10:14 krw Exp $ */
+/* $OpenBSD: sd_atapi.c,v 1.9 2005/06/03 15:50:10 krw Exp $ */
/* $NetBSD: sd_atapi.c,v 1.3 1998/08/31 22:28:07 cgd Exp $ */
/*
@@ -121,7 +121,7 @@ sd_atapibus_get_parms(sd, dp, flags)
error = scsi_do_mode_sense(sd->sc_link, ATAPI_FLEX_GEOMETRY_PAGE,
&sense_data, (void **)&sense_pages, NULL, NULL, NULL,
- sizeof(sense_pages->flex_geometry), flags | SCSI_SILENT);
+ sizeof(sense_pages->flex_geometry), flags | SCSI_SILENT, NULL);
if (error == 0 && sense_pages) {
dp->heads = sense_pages->flex_geometry.nheads;
dp->sectors = sense_pages->flex_geometry.ph_sec_tr;
diff --git a/sys/scsi/sd_scsi.c b/sys/scsi/sd_scsi.c
index c1ffd2b4510..b1713a2b8d8 100644
--- a/sys/scsi/sd_scsi.c
+++ b/sys/scsi/sd_scsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd_scsi.c,v 1.13 2005/05/28 06:16:33 krw Exp $ */
+/* $OpenBSD: sd_scsi.c,v 1.14 2005/06/03 15:50:10 krw Exp $ */
/* $NetBSD: sd_scsi.c,v 1.8 1998/10/08 20:21:13 thorpej Exp $ */
/*-
@@ -155,7 +155,7 @@ sd_scsibus_get_parms(sd, dp, flags)
error = scsi_do_mode_sense(sd->sc_link, page = 4, &buf,
(void **)&sense_pages, NULL, NULL, &blksize,
- sizeof(sense_pages->rigid_geometry), flags | SCSI_SILENT);
+ sizeof(sense_pages->rigid_geometry), flags | SCSI_SILENT, NULL);
if (error == 0) {
if (sense_pages) {
SC_DEBUG(sd->sc_link, SDEV_DB3,
@@ -194,7 +194,7 @@ sd_scsibus_get_parms(sd, dp, flags)
error = scsi_do_mode_sense(sd->sc_link, page = 5, &buf,
(void **)&sense_pages, NULL, NULL, &blksize,
- sizeof(sense_pages->flex_geometry), flags | SCSI_SILENT);
+ sizeof(sense_pages->flex_geometry), flags | SCSI_SILENT, NULL);
if (error == 0) {
if (sense_pages) {
dp->heads = sense_pages->flex_geometry.nheads;
@@ -226,7 +226,7 @@ sd_scsibus_get_parms(sd, dp, flags)
error = scsi_do_mode_sense(sd->sc_link, page = 6, &buf,
(void **)&sense_pages, NULL, NULL, &blksize,
- sizeof(sense_pages->reduced_geometry), flags | SCSI_SILENT);
+ sizeof(sense_pages->reduced_geometry), flags | SCSI_SILENT, NULL);
if (error == 0) {
dp->heads = 64;
dp->sectors = 32;