LiViD DVD player. (See forthcoming mail to current-users.)
XXX NOTE: We should do something to probe capabilities, rather than allowing
these ioctls on any device.
- `flags' is now gone, replaced with `xs_control' and `xs_status'.
- Massive cleanup of the control flags. Now we explicitly say that
a job is to complete asynchronously, rather than relying on side-effects,
and use a new flag to now that device discovery is being performed.
- Do SCSI device discovery interrupt-driven.
- Take note of magazine changes, and enqueue "Element Status Changed" events
that user processes can read or select on.
- Normalize some structure names.
- Report back more status about changer elements:
* Volume tags (e.g. barcode labels on the backs of your tapes)
* External device names (for drive units in a changer)
* Last element a unit of media was moved from
* Sense information for SCSI changer elements in EXCEPT condition
* Vendor-specific data if the user requests it.
- Add support for setting volume tags.
2 times in the past
- Set up timeout per xfer instead of per interrupt. This helps with
PIO transfer (we would call timeout()/untimout() several times for a
transfer).
- If we missed an interrupt for a PIO transfer, reset and restart it
immedialy, don't try to recover and continue. If we missed an interrupt we
may have lost a read/write cycle on the IDE bus. If this happens 1) we
corrupt data and 2) we enter an interrupt loop at the end of the xfer, as
the drive has some more data to read/write, but the host thinks the xfer is
done.
This last change fix the (or at last some of the) 'lookup after lost interrupt'
some peoples have been experiencing.
Anyway, just because a drive doesn't support the LOAD (to BOT) command does
not mean that the drive doesn't support the UNLOAD command. Also note and
print errors in rewinds and unloads (and errors in writing closing filemarks
for same).
directly, call the function pointer (*if_input)(ifp, m). The input routine
expects the packet header to be at the head of the packet, and will adjust
as necessary. Privatize the layer 2 input and output routines, allowing
*_ifattach() to set them up as appropriate.
By code inspection I found 2 bugs in the ATAPI code, one may be the cause
of your problem: A counter is not reset when issuing the request_sense
command. This is c_skip, the counter used to track the offset in the data
buffer when a data tranfer needs multiple phases. The effect of this is that
the sense data transfered may be stored outside the sense buffer (sense buffer
+ some, potentially several KB, offset). This can only occur in PIO mode,
DMA is not affected.
This doesn't occur in "normal" use because when reading a data CD, either
the sense is issued for a non-data command (in which case c_skip stays to
0), or an error occured and no data has been transfered, and c_skip is still 0.
I can't see a case where a data READ/WRITE could cause a sense tranfer without
error.
The second problem is that b_resid can be set to a false value (resulting of
the sense tranfer and not the data transfer). Again this is not a problem with
usual data tranfers because both values ends up being 0 when no error occurs.
EIO. The spec says ATAPI devices should support "PIO 3 or better".
They are supposed to support less as well. Setting the device to a highter
mode than the controller shoul'nt be a problem, and this is likely what
happens with legaty ISA controllers.
Solve problem reported by Ruey-Shyang Guo.
- the cap field is a u_int8_t, so none of the defined flags would fit in.
Looks like nobody had a drive using 16 bytes commands.
- the ACAP_DRQ_* flags are all wrong. Just remove them and use the definitions
from ata/atareg.h, there's no need to duplicate theses. The effect of this
was that we were always polling for the command phase, even for drives
with interrupt DRQ. This didn't break until the code was changed to support
shared interrupts.
Should fix the lookup problems or 'boot hangs' reported by some users, and
kern/7111.
are called from the interrupt or timeout handler, 0 otherwise.
- use this to know if we can busy-wait for wait_for_unbusy or wait_for_ready
This fixes a bug where CDs withot the DRQ_INTR capability would not busy-wait
for the CMDOUT phase.
While I'm there change 2 delay() to DELAY() for consistency, and
garbage-collect some old code from wdcintr() which has been ifdef'd out
for some time now.
command (unlock for sd and cd) if no other partitions are open, return
EBUSY otherwise. DIOCEJECT will have the old semantic if its argument is not
0. The old ioctl has been renamed to ODIOCEJECT for binary compatibility.
in the drive. restrict "opening of empty drive" to character devices only
(reading a block device returns a short read instead of ENODEV, which can lead
to confusion).
pending_xfers queue.
- When freeing a scsipi_xfer, remove it from the device's pending_xfers
queue. If the queue is empty, and SDEV_WAITDRAIN is set, wakeup
those waiting for the queue to drain.
- Implement scsipi_wait_drain(), which waits for a device's pending_xfers
queue to drain.
"device_q" TAILQ entries. The former is for use by the adapter driver,
as it sees fit. The latter is for the scsipi middle layer to track
pending xfers per device.
- Add a pending_xfers queue to scsipi_link, to track pending xfers per
device.
- Grow scsipi_link's flags to int, and add SDEV_WAITDRAIN, to indicate that
we're waiting for the pending_xfers queue to empty.
FC loops). Change the semantics of scsi_probedev so that it returns 1 if
you should continue probing at this target, else 0 for not.
Replace the blanket use of '7' with the use of the new sc_maxlun property
that is now gathered from HBAs. Allocate scsipi_link arrays based upon this.
Fix a really nasty and silly bug that has been there for a while where the
number of first level scsipi_link structures was one less than it needed
to be.
an array of fixed-sized channel_softc elements. This way IDE controllers
which more than 1 channel (pciide) can extend the channel data easily
for private needs.
To avoid the double dereference at runtime, change the argument of
wdcstart() to the channel data pointer instead of the array index.
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.