History log of /freebsd-current/sys/dev/siis/siis.c
Revision Date Author Comments
# 17bfbc40 04-Feb-2024 Mark Johnston <markj@FreeBSD.org>

siis: Use device_set_desc(f)()

No functional change intended.

MFC after: 1 week


# 9dbf5b0e 13-Mar-2024 John Baldwin <jhb@FreeBSD.org>

new-bus: Remove the 'rid' and 'type' arguments from BUS_RELEASE_RESOURCE

The public bus_release_resource() API still accepts both forms, but
the internal kobj method no longer passes the arguments.
Implementations which need the rid or type now use rman_get_rid() or
rman_get_type() to fetch the value from the allocated resource.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D44131


# fdafd315 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 1fdc3ba4 06-May-2022 John Baldwin <jhb@FreeBSD.org>

siis: Remove unused devclass arguments to DRIVER_MODULE.


# 25375b14 04-Mar-2022 Alexander Motin <mav@FreeBSD.org>

ahci/siis/mvs: Fix panics after 3394d4239b.

Full CCB header overwrites made frees go into wrong zones, causing
kernel panics. Instead of copying full header use xpt_setup_ccb(),
since the only field I see used from all the header is target_id.

PR: 262263


# 887ae195 26-Feb-2022 Scott Long <scottl@FreeBSD.org>

Fix "set but not used" in the siis driver.


# ddfc9c4c 22-Jun-2021 Warner Losh <imp@FreeBSD.org>

newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf

Now that the upper layers all go through a layer to tie into these
information functions that translates an sbuf into char * and len. The
current interface suffers issues of what to do in cases of truncation,
etc. Instead, migrate all these functions to using struct sbuf and these
issues go away. The caller is also in charge of any memory allocation
and/or expansion that's needed during this process.

Create a bus_generic_child_{pnpinfo,location} and make it default. It
just returns success. This is for those busses that have no information
for these items. Migrate the now-empty routines to using this as
appropriate.

Document these new interfaces with man pages, and oversight from before.

Reviewed by: jhb, bcr
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29937


# cd853791 27-Nov-2020 Konstantin Belousov <kib@FreeBSD.org>

Make MAXPHYS tunable. Bump MAXPHYS to 1M.

Replace MAXPHYS by runtime variable maxphys. It is initialized from
MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys.

Make b_pages[] array in struct buf flexible. Size b_pages[] for buffer
cache buffers exactly to atop(maxbcachebuf) (currently it is sized to
atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1.
The +1 for pbufs allow several pbuf consumers, among them vmapbuf(),
to use unaligned buffers still sized to maxphys, esp. when such
buffers come from userspace (*). Overall, we save significant amount
of otherwise wasted memory in b_pages[] for buffer cache buffers,
while bumping MAXPHYS to desired high value.

Eliminate all direct uses of the MAXPHYS constant in kernel and driver
sources, except a place which initialize maxphys. Some random (and
arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted
straight. Some drivers, which use MAXPHYS to size embeded structures,
get private MAXPHYS-like constant; their convertion is out of scope
for this work.

Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs,
dev/siis, where either submitted by, or based on changes by mav.

Suggested by: mav (*)
Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions)
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27225


# 9a201fad 20-Nov-2020 Alexander Motin <mav@FreeBSD.org>

Unlucky change...

MFC after: 3 days


# 69df0af0 20-Nov-2020 Alexander Motin <mav@FreeBSD.org>

Fix stupid math mistake in r366922.

MFC after: 3 days


# 06c888ec 01-Nov-2020 Alexander Motin <mav@FreeBSD.org>

Add icc (Isochronous Command Completion) ccb_ataio field.

MFC after: 1 week


# 4138a744 21-Oct-2020 Alexander Motin <mav@FreeBSD.org>

Pass lower 3 bits of sector_count for FPDMA commands.

When this code was written those bits were N/A, but now the lowest bit
is Rebuild Assist Recovery Control (RARC).

MFC after: 1 month


# 65d2f9c1 05-Dec-2019 John Baldwin <jhb@FreeBSD.org>

Use a void * argument to callout handlers instead of timeout_t casts.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D22684


# 718cf2cc 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# 950c5aca 19-Feb-2017 Alexander Motin <mav@FreeBSD.org>

Remove dead mentions of CAM target mode APIs from drivers.

This makes grepping kernel for target mode implementation much easier.


# 4195c7de 04-Jan-2017 Alan Somers <asomers@FreeBSD.org>

Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name)

