Commit Graph

66 Commits

Author SHA1 Message Date
bouyer e49057af19 Report SPC-2 features (DT clocking, quick arbitration and selection,
information unit transfers) though periph_cap.
2002-04-23 09:09:55 +00:00
bouyer 4940346b10 Add a chan_name to struct scsipi_channel, holding the channel's name.
Set this to dv_xname for scsibus and atapibus.
Set the name of the kernel thread to chan_name instead of controller's
name:channel number (so that we can use this name for controller-specific
threads).
2002-04-01 20:37:41 +00:00
bouyer 4809ad42cb Clean up attach of wd/atapibus:
kill ata_atapi_attach. Change atapibus to use a struct scsipi_channel instead
of ata_atapi_attach as attach arch. Create a ata_device, compatible with
scsipi_channel, to attach wd.
2001-12-02 22:44:32 +00:00
tsutsui 859356d03b Add a new quirk value PQUIRK_CAP_SYNC for SCSI1 devices which support
sync transfers, and set PERIPH_CAP_SYNC for them in scsi_probe_device().
As per discussion on tech-kern.
2001-11-19 22:50:00 +00:00
tsutsui c8f45396b3 Fix formatting of scsi_quirk_patterns[] and wrap long lines. 2001-11-18 17:22:43 +00:00
bouyer a84535fd3e Call ADAPTER_REQ_GROW_RESOURCES from the completion thread, if possible.
This allows HBA drivers to call bus_dmamem_map() safely.
2001-10-14 20:31:24 +00:00
bouyer ce6aaa187a Split channel flags in chan_flags used for communications between
scsipi and HBA, and chan_tflags used for communications between scsipi
and its kernel thread. No functionnal change.
2001-10-14 19:03:43 +00:00
mjacob 79d74959da Restore previous definitions. 2001-09-27 18:07:51 +00:00
fvdl 000902fbf6 Unfortunately, the previous change seems to make most (all?) configurations
using the ahc driver hang when probing scsi devices. The problem may be in
the ahc driver and not in this change, but back it out until this has been
fixed anyway.
2001-09-21 13:54:47 +00:00
mjacob 849eac52f2 Rather than run a periph's queue from scsipi_periph_timed_thaw which is
called via a callout, kick the completion thread to run it for us (uses
a new flag, SCSIPI_CHAN_KICK).

If we've received BUSY status and we haven't started the completion
thread yet, don't freeze do a callout to scsipi_periph_timed_thaw which
then will try and kick the completion thread- instead treat the command
as if it were a polled command and just call delay for 1 second.

If DIAGNOSTIC is defined, and the periph qfreeze count is less than
zero, panic because some HBA has corrupted the periph structure's
accounting.
2001-09-18 20:20:26 +00:00
tsutsui 354cce66e5 Use be16toh(), be32toh(), le16toh() and le32toh() rather than
ntohs(), ntohl() or homegrown bswap() functions.

XXX Does anyone use drives with PQUIRK_LITTLETOC on big endian machines?
2001-09-02 13:11:53 +00:00
augustss 60ffafe273 Add a new quirk, PQUIRK_NOBIGMODESENSE, for devices that need big
SCSI ops, but still fails on big mode sense.
Makes M-Sys DiskOnKey work.
2001-08-31 07:09:41 +00:00
bouyer f2cacede49 Adn scsipi_target_detach() and scsipi_thread_call_callback() as discussed
on tech-kern. scsipi_target_detach() accept wildcard target/lun as requested.
2001-07-18 20:19:24 +00:00
bouyer 90d0e67408 Add a XS_CTL_SILENT_NODEV flag: if the sense info is "not ready, medium
not present" don't print any message but still return ENODEV.
Use this in cd driver to allow open of character raw partition even if
the drive is empty (older drives fails at LOAD_UNLOAD time, newer
ones fail at TEST_UNIT_READY time).
2001-06-26 15:32:02 +00:00
bjh21 4bc5a3b295 Add explicit support for IDE and SCSI adaptors which don't support interrupts.
On such adaptors, all transfers are done in polling mode.

