315813 |
23-Mar-2017 |
mav |
MFC r311305 (by asomers): 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 |
281140 |
06-Apr-2015 |
mav |
MFC r280393: 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. |
280276 |
20-Mar-2015 |
mav |
MFC r279963: Fix SATA Gen3 speed constants. |
275982 |
21-Dec-2014 |
smh |
MFC r274819: Prevent overflow issues in timeout processing
MFC r274852: Fix build with asr driver
Sponsored by: Multiplay |
260387 |
07-Jan-2014 |
scottl |
MFC Alexander Motin's direct dispatch, multi-queue, and finer-grained locking support for CAM
r256826: Fix several target mode SIMs to not blindly clear ccb_h.flags field of ATIO CCBs. Not all CCB flags there belong to them.
r256836: Remove hard limit on number of BIOs handled with one ATA TRIM request.
r256843: 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.
r256888: Unconditionally acquire periph reference on CCB allocation failure.
r256895: Fix memory and references leak due to unfreed path.
r256960: Move CAM_UNQUEUED_INDEX setting to the last moment and under the periph lock. This fixes race condition with cam_periph_ccbwait(), causing use-after-free.
r256975: Minor (mostly cosmetical) addition to r256960.
r257054: Some microoptimizations for da and ada drivers: - Replace ordered_tag_count counter with single flag; - From da remove outstanding_cmds counter, duplicating pending_ccbs list; - From da_softc remove unused links field.
r257482: Fix lock recursion, triggered by `smartctl -a /dev/adaX`.
r257501: Make getenv_*() functions and respectively TUNABLE_*_FETCH() macros not allocate memory and so not require sleepable environment. getenv() has already used on-stack temporary storage, so just use it more rationally. getenv_string() receives buffer as argument, so don't need another one.
r257914: Some CAM locks polishing: - Fix LOR and possible lock recursion when handling high-power commands. Introduce new lock to protect left power quota and list of frozen devices. - Correct locking around xpt periph creation. - Remove seems never used XPT_FLAG_OPEN xpt periph flag.
Again, Netflix assisted with testing the merge, but all of the credit goes to Alexander and iX Systems.
Submitted by: mav Sponsored by: iX Systems |
256281 |
10-Oct-2013 |
gjb |
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation
|
249622 |
18-Apr-2013 |
mav |
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
|
248522 |
19-Mar-2013 |
kib |
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)
|
246713 |
12-Feb-2013 |
kib |
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>)
|
236847 |
10-Jun-2012 |
mav |
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
|
236666 |
06-Jun-2012 |
mav |
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.
|
235333 |
12-May-2012 |
mav |
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
|
227849 |
22-Nov-2011 |
hselasky |
Rename device_delete_all_children() into device_delete_children().
Suggested by: jhb @ and marius @ MFC after: 1 week
|
227701 |
19-Nov-2011 |
hselasky |
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
|
227293 |
07-Nov-2011 |
ed |
Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.
This means that their use is restricted to a single C file.
|
222285 |
25-May-2011 |
mav |
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.
|
220830 |
19-Apr-2011 |
mav |
Fix some English grammar.
|
220829 |
19-Apr-2011 |
mav |
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.
|
220822 |
19-Apr-2011 |
mav |
Properly handle memory allocation errors during error recovery.
|
220602 |
13-Apr-2011 |
mav |
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.
|
220591 |
13-Apr-2011 |
mav |
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.
|
220566 |
12-Apr-2011 |
mav |
Implement automatic SCSI sense fetching for siis(4).
Fix device freeze leak on recovery request (READ LOG, REQUEST SENSE) failure.
|
217883 |
26-Jan-2011 |
mav |
Add missing part of r217877.
|
217877 |
26-Jan-2011 |
mav |
Hardware supported by siis(4) allows software control over activity LEDs. Expose that functionality to led(4) OR-ing it with regular LED activity.
|
214988 |
08-Nov-2010 |
mav |
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.
|
214325 |
25-Oct-2010 |
mav |
Add missing mtx_destroy() on channel attach failure.
|
212732 |
16-Sep-2010 |
mav |
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
|
210471 |
25-Jul-2010 |
mav |
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.
|
208817 |
05-Jun-2010 |
mav |
Plug memory leak to silent Coverity. Error is still not really handled.
Found with: Coverity Prevent(tm) CID: 4196
|
208816 |
05-Jun-2010 |
mav |
Fix attach errors handling.
Found with: Coverity Prevent(tm) CID: 3477
|
208414 |
22-May-2010 |
mav |
Fill rman range start/end values. It makes devinfo output more readable.
|
208410 |
22-May-2010 |
mav |
Report ATA/SATA channel number to NewBus at location string.
|
208393 |
21-May-2010 |
mav |
Improve suspend/resume support. Make sure controller is idle on suspend and reset it on resume.
|
207499 |
02-May-2010 |
mav |
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.
|
207431 |
30-Apr-2010 |
mav |
Add Target/LUN ID checks and deny access to targets 1-14 when PMP absent.
|
206652 |
15-Apr-2010 |
mav |
Explicitly enable PCI busmastering on attach. Now SiI3124 with siis(4) successfully works on sparc64 (SunBlade 100).
H/W donated by: Gheorghe Ardelean
|
205358 |
20-Mar-2010 |
mav |
Enable MSI by default for SiI3124.
|
203870 |
14-Feb-2010 |
mav |
MFp4: After last running command completed, give commands in timeout state second time.
|
203529 |
05-Feb-2010 |
mav |
Use new helper functions to set PCIe max read request size.
|
203376 |
02-Feb-2010 |
mav |
- 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.
|
203165 |
29-Jan-2010 |
mav |
Reset port on disconnect event, to abort any running requests.
|
203108 |
28-Jan-2010 |
mav |
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.
|
201222 |
29-Dec-2009 |
mav |
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.
|
200291 |
09-Dec-2009 |
mav |
Increase Max Read Request Size for PCIe chips from 512 to 1024 bytes. It gives those beasts additional 10% of write bandwidth.
|
200223 |
07-Dec-2009 |
mav |
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".
|
200217 |
07-Dec-2009 |
mav |
SiI3124 has no SNotification register. Handle Asynchronous Notifications there without it as good as possible.
|
199821 |
26-Nov-2009 |
mav |
MFp4: Improve ATA mode/SATA revision control.
|
199747 |
24-Nov-2009 |
mav |
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.
|
199333 |
16-Nov-2009 |
mav |
Do not require payload data to be aligned. It is not mentioned in datasheet and works fine in practice.
|
199178 |
11-Nov-2009 |
mav |
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.
|
199132 |
10-Nov-2009 |
mav |
MFp4: Organize device IDs and add some more of them.
|
198896 |
04-Nov-2009 |
mav |
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.
|
198852 |
03-Nov-2009 |
mav |
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.
|
198426 |
23-Oct-2009 |
mav |
Reimplement device reset sequence in more controller-specific way.
|
198322 |
21-Oct-2009 |
mav |
MFp4: Report real max_target = 15. SIM doesn't need to know that target 15 is PMP. It is XPT business.
|
198321 |
21-Oct-2009 |
mav |
MFp4: Freeze device queue on error to permit periph driver to do proper recovery.
|
197838 |
07-Oct-2009 |
mav |
On command timeout handle frozen command first, to not run it inside XXX_end_transaction().
Submitted by: avg
|
196655 |
30-Aug-2009 |
mav |
MFp4: - Add SNTF support. - Do not report meaningless transport/protocol versions.
|
195801 |
21-Jul-2009 |
mav |
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)
|