The sim_vid, hba_vid, and dev_name fields of struct ccb_pathinq are
fixed-length strings. AFAICT the only place they're read is in
sbin/camcontrol/camcontrol.c, which assumes they'll be null-terminated.
However, the kernel doesn't null-terminate them. A bunch of copy-pasted code
uses strncpy to write them, and doesn't guarantee null-termination. For at
least 4 drivers (mpr, mps, ciss, and hyperv), the hba_vid field actually
overflows. You can see the result by doing "camcontrol negotiate da0 -v".

This change null-terminates those fields everywhere they're set in the
kernel. It also shortens a few strings to ensure they'll fit within the
16-character field.

PR: 215474
Reported by: Coverity
CID: 1009997 1010000 1010001 1010002 1010003 1010004 1010005
CID: 1331519 1010006 1215097 1010007 1288967 1010008 1306000
CID: 1211924 1010009 1010010 1010011 1010012 1010013 1010014
CID: 1147190 1010017 1010016 1010018 1216435 1010020 1010021
CID: 1010022 1009666 1018185 1010023 1010025 1010026 1010027
CID: 1010028 1010029 1010030 1010031 1010033 1018186 1018187
CID: 1010035 1010036 1010042 1010041 1010040 1010039
Reviewed by: imp, sephe, slm
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9037
Differential Revision: https://reviews.freebsd.org/D9038


# 453130d9 02-May-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: minor spelling fixes.

Most affect comments, very few have user-visible effects.


# 916d57df 16-Apr-2016 Warner Losh <imp@FreeBSD.org>

Implement Auxiliary register. Add PIM_ATA_EXT flag to flag that a SIM
can handle it, and add the code to add it to the FIS that's sent to
the drive. The mvs driver is the only other ATA driver in the system,
and its hardware doesn't appear to support setting the Auxiliary
register.

Differential Revision: https://reviews.freebsd.org/D5598


# d8d7c6b1 21-Mar-2016 Justin Hibbits <jhibbits@FreeBSD.org>

Fix some more long -> rman_res_t

Reported by: Michael Butler (siis breakage)


# 2dd1bdf1 26-Jan-2016 Justin Hibbits <jhibbits@FreeBSD.org>

Convert rman to use rman_res_t instead of u_long

Summary:
Migrate to using the semi-opaque type rman_res_t to specify rman resources. For
now, this is still compatible with u_long.

This is step one in migrating rman to use uintmax_t for resources instead of
u_long.

Going forward, this could feasibly be used to specify architecture-specific
definitions of resource ranges, rather than baking a specific integer type into
the API.

This change has been broken out to facilitate MFC'ing drivers back to 10 without
breaking ABI.

Reviewed By: jhb
Sponsored by: Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D5075


# 3036de3c 23-Mar-2015 Alexander Motin <mav@FreeBSD.org>

Reduce priority of ATA/SATA drivers.

Legacy ata(4) -> BUS_PROBE_LOW_PRIORITY; more functional ahci(4), siis(4),
mvs(4) -> BUS_PROBE_DEFAULT; BUS_PROBE_VENDOR leave for vendor drivers.

MFC after: 2 weeks


# 85c9dd9d 21-Nov-2014 Steven Hartland <smh@FreeBSD.org>

Prevent overflow issues in timeout processing

Previously, any timeout value for which (timeout * hz) will overflow the
signed integer, will give weird results, since callout(9) routines will
convert negative values of ticks to '1'. For unsigned integer overflow we
will get sufficiently smaller timeout values than expected.

Switch from callout_reset, which requires conversion to int based ticks
to callout_reset_sbt to avoid this.

Also correct isci to correctly resolve ccb timeout.

This was based on the original work done by Eygene Ryabinkin
<rea@freebsd.org> back in 5 Aug 2011 which used a macro to help avoid
the overlow.

Differential Revision: https://reviews.freebsd.org/D1157
Reviewed by: mav, davide
MFC after: 1 month
Sponsored by: Multiplay


# 200b4021 11-Sep-2014 Alexander Motin <mav@FreeBSD.org>

Initialize variables before resource_int_value().

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>


# 227d67aa 20-Oct-2013 Alexander Motin <mav@FreeBSD.org>

Merge CAM locking changes from the projects/camlock branch to radically
reduce lock congestion and improve SMP scalability of the SCSI/ATA stack,
preparing the ground for the coming next GEOM direct dispatch support.

