History log of /src/sys/dev/scsipi/scsipi_base.c |
Revision | | Date | Author | Comments |
1.193 |
| 29-Oct-2024 |
nat | Revert to previous - scsipi_done_once is not necessary.
A follow up commit will contain a simpler change (from riastradh@) to ncr5380sbc.
|
1.192 |
| 28-Oct-2024 |
nat | Allow medium errors to be retried.
This was necessary for some variants of the BlueSCSI-v2. For these devices retrying upon receiving a medium error they would work.
Addreses kern/58452.
As posted to tech-kern: https://mail-index.netbsd.org/tech-kern/2024/08/02/msg029652.html
Ok thorpej@.
|
1.191 |
| 28-Oct-2024 |
nat | Introduce scsipi_done_once.
This allows for transfers to be sucessfully aborted on the ncr5380sbc(4).
This may be usefull in future for other scsi controllers.
Callers of scsipi_done are not affected by this change.
Part of kern/58452.
As posted to tech-kern: https://mail-index.netbsd.org/tech-kern/2024/08/02/msg029652.html
Ok thorpej@.
|
1.190 |
| 14-Jun-2024 |
kardel | Ignore unit attention caused EIO errors when attempting to fetch supported op-codes and their timeout values during device attachment.
|
1.189 |
| 09-Apr-2022 |
riastradh | sys: Use membar_release/acquire around reference drop.
This just goes through my recent reference count membar audit and changes membar_exit to membar_release and membar_enter to membar_acquire -- this should make everything cheaper on most CPUs without hurting correctness, because membar_acquire is generally cheaper than membar_enter.
|
1.188 |
| 12-Mar-2022 |
riastradh | sys: Membar audit around reference count releases.
If two threads are using an object that is freed when the reference count goes to zero, we need to ensure that all memory operations related to the object happen before freeing the object.
Using an atomic_dec_uint_nv(&refcnt) == 0 ensures that only one thread takes responsibility for freeing, but it's not enough to ensure that the other thread's memory operations happen before the freeing.
Consider:
Thread A Thread B obj->foo = 42; obj->baz = 73; mumble(&obj->bar); grumble(&obj->quux); /* membar_exit(); */ /* membar_exit(); */ atomic_dec -- not last atomic_dec -- last /* membar_enter(); */ KASSERT(invariant(obj->foo, obj->bar)); free_stuff(obj);
The memory barriers ensure that
obj->foo = 42; mumble(&obj->bar);
in thread A happens before
KASSERT(invariant(obj->foo, obj->bar)); free_stuff(obj);
in thread B. Without them, this ordering is not guaranteed.
So in general it is necessary to do
membar_exit(); if (atomic_dec_uint_nv(&obj->refcnt) != 0) return; membar_enter();
to release a reference, for the `last one out hit the lights' style of reference counting. (This is in contrast to the style where one thread blocks new references and then waits under a lock for existing ones to drain with a condvar -- no membar needed thanks to mutex(9).)
I searched for atomic_dec to find all these. Obviously we ought to have a better abstraction for this because there's so much copypasta. This is a stop-gap measure to fix actual bugs until we have that. It would be nice if an abstraction could gracefully handle the different styles of reference counting in use -- some years ago I drafted an API for this, but making it cover everything got a little out of hand (particularly with struct vnode::v_usecount) and I ended up setting it aside to work on psref/localcount instead for better scalability.
I got bored of adding #ifdef __HAVE_ATOMIC_AS_MEMBAR everywhere, so I only put it on things that look performance-critical on 5sec review. We should really adopt membar_enter_preatomic/membar_exit_postatomic or something (except they are applicable only to atomic r/m/w, not to atomic_load/store_*, making the naming annoying) and get rid of all the ifdefs.
|
1.187 |
| 17-Sep-2020 |
jakllsch | Some misspelling-in-comments fixes for scsipi
|
1.186 |
| 13-Apr-2020 |
chs | slightly change and fix the semantics of pool_set*wat(), pool_sethardlimit() and pool_prime() (and their pool_cache_* counterparts):
- the pool_set*wat() APIs are supposed to specify thresholds for the count of free items in the pool before pool pages are automatically allocated or freed during pool_get() / pool_put(), whereas pool_sethardlimit() and pool_prime() are supposed to specify minimum and maximum numbers of total items in the pool (both free and allocated). these were somewhat conflated in the existing code, so separate them as they were intended.
- change pool_prime() to take an absolute number of items to preallocate rather than an increment over whatever was done before, and wait for any memory allocations to succeed. since pool_prime() can no longer fail after this, change its return value to void and adjust all callers.
- pool_setlowat() is documented as not immediately attempting to allocate any memory, but it was changed some time ago to immediately try to allocate up to the lowat level, so just fix the manpage to describe the current behaviour.
- add a pool_cache_prime() to complete the API set.
|
1.185 |
| 19-Feb-2020 |
riastradh | branches: 1.185.4; Sprinkle some dtrace probes into scsi(4).
|
1.184 |
| 10-Nov-2019 |
chs | branches: 1.184.2; in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT and remove code to handle failures that can no longer happen.
|
1.183 |
| 19-Sep-2019 |
msaitoh | Use unsigned to avoid undefined behavior in scsipi_{get,put}_tag(). Found by kUBSan.
|
1.182 |
| 28-Mar-2019 |
kardel | branches: 1.182.4; Add reading of supported opcodes and their timeouts at attachment time. Though this information is optional, it allows to override our fixed timeouts with device provided timeouts. These timeouts will override the hardcoded values if the device provided timeouts exceed the hardcoded values and are less than a day.
Using the device provided timeouts avoids premature device resets and unreliable operation due to inadequate timeouts.
Due to the limited implementations of USB umass devices this feature is disabled for all umass attached devices.
|
1.181 |
| 05-Feb-2019 |
mrg | avoid a fallthru checker complaint and make one case like the rest. NFCI.
|
1.180 |
| 24-Nov-2018 |
bouyer | Add more KASSERTS about locking.
|
1.179 |
| 03-Sep-2018 |
riastradh | Rename min/max -> uimin/uimax for better honesty.
These functions are defined on unsigned int. The generic name min/max should not silently truncate to 32 bits on 64-bit systems. This is purely a name change -- no functional change intended.
HOWEVER! Some subsystems have
#define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b))
even though our standard name for that is MIN/MAX. Although these may invite multiple evaluation bugs, these do _not_ cause integer truncation.
To avoid `fixing' these cases, I first changed the name in libkern, and then compile-tested every file where min/max occurred in order to confirm that it failed -- and thus confirm that nothing shadowed min/max -- before changing it.
I have left a handful of bootloaders that are too annoying to compile-test, and some dead code:
cobalt ews4800mips hp300 hppa ia64 luna68k vax acorn32/if_ie.c (not included in any kernels) macppc/if_gm.c (superseded by gem(4))
It should be easy to fix the fallout once identified -- this way of doing things fails safe, and the goal here, after all, is to _avoid_ silent integer truncations, not introduce them.
Maybe one day we can reintroduce min/max as type-generic things that never silently truncate. But we should avoid doing that for a while, so that existing code has a chance to be detected by the compiler for conversion to uimin/uimax without changing the semantics until we can properly audit it all. (Who knows, maybe in some cases integer truncation is actually intended!)
|
1.178 |
| 14-Jul-2017 |
christos | branches: 1.178.2; 1.178.4; 1.178.6; Async event can be called before the adapter is running (pmax tc asc)
|
1.177 |
| 19-Jun-2017 |
mlelstv | pass config_detach error to caller.
|
1.176 |
| 17-Jun-2017 |
mlelstv | The atapibus detach path did hold the channel mutex while calling into autoconf, which would trigger a panic when unplugging a USB ATAPI CDROM.
Align detach code for scsibus and atapibus to fix this.
Also avoid races when detaching devices by replacing callout_stop with callout_halt.
|
1.175 |
| 22-Dec-2016 |
mlelstv | branches: 1.175.8; fix comment. request_sense is called unlocked.
|
1.174 |
| 18-Dec-2016 |
skrll | KNF
No functional change.
|
1.173 |
| 18-Dec-2016 |
skrll | Whitespace
|
1.172 |
| 18-Dec-2016 |
skrll | mlelstv accidentaly dropped a mutex_enter
|
1.171 |
| 18-Dec-2016 |
mlelstv | The mutex passed to cv_wait must also be held when calling cv_broadcast. Also optimizing mutex handling in completion thread.
From nick@.
|
1.170 |
| 16-Dec-2016 |
mlelstv | Add locking for periph_active and flags. The operations aren't atomic.
|
1.169 |
| 29-Nov-2016 |
mlelstv | reference count adapter mutex possibly shared by multiple channels.
fix error in atapibusdetach, when a child device cannot be detached, keep atapibus instance alive.
|
1.168 |
| 21-Nov-2016 |
mlelstv | Lock is already taken when handling async events, don't lock again in scsipi_lookup_periph.
Fixes PR kern/51641.
|
1.167 |
| 20-Nov-2016 |
mlelstv | Make scsipi framework MPSAFE.
Data structures are now protected by a per-adapter mutex at IPL_BIO that is created by the scsibus or atapibus instance when the adapter is configured. The enable reference counter and the channel freeze counter which are currently used by HBA code before the adapter is configured, are made atomic. The target drivers are now all tagged as D_MPSAFE.
Almost all HBA drivers still require the kernel lock to present, so all callbacks into HBA code are still protected by kernel lock unless the driver is tagged as SCSIPI_ADAPT_MPSAFE.
TODO: refactor sd and cd to use dksubr.
|
1.166 |
| 02-Oct-2016 |
jdolecek | change scsipi_execute_xs() to default to simple tags for !XS_CTL_URGENT if not specified by caller; this is mostly for documentation purposes only, as sd(4) and cd(4) explicitly use simple tags already
|
1.165 |
| 24-Aug-2015 |
pooka | branches: 1.165.2; would you like some freshly ground _KERNEL_OPT with that? yes? excellent choice, sir/madam.
|
1.164 |
| 18-Nov-2014 |
joerg | branches: 1.164.2; Use size for the size argument of memcmp, not the result of a compare.
|
1.163 |
| 17-Nov-2014 |
christos | PR/49054: Add a quirk for the ES-6600 RAID controller which does not do INQUIRY3 properly. Unfortunately looking at the length does not solve the problem since other devices send greater lengths too.
|
1.162 |
| 18-Oct-2014 |
snj | src is too big these days to tolerate superfluous apostrophes. It's "its", people!
|
1.161 |
| 06-Oct-2014 |
christos | PR/49054: Uwe Toenjes: Some RAID controllers return more bytes in the scsi 3 inquiry command than expected by the size of the scsi 3 inquiry packet. This can be detected by looking at the additional_length field returned by the scsi 2 inquiry. If that's the case, avoid doing the scsi 3 inquiry because we can't handle the extra bytes later. XXX: Pullup -7
|
1.160 |
| 13-Jul-2014 |
dholland | branches: 1.160.2; "peripheral", not "peripherial".
|
1.159 |
| 20-Apr-2012 |
bouyer | branches: 1.159.2; 1.159.12; Add a bustype_async_event_xfer_mode() callback to scsipi_bustype (which can be NULL), so that transport-specific details of transfer mode setting/printing can be handled more easily. Move scsipi_async_event_xfer_mode() and scsipi_print_xfer_mode() to scsi_base.c and split in parallel scsi and FC/SAS parts. size of struct scsipi_bustype has changed, welcome to 6.99.5
|
1.158 |
| 19-Apr-2012 |
bouyer | Expand struct scsipi_bustype {} in a ABI-backward-compatible way to pass more informations about the bus: - bustype_type has 2 different bytes, one holding the existing SCSIPI_BUSTYPE_* (scsi, atapi, ata), and one for a per-SCSIPI_BUSTYPE_* subtype. Introduce macros to build or extract bustype_type. - for SCSIPI_BUSTYPE_SCSI, define subtypes for parallel SCSI, Fibre Channel, SAS and USB, to specify the transport method. SCSIPI_BUSTYPE_SCSI_PSCSI is 0 so that bustype_type value doesn't change for existing code - for non-SCSIPI_BUSTYPE_SCSI busses there's no defined subtype yet, so the bustype_type value doesn't change. - provide scsi_fc_bustype, scsi_sas_bustype and scsi_usb_bustype along with scsi_bustype to be used by bus driver where appropriate - scsipi_print_xfer_mode(): more existing code under a (SCSIPI_BUSTYPE_SCSI, SCSIPI_BUSTYPE_SCSI_PSCSI) case, as sync/wide parameters only make sense for parallel SCSI. For (SCSIPI_BUSTYPE_SCSI, SCSIPI_BUSTYPE_SCSI_FC) and (SCSIPI_BUSTYPE_SCSI, SCSIPI_BUSTYPE_SCSI_SAS), only print tagged queing status if enabled. Just be silent for other bustypes.
This change is prompted by this problem: right now, FC (e.g. isp(4)) and SAS (e.g. mfi(4)) don't do anything for ADAPTER_REQ_SET_XFER_MODE, and especially never call scsipi_async_event(ASYNC_EVENT_XFER_MODE), so sd(4) always runs untagged. Doing a scsipi_async_event(ASYNC_EVENT_XFER_MODE) with appropriate parameters is enough to enable tagged queuing, but then scsipi will print: sd0: async, 8-bit transfers, tagged queueing which is harmless (async, 8-bit transfers doens't make sense on SAS anyway) but will confuse users. With this change scsipi will only print: sd0: tagged queueing which is correct.
In the long run, knowning the underlying transport in scsipi will allow better handling of device which are not parallel SCSI.
Another change adding an extra callback to struct scsipi_bustype {} will come (so that scsipi_print_xfer_mode(), which is SCSI-specific, can be moved out of scsipi_base, and split into per-subtype callback), but this will break kernel ABI and so is not suitable for netbsd-6, so will be commmited later. The above is enough to get tagged queuing on FC and SAS in netbsd-6.
|
1.157 |
| 18-Apr-2012 |
bouyer | Fix KASSERT(): autoconf doesn't run under the KERNEL_LOCK
|
1.156 |
| 20-Feb-2012 |
mrg | assert kernel lock is held in a few places in inside scsipi. lock the kernel when calling into scsipi from umass and usscanner.
with these two in place on usbmp branch, umass appears stable.
|
1.155 |
| 13-Nov-2010 |
uebayasi | branches: 1.155.8; 1.155.12; 1.155.14; Don't pull in the whole uvm(9) API to access only PAGE_SIZE and some other constants. These are provided by sys/param.h now.
|
1.154 |
| 23-Aug-2010 |
pooka | Convert one second(!!) delay to kpause. It was originally done from a callout, so delay was the only option (in those days). Then the caller was converted to a thread, but left as a delay. It still may block the scsipi completion thread processing (so I seriously doubt this code path is executed very often on a live system).
|
1.153 |
| 07-Jun-2010 |
pgoyette | Update scsiverbose module to use module_autoload() rather than module_load(). Load the module right before each attempt to use its features, and let the module subsystem handle unloading.
|
1.152 |
| 30-May-2010 |
pgoyette | Extract SCSIVERBOSE into a kernel module. The module can be builtin by defining 'options SCSIVERBOSE' in the kernel config file (no change from current behavior), or it can be loaded at boot time on those architectures that support the boot loader's "load" command.
The module is built for all architectures, whether or not SCSI or atapi support exists.
|
1.151 |
| 12-Feb-2010 |
pooka | branches: 1.151.2; delay() is used here, so need to include machine/param.h.
|
1.150 |
| 21-Oct-2009 |
rmind | branches: 1.150.2; Remove uarea swap-out functionality:
- Addresses the issue described in PR/38828. - Some simplification in threading and sleepq subsystems. - Eliminates pmap_collect() and, as a side note, allows pmap optimisations. - Eliminates XS_CTL_DATA_ONSTACK in scsipi code. - Avoids few scans on LWP list and thus potentially long holds of proc_lock. - Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k. - Removes __SWAP_BROKEN cases.
Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on acorn26 (thanks to <bjh21>).
Discussed on <tech-kern>, reviewed by <ad>.
|
1.149 |
| 07-Apr-2009 |
dyoung | Destroy a scsipi_xfer's callout before putting it back into the pool.
|
1.148 |
| 11-May-2008 |
mlelstv | branches: 1.148.6; 1.148.12; Reintroduce the NODOORLOCK quirk. Helps with PR kern/23875.
|
1.147 |
| 28-Apr-2008 |
martin | branches: 1.147.2; Remove clause 3 and 4 from TNF licenses
|
1.146 |
| 05-Apr-2008 |
cegger | branches: 1.146.2; 1.146.4; use aprint_*_dev and device_xname
|
1.145 |
| 09-Jul-2007 |
ad | branches: 1.145.28; Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes - select()/poll() improvements - miscellaneous MT safety improvements
|
1.144 |
| 12-Mar-2007 |
ad | branches: 1.144.2; Pass an ipl argument to pool_init/POOL_INIT to be used when initializing the pool's lock.
|
1.143 |
| 09-Feb-2007 |
ad | branches: 1.143.2; 1.143.6; Merge newlock2 to head.
|
1.142 |
| 26-Nov-2006 |
itohy | If the block size reported by Read Capacity looks valid, just use it. Use Request Sense only if Read Capacity succeeded and did not return valid block size. Discussed on tech-kern. Fix the easier part of NetBSD PR kern/26537. (The harder part is the device hangs on large (>= 8KB) transfer. Possibly umass BBB problem?)
Remove scsipi_size() and scsipi_validate_secsize() from scsipi_base.c and add their functions to sd.c since they are used only by sd.c.
Use SCSI term `block' instead of `sector' where applicable.
|
1.141 |
| 16-Nov-2006 |
christos | __unused removal on arguments; approved by core.
|
1.140 |
| 20-Oct-2006 |
scw | Validate the sector size returned by READ CAPACITY. If it looks bogus print a warning and fallback to a suitable default.
Fixes a problem on hp700 reported by skrll@
|
1.139 |
| 12-Oct-2006 |
christos | - sprinkle __unused on function decls. - fix a couple of unused bugs - no more -Wno-unused for i386
|
1.138 |
| 09-Oct-2006 |
scw | Some removable umass(4) devices don't respond to mode sense page 6, or simply return zero for logical block size. In either case, use the sector length reported by READ_CAPACITY instead of defaulting to 512 bytes.
This partially addresses the problems reported in PR port-i386/34707 and PR kern/34737. Namely the incorrectly reported drive geometry and the 'hanging' issue.
However, since the device in question reports 2048-byte physical sectors it will remain unusable until DEV_BSIZE is banished.
|
1.137 |
| 11-Sep-2006 |
reinoud | branches: 1.137.2; Aparently i've misread, backing out change.
|
1.136 |
| 11-Sep-2006 |
reinoud | Don't add one to the capacity returned of READ CAPACITY! it results in reporting a sd* disc that is one sector too big (!) Normally not much a problem in FFS since its clustered but other filingsystems *do* care.
|
1.135 |
| 17-Apr-2006 |
nathanw | branches: 1.135.8; In scsipi_done(), bail out early if the scsipi_xfer has already been marked as done. Works around one problem with detaching in-use sd devices, as described on tech-kern:
http://mail-index.netbsd.org/tech-kern/2005/09/22/0002.html
|
1.134 |
| 20-Feb-2006 |
thorpej | branches: 1.134.2; 1.134.4; 1.134.6; Use device_is_active() rather than testing dv_flags for DVF_ACTIVE directly.
|
1.133 |
| 24-Dec-2005 |
perry | branches: 1.133.2; 1.133.4; 1.133.6; Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
|
1.132 |
| 11-Dec-2005 |
christos | merge ktrace-lwp.
|
1.131 |
| 31-May-2005 |
xtraeme | branches: 1.131.2; Add missing const.
|
1.130 |
| 29-May-2005 |
christos | - Sprinkle const - Avoid variable shadowing. - Eliminate some caddr_t abuse.
|
1.129 |
| 04-Apr-2005 |
yamt | scsipi_completion_thread: if we seemt to need more resources after doing ADAPTER_REQ_GROW_RESOURCES, yield cpu rather than busy-looping. PR/25164.
|
1.128 |
| 27-Feb-2005 |
perry | nuke trailing whitespace
|
1.127 |
| 21-Feb-2005 |
thorpej | Part 1 of a cleanup pass over the SCSI subsystem. The aim is to name everything "scsi_*", since we really are talking about the SCSI command set, ATAPI transport not withstanding. Improve the names of many structures, and prepend "SCSI_" onto all SCSI command opcodes. Place items described by the SCSI Primary Commands document into scsi_spc.h.
|
1.126 |
| 01-Feb-2005 |
reinoud | Backing out changes to clean up scsipi. I was pointed out there were problems i hadn't seen. To prevent lossage i'd decided to back off all changes and let them be reviewed on tech-kern.
|
1.125 |
| 31-Jan-2005 |
reinoud | Part of the cleanup of sys/scsipi's use of types; rename all u_int* to uint* and change the u_long's to uint32_t's where possible. Note that the iocl definitions/hooks have to be ulong (or u_long) or they'll bomb out.
|
1.124 |
| 31-Jan-2005 |
reinoud | As part of cleaning up sys/scsipi, replace all u_char by uint8_t and replace all `short' with int16_t.
|
1.123 |
| 07-Dec-2004 |
thorpej | branches: 1.123.2; 1.123.4; READ_CAPACITY -> READ_CAPACITY_10
|
1.122 |
| 03-Dec-2004 |
thorpej | And thus spake SBC-3:
If the number of logical blocks exceeds the maximum value that is able to be specified in the RETURNED LOGICAL BLOCK ADDRESS field, the device server shall set the RETURNED LOGICAL BLOCK ADDRESS field to FFFFFFFFh. The application client should then issue a READ CAPACITY (16) command (see 5.11) to retrieve the READ CAPACITY (16) parameter data.
Implement this in scsipi_size().
First issue in kern/28514.
|
1.121 |
| 01-Oct-2004 |
enami | Don't touch free'ed object. Fixes l_holdcnt leak reported by Andreas Wrede on current-users.
|
1.120 |
| 18-Sep-2004 |
mycroft | If our enqueue failed -- because we're polling and there is already something in the queue -- do not attempt to requeue it. We only poll in two cases:
1) We have a non-interrupting controller. In this case, execution of the previous command should have left the queue empty. (Perhaps there should be a KASSERT() to this effect.)
2) We're in the shutdown path, either doing a cache sync or a dump. In these cases, the retry behavior is useless, because we will no longer get interrupts to notify us that the earlier commands completed. Instead we just spin for a few seconds and fail anyway. (XXX We should probably clear the queue explicitly so that the shutdown/dump will succeed.)
|
1.119 |
| 18-Sep-2004 |
mycroft | Since we always defer probing SCSI and ATAPI devices now, we can never be "cold" -- so change the check for this to a KASSERT().
|
1.118 |
| 18-Sep-2004 |
mycroft | Oops; eliminate the EJUSTRETURN return value from scsipi_execute_xs(). Don't know how this worked when I tested it.
|
1.117 |
| 18-Sep-2004 |
mycroft | Minor rearrangement. Whitespace and #include cleanup.
|
1.116 |
| 18-Sep-2004 |
mycroft | Standardize some variable names and the calling pattern for scsipi_command(). Use void pointer casts.
|
1.115 |
| 17-Sep-2004 |
mycroft | Remove the "xfer" argument to scsipi_command().
|
1.114 |
| 17-Sep-2004 |
mycroft | Change the way bustype_cmd is used. Rather than having it be responsible for 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.
|
1.113 |
| 17-Sep-2004 |
mycroft | Do not manipulate xs->bp in "generic" code -- do it only in the psw_done routine. As part of this, pass down our pre-parsed error code -- though this interface will probably change later to accomodate better error handling.
|
1.112 |
| 09-Sep-2004 |
bouyer | Make the xxstart() functions reentrant again, as some drivers HBA can call 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.
|
1.111 |
| 02-Sep-2004 |
chs | make this compile on platforms where PAGE_SIZE is not a compile-time constant.
|
1.110 |
| 27-Aug-2004 |
bouyer | Improve handling of memory shortage, to fix problems like: sd3(mpt0:0:1:0): unable to allocate scsipi_xfer sd3: not queued, error 12 Havard Eidnes's analysis of this problem is that the scsipi_xfer pool is competing for resources with other pools, including the the inode and vnode pools which can grow quite large.
*_scsipi_cmd(): don't biodone the buffer if scsipi_make_xs() fails, let the caller deal with the problem start function of block devices drivers: dequeue the buffer after the scsipi_command() call. If scsipi_command() fails with ENOMEM don't dequeue the buffer, and schedule a callout to call the start function after some delay. scsipi_init(): prime the scsipi_xfer_pool with one page. This ensure that there is always some scsipi_xfer to play with. If scsipi_command() fails because of pool_get(), we're sure there will be resources available later, when the pending commands have completed.
Reviewed by Jason Thorpe and Havard Eidnes. Todo: remove the "unable to allocate scsipi_xfer" and "not queued, error %d" printfs, but I choose to keep them for now, to help make sure the code does what it should.
|
1.109 |
| 23-Aug-2004 |
bouyer | Fix typo pointed out by Patrick Welche on current-users@
|
1.108 |
| 21-Aug-2004 |
thorpej | Use ANSI function decls and make use of static.
|
1.107 |
| 18-Aug-2004 |
drochner | Use the new autoconf functions to rescan busses and detach devices on user request. This duplicates the functionality provided by a private ioctl interface (accessible through scsictl(8)), but in a more generic way.
|
1.106 |
| 04-Aug-2004 |
bouyer | Fix some problems in the scsipi detach code: - only call periph_switch->psw_start() if the device is active; if it is not psw_start() may try to access invalid data. - remove the TAILQ_FIRST(&periph->periph_xferq) != NULL diagnostic in scsipi_kill_pending(). This can't be true at this point (unless the device was idle at the time of the detach), because the scsipi channel kernel thread has to run for the queue to be flushed. There are still other problems to be fixed here ...
|
1.105 |
| 27-Apr-2004 |
bouyer | Revert part of 1.102: Don't decrease/check xs_retries when the device report "Power On, Reset, or Bus Device Reset" sense condition, just retry the command. The initial bus reset would cause the first TEST_UNIT_READY to report this condition, and as xs_retries is set to 0 when XS_CTL_DISCOVERY is set, it would report an error instead of being retried, causing the disk probe to report "drive offline" instead of the geometry and capacity. Checking/decreasing xs_retries on the bus reset reported by the adapter is enouth to avoid the problem reported by rev 1.102.
Problem analysed by Paul Kranenburg, fix confirmed by Anders Hjalmars, and explaination as to why the INQUIRY wasn't affected by this provided by Bill Studenmund.
|
1.104 |
| 16-Mar-2004 |
bouyer | branches: 1.104.2; cbd -> cdb Command Block Descriptor -> Command Descriptor Block Pointed out by Allen Briggs.
|
1.103 |
| 15-Mar-2004 |
bouyer | Extract the code printing the CBD from scsipi_print_sense(), so that it's usable in other context. Use the new scsipi_print_cbd() to dump the command in case of timeout in siop/esiop.
|
1.102 |
| 10-Mar-2004 |
bouyer | Decrease xs_retries before retrying aborted commands, and report EIO if it reaches 0. Avoids looping on aborded command in some special cases.
|
1.101 |
| 03-Jan-2004 |
thorpej | callout_init() after memset().
|
1.100 |
| 18-Nov-2003 |
briggs | Use aprint_normal instead of printf in scsipi_print_xfer_mode().
|
1.99 |
| 28-Oct-2003 |
simonb | Fix bogus uninitialised warning.
|
1.98 |
| 17-Oct-2003 |
mycroft | Add a comment explaining the INQUIRE behavior.
|
1.97 |
| 16-Oct-2003 |
mycroft | Whoops, set cmd_length correctly for the 36-byte INQUIRE.
|
1.96 |
| 16-Oct-2003 |
mycroft | Do a 36-byte SCSI 2 inquiry first, and iff that returns an additional length >32 do a 74-byte inquiry. Fixes problems with devices that barf on longer inquiries. (Linux uses 36 bytes almost everywhere, as a data point.)
|
1.95 |
| 12-Oct-2003 |
thorpej | Revert previous change.
|
1.94 |
| 10-Oct-2003 |
thorpej | Warn if a sync period requiring DT was negotiated on a peripheral not capable of DT.
|
1.93 |
| 09-Sep-2003 |
mycroft | Exorcise PQUIRK_NODOORLOCK.
|
1.92 |
| 08-Sep-2003 |
mycroft | Do a START UNIT only if the TEST UNIT READY reports that the device is not ready. This avoids gratuitously starting the motor on floppy and CD-ROM drives, and eliminates the need for the audio playing test in cdopen().
Therefore, also remove PQUIRK_NOSTARTUNIT.
|
1.91 |
| 08-Sep-2003 |
mycroft | On further investigation... don't panic if we try to do a 6-byte mode sense/select on ATAPI. Some tape drives require it. And who knows? Some fool might wire a RBC device to ATAPI.
|
1.90 |
| 08-Sep-2003 |
mycroft | Perform the exorcism on scsipi_mode_select() too.
|
1.89 |
| 08-Sep-2003 |
mycroft | Exorcise something evil and wrong in scsipi_mode_sense().
|
1.88 |
| 19-Apr-2003 |
fvdl | branches: 1.88.2; A device should always respond to inquiry or test unit ready; disable retries for these during discovery. From Pascal Renauld at Network Storage Solutions, Inc
|
1.87 |
| 16-Apr-2003 |
nathanw | Remove extra right paren.
|
1.86 |
| 16-Apr-2003 |
thorpej | * Change the APIs that handle the sync period to work with 100ths of ns, rather than 10ths of ns. This is necessary in order to represent Ultra320 SCSI. * Add Ultra320 SCSI to the scsipi_syncparams[] table.
We're not going to bother bumping any version numbers with this change; only the "hba" driver uses scsipi_sync_period_to_factor(), and the uses of scsipi_sync_factor_to_period() are all internal to the scsipi code. Most things just pass the factor around, which is unchanged by this.
Reviewed by Frank van der Linden.
|
1.85 |
| 03-Apr-2003 |
fvdl | Check RAW_PART against the media size instead of the disklabel. Add the media size in 512-byte sectors to the softc, to avoid some 64 bit computations. Bump the capacity stored in softcs for disks to 64 bits.
|
1.84 |
| 03-Feb-2003 |
thorpej | Test callout_pending(), not callout_active(), and eliminate now-unnecessary callout_deactivate() calls.
|
1.83 |
| 20-Jan-2003 |
simonb | Only declare and set the "info" variable #ifndef SCSIVERBOSE.
|
1.82 |
| 24-Nov-2002 |
scw | Quell an uninitialised variable warning.
|
1.81 |
| 09-Nov-2002 |
thorpej | Fix signed/unsigned comparison warnings.
|
1.80 |
| 04-Oct-2002 |
soren | Leave error printing to the callers of scsipi_size().
|
1.79 |
| 19-Sep-2002 |
jmc | Force the initial probes to happen within the newly forked off kthread. This eliminates problems where the underlying interrupt handler isn't the specific layer calling scsipi_complete() for a given scsi transaction. This avoids deadlocks where the kthread that called the autoconf routines to configure a scsibus shouldn't be the one put to sleep waiting on a scsipi_complete (only the scsibus's kthread should be doing that).
To avoid jitter this will force the scsibus's to probe in the order they run through autoconf (so machines with multiple bus's don't move sd* devices around on every reboot).
|
1.78 |
| 26-Jul-2002 |
wiz | Spell '[Rr]ight' correctly. From Jim Bernard.
|
1.77 |
| 05-Jun-2002 |
mjacob | As per a discussion on tech-kern a while back- honor retries for XS_SELTIMEOUT and XS_TIMEOUT errors- but only do so if the device exists already.
Devices that are being probed won't be found via periph_lookup, so we can use that to find if a device exists for the purposes of honoring retries.
|
1.76 |
| 03-Jun-2002 |
bouyer | Doh, the return of scsipi_lookup_periph() was meant to be assigned to periph. periph was used uninitialised, and caused a panic when the scsibus is reset with siop or esiop, and possibly others HBA drivers.
|
1.75 |
| 17-May-2002 |
mjacob | branches: 1.75.2; Give XS_DRIVER_STUFFUP a case all by itself.
|
1.74 |
| 16-May-2002 |
thorpej | Don't use a 2-dimensional array for the channel's periph table. Instead, hash the target and lun together and use a hash table. This will be necessary in order to support very large (64-bit) LUN number spaces.
|
1.73 |
| 15-May-2002 |
bouyer | branches: 1.73.2; scsipi_print_xfer_mode(): PERIPH_CAP_DT is an equivalent of (PERIPH_CAP_SYNC | PERIPH_CAP_WIDE16) here.
|
1.72 |
| 05-May-2002 |
bouyer | If periph->periph_callout is already active, don't freeze the periph again: scispi_periph_timed_thaw() will be called only one time anyway.
|
1.71 |
| 01-Apr-2002 |
bouyer | 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).
|
1.70 |
| 28-Mar-2002 |
christos | PR/16110: Chris Jepeway: scsipi_complete() calls (*psw_done)() b/4 setting buffer fields
|
1.69 |
| 16-Mar-2002 |
bouyer | Present the same interface to periph driver for ASYNC scsipi_command() in the normal case, and in the polling or "no thread yet" cases: don't return an error from scsipi_complete(), as the error should already have been handled in scsipi_complete() and eventually periph driver callbacks. Should fix kern/15190.
|
1.68 |
| 08-Mar-2002 |
thorpej | Pool deals fairly well with physical memory shortage, but it doesn't deal with shortages of the VM maps where the backing pages are mapped (usually kmem_map). Try to deal with this:
* Group all information about the backend allocator for a pool in a separate structure. The pool references this structure, rather than the individual fields. * Change the pool_init() API accordingly, and adjust all callers. * Link all pools using the same backend allocator on a list. * The backend allocator is responsible for waiting for physical memory to become available, but will still fail if it cannot callocate KVA space for the pages. If this happens, carefully drain all pools using the same backend allocator, so that some KVA space can be freed. * Change pool_reclaim() to indicate if it actually succeeded in freeing some pages, and use that information to make draining easier and more efficient. * Get rid of PR_URGENT. There was only one use of it, and it could be dealt with by the caller.
From art@openbsd.org.
|
1.67 |
| 21-Feb-2002 |
enami | Fix broken indentation.
|
1.66 |
| 12-Jan-2002 |
tsutsui | Call malloc(9) with M_ZERO flag instead of memset() after malloc().
|
1.65 |
| 28-Nov-2001 |
fredette | Added the new defopt SCSI_OLD_NOINQUIRY; this is used instead of sun2 to wrap code that conjures up INQUIRY responses for certain specific old devices.
|
1.64 |
| 26-Nov-2001 |
fredette | Added quirk entries for Adaptec and Emulex SCSI interposer boards. Decode a limited set of SASI/SCSI-1 sense codes, and under sun2 only, conjure up INQUIRY responses for these boards.
|
1.63 |
| 15-Nov-2001 |
lukem | don't need <sys/types.h> when including <sys/param.h>
|
1.62 |
| 13-Nov-2001 |
lukem | add RCSIDs
|
1.61 |
| 14-Oct-2001 |
bouyer | Refuse to register a callback if the completion thread isn't started yet.
|
1.60 |
| 14-Oct-2001 |
bouyer | Call ADAPTER_REQ_GROW_RESOURCES from the completion thread, if possible. This allows HBA drivers to call bus_dmamem_map() safely.
|
1.59 |
| 14-Oct-2001 |
bouyer | 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.
|
1.58 |
| 27-Sep-2001 |
mjacob | Restore previous functionality- in scsipi_periph_timed_thaw check to make sure the completion thread is running before you try to schedule it.
Fixes port-i386/14013
|
1.57 |
| 21-Sep-2001 |
fvdl | 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.
|
1.56 |
| 18-Sep-2001 |
mjacob | 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.
|
1.55 |
| 01-Sep-2001 |
mjacob | branches: 1.55.2; Add table value for Ultra3, so configuring an Ultra3 disk shows:
sd1: sync (12.5ns offset 14), 16-bit (160.000MB/s) transfers, tagged queueing enabled
instead of:
sd1: sync (36.0ns offset 14), 16-bit (55.554MB/s) transfers, tagged queueing enabled
|
1.54 |
| 20-Aug-2001 |
ad | Cosmetic change.
|
1.53 |
| 20-Aug-2001 |
ad | Medium Not Present has number of defined ASCQs. Pointed out by Sergey Svishchev <svs@ropnet.ru> in PR 8326.
|
1.52 |
| 19-Aug-2001 |
yamt | fix scsipi_target_detach with wildcard target.
|
1.51 |
| 18-Jul-2001 |
bouyer | Adn scsipi_target_detach() and scsipi_thread_call_callback() as discussed on tech-kern. scsipi_target_detach() accept wildcard target/lun as requested.
|
1.50 |
| 18-Jul-2001 |
thorpej | bzero -> memset
|
1.49 |
| 13-Jul-2001 |
bouyer | scsipi_set_xfer_mode(): issue a ADAPTER_REQ_SET_XFER_MODE request to adapter only if we succesfully attached at last one device for this I_T.
|
1.48 |
| 27-Jun-2001 |
ross | branches: 1.48.2; compile tweak for non-SCSIVERBOSE
|
1.47 |
| 27-Jun-2001 |
bouyer | Better diagnostic when a REQUEST SENSE is terminated with CHECK CONDITION.
|
1.46 |
| 26-Jun-2001 |
bouyer | 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).
|
1.45 |
| 13-Jun-2001 |
bjh21 | 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.
|
1.44 |
| 23-May-2001 |
bouyer | In scsipi_channel_thaw(), if the count drops to 0, call scsipi_run_queue().
|
1.43 |
| 18-May-2001 |
enami | Don't capitalize the word sync or async. It's inconsistient with other messages.
|
1.42 |
| 18-May-2001 |
bouyer | Workaround for broken drives (explained to me by Chris G. Demetriou): some devices can't handle tag number larger than some values and always reject commands with QUEUE FULL if the tag number is larger than this. Under some circonstances the scsipi system may not decrease periph_openings (as a workaround of other odd behavior) and we may end up requeuing the command with a hight tag value again, and the driver could loop on this. Workaround: in case of queue full, decrease periph_openings to min(periph_active - 1, periph_openings - 1) so that, after some iteration, periph_openings is less than the max tag value acceptable by the device.
Solves the problem with tagged queuing on ncr53c9x for me.
|
1.41 |
| 14-May-2001 |
bouyer | 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.
|
1.40 |
| 27-Apr-2001 |
bouyer | Don't forget to call psw_done() !
|
1.39 |
| 25-Apr-2001 |
bouyer | 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
|
1.38 |
| 09-Jun-2000 |
enami | branches: 1.38.4; 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.
|
1.37 |
| 31-May-2000 |
fvdl | Initialize xs_status to 0 after allocating a scsipi_xfer struct. Makes life easier for driver debugging.
|
1.36 |
| 27-May-2000 |
fvdl | At least try to do something useful in the XS_BUSY case; don't cause a panic by sleeping in an interrupt context.
|
1.35 |
| 23-May-2000 |
bouyer | branches: 1.35.2; 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.
|
1.34 |
| 03-Apr-2000 |
enami | 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.
|
1.33 |
| 03-Apr-2000 |
enami | Fold long line.
|
1.32 |
| 02-Apr-2000 |
augustss | With SCSIVERBOSE, only print sense data if there actually is a problem.
|
1.31 |
| 02-Apr-2000 |
enami | Add missing protect from disk interrupt while calling scsipi_free_xs.
|
1.30 |
| 23-Mar-2000 |
thorpej | 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.
|
1.29 |
| 17-Jan-2000 |
bouyer | 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.
|
1.28 |
| 14-Jan-2000 |
mjacob | Print out the contents of an otherwise unreported undecodable sense data buffer. This helps catch adapter breakage mostly.
|
1.27 |
| 20-Oct-1999 |
enami | Cancel active transfers on aic/wdc detach. Also makes LS-120 drive works for me again.
|
1.26 |
| 17-Oct-1999 |
enami | branches: 1.26.2; 1.26.4; ENODEV is not a value supposed to be assigned to xs->error. Use XS_DRIVER_STUFFUP instead.
|
1.25 |
| 06-Oct-1999 |
mjacob | If we're discovering, don't tsleep on lbolt if we had a busy status.
|
1.24 |
| 30-Sep-1999 |
thorpej | branches: 1.24.2; 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.
|
1.23 |
| 11-Sep-1999 |
thorpej | Implement a function to kill off all commands pending for a given scsipi_link.
|
1.22 |
| 16-Jun-1999 |
pk | In scsipi_done(), call scsipi_free_xs() at splbio().
|
1.21 |
| 07-Apr-1999 |
bouyer | 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.
|
1.20 |
| 02-Feb-1999 |
bouyer | branches: 1.20.2; 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.
|
1.19 |
| 29-Jan-1999 |
bouyer | 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).
|
1.18 |
| 19-Jan-1999 |
bouyer | 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).
|
1.17 |
| 10-Jan-1999 |
mjacob | Make the error condition of neither 0x70 or 0x71 error codes a tad more informative than the lower case 'error code %d'.
|
1.16 |
| 08-Dec-1998 |
thorpej | Actually, restructure scsipi_wait_drain() slightly.
|
1.15 |
| 08-Dec-1998 |
thorpej | - 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.
|
1.14 |
| 19-Nov-1998 |
thorpej | 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.
|
1.13 |
| 17-Nov-1998 |
bouyer | 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).
|
1.12 |
| 10-Oct-1998 |
thorpej | If the adapter returned XS_RESET and the xfer specifies a retry count, attempt to reissue the command (which was destroyed by the bus reset).
Slightly modified from PR #6090, from Matt Jacob.
|
1.11 |
| 18-Sep-1998 |
scottr | SCSI_ASYNCREQ turns out to be redundant; we can simply free the scsipi_xfer 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).
|
1.10 |
| 16-Sep-1998 |
scottr | Found a race in scsipi_execute_xs(): if an asynchronous transfer completes (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.
|
1.9 |
| 14-Sep-1998 |
scottr | Fix a problem uncovered when we started to use the pool allocator to manage 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.
|
1.8 |
| 15-Aug-1998 |
mycroft | Assign my copyrights to TNF.
|
1.7 |
| 11-Aug-1998 |
scottr | Eliminate a potential (but not common) NULL dereference.
|
1.6 |
| 31-Jul-1998 |
thorpej | Use the pool allocator for scsipi_xfer structures.
|
1.5 |
| 10-Feb-1998 |
thorpej | branches: 1.5.2; Clear the scsipi_xfer's status byte before executing the command. This fixes a condition where stale data can be left in the status byte, causing user programs that interpret it to fail.
Fixes kern/4964 from Chris Jones <cjones@honors.montana.edu>.
|
1.4 |
| 18-Oct-1997 |
thorpej | Implement two macros, scsipi_command() and scsipi_command_direct(), and use them to hide the structure of the function pointers we jump through to issue a command.
|
1.3 |
| 01-Oct-1997 |
enami | Cosmetic changes to keep coding style consistency in this directory;
- 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.
|
1.2 |
| 27-Aug-1997 |
bouyer | branches: 1.2.2; Merge scsipi branch in the mainline. This add support for ATAPI devices (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.
|
1.1 |
| 01-Jul-1997 |
bouyer | branches: 1.1.2; file scsipi_base.c was initially added on branch bouyer-scsipi.
|
1.1.2.2 |
| 14-Aug-1997 |
bouyer | Sync with trunk.
|
1.1.2.1 |
| 01-Jul-1997 |
bouyer | New merged scsi/atapi code. Tested on i386 and sparc. Commiting to a branch for now, so that it can be tested on other ports too. The config sheme is as follow: New merged scsi/atapi code. Tested on i386 and sparc. Commiting to a branch for now, so that it can be tested on other ports too. The config sheme is as follow: scsibus at aha sd at scsibus cd at scsibus atapibus at wdc cd at atapibus cd has bus-specific config and function front-end in scsicd.c and atapicd.c The call to theses functions from cd.c is conditionned to NSCSICD and NATAPICD (all defined in cd.h by config).
|
1.2.2.3 |
| 14-Oct-1997 |
thorpej | Update marc-pcmcia branch from trunk.
|
1.2.2.2 |
| 27-Aug-1997 |
thorpej | Update marc-pcmcia branch from trunk.
|
1.2.2.1 |
| 27-Aug-1997 |
thorpej | file scsipi_base.c was added on branch marc-pcmcia on 1997-08-27 23:33:23 +0000
|
1.5.2.1 |
| 08-Aug-1998 |
eeh | Revert cdevsw mmap routines to return int.
|
1.20.2.4 |
| 23-Jan-2000 |
he | Pull up revision 1.29 (via patch, requested by bouyer): Use SCSIPIRETRIES instead of hard-coded value '2' for number of retries in common routines, and define it as 4 so that ATAPI command will succeed after several downgrade.
|
1.20.2.3 |
| 16-Jan-2000 |
he | Apply patch (requested by ad): When probing a SCSI target, do not report an error if the target indicates that LUNs are not supported.
|
1.20.2.2 |
| 24-Jun-1999 |
perry | pullup 1.21->1.22 (pk): deal with missing "raise interrupt level" code
|
1.20.2.1 |
| 07-Apr-1999 |
bouyer | branches: 1.20.2.1.2; 1.20.2.1.4; Pull up rev 1.21: fix timeout for SSS_START|SSS_LOEJ in scsipi_start().
|
1.20.2.1.4.1 |
| 30-Nov-1999 |
itojun | bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch just for reference purposes. This commit includes 1.4 -> 1.4.1 sync for kame branch.
The branch does not compile at all (due to the lack of ALTQ and some other source code). Please do not try to modify the branch, this is just for referenre purposes.
synchronization to latest KAME will take place on HEAD branch soon.
|
1.20.2.1.2.1 |
| 21-Jun-1999 |
thorpej | Sync w/ -current.
|
1.24.2.1 |
| 27-Dec-1999 |
wrstuden | Pull up to last week's -current.
|
1.26.4.1 |
| 15-Nov-1999 |
fvdl | Sync with -current
|
1.26.2.17 |
| 23-Apr-2001 |
bouyer | In channel completion thread, tsleep() at splbio, to avoid race condition where scsipi_done would put something in the queue and wakeup between splx(s) and tsleep().
|
1.26.2.16 |
| 23-Apr-2001 |
mjacob | Don't let the chan_qfreeze count go negative.
It's possible that the adapters shouldn't do this. But if you think about it, this is a function that could be called from anywhere. In any case, the specific reason here was that there is *sometimes* one more Loop UP message from QLogic FC cards than then Loop Down, so making the chan_qfreeze go negative blocked the queue needlessly.
Add a splbio/splx around the test against XS_STS_DONE in scsipi_execute_xs for the non-async case so we don't do the classic sleep after test crock.
|
1.26.2.15 |
| 22-Apr-2001 |
bouyer | Keep track of the number of commands per periph really sent to the adapter. In scsipi_run_queue(), compare this to periph_openings instead of periph_active When a drive reject all queued commands with QUEUE FULL (my IBM DDRS34560D does this on large writes) we end up with all commands in the queue, and periph_active > periph_openings. While doing this I found a bug in scsipi_async_event_channel_reset(): calling scsipi_done() would corrupt accounting.
|
1.26.2.14 |
| 11-Apr-2001 |
mjacob | Make scsipi_channel_init a function returning an int- non-zero means it failed to initialize the channel (this should be acceptable)- in which case we complain and don't schedule bus probing for later.
We make the internal memory allocations for the periph and the chan_periphs array M_NOWAIT- this way we have a hope of booting instead of silently hanging during boot if we've run out of memory.
|
1.26.2.13 |
| 03-Apr-2001 |
bouyer | When we send a untagged command, block the queue until this command is complete.
|
1.26.2.12 |
| 28-Mar-2001 |
bouyer | Better handling of errors for request sense commands.
|
1.26.2.11 |
| 27-Mar-2001 |
bouyer | Kill scsipi_link from comments.
|
1.26.2.10 |
| 22-Jan-2001 |
bouyer | Don't forget to remove xfer from the channel's queue in scsipi_async_event_channel_reset() thaw the periph when request_sense failed(), and when calling user done, as we're not going though the usual path. Implement XS_REQUEUE, for drivers needing to requeue a xfer.
|
1.26.2.9 |
| 15-Jan-2001 |
bouyer | Handle CHECK CONDITION status in mid-layer: the REQUEST_SENSE command is generated from scsipi_complete() so it can tsleep() (we use a regular scsipi_command() call for this). Add a new periph_flag, PERIPH_SENSE, and a new xs_control, XS_CTL_REQSENSE. When PERIPH_SENSE is set only xfer with XS_CTL_REQSENSE may be sent (same logic as PERIPH_RECOVERING but with higther priority). xfer with XS_CTL_REQSENSE need to have XS_CTL_URGENT urgent too. XS_CTL_USERCMD xfers are now handled in scsipi_complete().
We need to pay special attention to SCSI resets, as we may have: - an aborted REQUEST_SENSE. In this case we need to requeue the original command, not the request sense. - sense pending for a command no longer in the queue but for which a request sense has not yet been queued. In this case we should not issue the request sense but requeue the original command instead.
For this: - the xfer with the CHECK CONDITION status is stored in the scsipi_periph (periph_xscheck); the CHECK CONDITION is tested in scsipi_done, PERIPH_SENSE and periph_xscheck is set here. - XS_CTL_REQSENSE xfers are not allowed to be requeued, and are terminated with EINTR in case of reset. - we have a new async event, "ASYNC_EVENT_RESET", which cleanup the xfer in periph_xscheck. - appropriate splbio/splx to avoid race condition (especially, scsipi_request_sense() runs at splbio. Should not be a real problem as it doesn't happen often.
While I'm there kill req_sense_length from struct scsipi_xfer, it's always set to 0 and only checked by a few drivers.
|
1.26.2.8 |
| 20-Nov-2000 |
bouyer | Update thorpej_scsipi to -current as of a month ago A i386 GENERIC kernel compiles without the siop, ahc and bha drivers (will be updated later). i386 IDE/ATAPI and ncr work, as well as sparc/esp_sbus. alpha should work as well (untested yet). siop, ahc and bha will be updated once I've updated the branch to current -current, as well as machine-dependant code.
Main changes to the scsipi code itself: - add a scsipi_channel->type to allow umass to attach to both atapibus and scsibus. Will die when IDE is converted from ata_atapi_attach to scsipi_channel/scsipi_adapter - Add a chan_defquirks to scsipi_channel so that adapters can pass a default set of quirks to be set for each device attached - add adapt_getgeom and adapt_accesschk callbacks
|
1.26.2.7 |
| 04-Feb-2000 |
thorpej | Make sure the channel's completion thread exits when the channel is detached, and completely encapsulate the way periph's are stored by the channel.
|
1.26.2.6 |
| 01-Nov-1999 |
thorpej | Fixup the SC_DEBUG() stuff for the new world order.
|
1.26.2.5 |
| 26-Oct-1999 |
thorpej | Deal a little more gracefully with the fact that xfer mode parameters are for the I_T Nexus, and make all xfer mode updates `async events'.
|
1.26.2.4 |
| 20-Oct-1999 |
thorpej | Sync w/ trunk.
|
1.26.2.3 |
| 20-Oct-1999 |
thorpej | Add channel freeze/thaw, and when a timed thaw occurs on either a channel or periph, make sure to kick the channel queue.
|
1.26.2.2 |
| 19-Oct-1999 |
thorpej | Add an asynchronous event for the adapter to notify the midlayer that xfer mode parameters have changed for an I_T Nexus.
|
1.26.2.1 |
| 19-Oct-1999 |
thorpej | Completely rewritten scsipi_xfer execution engine: - 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).
There is a lot more work to do, but this correctly functions for the most part on several file servers I run.
|
1.35.2.1 |
| 22-Jun-2000 |
minoura | Sync w/ netbsd-1-5-base.
|
1.38.4.15 |
| 11-Dec-2002 |
thorpej | Sync with HEAD.
|
1.38.4.14 |
| 11-Nov-2002 |
nathanw | Catch up to -current
|
1.38.4.13 |
| 18-Oct-2002 |
nathanw | Catch up to -current.
|
1.38.4.12 |
| 01-Aug-2002 |
nathanw | Catch up to -current.
|
1.38.4.11 |
| 20-Jun-2002 |
nathanw | Catch up to -current.
|
1.38.4.10 |
| 17-Apr-2002 |
nathanw | Catch up to -current.
|
1.38.4.9 |
| 01-Apr-2002 |
nathanw | Catch up to -current. (CVS: It's not just a program. It's an adventure!)
|
1.38.4.8 |
| 28-Feb-2002 |
nathanw | Catch up to -current.
|
1.38.4.7 |
| 08-Jan-2002 |
nathanw | Catch up to -current.
|
1.38.4.6 |
| 14-Nov-2001 |
nathanw | Catch up to -current.
|
1.38.4.5 |
| 22-Oct-2001 |
nathanw | Catch up to -current.
|
1.38.4.4 |
| 08-Oct-2001 |
nathanw | Catch up to -current.
|
1.38.4.3 |
| 21-Sep-2001 |
nathanw | Catch up to -current.
|
1.38.4.2 |
| 24-Aug-2001 |
nathanw | Catch up with -current.
|
1.38.4.1 |
| 21-Jun-2001 |
nathanw | Catch up to -current.
|
1.48.2.9 |
| 10-Oct-2002 |
jdolecek | sync kqueue with -current; this includes merge of gehenna-devsw branch, merge of i386 MP branch, and part of autoconf rototil work
|
1.48.2.8 |
| 06-Sep-2002 |
jdolecek | sync kqueue branch with HEAD
|
1.48.2.7 |
| 23-Jun-2002 |
jdolecek | catch up with -current on kqueue branch
|
1.48.2.6 |
| 16-Mar-2002 |
jdolecek | Catch up with -current.
|
1.48.2.5 |
| 11-Feb-2002 |
jdolecek | Sync w/ -current.
|
1.48.2.4 |
| 10-Jan-2002 |
thorpej | Sync kqueue branch with -current.
|
1.48.2.3 |
| 13-Sep-2001 |
thorpej | Update the kqueue branch to HEAD.
|
1.48.2.2 |
| 25-Aug-2001 |
thorpej | Merge Aug 24 -current into the kqueue branch.
|
1.48.2.1 |
| 03-Aug-2001 |
lukem | update to -current
|
1.55.2.1 |
| 01-Oct-2001 |
fvdl | Catch up with -current.
|
1.73.2.3 |
| 29-Aug-2002 |
gehenna | catch up with -current.
|
1.73.2.2 |
| 20-Jun-2002 |
gehenna | catch up with -current.
|
1.73.2.1 |
| 30-May-2002 |
gehenna | Catch up with -current.
|
1.75.2.1 |
| 04-Jun-2002 |
lukem | Pull up revision 1.76 (requested by bouyer in ticket #149): Doh, the return of scsipi_lookup_periph() was meant to be assigned to periph. periph was used uninitialised, and caused a panic when the scsibus is reset with siop or esiop, and possibly others HBA drivers.
|
1.88.2.11 |
| 10-Nov-2005 |
skrll | Sync with HEAD. Here we go again...
|
1.88.2.10 |
| 04-Mar-2005 |
skrll | Sync with HEAD.
Hi Perry!
|
1.88.2.9 |
| 18-Dec-2004 |
skrll | Sync with HEAD.
|
1.88.2.8 |
| 19-Oct-2004 |
skrll | Sync with HEAD
|
1.88.2.7 |
| 24-Sep-2004 |
skrll | Sync with HEAD.
|
1.88.2.6 |
| 21-Sep-2004 |
skrll | Fix the sync with head I botched.
|
1.88.2.5 |
| 18-Sep-2004 |
skrll | Sync with HEAD.
|
1.88.2.4 |
| 03-Sep-2004 |
skrll | Sync with HEAD
|
1.88.2.3 |
| 25-Aug-2004 |
skrll | Sync with HEAD.
|
1.88.2.2 |
| 12-Aug-2004 |
skrll | Sync with HEAD.
|
1.88.2.1 |
| 03-Aug-2004 |
skrll | Sync with HEAD
|
1.104.2.2 |
| 11-Sep-2004 |
he | Pull up revisions 1.110-1.112 (via patch, requested by bouyer in ticket #837): Improve handling of memory shortage, to fix problems like: sd3(mpt0:0:1:0): unable to allocate scsipi_xfer sd3: not queued, error 12 The theory is that other consumers of pool memory is causing this memory shortage in certain somewhat hard to reproduce situations. This is done by giving scsipi_command an extra argument to optionally pass a preallocated scsipi_xfer, and allocating a scsipi_xfer before dequeueing a buffer in the various *start() functions. If the allocation of a scsipi_xfer fails, schedule a callout for delayed invocation of the start function. Also reserve one page for scsipi_xfer structs, to ensure that we will eventually have some available once pending commands complete. Should fix PR#25670.
|
1.104.2.1 |
| 29-Apr-2004 |
jmc | Pullup rev 1.105 (requested by bouyer in ticket #214)
Revert part of 1.102: Don't decrease/check xs_retries when the device report "Power On, Reset, or Bus Device Reset" sense condition, just retry the command. The initial bus reset would cause the first TEST_UNIT_READY to report this condition, and as xs_retries is set to 0 when XS_CTL_DISCOVERY is set, it would report an error instead of being retried, causing the disk probe to report "drive offline" instead of the geometry and capacity. Checking/decreasing xs_retries on the bus reset reported by the adapter is enouth to avoid the problem reported by rev 1.102.
|
1.123.4.1 |
| 19-Mar-2005 |
yamt | sync with head. xen and whitespace. xen part is not finished.
|
1.123.2.1 |
| 29-Apr-2005 |
kent | sync with -current
|
1.131.2.4 |
| 03-Sep-2007 |
yamt | sync with head.
|
1.131.2.3 |
| 26-Feb-2007 |
yamt | sync with head.
|
1.131.2.2 |
| 30-Dec-2006 |
yamt | sync with head.
|
1.131.2.1 |
| 21-Jun-2006 |
yamt | sync with head.
|
1.133.6.1 |
| 22-Apr-2006 |
simonb | Sync with head.
|
1.133.4.1 |
| 09-Sep-2006 |
rpaulo | sync with head
|
1.133.2.1 |
| 01-Mar-2006 |
yamt | sync with head.
|
1.134.6.1 |
| 24-May-2006 |
tron | Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
|
1.134.4.1 |
| 19-Apr-2006 |
elad | sync with head.
|
1.134.2.1 |
| 24-May-2006 |
yamt | sync with head.
|
1.135.8.6 |
| 06-Feb-2007 |
ad | Now that kthreads always run with kernel priority, don't rely on preempt() to actually yield the CPU.
|
1.135.8.5 |
| 30-Jan-2007 |
ad | Remove support for SA. Ok core@.
|
1.135.8.4 |
| 19-Jan-2007 |
ad | Put back arg to preempt() for nwo.
|
1.135.8.3 |
| 19-Jan-2007 |
ad | Acquire proclist_mutex before sending signals.
|
1.135.8.2 |
| 12-Jan-2007 |
ad | Sync with head.
|
1.135.8.1 |
| 18-Nov-2006 |
ad | Sync with head.
|
1.137.2.2 |
| 10-Dec-2006 |
yamt | sync with head.
|
1.137.2.1 |
| 22-Oct-2006 |
yamt | sync with head
|
1.143.6.6 |
| 01-Jul-2007 |
ad | Adapt to callout API change.
|
1.143.6.5 |
| 13-May-2007 |
ad | - Pass the error number and residual count to biodone(), and let it handle setting error indicators. Prepare to eliminate B_ERROR. - Add a flag argument to brelse() to be set into the buf's flags, instead of doing it directly. Typically used to set B_INVAL. - Add a "struct cpu_info *" argument to kthread_create(), to be used to create bound threads. Change "bool mpsafe" to "int flags". - Allow exit of LWPs in the IDL state when (l != curlwp). - More locking fixes & conversion to the new API.
|
1.143.6.4 |
| 10-Apr-2007 |
ad | Nuke the deferred kthread creation stuff, as it's no longer needed. Pointed out by thorpej@.
|
1.143.6.3 |
| 09-Apr-2007 |
ad | - Add two new arguments to kthread_create1: pri_t pri, bool mpsafe. - Fork kthreads off proc0 as new LWPs, not new processes.
|
1.143.6.2 |
| 05-Apr-2007 |
ad | Compile fixes.
|
1.143.6.1 |
| 13-Mar-2007 |
ad | Sync with head.
|
1.143.2.1 |
| 24-Mar-2007 |
yamt | sync with head.
|
1.144.2.1 |
| 11-Jul-2007 |
mjf | Sync with head.
|
1.145.28.1 |
| 02-Jun-2008 |
mjf | Sync with HEAD.
|
1.146.4.5 |
| 09-Oct-2010 |
yamt | sync with head
|
1.146.4.4 |
| 11-Aug-2010 |
yamt | sync with head.
|
1.146.4.3 |
| 11-Mar-2010 |
yamt | sync with head
|
1.146.4.2 |
| 04-May-2009 |
yamt | sync with head.
|
1.146.4.1 |
| 16-May-2008 |
yamt | sync with head.
|
1.146.2.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.147.2.1 |
| 23-Jun-2008 |
wrstuden | Sync w/ -current. 34 merge conflicts to follow.
|
1.148.12.1 |
| 13-May-2009 |
jym | Sync with HEAD.
Commit is split, to avoid a "too many arguments" protocol error.
|
1.148.6.1 |
| 28-Apr-2009 |
skrll | Sync with HEAD.
|
1.150.2.3 |
| 22-Oct-2010 |
uebayasi | Sync with HEAD (-D20101022).
|
1.150.2.2 |
| 17-Aug-2010 |
uebayasi | Sync with HEAD.
|
1.150.2.1 |
| 30-Apr-2010 |
uebayasi | Sync with HEAD.
|
1.151.2.2 |
| 05-Mar-2011 |
rmind | sync with head
|
1.151.2.1 |
| 03-Jul-2010 |
rmind | sync with head
|
1.155.14.1 |
| 23-Apr-2012 |
riz | Pull up following revision(s) (requested by bouyer in ticket #192): sys/dev/scsipi/cd.c: revision 1.307 sys/dev/scsipi/scsiconf.c: revision 1.266 sys/dev/scsipi/sd.c: revision 1.298 sys/dev/scsipi/st_scsi.c: revision 1.35 sys/dev/scsipi/atapiconf.c: revision 1.85 sys/dev/scsipi/scsipiconf.h: revision 1.120 sys/dev/usb/umass_scsipi.c: revision 1.44 sys/dev/scsipi/scsiconf.h: revision 1.57 sys/dev/scsipi/st_atapi.c: revision 1.29 sys/dev/scsipi/scsipi_base.c: revision 1.158 sys/dev/scsipi/st.c: revision 1.221 sys/dev/scsipi/scsipi_ioctl.c: revision 1.67 Expand struct scsipi_bustype {} in a ABI-backward-compatible way to pass more informations about the bus: - bustype_type has 2 different bytes, one holding the existing SCSIPI_BUSTYPE_* (scsi, atapi, ata), and one for a per-SCSIPI_BUSTYPE_* subtype. Introduce macros to build or extract bustype_type. - for SCSIPI_BUSTYPE_SCSI, define subtypes for parallel SCSI, Fibre Channel, SAS and USB, to specify the transport method. SCSIPI_BUSTYPE_SCSI_PSCSI is 0 so that bustype_type value doesn't change for existing code - for non-SCSIPI_BUSTYPE_SCSI busses there's no defined subtype yet, so the bustype_type value doesn't change. - provide scsi_fc_bustype, scsi_sas_bustype and scsi_usb_bustype along with scsi_bustype to be used by bus driver where appropriate - scsipi_print_xfer_mode(): more existing code under a (SCSIPI_BUSTYPE_SCSI, SCSIPI_BUSTYPE_SCSI_PSCSI) case, as sync/wide parameters only make sense for parallel SCSI. For (SCSIPI_BUSTYPE_SCSI, SCSIPI_BUSTYPE_SCSI_FC) and (SCSIPI_BUSTYPE_SCSI, SCSIPI_BUSTYPE_SCSI_SAS), only print tagged queing status if enabled. Just be silent for other bustypes. This change is prompted by this problem: right now, FC (e.g. isp(4)) and SAS (e.g. mfi(4)) don't do anything for ADAPTER_REQ_SET_XFER_MODE, and especially never call scsipi_async_event(ASYNC_EVENT_XFER_MODE), so sd(4) always runs untagged. Doing a scsipi_async_event(ASYNC_EVENT_XFER_MODE) with appropriate parameters is enough to enable tagged queuing, but then scsipi will print: sd0: async, 8-bit transfers, tagged queueing which is harmless (async, 8-bit transfers doens't make sense on SAS anyway) but will confuse users. With this change scsipi will only print: sd0: tagged queueing which is correct. In the long run, knowning the underlying transport in scsipi will allow better handling of device which are not parallel SCSI. Another change adding an extra callback to struct scsipi_bustype {} will come (so that scsipi_print_xfer_mode(), which is SCSI-specific, can be moved out of scsipi_base, and split into per-subtype callback), but this will break kernel ABI and so is not suitable for netbsd-6, so will be commmited later. The above is enough to get tagged queuing on FC and SAS in netbsd-6.
|
1.155.12.2 |
| 29-Apr-2012 |
mrg | sync to latest -current.
|
1.155.12.1 |
| 20-Feb-2012 |
mrg | pullup from -current: >assert kernel lock is held in a few places in inside scsipi. >lock the kernel when calling into scsipi from umass and usscanner. > >with these two in place on usbmp branch, umass appears stable.
|
1.155.8.2 |
| 23-May-2012 |
yamt | sync with head.
|
1.155.8.1 |
| 17-Apr-2012 |
yamt | sync with head
|
1.159.12.1 |
| 10-Aug-2014 |
tls | Rebase.
|
1.159.2.2 |
| 03-Dec-2017 |
jdolecek | update from HEAD
|
1.159.2.1 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.160.2.1 |
| 26-Mar-2015 |
martin | Pull up the following revisions, requested by christos in #644:
sys/dev/scsipi/scsipi_base.c 1.161 - 1.164
Use size for the size argument of memcmp, not the result of a compare.
PR/49054: Add a quirk for the ES-6600 RAID controller which does not do INQUIRY3 properly. Unfortunately looking at the length does not solve the problem since other devices send greater lengths too.
src is too big these days to tolerate superfluous apostrophes. It's "its", people!
PR/49054: Uwe Toenjes: Some RAID controllers return more bytes in the scsi 3 inquiry command than expected by the size of the scsi 3 inquiry packet. This can be detected by looking at the additional_length field returned by the scsi 2 inquiry. If that's the case, avoid doing the scsi 3 inquiry because we can't handle the extra bytes later.
|
1.164.2.5 |
| 28-Aug-2017 |
skrll | Sync with HEAD
|
1.164.2.4 |
| 05-Feb-2017 |
skrll | Sync with HEAD
|
1.164.2.3 |
| 05-Dec-2016 |
skrll | Sync with HEAD
|
1.164.2.2 |
| 05-Oct-2016 |
skrll | Sync with HEAD
|
1.164.2.1 |
| 22-Sep-2015 |
skrll | Sync with HEAD
|
1.165.2.2 |
| 07-Jan-2017 |
pgoyette | Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
|
1.165.2.1 |
| 04-Nov-2016 |
pgoyette | Sync with HEAD
|
1.175.8.2 |
| 07-Sep-2018 |
martin | Pull up following revision(s) (requested by mrg in ticket #1010):
sys/dev/scsipi/scsipi_base.c: revision 1.178
Async event can be called before the adapter is running (pmax tc asc)
|
1.175.8.1 |
| 21-Jun-2017 |
snj | Pull up following revision(s) (requested by mlelstv in ticket #53): sys/dev/scsipi/atapiconf.c: revision 1.91 sys/dev/scsipi/cd.c: revision 1.341 sys/dev/scsipi/scsi_base.c: revision 1.92 sys/dev/scsipi/scsiconf.c: revision 1.280 sys/dev/scsipi/scsipi_base.c: revisions 1.176, 1.177 sys/dev/scsipi/sd.c: revision 1.325 sys/dev/scsipi/ss.c: revision 1.89 sys/dev/scsipi/st.c: revision 1.231 The atapibus detach path did hold the channel mutex while calling into autoconf, which would trigger a panic when unplugging a USB ATAPI CDROM. Align detach code for scsibus and atapibus to fix this. Also avoid races when detaching devices by replacing callout_stop with callout_halt. -- pass config_detach error to caller.
|
1.178.6.4 |
| 21-Apr-2020 |
martin | Sync with HEAD
|
1.178.6.3 |
| 13-Apr-2020 |
martin | Mostly merge changes from HEAD upto 20200411
|
1.178.6.2 |
| 08-Apr-2020 |
martin | Merge changes from current as of 20200406
|
1.178.6.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.178.4.2 |
| 26-Nov-2018 |
pgoyette | Sync with HEAD, resolve a couple of conflicts
|
1.178.4.1 |
| 06-Sep-2018 |
pgoyette | Sync with HEAD
Resolve a couple of conflicts (result of the uimin/uimax changes)
|
1.178.2.2 |
| 14-Jul-2017 |
christos | 2975092
|
1.178.2.1 |
| 14-Jul-2017 |
christos | file scsipi_base.c was added on branch perseant-stdc-iso10646 on 2017-07-14 17:50:12 +0000
|
1.182.4.1 |
| 31-Jan-2020 |
martin | Pull up following revision(s) (requested by msaitoh in ticket #672):
sys/dev/ic/tulip.c: revision 1.198 sys/dev/pci/if_jme.c: revision 1.45 sys/dev/pci/agp.c: revision 1.86 sys/dev/pci/if_lii.c: revision 1.27 sys/dev/acpi/thinkpad_acpi.c: revision 1.47 sys/dev/scsipi/scsipi_base.c: revision 1.183 sys/dev/ic/aic6915reg.h: revision 1.6
Fix undefined behavior in thinkpad_mask_init(). Found by kUBSan.
Use unsigned when initialize the transmit completion ring to avoid undefined behavior. Found by kUBSan.
Avoid undefined behavior when setting multicast address. found by kUBSan.
Use unsigned to avoid undefined behavior in agpattach(). Found by kUBSan.
Avoid undefined behavior in jme_mii_write(). Found by kUBSan.
Use unsigned to avoid undefined behavior in lii_setmulti().
Use unsigned to avoid undefined behavior in scsipi_{get,put}_tag().
Found by kUBSan.
|
1.184.2.1 |
| 29-Feb-2020 |
ad | Sync with head.
|
1.185.4.1 |
| 20-Apr-2020 |
bouyer | Sync with HEAD
|