OK'ed by Manuel on tech-kern.
2001-06-13 18:17:38 +00:00
mjacob 3462fe5d99 Remove reference to adapter_q in scsipi structure. Comment about the
usage of channel_q.
2001-05-21 15:50:46 +00:00
bouyer bc980d7eba Use SCSI/ATAPI common definition for MODE_{SELECT,SENSE}{,_BIG}. Define
functions to send theses commands in scsipi_base.c and use them instead
of ad-hoc commands setups.
2001-05-14 20:35:27 +00:00
bouyer 28d47d8db3 Use same type for first field of struct ata_atapi_attach and struct
scsipi_channel, so umass has better chances of working on big-endian systems.
2001-05-02 09:47:45 +00:00
lukem 85772a1cef remove some lint 2001-04-30 02:34:58 +00:00
bouyer 937a7a3ed9 Pull up the thorpej_scsipi branch to main branch.
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
2001-04-25 17:53:04 +00:00
augustss 93b623b541 Extend quirks to 32 bits. Add two new ATAPI quirks, one to
deal with a bad byte5 of the capacity descriptor, one to
handle devices that lack the flex geometry page.
2001-03-20 22:39:08 +00:00
ad 382141e2f7 Add a new, optional method to scsipi_adapter (scsipi_accesschk()), and use
it when considering whether to attach devices. This is to facilitate
`non-SCSI' RAID controller drivers that want to provide SCSI pass-through
services to the kernel.
2000-09-22 16:45:17 +00:00
mjacob b47890a934 Reserve top nibble of status for use by the HBA. It's up to the
HBA to set or clear it.
2000-07-06 01:56:23 +00:00
enami 5a4b9fcbbf Prevent a process being swapped out during I/O if the data buffer is
allocated on stack.  This potential problem is noticed by Noriyuki Soda
and the idea and sample code to fix is given by Jason R. Thorpe.
2000-06-09 08:54:19 +00:00
augustss 72684ce3ec Add a method, scsipi_getgeom, to the adapter struct. If this method is
present it will be used to get the drive geometry if the MODE SENSE fails.
2000-05-31 09:15:48 +00:00
augustss 997c3c5b8a Add a quirk, SDEV_ONLYBIG, which implies that the device cannot handle
the 6 byte versions of READ, WRITE, and MODE_SENSE.
This greatly simplifies the UFI (USB Floppy) handling.
2000-05-30 01:08:23 +00:00
bouyer 405302008d ADEV_CDROM -> SDEV_CDROM, for consistency. 2000-05-29 20:13:06 +00:00
augustss 7797648425 Change the initial field in struct ata_atapi_attach and struct scsipi_link
slightly to allow scsibus and atapibus to attach to the same device.
Furthermore, only attach a scsibus when the bus type is BUS_SCSI.
2000-04-02 17:25:52 +00:00
augustss fc4d9ff403 Get rid of register declarations. 2000-03-30 00:00:55 +00:00
thorpej fc96443d15 New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
  resource allocation.
- Insertion and removal of callouts is constant time, important as
  this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
2000-03-23 07:01:25 +00:00
mjacob 56196ffa4e Nobody said no to adding a pointer to original scsi inquiry data
to the scsibus attach args. Make sure it's nulled for ATAPI. Also,
for scsiconf.c, modify SENA's quirk entry.
2000-01-20 17:10:18 +00:00
bouyer e51ae5d23a Use SCSIPIRETRIES instead of hard-coded value '2' for number of retries in
common routines. Define SCSIPIRETRIES as 4, so that the command will finally
succeed after several consecutive downgrades from UDMA2 to PIO4.
2000-01-17 17:59:48 +00:00
pk 33f192535d <machine/cpu.h> is not needed here. 2000-01-11 15:32:37 +00:00
leo 384bdc532b Implement the DIOCKLABEL ioctl. Through this ioctl it it possible keep the
disklabel on the last close or to drop it.
1999-12-23 21:23:19 +00:00
enami a2369d8e97 Cancel active transfers on aic/wdc detach.
Also makes LS-120 drive works for me again.
1999-10-20 15:22:24 +00:00
thorpej 16a9d90e17 Cleanup the scsipi_xfer flags:
- `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.
1999-09-30 22:57:52 +00:00
thorpej e8dded5513 Implement a function to kill off all commands pending for a given
scsipi_link.
1999-09-11 21:39:53 +00:00
bouyer c2752835f7 Fix a long-standing bug with the ACAP_* flags:
- 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.
1999-04-08 11:29:01 +00:00
bouyer d8f58a3506 Move test for SDEV_NOSTARTUNIT quirk from sd.c to scsipi_start().
Add a SDEV_NOSTARTUNIT quirk entry for BCD-16X 1997-04-25", "", "VER 2.2"
CD-rom (from Michael Santos).
1999-01-19 10:57:11 +00:00
bouyer 85078af6c4 Add a new quirk flags, "ADEV_NOSENSE", for devices that don't
handle properly the request sense command. Add <FX320S, , q01> as being
sense-unfriendly in the quirk table.
1998-12-17 13:05:05 +00:00
thorpej 126dc6bfcc - Remove the "free_list" member from scsipi_xfer. Add "adapter_q" and
"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.
1998-12-08 00:13:58 +00:00
mjacob 4b8245a959 Add a max_lun property to match with the max_target property. Shorten
max_target to int16.
1998-12-05 19:41:31 +00:00
thorpej e87fa217f4 Add support for reference counting and enabling/disabling SCSI and
ATAPI controllers.  This will eventually be used for power management
of e.g. PCMCIA SCSI and IDE controller cards.
1998-11-19 20:08:52 +00:00
bouyer 00d93f776b Rename scsi_interpret_sense() to scsipi_interpret_sense() and move it from
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).
1998-11-17 14:38:42 +00:00
thorpej d153ad6324 Some const poisioning. 1998-10-15 07:06:47 +00:00
thorpej 859b5d88a6 Protect kernel prototypes w/ #ifdef _KERNEL. 1998-10-15 05:11:52 +00:00
thorpej 2ebdceb3f7 Forward decl of struct proc. 1998-10-15 05:10:20 +00:00
bouyer 19fddaeeb5 Merge bouyer-ide 1998-10-12 16:09:10 +00:00
thorpej dda872c16a Define an additional host adapter return code, XS_RESET, indicating
that the bus was reset while the command was pending.  The middle
layer may choose to retry the command.
1998-10-10 00:36:13 +00:00
thorpej 29d472f53d Garbage-collect the open_target_lu and close_target_lu entry points from
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.
1998-10-10 00:28:28 +00:00