Replace big per-SIM locks with bunch of smaller ones:
- per-LUN locks to protect device and peripheral drivers state;
- per-target locks to protect list of LUNs on target;
- per-bus locks to protect reference counting;
- per-send queue locks to protect queue of CCBs to be sent;
- per-done queue locks to protect queue of completed CCBs;
- remaining per-SIM locks now protect only HBA driver internals.

While holding LUN lock it is allowed (while not recommended for performance
reasons) to take SIM lock. The opposite acquisition order is forbidden.
All the other locks are leaf locks, that can be taken anywhere, but should
not be cascaded. Many functions, such as: xpt_action(), xpt_done(),
xpt_async(), xpt_create_path(), etc. are no longer require (but allow) SIM
lock to be held.

To keep compatibility and solve cases where SIM lock can't be dropped, all
xpt_async() calls in addition to xpt_done() calls are queued to completion
threads for async processing in clean environment without SIM lock held.

Instead of single CAM SWI thread, used for commands completion processing
before, use multiple (depending on number of CPUs) threads. Load balanced
between them using "hash" of the device B:T:L address.

HBA drivers that can drop SIM lock during completion processing and have
sufficient number of completion threads to efficiently scale to multiple
CPUs can use new function xpt_done_direct() to avoid extra context switch.
Make ahci(4) driver to use this mechanism depending on hardware setup.

Sponsored by: iXsystems, Inc.
MFC after: 2 months


# ca114192 17-Apr-2013 Alexander Motin <mav@FreeBSD.org>

Make siis(4) and mvs(4) send bus_get_dma_tag() requests to parent buses
passing real bus' child pointers instead of grandchilds.

Requested by: kib


# 129c6621 19-Mar-2013 Konstantin Belousov <kib@FreeBSD.org>

ahci(4) and siis(4) are ready to process the unmapped i/o requests

Sponsored by: The FreeBSD Foundation
Tested by: pho
Submitted by: bf (siis patch)


# dd0b4fb6 12-Feb-2013 Konstantin Belousov <kib@FreeBSD.org>

Reform the busdma API so that new types may be added without modifying
every architecture's busdma_machdep.c. It is done by unifying the
bus_dmamap_load_buffer() routines so that they may be called from MI
code. The MD busdma is then given a chance to do any final processing
in the complete() callback.

The cam changes unify the bus_dmamap_load* handling in cam drivers.

The arm and mips implementations are updated to track virtual
addresses for sync(). Previously this was done in a type specific
way. Now it is done in a generic way by recording the list of
virtuals in the map.

Submitted by: jeff (sponsored by EMC/Isilon)
Reviewed by: kan (previous version), scottl,
mjacob (isp(4), no objections for target mode changes)
Discussed with: ian (arm changes)
Tested by: marius (sparc64), mips (jmallet), isci(4) on x86 (jharris),
amd64 (Fabian Keil <freebsd-listen@fabiankeil.de>)


# eb586bd9 10-Jun-2012 Alexander Motin <mav@FreeBSD.org>

Partially revert r236666:
Return PROTO_ATA protocol in response to XPT_PATH_INQ.

smartmontools uses it to identify ATA devices and I don't know any other
place now where it is important. It could probably use XPT_GDEV_TYPE
instead for more accurate protocol information, but let it live for now.

Reported by: matthew
MFC after: 3 days


# bc1bf6e8 06-Jun-2012 Alexander Motin <mav@FreeBSD.org>

ATA/SATA controllers have no idea about protocol of the connected device
until transport will do some probe actions (at least soft reset).
Make ATA/SATA SIMs to not report bogus and confusing PROTO_ATA protocol.
Make ATA/SATA transport to fill that gap by reporting protocol to SIM with
XPT_SET_TRAN_SETTINGS and patching XPT_GET_TRAN_SETTINGS results if needed.


# 711f6613 12-May-2012 Alexander Motin <mav@FreeBSD.org>

Add two functions xpt_batch_start() and xpt_batch_done() to the CAM SIM KPI
to allow drivers to handle request completion directly without passing
them to the CAM SWI thread removing extra context switch.
Modify all ATA/SATA drivers to use them.

Reviewed by: gibbs, ken
MFC after: 2 weeks


# 3b12bdb5 22-Nov-2011 Hans Petter Selasky <hselasky@FreeBSD.org>

Rename device_delete_all_children() into device_delete_children().

