Commit Graph

819 Commits

Author SHA1 Message Date
ad 5df1120c67 Add some more completion status codes. 2000-10-05 11:23:05 +00:00
thorpej 7ca3fb9ef0 Move the check for "promisc + unicast + not for us" into ether_input(),
and change Ethernet drivers to always pass all received frames to
ether_input() (with a few exceptions, which are documented in the
code).
2000-10-01 23:32:39 +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
matt b0c9fcd14a Add a NOPREVENT quirk which prevents the sending of PREVENT messages (some
manual 9track tapes don't support it).  Add a quirk entry for the NCR H621
9track tape drive.
2000-08-16 19:22:25 +00:00
mjacob 927f61818e Add "SYMBIOS" processor type to the SDEV_NOLUN category. These are usually
the GEM chips on a Sun D1000- and they cause Qlogic SBus firmware to blow
chunks if you access past lun 0.
2000-08-13 00:03:01 +00:00
mjacob 9766fcf2be Don't attempt to actually read SAF-TE temperature objects- nobody seems
to be obeying the original spec as to what the numeric value means.

Temperature flags are unaffected- these are still the 'pseudo-thermometers'
and overtemp/undertemp warnings will be caught and translated to SES objects
here.
2000-08-08 22:55:30 +00:00
mjacob 295864adef During probe, use SCBUSACCEL ioctl to adapters that support it to
enable fast/wide/tagged.
2000-08-08 22:46:03 +00:00
bouyer 8464bde7e8 If the SET_FEATURE for piomode is rejected, fallback to mode 0 instead of
reporting an error.
This fixes the "piomode error (0x4)" problem with some ATAPI ZIP drives
reported on port-i386.
2000-08-03 23:14:31 +00:00
bouyer 1b00421876 Add quirk entry for NEDICOM CRD-BP2, from kern/10738. 2000-08-03 12:36:08 +00:00
sommerfeld ed9ce99d8c printf format paranoia 2000-07-08 17:12:08 +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
thorpej cde72a2c2b Garbage-collect __BDEVSW_DUMP_OLD_TYPE. 2000-07-05 23:31:12 +00:00
mrg 261538ecac remove include of <vm/vm.h> 2000-06-28 16:39:25 +00:00
mrg 666116dd21 <vm/vm.h> -> <uvm/uvm_extern.h> 2000-06-28 16:38:37 +00:00
bouyer 12d3bf8c1a Add a callback (*irqack), for controllers that need special action to ack
the interrupt once it has been ack'd on the drive.
2000-06-12 21:10:40 +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
soren cd4324537d Density codes are usually given in decimal, so print them that way. 2000-06-06 17:16:02 +00:00
phil d09ecbdf2a Add an entry for the HP ScanJet 6300C. 2000-05-31 23:10:39 +00:00
fvdl c0f99cc74a Initialize xs_status to 0 after allocating a scsipi_xfer struct. Makes life
easier for driver debugging.
2000-05-31 11:14:25 +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 6b0b8292ff Add NOMODESENSE quirk for TEAC USB floppy. 2000-05-30 15:16:41 +00:00
augustss 61143a446c Add NOMODESENSE quirk for Y-E data floppy (thanks Jason for reminding me). 2000-05-30 01:49:19 +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
gmcgarry 4ba1e04ba2 Handle ADEV_CDROM in quirks table.
Quirk entry for another Toshiba cdrom.
2000-05-28 07:03:59 +00:00
fvdl cb5289547f At least try to do something useful in the XS_BUSY case; don't cause
a panic by sleeping in an interrupt context.
2000-05-27 23:59:58 +00:00
bouyer e662e86225 sd_interpret_sense() can be called from interrupt context; call scsipi_start()
with XS_CTL_ASYNC if the failed command was called with XS_CTL_ASYNC.
Add a SDF_RESTART flag to keep state, cleared in sddone().
A mounted disk can now spin down, it will propely spin up at the next access.
2000-05-23 10:20:14 +00:00
bouyer 373582e298 scsipi_get_xs(): if we have XS_CTL_URGENT, return an xfer even if
active >= openings. An XS_CTL_URGENT command could otherwise fail, especially
if openings == 1.
2000-05-23 10:16:43 +00:00
thorpej f5d4219e96 Remove an used variable and add a missing `}' so that this compiles. 2000-05-22 16:52:03 +00:00
kleink 5f56eae96a Add a quirk table entry for the OnStream ADR50 Drive;
from S.P.Zeidler <spz@serpens.swb.de> in kern/10118.
2000-05-19 06:55:42 +00:00
thorpej 463931b3ba Nuke dk_establish() from orbit except from those ports which still use
it to determine the boot device: mvme68k, pc532, macppc, ofppc.  Those
platforms should be changed to use device_register().  In the mean time,
those ports defined __BROKEN_DK_ESTABLISH.
2000-05-16 05:45:44 +00:00
dante ceb378e070 Add few peripheral device type
Remove "???" from T_IT8_1/2. They actually are pre-press devices for graphic arts as described by ASC IT8
Zeros and blanks scsipi_inquiry_data from byte 58 to byte 74 if additional_length is less than 58
2000-05-15 16:35:49 +00:00
bouyer 7e71ffde06 Sync copyrigth notice 2000-05-15 08:48:25 +00:00
dante e852afa89f Fix a typo 2000-05-14 19:52:34 +00:00
dante f65d97bb57 Change scsipi_inquiry_data strucure to be ANSI SPC-2 rev16 compliant 2000-05-14 18:20:11 +00:00
enami a2bf544200 Allocate the variable `inqbuf' in scsi_probedev on stack rather than
statically.  Since this function may called for another luns immediately,
allocating it statically doesn't make sense and may cause race condition
as pointed out by PR#9749.
2000-04-19 04:49:50 +00:00
enami c560e9a77b When killing pending xfers on device detach, we can't expect scsipi_done
to remove all xfers from the pending queue.  It removes only xfers for
asynchronous transactions.  So, simply loop over all pending xfers
with calling scsipi_done and wait xfers to drain.  Addresses PR#9703.
2000-04-03 03:37:33 +00:00
enami ae8fb348b3 Fold long line. 2000-04-03 01:40:51 +00:00
augustss b6cee95eb7 Let the device thet gets an atapibus attached specify how to kill pending
transfers by giving a function pointer.
The old method always called wdc specific code.
2000-04-02 23:38:19 +00:00
augustss 7246364f07 With SCSIVERBOSE, only print sense data if there actually is a problem. 2000-04-02 17:58:17 +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
enami 28d49dce4e Add missing protect from disk interrupt while calling scsipi_free_xs. 2000-04-02 03:05:55 +00:00
bouyer 26f6c9a9cf - DMA code cleanup: pciide_dma_finish() doesn't stop/unload the current DMA op
if an IRQ was not detected, unless the force flag was given. Use this to
  detect if the IRQ was for us (closer to shared IRQ for controllers which
  don't have their own IRQ handler in pciide.c) and to poll for DMA xfer.
  Also makes the timeout recovery code simpler.
- ATAPI cleanup: don't call controller-specific functions from atapiconf.c
  (wdc_*), so that it's possible to attach an atapibus to something else
  than a wdc/pciide (Hi Lennart :).
  Overload struct scsi_adapter with struct atapi_adapter, defined
  as struct scsi_adapter + atapi-specific callbacks. scsipi_link still points
  to an scsi_adapter, atapi code casts it to atapi_adapter if needed.
  Move atapi_softc to atapiconf.h so that it can be used by the underlying
  controller code (e.g. atapi_wdc.c).
  Add an atapi-specific callback *atapi_probedev(), which probe a drive
  in a controller-specific way, allocate the sc_link and fills in the
  ataparams if needed. It then calls atapi_probedev() (from atapiconf.c)
  to do the generic initialisations and attach the device.
- While I'm there merge and centralise the state definitions in atavar.h.
  It should now be possible to use a common ata/atapi routine to set the
  drive's modes (will do later).
2000-04-01 14:32:22 +00:00
augustss fc4d9ff403 Get rid of register declarations. 2000-03-30 00:00:55 +00:00
augustss 356d681927 Add ukactivate&ukdetach so uk devices can be detached. 2000-03-29 18:11:44 +00:00
simonb 9ff7681a33 Don't need to include <sys/conf.h> here. 2000-03-29 03:43:31 +00:00
augustss fc39329153 Change a printf() to a panic() since the kernel is going to die on the next
line anyway.
2000-03-28 17:24:46 +00:00
augustss 439812ba3b In attach message, spell it "target" not "targ", as in the locator. 2000-03-27 11:45:42 +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
enami 68e028fe82 Cancel requested command if controller isn't active. 2000-03-20 22:57:00 +00:00
sjg 281c45ba53 Added NOLUNS quirk for YAMAHA CRW8424S 2000-03-19 10:33:26 +00:00
soren 11bd453515 scsiprint() is needed even without scsibus'es, so move it to scsi_base.c . 2000-03-17 11:45:49 +00:00
soren 82ad0bf745 atapiprint() does not exist. 2000-03-17 11:23:23 +00:00
fvdl d025f5705e Add a couple of defines/aliases for messages. 2000-03-15 02:02:37 +00:00
soren 95054da1a1 Fix doubled 'the's in comments. 2000-03-13 23:52:25 +00:00
martin 112137cd30 Added Artec/Ultima A6000C scanner to the quirks table (no LUNs). 2000-03-13 09:56:26 +00:00
augustss ce6f0100c1 Remove extra \n in attach message. 2000-03-12 19:16:48 +00:00
thorpej d788e0dbad Make sure to initialize xs->req_sense_length (to 0). This appears to be
a historical leftover, and very few drivers actually look at it.  But the
PCI `ncr' driver does, and if this field is not initialized to its default
value, that driver will fall over flat on its face when it attempts to get
sense data from a target.
2000-02-28 17:44:20 +00:00
jdolecek 86ae2ab1fc Add ADEV_NOSENSE quirk for HITACHI CDR-7730.
Patch sent by Hume Smith in kern/9489.
2000-02-28 09:46:25 +00:00
tls 08ef0cfe07 revert previous change 2000-02-22 21:09:50 +00:00
mjacob 64fa8aa0d6 remove SES driver 2000-02-22 17:43:57 +00:00
mjacob 296fbeed2a Patches from msouth@scruz.net to handle QIC 3220 (HP T20). 2000-02-21 05:11:09 +00:00
mjacob a3a129e6f5 Oops...I forgot that the GEM-2 chip is so lame that if you don't tell
it exactly the right amount of data to transfer for WRITE BUFFER/Global
it will stay stuck in command phase (causing a command phase overrun).
2000-02-20 21:30:44 +00:00
mjacob 1c4521f1da add ses.h to list of includes 2000-02-20 07:39:41 +00:00
mjacob c5f8d33f85 minor spelling change 2000-02-20 07:38:48 +00:00
thorpej fe551f0e64 Fix a bug in disksort_*() which caused non-optimal ordering when multiple
active partitions were on a single spindle.  Add a b_rawblkno member to
struct buf which contains the non-partition-relative block number to sort
by.
2000-02-07 20:16:47 +00:00
drochner e81d123f6d try to dtrt for sector sizes <DEV_BSIZE (at least, don't divide by 0) 2000-01-25 20:42:33 +00:00
drochner 05261ccb43 include "rnd.h" explicitely since the size of sd_softc depends on it
(sd_scsi.c and sd_atapi.c missed it, leading to random memory corruption)
2000-01-22 16:35:25 +00:00
mjacob 91c88eb52f PR/9271 (from srp@zgi.com)- recognize (indirectly) HP4000s via density
code and do the right QIC type dance (1 FM @EOT, fixed block size).
2000-01-22 04:29:58 +00:00
thorpej dc59bc1db3 Update for sys/buf.h/disksort_*() changes. 2000-01-21 23:39:55 +00:00
mjacob 04b750733c slight change for platform independence 2000-01-21 21:19:57 +00:00
mjacob 7faf9d32ea cleanup SAF-TE attachment code 2000-01-21 21:10:41 +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
mjacob 3bcc285367 add SES driver 2000-01-20 17:07:41 +00:00
mjacob a8f0034523 add SES device 2000-01-20 16:07:43 +00:00
abs 3a63eeee63 newline terminate ss: atatch message - from Roger Brooks 2000-01-19 01:00:07 +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
abs 0f75dd5dc4 allow ioctl() on all scanner device nodes - now SANE can work with ss* driver 2000-01-17 11:25:31 +00:00
bouyer 638e1a6958 Improve the downgrade logic:
- If UDMA 2 is failing try UDMA 1 first, it helps in some cases
- downgrade if we get an error in the first 4000 xfers, or if we get
  4 errors in 4000 xfers if the first 4000 went without troubles.

While I'm there commit a local change I have since some time to get my CD
probed: issue a "blanck" IDENTIFY before the one used to detect slave ghosts,
with my drive the first IDENTIFY following a controller reset fails with an
aborted command ...
2000-01-17 00:01:00 +00:00
mjacob 4cb8fbf10d Print out the contents of an otherwise unreported undecodable
sense data buffer. This helps catch adapter breakage mostly.
2000-01-14 02:40:45 +00:00
nisimura 1775fae985 Add tweaks for TEAC compact cassette tape drive. 2000-01-13 00:18:27 +00:00
mjacob 34721cbe92 Check in the implementation of the ST_MOUNT_DELAY option.
This is an attempt to allow people to change the default configuration
to try harder at 'mounting' a tape. This allows you to specify, in
seconds, the amount of time a non-control unit open will retry
(once per second) the scsipi_test_unit_ready when it tries to mount
the tape. It also turns off the over-verbose error reporting at
this time unless SCSIDEBUG is set.

The reason this is not enabled as a default is that it's a large change
of behaviour. I find it useful to 'try harder' at mounting a tape in
the tape driver, particularly when loaded via a media changer device
rather than specifying the delays in the backup program.
2000-01-12 14:46:43 +00:00
pk 33f192535d <machine/cpu.h> is not needed here. 2000-01-11 15:32:37 +00:00
mjacob 4783eac2b8 add ST_MOUNT_DELAY options for st 2000-01-06 18:28:28 +00:00
mjacob 182c6629c1 oops, bad patch 2000-01-04 22:47:12 +00:00
mjacob c763ef5b5d - If the user application issues an INITIALIZE ELEMENT STATUS which
succeeds, note that we now are valid.

- Don't attempt to try and run initialize element status from interrupt level-
  we don't really support that yet. Also, key more correctly off of ASC/ASCQ
  instead of just the sense key.

- Make the practice of doing an INITIALIZE ELEMENT STATUS automatically when
  we get params (from chopen time even) a policy decision that is not the
  default for now- this can be a dangerous practice as well as time consuming.
  It's dangerous in that you can have a hung open when all you really want
  to do is do a read of parameters- and parameters, including slot status,
  are perfectly fine to read even before an INITIALIZE ELEMENT STATUS is
  done- all the elements whos status your read are going to be marked with
  an exception- so leave it up to the application to decide how important
  this is.
2000-01-04 22:35:57 +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
soren b202ac1466 Allow SCSI_DELAY to be shorter than 2 seconds. 1999-11-14 18:06:09 +00:00
matthias b45486b2a2 Make this work again by adding XS_CTL_ASYNC to the SCSI requests in
se_ifstart and se_recv.
1999-11-13 18:03:34 +00:00
bouyer fb8b192c0a Pass xfer->c_bcount instead of sc_xfer->datalen to the device, so that
it gets the rigth len for a request sense (from OpenBSD).
1999-11-04 21:16:53 +00:00
matt 31ba134e32 use __vax__ and __i386__ instead of vax and i386 1999-11-03 20:50:17 +00:00
mycroft 8efdaab402 Fix the size of start_sector, end_sector and end_sector_l0. (I'm just going to
assume the Linux people will also fix this, since I reported it to them.)
1999-10-31 14:03:16 +00:00
bouyer 98b5a519ce In sddump(), check sd->sc_dev.dv_flags once sd has been initialised.
Patch supplied by tsutsui@ceres.dti.ne.jp in kern/8708.
1999-10-30 16:35:12 +00:00
mycroft e45ef6abcd Emulate the Linux DVD_* ioctls(2). This gets us 90% of the way to running the
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.
1999-10-29 15:02:56 +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
ragge 2674b15280 Don't call dk_establish() on vax either. 1999-10-17 09:44:48 +00:00
enami 46f1868fe7 Cosmetic changes. 1999-10-17 06:22:05 +00:00
enami de4b3a819a ENODEV is not a value supposed to be assigned to xs->error. Use
XS_DRIVER_STUFFUP instead.
1999-10-17 06:13:01 +00:00
hwr d5103deed3 Add ad quirk for CDU-561 CD-ROM. From PR kern/8608
by SUNAGAWA Keiki <kei_sun@ba2.so-net.ne.jp>.
1999-10-11 15:28:57 +00:00
hwr eed9db126b Add a quirk to recognize a Toshiba XM-3401TA SCSI CD-ROM as
removable SCSI device. From Matthew Fredette <fredette@mit.edu> in
kern/7438.
1999-10-10 18:49:15 +00:00
mjacob 51a4d18f0f If we're discovering, don't tsleep on lbolt if we had a busy status. 1999-10-06 05:01:05 +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
soren 1d04441597 Remove outdated list of density codes. mt(1) has helpful
hints and the SCSI specification has the real, current list.
1999-09-30 12:12:41 +00:00
enami 67e874d814 Allow to detach wdc, atapibus, wd and cd. 1999-09-23 11:04:29 +00:00
enami 31e6da77de Calculate the correct device minor of the first partition. 1999-09-21 03:10:00 +00:00
nathanw 3598bf5251 Add NOLUNS quirk for another Texel CD-ROM revision. 1999-09-19 23:45:28 +00:00
thorpej f77302e768 Implement detaching SCSI and ATAPI disks. 1999-09-11 21:42:58 +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
thorpej 5116cf4fa5 Implement detaching of SCSI busses. 1999-09-11 21:25:26 +00:00
thorpej d622281820 Rework the changer driver a bit:
- 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.
1999-09-09 23:24:11 +00:00
hwr 31292f422e Add a quirk for Wangtec SCSI-36 (QIC-120) tape drive.
From Izumi Tsutsiu in PR 8357.
1999-09-09 20:06:52 +00:00
simonb 56a01be374 Fix tyop in a comment. 1999-09-04 09:41:15 +00:00
thorpej 61f3c9356e If scsipi_make_xs() fails, make sure to flag the buffer as error'd,
if provided, and biodone() it.  Callers of scsipi_command() expect
this to be done.
1999-08-28 22:28:35 +00:00
hannken f04bd56be1 Make `sc_ops->sdo_flush' synchronous. The flags `SDF_FLUSHING' and
`SDF_DIRTY' were never reset because `sddone' doesn't get called from
synchronous scsi commands.
1999-08-26 09:28:17 +00:00
bouyer 7eb1fae5d3 Add a missing 'return' in previous commit.
Don't use C_NEEDDONE anymore (it's safe to always call scsipi_done()).
1999-08-09 09:49:48 +00:00
mycroft 6b33521af9 Increase several timeouts to 30s. 1999-08-07 02:51:51 +00:00
bouyer fae9929734 - Add some debug printf (WDCPROBE) in _wdcreset_wait(), I've needed these
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.
1999-08-06 12:00:23 +00:00
explorer 8fa3d8be55 make the JVC 2626 match more than one version, since all seem to be
returning errors on the LUN probe.
1999-07-26 22:43:13 +00:00
thorpej 40d9e23179 Define the Volume Tag format. 1999-07-22 17:43:53 +00:00
tron 62af9404e6 Skip LUN check for all versions of the UMAX Astra 1220S as suggested
by Dan McMahill in PR kern/7991.
1999-07-14 22:34:18 +00:00
bouyer e5d15c0dc6 Add another CD to the quirk table. 1999-07-08 14:24:42 +00:00
thorpej 59da37b37e Go to splbio() when calling scsipi_free_xs(), just like the SCSI counterpart.
Fixes PR #7853, Paul Dokas <dokas@cs.umn.edu>.
1999-06-25 18:58:54 +00:00
mjacob 92f90fcb92 STK 9490 && SD-3 drives incorrectly quirked as not supporting the LOAD command.
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).
1999-06-17 04:20:55 +00:00
pk b6429ec3c5 In scsipi_done(), call scsipi_free_xs() at splbio(). 1999-06-16 07:35:31 +00:00
pk 5b4a75d281 scsipi_free_xs() wants to be called at splbio; do it. 1999-06-12 11:19:00 +00:00
lukem 7d44fa2e6e * use format_bytes() to display the disk size
* wrap a couple of printf()s
1999-05-31 12:05:39 +00:00
bouyer b87dbb8918 in cdclose(), ignore "media change" when calling scsipi_prevent(), after
a 'eject -l' some ATAPI drives report this instead of illegal request.
1999-05-27 11:19:04 +00:00
thorpej f98d358a1f Rework layer 2 protocol input routines. Instead of calling e.g. ether_input()
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.
1999-05-18 23:52:51 +00:00
perry f8e8703b5e Add patch from Manuel Bouyer -- his mail message said:
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.
1999-05-05 21:35:15 +00:00
bouyer b5f3e628a3 If setting to pio mode < 3 fails, try to set pio mode 3 before returning
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.
1999-04-15 16:21:27 +00:00
bouyer e91bdf1c67 Add SCSI_IGNORE_NOT_READY to the flags for CDIOCCLOSE: some devices will
attempt to spin up, and report an error if there's no CD. Fixes port-i386/7345.
1999-04-08 16:12:31 +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 29936d77d4 Now that we do real use of CDIOCCLOSE, we can have SSS_START|SSS_LOEJ
in scsipi_start(). Adjust test so that timeout will let enouth time to
the drive to spin up.
1999-04-07 12:47:27 +00:00
mycroft 7a304dfe1b If scsipi_command() fails, always print out the error code. 1999-04-05 19:19:34 +00:00
bouyer bf88fc82eb Adjust timeout for 'ielem' to match the comment: 5 mn (not 5s) per element +
10mn initial.
1999-04-04 12:20:48 +00:00
bouyer b43b844f6f - change the interrupt routines to take a 3rd arguments, set to 1 if we
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.
1999-04-01 21:46:28 +00:00
bouyer 1ff88ee466 Avoid busy-waiting when possible if we are not polling (real IRQ or timeout
callback). Shared PCI IRQ should now work (but still untested).
1999-03-25 16:17:36 +00:00
explorer 3ebb419571 Update to slightly altered rnd_attach_source() api 1999-02-28 17:08:05 +00:00
jwise 8ef8f5c8fb Fix typo.
Fixes last part of PR bin/6883 from Soren S. Jorvang <soren@t.dk>.
1999-02-24 18:54:03 +00:00
hubertf ed418e30a2 Only define WDCDEBUG if not already define (e.g. by kernel option) 1999-02-21 00:52:04 +00:00
bouyer 13e811e874 Revert to 1.23, this was not supposed to be checked in yet. 1999-02-15 18:43:08 +00:00
bouyer 18496766b2 For CDIOCCLOSE, ignore media changes, as some drive seems to return this
info here.
1999-02-15 18:41:04 +00:00
bouyer 379429d4df If the REQUEST_SENSE command fails, issue a reset instead of XS_DRIVER_STUFFUP.
If REQUEST_SENSE succeeds but doens't return any data, return XS_SHORTSENSE
as the sense field will just contain a copy or the error register.
1999-02-15 18:40:01 +00:00
bouyer 6dd47fe65f Abort transfer if b_blkno is negative. Closes PR kern/5553 by Johan Danielsson. 1999-02-10 12:29:50 +00:00
bouyer f6f9f8a965 Change DIOCEJECT to do what's needed to eject a device before the eject
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.
1999-02-08 16:33:16 +00:00
sommerfe 0d3a9dfce7 Don't bring scsi/atapi common files in under the "atapi" attribute.
Bring them in under atapibus since they're not needed unless something
attached to an atapibus is also attached.
Tested on i386 and arm32.
1999-02-07 22:58:43 +00:00
bouyer 0075c51a23 Bump CDRETRIES to 4. Now if a DMA error occurs, the driver should downgrade
to PIO mode and the command be retried properly.
1999-02-02 13:02:49 +00:00
bouyer c0e7b6c5cb If sense_key == UNIT_ATTENTION and ASC/ASQ == "Power On, Reset, or Bus Device
Reset", retry the command instead of returning an error. XS_RESET is useless
without this, as the retryed command will die with this unit attention.
1999-02-02 13:01:36 +00:00
bouyer 2bf6a99afb For IDE/ATAPI protocols botches, reset the bus and return XS_RESET
instead of XS_DRIVER_STUFFUP.
1999-02-02 12:59:31 +00:00
bouyer ce870816e0 Cosmetic changes, from Soren S. Jorvan. 1999-01-29 11:36:20 +00:00
bouyer 12868a7d80 Return ENODEV instead of EIO when we are trying to open a device without media
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).
1999-01-29 11:17:58 +00:00
bouyer f52c71b0e8 Allows the raw partition to be open()'ed, even when scsipi_start() fails
(no media or other ...) so that we can always send ioctl's to the device.
1999-01-26 13:59:44 +00:00
bouyer cafe97da38 Another CD drive that doesn't support REQUEST SENSE, from Patrick Welche. 1999-01-26 10:00:08 +00:00
bouyer d86a570eac Add a mitsumi CD that can't handle REQUEST SENSE command. From
Johan Danielsson <joda@pdc.kth.se>.
1999-01-21 10:31:39 +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 f10115b632 "Memorex CRW-2642" CD-R can't properly handle REQUEST SENSE command.
Add it to the quick table, per PR kern/6844.
1999-01-19 09:31:58 +00:00
thorpej ae8a556ce5 Add missing XS_SELTIMEOUT case in user command completion path, returning
SCCMD_TIMEOUT.  Based on PR #6720, Andreas Wrede.
1999-01-11 22:07:08 +00:00
tron 3fbb44a7bb Make MTIOCRDSPOS, MTIOCSLOCATE, etc. work with write protected tapes.
Patch supplied by Dave Huang in PR kern/5305.
1999-01-10 21:46:39 +00:00
mjacob ec1a086c80 Make the error condition of neither 0x70 or 0x71 error codes a tad
more informative than the lower case 'error code %d'.
1999-01-10 06:26:23 +00:00
thorpej 268eb959c4 Make this compile again after the void * arith changes. 1999-01-09 03:16:17 +00:00
augustss 332d7c138f Avoid arithmetic on `void *' since that's not ANSI C. 1999-01-08 18:10:35 +00:00
is bfb7f2aaf3 Multisession-CD-Support, by Torsten Duwe <duwe@ns.lst.de>. 1999-01-04 15:32:08 +00:00
dbj 3fec12a459 Added parens around ADD_BYTES_LIM() macro definition to protects its
use of the low precedence ?: conditional operator.  This fixes a bug
in scsipi_interpret_sense when printing out debugging info.
1998-12-30 11:17:34 +00:00
leo c81639d273 Change quirk entry: "FX320S", "", " q01" to: "FX320S", "", "q01". This
space does seem to matter...
1998-12-21 21:40:12 +00:00
gibbs c9eb836a6a Return ENODEV when the device capability check fails for MOVE and EXCHANGE
operations.
1998-12-17 22:28:07 +00:00
gibbs 1b30d7e440 Correct the definition of the changer device capabilities page. The
previous definition confused some reserved bytes for exchange capabilities.
1998-12-17 22:27:18 +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
bouyer 945acd7834 Leave some room for the string-terminating char in temp. buffers.
Pointed out by Scott Presnell (thanks !).
1998-12-16 13:06:52 +00:00
bouyer c37bf0ccb4 Keep track of DMA errors, and downgrade the transert mode (UDMA ->DMA,
DMA->PIO) in case of 2 consecutive errors. Don't downgrade if the
PIO/DMA/UDMA modes were forced by a config flag.
1998-12-16 13:02:03 +00:00
mycroft 95aa0d0b7d Simplify the copy loops a bit. 1998-12-12 16:58:10 +00:00
mjacob 7f5c8f7db2 add Adaptec RAID units as devices that do not return geometry pages 1998-12-10 18:13:29 +00:00
thorpej 10d50739c7 Actually, restructure scsipi_wait_drain() slightly. 1998-12-08 00:26:22 +00:00
thorpej 8ebf1e8824 Remove xs_free_list; it no longer exists. 1998-12-08 00:20:16 +00:00
thorpej 624619a881 When closing, wait for pending xfers to drain before deleting the reference
to the adapter.
1998-12-08 00:19:27 +00:00
thorpej dcc5f32c2b When closing, wait for pending xfers to drain before unlocking the door,
and wait again before deleting the reference to the adapter.
1998-12-08 00:18:46 +00:00
thorpej 1ddd2ffec0 - When allocating a scsipi_xfer, add it to the specified device's
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.
1998-12-08 00:17:21 +00:00
thorpej 98194169ea When allocating a device's scsipi_link, initialize the pending_xfers
queue.
1998-12-08 00:14:41 +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 337eb43541 NOMODESENSE for all Seagate ST19171- not just FC 1998-12-05 20:52:47 +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
mjacob 33fde1ad76 Eliminate the moreluns entry as it makes no sense for fat SCSI busses (e.g,
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.
1998-12-05 19:39:23 +00:00
leo bea7038c02 The IOMEGA ZIP 100, J.03 does not grok LUN's. 1998-11-26 13:39:14 +00:00
drochner 3e38051bc5 in wdc_softc: access the per-channel data via a pointer array instead of
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.
1998-11-21 15:41:41 +00:00
thorpej 6a60e078ee Add adapter reference counting for SCSI and ATAPI devices. 1998-11-20 00:35:39 +00:00
thorpej baec89716d Add a reference to the adapter when the scsibus is opened, and delete it
when it is closed.
1998-11-19 22:28:20 +00:00
thorpej 54b52fb5f6 Add a reference to the adapter before probing the bus, and delete it
once we are done probing.
1998-11-19 22:25:56 +00:00
thorpej 3b068a6c78 Adapt to the new scsipi_adapter interface. 1998-11-19 21:53:32 +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
thorpej fd684d874c Protect against multiple inclusion. 1998-11-19 03:45:39 +00:00
bouyer 0af9847a2d The ATAPI-specific hack is not needed any more. 1998-11-17 14:46:26 +00:00
bouyer 0d0ff884e5 In atapi_wdc.c, issue a 'REQUEST SENSE' command when appropriate.
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 ...
1998-11-17 14:45:39 +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 ed473183ef Define the FORMAT UNIT command, and several related structures. 1998-10-30 02:07:15 +00:00
thorpej c0ba12768e Fix a sight open flags buglet pointed out by Matthias Scheler. 1998-10-20 22:26:04 +00:00
bouyer f6f8ba3446 Allow uk to attach at atapibus. 1998-10-19 12:28:52 +00:00
bouyer 5f723da8af Move the "warning: bcount value is %d after io" message in a WDCDEBUG_PRINT.
Ifdef DIAGNOSTIC, print the above message only if bcount is < 0.
1998-10-19 12:28:03 +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 e8322de657 Add a new drive flag, DRIVE_MODE, set when the drive properly reported its
PIO/DMA modes. Don't try a SET_FEATURE if it didn't report its mode.
1998-10-13 15:18:46 +00:00