All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pat LaVarre <p.lavarre@ieee.org>
To: stern@rowland.harvard.edu
Cc: ronald@kuetemeier.com, patmans@us.ibm.com,
	linux-scsi@vger.kernel.org, usb-storage@one-eyed-alien.net
Subject: Re: [PATCH] SCSI: limit mode sense usage
Date: 28 Oct 2003 15:54:23 -0700	[thread overview]
Message-ID: <1067381663.11029.16.camel@patehci2> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0310281724430.6912-100000@ida.rowland.org>

> Pat, I think maybe you're misunderstanding the reason behind this thread.  
> The device in question wasn't failing the MODE-SENSE(10) for page x08 
> (determine cache-type); it was failing the MODE-SENSE(10) for page x3F 
> (where only the first 4 bytes are read to determine write-enable).

That much I knew, thanks for finding the time to nak me.

> The code that does this is in 
> drivers/scsi/sd.c:sd_read_write_protect_flag().

Great link, thanks.  There now in -test9 I think I see:

We guess writable if need be, but we prefer to settle for:

sdkp->write_prot = ((data.device_specific & 0x80) != 0);

after the first command that works in the sequence:

sd_do_mode_sense(..., 0x3F, ..., 4, ...);
sd_do_mode_sense(..., 0, buffer, 4, ...);
sd_do_mode_sense(..., 0x3F, buffer, 255, ...);

I mean to suggest, ahead of these more creative (i.e. less friendly)
alternatives, in order to fetch that bit of header, we try a command
that more closely resembles the commands of the Talk Like Windows set,
e.g.:

sd_do_mode_sense(..., 0x08, ..., 4, ...);

I'm pleased to think I see sd.c sd_do_mode_sense via scsi_lib.c
__scsi_mode_sense will round up our header-only length of 4 to 8 when
using op x5A MODE_SENSE_10 rather than op x1A MODE_SENSE.

Furthermore, I believe we'd work better still if we fit our first try
completely into the Talk Like Windows command set.  My first glance at
__scsi_mode_sense says we don't reliably produce completely equivalent
op x5A MODE_SENSE_10 vs. op x1A MODE_SENSE.  This behaviour I recognise
from other hosts.

Me, I think the equivalent mode sense near here are:

-y "1A 00:08:00 18 00" -i x18 // x18 = 4 header + 8 block desc + xC page
-y "5A 00 08:00:00:00 00 00:1C 00" -i x1C // x1C = 8 header + ...

But I think if we try:

sd_do_mode_sense(..., 0x08, ..., 0x18, ...);

instead we get the inconsistent pair:

-y "1A 00:08:00 18 00" -i x18
-y "5A 00 08:00:00:00 00 00:18 00" -i x18 // four short of x1C wanted

And I think if we try:

sd_do_mode_sense(..., 0x08, ..., 0x1C, ...);

instead we get the inconsistent pair:

-y "1A 00:08:00 1C 00" -i x1C // four beyond of x18 wanted
-y "5A 00 08:00:00:00 00 00:1C 00" -i x1C

> ...

Am I yet more clear than mud?

Thank you for your patience.

Pat LaVarre



  reply	other threads:[~2003-10-28 22:54 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1067293080.1075.8.camel@ronald.kuetemeier.com>
     [not found] ` <20031027145531.A2130@beaverton.ibm.com>
2003-10-28  3:51   ` [PATCH] SCSI: limit mode sense usage Ronald Kuetemeier
2003-10-28 15:03     ` [usb-storage] " Alan Stern
2003-10-28 15:16       ` Patrick Mansfield
2003-10-28 15:40         ` Alan Stern
2003-10-28 15:55           ` Ronald Kuetemeier
2003-10-28 16:15           ` Ronald Kuetemeier
2003-10-28 19:17             ` Alan Stern
2003-10-28 19:55               ` Ronald Kuetemeier
2003-10-28 20:29                 ` Alan Stern
2003-10-28 21:33                   ` Ronald Kuetemeier
2003-10-28 22:49                     ` Alan Stern
2003-10-28 23:37                       ` Pat LaVarre
2003-10-29  1:51                       ` Patrick Mansfield
2003-10-29  2:16                         ` Ronald Kuetemeier
2003-10-29  7:27                           ` Patrick Mansfield
2003-10-29  7:21                         ` Patrick Mansfield
2003-10-29 15:16                           ` Alan Stern
2003-10-29 16:04                             ` Ronald Kuetemeier
2003-10-29 15:09                         ` Alan Stern
2003-10-29 15:53                           ` Ronald Kuetemeier
2003-10-29 16:30                             ` Patrick Mansfield
2003-10-28 15:42         ` Ronald Kuetemeier
2003-10-29 16:46           ` [PATCH/RFT] check non-scsi part of status in scsi_status_is_good Patrick Mansfield
2003-10-29 17:53             ` Ronald Kuetemeier
2003-10-29 23:16               ` Patrick Mansfield
2003-10-30 15:11                 ` Alan Stern
2003-10-30 16:35                   ` Pat LaVarre
2003-10-30 17:18                     ` Patrick Mansfield
2003-10-30 17:38                       ` Pat LaVarre
2003-10-30 18:05                         ` [PATCH/RFT] mode sense madness always use page 8 Patrick Mansfield
2003-10-30 18:14                           ` Ronald Kuetemeier
2003-10-30 18:25                             ` Patrick Mansfield
2003-10-30 18:15                           ` Pat LaVarre
2003-10-30 18:56                           ` Alan Stern
2003-10-30 19:06                             ` Pat LaVarre
2003-10-30 20:00                               ` Alan Stern
2003-10-31 20:47                                 ` Pat LaVarre
2003-10-30 19:26                             ` Patrick Mansfield
2003-10-31 20:38                               ` Pat LaVarre
2003-11-03 21:40                                 ` Pat LaVarre
2003-10-30 19:25                           ` Ronald Kuetemeier
2003-10-30 19:39                             ` Pat LaVarre
2003-10-30 21:48                             ` Patrick Mansfield
2003-10-30 21:58                               ` Ronald Kuetemeier
2003-10-30 23:59                                 ` Pat LaVarre
2003-10-31 18:16                                   ` Patrick Mansfield
2003-10-31 23:11                                     ` Pat LaVarre
2003-11-06 23:11                                     ` Douglas Gilbert
2003-11-07 16:13                                       ` Pat LaVarre
2003-10-28 15:38       ` [PATCH] SCSI: limit mode sense usage Pat LaVarre
2003-10-28 20:56         ` Pat LaVarre
2003-10-28 22:28           ` Alan Stern
2003-10-28 22:54             ` Pat LaVarre [this message]
2003-10-29 14:49               ` Alan Stern
2003-10-29 15:43                 ` Pat LaVarre
2003-10-28 20:59 Pat LaVarre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1067381663.11029.16.camel@patehci2 \
    --to=p.lavarre@ieee.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=patmans@us.ibm.com \
    --cc=ronald@kuetemeier.com \
    --cc=stern@rowland.harvard.edu \
    --cc=usb-storage@one-eyed-alien.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.