Suggested by: jhb @ and marius @
MFC after: 1 week


# 11bcf702 19-Nov-2011 Hans Petter Selasky <hselasky@FreeBSD.org>

Move the device_delete_all_children() function from usb_util.c
to kern/subr_bus.c. Simplify this function so that it no longer
depends on malloc() to execute. Identify a few other places where
it makes sense to use device_delete_all_children().

MFC after: 1 week


# d745c852 06-Nov-2011 Ed Schouten <ed@FreeBSD.org>

Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.

This means that their use is restricted to a single C file.


# 08c8fde0 25-May-2011 Alexander Motin <mav@FreeBSD.org>

According to SATA specification, when Serial ATA Enclosure Management Bridge
(SEMB) is unable to communicate to Storage Enclosure Processor (SEP), in
response to hard and soft resets it should among other things return value
0x7F in Status register. The weird side is that it means DRQ bit set, which
tells that reset request is not completed. It would be fine if SEMB was the
only device on port. But if SEMB connected to PMP or built into it, it may
block access to other devices sharing same SATA port.

Make some tunings/fixes to soft-reset handling to workaround the issue:
- ahci(4): request CLO on the port after soft reset to ignore DRQ bit;
- siis(4): gracefully reinitialize port after soft reset timeout (hardware
doesn't detect reset request completion in this case);
- mvs(4): if PMP is used, send dummy soft-reset to the PMP port to make it
clear DRQ bit for us.

For now this makes quirks in ata_pmp.c, hiding SEMB ports of SiI3726/SiI4726
PMPs, less important. Further, if hardware permit, I hope to implement real
SEMB support.


# 7bcc5957 19-Apr-2011 Alexander Motin <mav@FreeBSD.org>

Fix some English grammar.


# 1f145eaf 19-Apr-2011 Alexander Motin <mav@FreeBSD.org>

According to specification. device should respond to COMRESET with COMINIT
in no more then 10ms. If we detected no device presence within that time,
there is no reason to wait longer.


# 6ac0befd 19-Apr-2011 Alexander Motin <mav@FreeBSD.org>

Properly handle memory allocation errors during error recovery.


# 8d169381 13-Apr-2011 Alexander Motin <mav@FreeBSD.org>

Improve SATA Asynchronous Notification feature support in CAM:
- make SATA SIMs announce capabilities to handle SDB with Notification bit;
- make PMP driver honor this SIMs capability;
- make SATA XPT to negotiate and enable this feature for ATAPI devices.

This feature allows supporting SATA ATAPI devices to inform system about
some events happened, that may require attention. In my case this allows
LG GH22LS50 SATA DVR-RW drive to report tray open/close events. Events
reported to CAM in form of AC_SCSI_AEN async. Further they could be used
as a hints for checking device status and reporting media change to upper
layers, for example, via spoiling mechanism of GEOM.


# 54fc853a 13-Apr-2011 Alexander Motin <mav@FreeBSD.org>

As soon as siis_reset() doesn't waits for device readiness, but only for
controller port readiness (that should set just after PHY ready signal),
reduce wait time from 10s to 1s before trying more aggressive reset method.

This should improve system responsibility in some failure conditions.


# b8b7a902 12-Apr-2011 Alexander Motin <mav@FreeBSD.org>

Implement automatic SCSI sense fetching for siis(4).

Fix device freeze leak on recovery request (READ LOG, REQUEST SENSE)
failure.


# a59641a9 26-Jan-2011 Alexander Motin <mav@FreeBSD.org>

Hardware supported by siis(4) allows software control over activity LEDs.
Expose that functionality to led(4) OR-ing it with regular LED activity.


# ba3a9995 08-Nov-2010 Alexander Motin <mav@FreeBSD.org>

Teach ahci(4), siis(4) and ATA_CAM ata(4) wrapper report to CAM residual
I/O length on underruns, that often happens for some SCSI commands.


# 5b9392e8 25-Oct-2010 Alexander Motin <mav@FreeBSD.org>

Add missing mtx_destroy() on channel attach failure.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# bf12976c 15-Sep-2010 Alexander Motin <mav@FreeBSD.org>

Fix panic, when due to some kind of congestion on FIS-based switching
port multiplier some command triggers false positive timeout, but then
completes normally.

MFC after: 2 weeks


# 8edcf694 25-Jul-2010 Alexander Motin <mav@FreeBSD.org>

Export PCI IDs of ATA/SATA controllers through CAM and ata(4) layers to
GEOM. This information needed for proper soft-RAID's on-disk metadata
reading and writing.


# 8d659f34 05-Jun-2010 Alexander Motin <mav@FreeBSD.org>

Plug memory leak to silent Coverity. Error is still not really handled.

Found with: Coverity Prevent(tm)
CID: 4196


# b1364652 05-Jun-2010 Alexander Motin <mav@FreeBSD.org>

Fix attach errors handling.

Found with: Coverity Prevent(tm)
CID: 3477


# 8c14a06f 24-May-2010 Alexander Motin <mav@FreeBSD.org>

MFC r208410:
Report ATA/SATA channel number to NewBus at location string.


# bb4b8a9f 24-May-2010 Alexander Motin <mav@FreeBSD.org>

MFC r208414:
Fill rman range start/end values. It makes devinfo output more readable.


# 6488c6b3 23-May-2010 Alexander Motin <mav@FreeBSD.org>

MFC r208375, r208393:
Improve suspend/resume support. Make sure controller is idle on suspend
and reset it on resume.


# cc6b610b 22-May-2010 Alexander Motin <mav@FreeBSD.org>

Fill rman range start/end values. It makes devinfo output more readable.


# 445cc79c 22-May-2010 Alexander Motin <mav@FreeBSD.org>

Report ATA/SATA channel number to NewBus at location string.


# 243e0fb9 21-May-2010 Alexander Motin <mav@FreeBSD.org>

Improve suspend/resume support. Make sure controller is idle on suspend
and reset it on resume.


# 967b11e3 08-May-2010 Alexander Motin <mav@FreeBSD.org>

MFC r207499:
Make SATA XPT negotiate and enable some additional SATA features, such as:
- device initiated power management (some devices support only this way);
- Automatic Partial to Slumber Transition (more power saving);
- DMA auto-activation (expected to slightly improve performance).
More features could be added later, when hardware supports.


# 6e2b58a6 08-May-2010 Alexander Motin <mav@FreeBSD.org>

MFC r207431:
Add Target/LUN ID checks and deny access to targets 1-14 when PMP absent.


# 9171d4b7 01-May-2010 Alexander Motin <mav@FreeBSD.org>

MFC r206652:
Explicitly enable PCI busmastering on attach.
Now SiI3124 with siis(4) successfully works on sparc64 (SunBlade 100).


# f40596ef 01-May-2010 Alexander Motin <mav@FreeBSD.org>

MFC r205358:
Enable MSI by default for SiI3124.


# da6808c1 01-May-2010 Alexander Motin <mav@FreeBSD.org>

Make SATA XPT negotiate and enable some additional SATA features, such as:
- device initiated power management (some devices support only this way);
- Automatic Partial to Slumber Transition (more power saving);
- DMA auto-activation (expected to slightly improve performance).
More features could be added later, when hardware supports.


# 81a75ae3 30-Apr-2010 Alexander Motin <mav@FreeBSD.org>

Add Target/LUN ID checks and deny access to targets 1-14 when PMP absent.


# 94410af7 15-Apr-2010 Alexander Motin <mav@FreeBSD.org>

Explicitly enable PCI busmastering on attach.
Now SiI3124 with siis(4) successfully works on sparc64 (SunBlade 100).

H/W donated by: Gheorghe Ardelean


# f81100fd 19-Mar-2010 Alexander Motin <mav@FreeBSD.org>

Enable MSI by default for SiI3124.


# a510b78b 19-Feb-2010 Alexander Motin <mav@FreeBSD.org>

MFC r200291, r203529:
Increase Max Read Request Size for PCIe chips from 512 to 1024 bytes.
It gives those beasts additional 10% of write bandwidth.
Use new helper functions to do it.


# 3e2fbfe5 14-Feb-2010 Alexander Motin <mav@FreeBSD.org>

MFC r203165:
Reset port on disconnect event, to abort any running requests.


# 92910047 14-Feb-2010 Alexander Motin <mav@FreeBSD.org>

MFC r203376, r203384:
- Give ATA/SATA SIMs info about ATAPI packet size, supported by device.
- Make ATA XPT to reject longer SCSI CDBs then supported by device, or
any SCSI CDBs, if device doesn't support ATAPI.


# 50ae5fde 14-Feb-2010 Alexander Motin <mav@FreeBSD.org>

MFC r203108:
Large set of CAM improvements:
- Unify bus reset/probe sequence. Whenever bus attached at boot or later,
CAM will automatically reset and scan it. It allows to remove duplicate
code from many drivers.
- Any bus, attached before CAM completed it's boot-time initialization,
will equally join to the process, delaying boot if needed.
- New kern.cam.boot_delay loader tunable should help controllers that
are still unable to register their buses in time (such as slow USB/
PCCard/ CardBus devices), by adding one more event to wait on boot.
- To allow synchronization between different CAM levels, concept of
requests priorities was extended. Priorities now split between several
"run levels". Device can be freezed at specified level, allowing higher
priority requests to pass. For example, no payload requests allowed,
until PMP driver enable port. ATA XPT negotiate transfer parameters,
periph driver configure caching and so on.
- Frozen requests are no more counted by request allocation scheduler.
It fixes deadlocks, when frozen low priority payload requests occupying
slots, required by higher levels to manage theit execution.
- Two last changes were holding proper ATA reinitialization and error
recovery implementation. Now it is done: SATA controllers and Port
Multipliers now implement automatic hot-plug and should correctly
recover from timeouts and bus resets.
- Improve SCSI error recovery for devices on buses without automatic sense
reporting, such as ATAPI or USB. For example, it allows CAM to wait, while
CD drive loads disk, instead of immediately return error status.
- Decapitalize diagnostic messages and make them more readable and sensible.
- Teach PMP driver to limit maximum speed on fan-out ports.
- Make boot wait for PMP scan completes, and make rescan more reliable.
- Fix pass driver, to return CCB to user level in case of error.
- Increase number of retries in cd driver, as device may return several UAs.


# 301c88be 13-Feb-2010 Alexander Motin <mav@FreeBSD.org>

MFp4:
After last running command completed, give commands in timeout state
second time.


# 20bbf2de 13-Feb-2010 Alexander Motin <mav@FreeBSD.org>

MFp4:
After last running command completed, give commands in timeout state
second time.


# 2622a559 05-Feb-2010 Alexander Motin <mav@FreeBSD.org>

Use new helper functions to set PCIe max read request size.


# 4cca1530 02-Feb-2010 Alexander Motin <mav@FreeBSD.org>

- Give ATA/SATA SIMs info about ATAPI packet size, supported by device.
- Make ATA XPT to reject longer SCSI CDBs then supported by device, or
any SCSI CDBs, if device doesn't support ATAPI.


# ed70cffd 28-Jan-2010 Alexander Motin <mav@FreeBSD.org>

Reset port on disconnect event, to abort any running requests.


# 83c5d981 28-Jan-2010 Alexander Motin <mav@FreeBSD.org>

MFp4: Large set of CAM inprovements.

- Unify bus reset/probe sequence. Whenever bus attached at boot or later,
CAM will automatically reset and scan it. It allows to remove duplicate
code from many drivers.
- Any bus, attached before CAM completed it's boot-time initialization,
will equally join to the process, delaying boot if needed.
- New kern.cam.boot_delay loader tunable should help controllers that
are still unable to register their buses in time (such as slow USB/
PCCard/ CardBus devices), by adding one more event to wait on boot.
- To allow synchronization between different CAM levels, concept of
requests priorities was extended. Priorities now split between several
"run levels". Device can be freezed at specified level, allowing higher
priority requests to pass. For example, no payload requests allowed,
until PMP driver enable port. ATA XPT negotiate transfer parameters,
periph driver configure caching and so on.
- Frozen requests are no more counted by request allocation scheduler.
It fixes deadlocks, when frozen low priority payload requests occupying
slots, required by higher levels to manage theit execution.
- Two last changes were holding proper ATA reinitialization and error
recovery implementation. Now it is done: SATA controllers and Port
Multipliers now implement automatic hot-plug and should correctly
recover from timeouts and bus resets.
- Improve SCSI error recovery for devices on buses without automatic sense
reporting, such as ATAPI or USB. For example, it allows CAM to wait, while
CD drive loads disk, instead of immediately return error status.
- Decapitalize diagnostic messages and make them more readable and sensible.
- Teach PMP driver to limit maximum speed on fan-out ports.
- Make boot wait for PMP scan completes, and make rescan more reliable.
- Fix pass driver, to return CCB to user level in case of error.
- Increase number of retries in cd driver, as device may return several UAs.


# 6c35bbee 19-Jan-2010 Alexander Motin <mav@FreeBSD.org>

MFC r201222:
Usually these controllers are able to automatically decode command code to
get required command protocol. But they have no idea about new commands,
such as DATA SET MANAGEMENT (TRIM). As soon as this info any way provided
by CAM, give controller specific instructions.


# 723bd8c6 29-Dec-2009 Alexander Motin <mav@FreeBSD.org>

Usually these controllers are able to automatically decode command code to
get required command protocol. But they have no idea about new commands,
such as DATA SET MANAGEMENT (TRIM). As soon as this info any way provided
by CAM, give controller specific instructions.


# 67c3bd26 09-Dec-2009 Alexander Motin <mav@FreeBSD.org>

MFC r200223:
Explicitly acknowledge MSI completion, as required by SiI3124 datasheet.
It makes MSI working there. Later (and cheaper) PCIe chips (3132/3531)
still randomly crashing system in few seconds of high MSI rates, generating
something inaporopriate, like NMI or "Fatal trap 30".


# 0d8f2099 09-Dec-2009 Alexander Motin <mav@FreeBSD.org>

MFC r200217:
SiI3124 has no SNotification register. Handle Asynchronous Notifications
there without it as good as possible.


# 1535d59d 09-Dec-2009 Alexander Motin <mav@FreeBSD.org>

Increase Max Read Request Size for PCIe chips from 512 to 1024 bytes.
It gives those beasts additional 10% of write bandwidth.


# 30053681 07-Dec-2009 Alexander Motin <mav@FreeBSD.org>

Explicitly acknowledge MSI completion, as required by SiI3124 datasheet.
It makes MSI working there. Later (and cheaper) PCIe chips (3132/3531)
still randomly crashing system in few seconds of high MSI rates, generating
something inaporopriate, like NMI or "Fatal trap 30".


# d095fa04 07-Dec-2009 Alexander Motin <mav@FreeBSD.org>

SiI3124 has no SNotification register. Handle Asynchronous Notifications
there without it as good as possible.


# 03b5c374 02-Dec-2009 Alexander Motin <mav@FreeBSD.org>

MFC r199747, r199799, r199821:
- Extend XPT-SIM transfer settings control API. Now it allows to report to
SATA SIM number of tags supported by each device, implement ATA mode and
SATA revision negotiation for both SATA and PATA SIMs.
- Make ahci(4) and siis(4) to use submitted maximum tag number, when
scheduling requests. It allows to support NCQ on devices with lower tags
count then controller supports.
- Make PMP driver to report attached devices connection speeds.
- Implement ATA mode negotiation between user settings, device and
controller capabilities.
- Improve ATA mode/SATA revision control.


# b447e682 26-Nov-2009 Alexander Motin <mav@FreeBSD.org>

MFp4:
Improve ATA mode/SATA revision control.


# c8039fc6 23-Nov-2009 Alexander Motin <mav@FreeBSD.org>

MFp4:
- Extend XPT-SIM transfer settings control API. Now it allows to report to
SATA SIM number of tags supported by each device, implement ATA mode and
SATA revision negotiation for both SATA and PATA SIMs.
- Make ahci(4) and siis(4) to use submitted maximum tag number, when
scheduling requests. It allows to support NCQ on devices with lower tags
count then controller supports.
- Make PMP driver to report attached devices connection speeds.
- Implement ATA mode negotiation between user settings, device and
controller capabilities.


# 7c1a88d4 17-Nov-2009 Alexander Motin <mav@FreeBSD.org>

MFC r199333:
Do not require payload data to be aligned. It is not mentioned in datasheet
and works fine in practice.


# 99695a07 17-Nov-2009 Alexander Motin <mav@FreeBSD.org>

MFC r199178:
- Move tagged queueing control from ADA to ATA XPT. It allows to control
device command queue length correctly. First step to support < 32 tags.
- Limit queue for non-tagged devices by 2 slots for ahci(4) and siis(4).
- Implement quirk matching for ATA devices.
- Move xpt_schedule_dev_sendq() from header to source file.
- Move delayed queue shrinking to the more expected place - element freeing.
- Remove some SCSIsms in ATA.


# f629df57 17-Nov-2009 Alexander Motin <mav@FreeBSD.org>

MFC r199132:
Organize device IDs and add some more of them.


# ecc2f2f4 17-Nov-2009 Alexander Motin <mav@FreeBSD.org>

MFC r198896:
Do not unarm callout on request completion and change slot selection
algorithm as done in ahci(4). This saves some CPU time on high request
rates.


# d54c3c63 17-Nov-2009 Alexander Motin <mav@FreeBSD.org>

MFC r198852:
- Rework timeout handling, to make it more graceful for devices sharing
controller port (with PMP). Wait for other commands completion/timeout
before initiating recovery.
- Handle timeouts and fatal errors with port hard-reset. The rest of
recovery will be done by XPT on receiving async event. More gracefull
per-device soft-reset recovery can be implemented later.


# e587ad07 17-Nov-2009 Alexander Motin <mav@FreeBSD.org>

MFC r198426:
Reimplement device reset sequence in more controller-specific way.


# 2ab5a453 17-Nov-2009 Alexander Motin <mav@FreeBSD.org>

MFC r198321
Freeze device queue on error to permit periph driver to do proper recovery.


# 01007372 17-Nov-2009 Alexander Motin <mav@FreeBSD.org>

MFC r197838:
On command timeout handle frozen command first, to not run it inside
XXX_end_transaction().


# db581aa0 17-Nov-2009 Alexander Motin <mav@FreeBSD.org>

MFC r198322:
Report real max_target = 15. SIM doesn't need to know that target 15 is PMP.
It is XPT business.


# 5319fb62 16-Nov-2009 Alexander Motin <mav@FreeBSD.org>

Do not require payload data to be aligned. It is not mentioned in datasheet
and works fine in practice.


# 30a4094f 11-Nov-2009 Alexander Motin <mav@FreeBSD.org>

MFp4:
- Move tagged queueing control from ADA to ATA XPT. It allows to control
device command queue length correctly. First step to support < 32 tags.
- Limit queue for non-tagged devices by 2 slots for ahci(4) and siis(4).
- Implement quirk matching for ATA devices.
- Move xpt_schedule_dev_sendq() from header to source file.
- Move delayed queue shrinking to the more expected place - element freeing.
- Remove some SCSIsms in ATA.


# 03a6387e 10-Nov-2009 Alexander Motin <mav@FreeBSD.org>

MFp4:
Organize device IDs and add some more of them.


# c82b245a 04-Nov-2009 Alexander Motin <mav@FreeBSD.org>

Do not unarm callout on request completion and change slot selection
algorithm as done in ahci(4). This saves some CPU time on high request
rates.


# 6f9a51c7 02-Nov-2009 Alexander Motin <mav@FreeBSD.org>

MFp4:
- Rework timeout handling, to make it more graceful for devices sharing
controller port (with PMP). Wait for other commands completion/timeout
before initiating recovery.
- Handle timeouts and fatal errors with port hard-reset. The rest of
recovery will be done by XPT on receiving async event. More gracefull
per-device soft-reset recovery can be implemented later.


# 27acd6ea 23-Oct-2009 Alexander Motin <mav@FreeBSD.org>

Reimplement device reset sequence in more controller-specific way.


# 8e7cccb3 21-Oct-2009 Alexander Motin <mav@FreeBSD.org>

MFp4:
Report real max_target = 15. SIM doesn't need to know that target 15 is PMP.
It is XPT business.


# e06db192 20-Oct-2009 Alexander Motin <mav@FreeBSD.org>

MFp4:
Freeze device queue on error to permit periph driver to do proper recovery.


# 660d482a 07-Oct-2009 Alexander Motin <mav@FreeBSD.org>

On command timeout handle frozen command first, to not run it inside
XXX_end_transaction().

Submitted by: avg


# 088705a8 01-Sep-2009 Alexander Motin <mav@FreeBSD.org>

MFC r196655:
Update siis driver:
- Add SNTF support.
- Do not report meaningless transport/protocol versions.

Approved by: re (ATA-CAM blanket)


# 35713642 30-Aug-2009 Alexander Motin <mav@FreeBSD.org>

MFp4:
- Add SNTF support.
- Do not report meaningless transport/protocol versions.


# 67b87e44 20-Jul-2009 Alexander Motin <mav@FreeBSD.org>

Add `siis` CAM driver for SiliconImage SiI3124/3132/3531 SATA2 controllers.

Driver supports Serial ATA and ATAPI devices, Port Multipliers
(including FIS-based switching), hardware command queues (31 command
per port) and Native Command Queuing. This is probably the second on
popularity, after AHCI, type of SATA2 controllers, that benefits from
using CAM, because of hardware command queuing support.

Approved by: re (kib)