From 5a21766d950ac1e7a8ceadd9b718884f4aa216fb Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Sun, 3 Jul 2005 22:31:28 +0000 Subject: 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@ --- sys/dev/ic/ami.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/dev/ic/ami.c') 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 */ -- cgit v1.2.3