Return XS_SENSE when the full sense info has been retrieved, or
XS_SHORTSENSE if only the sense key was available (from the error register)
Make atapi_interpret_sense() deal with this, and call scsipi_interpret_sense()
for XS_SENSE. (XXX sd_interpret_sense() and the ioctl code needs to be made
aware of XS_SHORTSENSE too ! sense hanlding for these is now less broken for
devices that support 'REQUEST SENSE')
All the ATAPI devices I have access to seems to honnor the SENSE_REQUEST
command, but I suspect some ATAPI devices will not (althouh it's mandatory).
The code should be able to deal with this, but is untested ...
scsi_base.c to scsipi_base.c. Rename the functions from scsi_verbose.c
too, and rename the file itself. Cleaup includes too (scsi_*.h should not
be #included in scsipi_*.h files, which are supposed to be
common to atapi and scsi).
in the printing of DMA mode (piix3/4 only)
others: set the debug_mask to 0, so that debug messages are turned off by
default but can be easily turned on.
Reset drive_flags to 0 for unconfigured devices, so that they are ignored
later. For configured devices, reset state to 0 after probe/attach.
Our other constants also use "ATALK".
Added many new ETHERTYPE constants to sys/net/ethertypes.h, including the
ones from libpcap and tcpdump "ethertype.h" files.
Implement ioctl pass-through to the host bus adapter, allowing both
SCBUS* ioctls handled at that level and host adapter-specific ioctls
to be implemented. Implement SCBUSIORESET as a pass-through.
Inspired by PR #6090, from Matt Jacob.
struct scsipi_adapter; they were not used.
Add a scsipi_ioctl entry point to struct scsipi_adapter. This will be
used to issue ioctl commands to the host adapters.
Inspired by PR #6090, from Matt Jacob.
in scsipi_done() if the transfer is asynchronous. This reduces the size
of the critical section in scsipi_execute_xs() somewhat (in fact,
back to its original size).
(probably due to an interrupt) between the time it is scheduled and the
time we get around to setting the SCSI_ASYNCREQ flag, we can lose the xs.
Fix this by checking to see if the transfer has already completed after
the scsi_cmd function returns SUCCESSFULLY_QUEUED, and just return to the
caller if so.
scsipi_xfer structures.
When scsipi_execute_xs() calls the driver's scsi_cmd function, it assumes
that it can still dereference a pointer to the scsipi_xfer struct. Since
scsipi_done() has already been called, which in turn has called
scsipi_free_xs(), the struct has already been returned the structure to
the pool! In other words, xs->flags has been compromised, but we are still
testing it.
These changes resolve the problem by doing the following:
- In scsipi_execute_xs(), if the hardware driver's scsi_cmd function
returns SUCCESSFULLY_QUEUED, set a new flag (SCSI_ASYNCREQ) in xs->flags.
Since the request will be handled asynchronously, we will need the
scsipi_xfer struct to be freed in scsipi_done().
If the hardware driver's scsi_cmd function returns COMPLETE, we now
simply return any actual errors, or 0 if none occurred. (Previously,
we may have returned EJUSTRETURN, of which the sole effect was to
avoid freeing the scsipi_xfer struct in our caller.)
- In scsipi_done(), only free the scsipi_xfer struct for async requests.
The contents of the struct will otherwise remain valid until the
function that initiated the transfer frees it.
With this change, responsibility for freeing the struct now lies in two
places, depending on the type of the request:
- For synchronous requests, the routine calling scsipi_execute_xs()
must clean up.
- For asynchronous requests, scsipi_done() cleans up (as it always has).
[Note: this change also corrects a problem with sddump(): scsipi_done()
was attempting to return a static scsipi_xfer struct to the pool! Since
dumps are performed synchronously, we now handle this correctly.]
This solution was provided by Jason Thorpe, after I got him to look at
some related (but insufficient) attempts of my own.
scsipi_xfer structures.
When scsipi_execute_xs() calls the driver's scsi_cmd function, it assumes
that it can still dereference a pointer to the scsipi_xfer struct. Since
scsipi_done() has already been called, which in turn has called
scsipi_free_xs(), the struct has already been returned to the pool! In
other words, xs->flags has been compromised, but we are still testing it.
These changes resolve the problem by doing the following:
- In scsipi_execute_xs(), if the lower-level driver's scsi_cmd function
returns SUCCESSFULLY_QUEUED and SCSI_NOSLEEP is set in xs->flags, set a
new flag (SCSI_ASYNCREQ). This indicates that scsipi_done() should free
the scsipi_xfer struct.
If the lower-level driver's scsi_cmd function returns SUCCESSFULLY_QUEUED
but SCSI_NOSLEEP is not set, we wait (via tsleep()) for the request to
complete, then fall through to the COMPLETE case.
If the lower-level driver's scsi_cmd function returns COMPLETE, we now
simply return any actual errors, or 0 if none occurred. (Previously,
we may have returned EJUSTRETURN, of which the sole effect was to
avoid freeing the scsipi_xfer struct in our caller. No code seems
to depend on this behavior, however.)
- In scsipi_done(), only free the scsipi_xfer struct for async requests.
The contents of the struct will otherwise remain valid until the
function that initiated the transfer frees it.
With this change, responsibility for freeing the struct now lies in two
places, depending on the type of the request:
- For synchronous requests, the routine calling scsipi_execute_xs()
must clean up.
- For asynchronous requests, scsipi_done() cleans up (as it always has).
[Note: this change also corrects a problem with sddump(): scsipi_done()
was attempting to return a static scsipi_xfer struct to the pool! Since
dumps are performed synchronously, we now handle this correctly.]
This solution was provided by Jason Thorpe, after I got him to look at
some related (but insufficient) attempts of my own.
opened norewind and 2 filemarks are written at the end a phantom file
is left (just what I was afraid of, but I didn't think about it in
the last delta because somehow I had managed to convince myself that
this was a nonissue. It's not.).
So- in stdone clear ST_WRITTEN for regular reads. In st_close, preserve
the state of ST_WRITTEN, and if no error and 2FM@EOD for this device and
this is a no-rewind open, backspace one filemark. This should preserve
(for this mount session) FILE - FMK - FILE - FMK - FILE ... FILE FMK FMK EOD
sequencing.
This doesn't clean up the case of EOM appends- in this case you *will* still
get (after an MTEOM operation and a write of a file) a phantom empty file,
e.g. FILE - FMK FMK - FILE - FMK FMK EOD *unless* you follow the EOM operation
with an explicit backspace. The trouble is that this makes it difficult for
seamless interchange with other systems which don't necessarily follow.
The preferrable alternative would be to eliminate the 2FM@EOD except for
1/2" Reel tapes, but that has been pretty much nixed within developers.
-store printable product ID in cd's and sd's softc, use it as "typename"
-for this, add a "destination buffer length" argument to scsipi_strvis()
-return ATAPI device type for ATAPI devices
filemark 'coz you opened write only and didn't do anything else,
call st_check_eod to possibly write TWO furshlugginer filemarks.
Also- return any errors from writing filemarks out of stclose.
like a no-rewind device. Secondly figure out whether the initial TUR
for a CTRL_MODE open resulted in a tape being actually found (if so,
then do a mount session).
Move the 'sun compatibility' behaviour into stdone && stclose- don't
mark a tape as having been written in stopenm, fer gosh sakes.
Also- to be fair and on review, kern/391 isn't really addressed by
the previous commits. In reviewing, I'm embarassed to find that this
talks about reading at EOT. I'm actually going to claim that this
is 'not a bug' or 'fixed already' in that at the end of media (at the
edge of recorded media), you may continuously open the tape (should
you choose to) issue a read, and zero bytes will transfer- this is a
sufficient EOF indicator.
a now unused variable. Also, remove the restriction against at density
code being greater than the max SCSI 2 density code: 0x80..0xff are the
Vendor Unique codes and most certainly should be allowed. The check for
invalid values should be less than 0 or greater than 255.
Oh- yeah, the previous commit addressed kern/391.
EOM_PENDING. Set up a persistent EARLYWARNING behaviour flag. If
set, EOM behaviour forces a 'short read' to signal logical (as
opposed to physical) end of media. The user application may, of
course, do with this information what it will.
The EARLYWARNING behaviour may be enabled/disabled by a MTIOCTOP
operation. The default action is to not have EARLYWARNING enabled-
but this may be reversed by an option ST_ENABLE_EARLYWARN in
the kernel build.
("CTLMODE") subdevice. There are legitimate uses for raw commands with
normal tape handles too.
[I'm not sure if this is a final solution. Administrators might want
to set up a more finegrained policy. However, this should not be mixed
with the "set defaults" semantics of the "CTLMODE" subdevice; another
flag should be used instead (eg execute permission or a minor number bit).]
data ASC/ASCQ of 0x04/0x01 (logical unit not ready, initialization in progress),
hang out for 5 seconds and return a RETRY THE OPERATION command. If we
get a check condition/sense data ASC/ASCQ of 0x04/0x02 (logical unit not
ready, initialization command required), send a polled/nosleep START UNIT
command and return a RETRY THE OPERATION command if that succeeds.
Don't send a START UNIT to a disk quirked as SDEV_NO_START. Don't send
a START UNIT to removable media. The reason for the latter is to not
just blindly spin up new (maybe changed) media.
I should note that I've successfully made this work with the ISP host
adapter so far. Other host adapters will need some work to be able
to manage or reasonably fail NOSLEEP/POLL commands while in this
state. Alternatively, the internal SCSI midlayer structure has got
to allow for more controlled error recovery (e.g., restart queues
controlled by the target driver).
drivers' sense handlers to return. Coincidentally one of them ends up
being ERESTARTSYS.
2) Add a SCSI_URGENT flag to xs structure- this allows host adapters that
do command tagging to do the right thing wrt a tag.
1) Quirk entries for Storage Tek 9490 (Timberline) and D3 (Redwood)
drives.
2) Modification to st_loadtape to do a REWIND to BOT if the
action is a load and the tape doesn't support the LOAD command
(9490, SD3, and IBM 3590).
3) Cleaned up the 'undersized user record' error message to
make a little more sense.
Various bug fixes:
kern/1275: Now returns values in dsreg and erreg and sets resid
(as best as it can for a 16 but integer). See also
a recent change to mtio.h. We are declining to fix
the portion of this bug about naming a more specific
SCSI device. Since there is nothing programmatic
you can do with that information, it is not useful
to pass back at this time.
A side effect of this change is that doing MTIOCGET
also forces a mode sense (to get the current state
of WRITE PROTECT).
kern/5647: Now no longer logs to the console ILI or Filemark or (first)
EOM (on write) errors (unless SCSIDEBUG is set).
kern/5525: Substantially increased timeouts for a variety of
operations, and split them into categories of
I/O, Space, and Control operations (each have
likely different inherent times). I/O is for
reads/writes. Control is for mode sense/select.
Space is for spacing the tape.
Until EOM handling is changed, though kern/391 is still not fixed. A side
effect of EOM handling is that you now always 'lose' (to the writing
application's view) the last write since EIO is what is returned on
EOM detection during writes. Hopefully the reader applications don't
get too bent out of shape by this.
takes to do IELEM can be proportional to the number of elements, but is
also affected by wierd things like how readable the barcodes on the
media are. There are worst case scenarios I've seen where there are
white labels on the back of tapes with pencilled in labels which is
*just* close enough to being a bar code that an Exabyte 120 would
peer at them myopically and long enough for a *really* long time to
pass in inventorying the jukebox.
I've upped the limit to be proportional to 5 minutes per element. That
is long enough that someone I'm sure will complain about "you wait
to long and should time out" for broken h/w.
As is also noted in the PR, there are a lot of other issues here. It's
really also a question as to whether to update this driver or go
with CAM's driver. This one doesn't have switching between block
descriptors and not, doesn't support volume tag setting, and so on.
Time is limited. This PR should have been closed and fixed right away,
tho.
as with user-land programs, include files are installed by each directory
in the tree that has includes to install. (This allows more flexibility
as to what gets installed, makes 'partial installs' easier, and gives us
more options as to which machines' includes get installed at any given
time.) The old SYS_INCLUDES={symlinks,copies} behaviours are _both_
still supported, though at least one bug in the 'symlinks' case is
fixed by this change. Include files can't be build before installation,
so directories that have includes as targets (e.g. dev/pci) have to move
those targets into a different Makefile.
operation with address 0 length 0, which, according to the SCSI-2 spec, should
be interpreted as "synchronize all remaining blocks beginning at address 0".