calling scsipi_make_xs() and scsipi_execute_xs(), instead push these into
scsipi_command. Make bustype_cmd and PHOLD/PRELE be called from
scsipi_execute_xs(). This allows us to create a xfer structure -- possibly on
the stack -- and call scsipi_execute_xs() directly.
scsipi_done() from their scsipi_request().
For this, add a struct scsipi_xfer * argument to scsipi_command().
If not NULL scsipi_command() will use this to enqueue this xfer, otherwise
it'll try to allocate a new one. This scsipi_xfer has to be allocated
and initialised by scsipi_make_xs() or equivalent.
In xxstart(), allocate a scsipi_xfer using scsipi_make_xs(), and if not NULL,
dequeue the buffer before calling scsipi_command(). This makes sure that
scsipi_command() will not fail, and also makes sure that xxstart() won't
be called again between the BUFQ_PEEK() and BUFQ_GET().
Fix "dequeued wrong buf" panics reported by Juergen Hannken-Illjes in
private mail and Andreas Wrede on current-users@.
Thanks to Jason Thorpe and Chuck Silver for review, and Andreas Wrede for
testing the patch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.
Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
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.
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).
- Indent with tab of width 8.
- Use four column to indent continuation line.
- Fold long line if possible.
- Use return (xx) instead of return xx.
- Compare pointer against NULL instead of testing like boolean.
- Delete whitespace at the end of line.
- Delete whitespace in front of function call operator.
- Delete whitespace after cast.
- Dereference a pointer to function explicitly.
- Add an empty line after local variable declaration.
- Use NULL instead of (char *)0.
- Dont use block for single statement.
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
is called *after* the driver `done' routine. This fixes disk I/O statistics
on SCSI devices.
Also, calling the `done' routine with a `complete' argument of 0 and actually
having it do anything meaningful loses in at least 3 ways, so just nuke the
argument altogether and don't call it this way. If the driver needs to do
some error handling, that's what `err_handler' is for.
host adapter drivers, indicating the highest SCSI target they can
address. Use this value to dynamically allocate data structures, rather
than hard-coding 8 targets.
These changes allow targets > 7 to be addressed on wide SCSI busses.
Fixes PRs #1674 and #2892.
management by itself. But when it gets a start unit request, it keeps
the floppy motor running all the time. This adds code for dealing with
yet another quirk (SDEV_NOSTARTUNIT) that prevents sd.c from sending
start unit requests. A entry for the Teac FC-1 is added to the quirk
table.
if the version is <= SCSI-2. This should help some older SCSI
devices that previously needed the "NOLUNS" quirk. While this is
not strictly necessary on SCSI-2 devices, the spec allows it,
so we set it for SCSI-2 devices "just in case". See section 7.2.2 of
Draft X3T9.2 Rev 10L for details.
(2) in scsibusmatch, match channel as appropriate.
(3) add a scsiprint() function, to do the "scsibus at..."
and channel (if not SCSI_CHANNEL_ONLY_ONE) printing,
i.e. the common functionality that all SCSI drivers currently
should be doing.
- controller calls scsi_done() with error XS_TIMEOUT
- scsi_done() calls sddone()
- sddone() calls disk_unbusy()
- scsi_done() calls controller to retry command (missing the
call to disk_busy())
- controller calls scsi_done()
- scsi_done() calls sddone()
- sddone() calls disk_busy(), which panics because of the imbalance.
Bug noticed by Leo Weppleman, who also suggested this fix; pass an additional
boolean argument ("complete") to the device's "done" routine, with a
value of `0' passed from the previous call to "done", and add an additional
call to "done" when the xfer resources are freed.