summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2005-07-03 22:31:28 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2005-07-03 22:31:28 +0000
commit5a21766d950ac1e7a8ceadd9b718884f4aa216fb (patch)
treeb4e6194b0c989672ccbc9125816af783626477c1 /sys/dev/ic
parent02b72cb30eea964619de3317ace902ac0963a24a (diff)
Fix data_length values in simulationed MODE SENSE page 4 responses so
that scsi_do_mode_sense() accepts them. The data_length value does not include itself, and the pg_length value in a mode page does not include itself or the page_code fields. We were +1 on the former and -2 on the latter resulting in a data_length value that was too small by one. Eliminates 'mode sense page 5 not simulated' messages. ok marco@
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/aac.c7
-rw-r--r--sys/dev/ic/ami.c7
-rw-r--r--sys/dev/ic/cac.c7
-rw-r--r--sys/dev/ic/gdt_common.c7
-rw-r--r--sys/dev/ic/twe.c7
5 files changed, 20 insertions, 15 deletions
diff --git a/sys/dev/ic/aac.c b/sys/dev/ic/aac.c
index d5f83b5b54c..27b1b644ac9 100644
--- a/sys/dev/ic/aac.c
+++ b/sys/dev/ic/aac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aac.c,v 1.20 2005/05/26 23:53:14 martin Exp $ */
+/* $OpenBSD: aac.c,v 1.21 2005/07/03 22:31:27 krw Exp $ */
/*-
* Copyright (c) 2000 Michael Smith
@@ -868,8 +868,9 @@ aac_internal_cache_cmd(xs)
case 4:
/* scsi_disk.h says this should be 0x16 */
mpd.dp.rigid_geometry.pg_length = 0x16;
- mpd.hd.data_length = sizeof mpd.hd + sizeof mpd.bd +
- mpd.dp.rigid_geometry.pg_length;
+ mpd.hd.data_length = sizeof mpd.hd -
+ sizeof mpd.hd.data_length + sizeof mpd.bd +
+ sizeof mpd.dp.rigid_geometry;
mpd.hd.blk_desc_len = sizeof mpd.bd;
/* XXX */
diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c
index b7abfbeacce..f93c91e0c44 100644
--- a/sys/dev/ic/ami.c
+++ b/sys/dev/ic/ami.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ami.c,v 1.45 2005/06/28 18:33:11 marco Exp $ */
+/* $OpenBSD: ami.c,v 1.46 2005/07/03 22:31:27 krw Exp $ */
/*
* Copyright (c) 2001 Michael Shalayeff
@@ -1476,8 +1476,9 @@ ami_scsi_cmd(xs)
case 4:
/* scsi_disk.h says this should be 0x16 */
mpd.dp.rigid_geometry.pg_length = 0x16;
- mpd.hd.data_length = sizeof mpd.hd + sizeof mpd.bd +
- mpd.dp.rigid_geometry.pg_length;
+ mpd.hd.data_length = sizeof mpd.hd -
+ sizeof mpd.hd.data_length + sizeof mpd.bd +
+ sizeof mpd.dp.rigid_geometry;
mpd.hd.blk_desc_len = sizeof mpd.bd;
mpd.hd.dev_spec = 0; /* writeprotect ? XXX */
diff --git a/sys/dev/ic/cac.c b/sys/dev/ic/cac.c
index dd5948d92d9..8f62ca6e133 100644
--- a/sys/dev/ic/cac.c
+++ b/sys/dev/ic/cac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cac.c,v 1.18 2004/05/04 16:59:31 grange Exp $ */
+/* $OpenBSD: cac.c,v 1.19 2005/07/03 22:31:27 krw Exp $ */
/* $NetBSD: cac.c,v 1.15 2000/11/08 19:20:35 ad Exp $ */
/*
@@ -634,8 +634,9 @@ cac_scsi_cmd(xs)
case 4:
/* scsi_disk.h says this should be 0x16 */
mpd.dp.rigid_geometry.pg_length = 0x16;
- mpd.hd.data_length = sizeof mpd.hd + sizeof mpd.bd +
- mpd.dp.rigid_geometry.pg_length;
+ mpd.hd.data_length = sizeof mpd.hd -
+ sizeof mpd.hd.data_length + sizeof mpd.bd +
+ sizeof mpd.dp.rigid_geometry;
mpd.hd.blk_desc_len = sizeof mpd.bd;
/* XXX */
diff --git a/sys/dev/ic/gdt_common.c b/sys/dev/ic/gdt_common.c
index 8e1631b5c25..ea4e81c3170 100644
--- a/sys/dev/ic/gdt_common.c
+++ b/sys/dev/ic/gdt_common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gdt_common.c,v 1.28 2004/04/12 05:33:04 deraadt Exp $ */
+/* $OpenBSD: gdt_common.c,v 1.29 2005/07/03 22:31:27 krw Exp $ */
/*
* Copyright (c) 1999, 2000, 2003 Niklas Hallqvist. All rights reserved.
@@ -910,8 +910,9 @@ gdt_internal_cache_cmd(xs)
case 4:
/* scsi_disk.h says this should be 0x16 */
mpd.dp.rigid_geometry.pg_length = 0x16;
- mpd.hd.data_length = sizeof mpd.hd + sizeof mpd.bd +
- mpd.dp.rigid_geometry.pg_length;
+ mpd.hd.data_length = sizeof mpd.hd -
+ sizeof mpd.hd.data_length + sizeof mpd.bd +
+ sizeof mpd.dp.rigid_geometry;
mpd.hd.blk_desc_len = sizeof mpd.bd;
/* XXX */
diff --git a/sys/dev/ic/twe.c b/sys/dev/ic/twe.c
index 07eac0fb784..6ae6c8a1748 100644
--- a/sys/dev/ic/twe.c
+++ b/sys/dev/ic/twe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: twe.c,v 1.22 2003/08/06 21:08:06 millert Exp $ */
+/* $OpenBSD: twe.c,v 1.23 2005/07/03 22:31:27 krw Exp $ */
/*
* Copyright (c) 2000-2002 Michael Shalayeff. All rights reserved.
@@ -860,8 +860,9 @@ twe_scsi_cmd(xs)
case 4:
/* scsi_disk.h says this should be 0x16 */
mpd.dp.rigid_geometry.pg_length = 0x16;
- mpd.hd.data_length = sizeof mpd.hd + sizeof mpd.bd +
- mpd.dp.rigid_geometry.pg_length;
+ mpd.hd.data_length = sizeof mpd.hd -
+ sizeof mpd.hd.data_length + sizeof mpd.bd +
+ sizeof mpd.dp.rigid_geometry;
mpd.hd.blk_desc_len = sizeof mpd.bd;
/* XXX */