De-spl mly(4).The driver already has mutex locking and holds its per-softc lock acrosscalls to the one function that still used splcam().
sys/dev: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - error
sys/dev: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - errorprone - task.The Software Package Data Exchange (SPDX) group provides a specificationto make it easier for automated tools to detect and summarize well knownopensource licenses. We are gradually adopting the specification, notingthat the tags are considered only advisory and do not, in any way,superceed or replace the license texts.
show more ...
Fix a NULL pointer dereference in mly_user_command().If mly_user_command fails to allocate a command slot it jumps to an 'out'label used for error handling. The error handling code checks for a d
Fix a NULL pointer dereference in mly_user_command().If mly_user_command fails to allocate a command slot it jumps to an 'out'label used for error handling. The error handling code checks for a databuffer in 'mc->mc_data' to free before checking if 'mc' is NULL. Fix byjust returning directly if we fail to allocate a command and only usingthe 'out' label for subsequent errors when there is actual cleanup toperform.PR: 217747Reported by: PVS-StudioReviewed by: emasteMFC after: 1 week
In the same vein as r311350, fix whitespace in handling of XPT_PATH_INQ inseveral more drivers.Sponsored by: Panasas
Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name)The sim_vid, hba_vid, and dev_name fields of struct ccb_pathinq arefixed-length strings. AFAICT the only place they're read is insbin/c
Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name)The sim_vid, hba_vid, and dev_name fields of struct ccb_pathinq arefixed-length strings. AFAICT the only place they're read is insbin/camcontrol/camcontrol.c, which assumes they'll be null-terminated.However, the kernel doesn't null-terminate them. A bunch of copy-pasted codeuses strncpy to write them, and doesn't guarantee null-termination. For atleast 4 drivers (mpr, mps, ciss, and hyperv), the hba_vid field actuallyoverflows. You can see the result by doing "camcontrol negotiate da0 -v".This change null-terminates those fields everywhere they're set in thekernel. It also shortens a few strings to ensure they'll fit within the16-character field.PR: 215474Reported by: CoverityCID: 1009997 1010000 1010001 1010002 1010003 1010004 1010005CID: 1331519 1010006 1215097 1010007 1288967 1010008 1306000CID: 1211924 1010009 1010010 1010011 1010012 1010013 1010014CID: 1147190 1010017 1010016 1010018 1216435 1010020 1010021CID: 1010022 1009666 1018185 1010023 1010025 1010026 1010027CID: 1010028 1010029 1010030 1010031 1010033 1018186 1018187CID: 1010035 1010036 1010042 1010041 1010040 1010039Reviewed by: imp, sephe, slmMFC after: 4 weeksSponsored by: Spectra Logic CorpDifferential Revision: https://reviews.freebsd.org/D9037Differential Revision: https://reviews.freebsd.org/D9038
sys/dev: minor spelling fixes.Most affect comments, very few have user-visible effects.
Remove MAXBSIZE use from drivers where it has nothing to do.In some cases limits are just not needed, in others -- DFLTPHYS is theright constant to use instead.MFC after: 1 month
Add locking to mly(4) and mark MPSAFE.- Add a per-softc mutex.- Use mutex as CAM sim lock.- Use taskqueue_thread instead of taskqueue_swi_giant.- Use callout(9) instead of timeout(9).- Use bus_*
Add locking to mly(4) and mark MPSAFE.- Add a per-softc mutex.- Use mutex as CAM sim lock.- Use taskqueue_thread instead of taskqueue_swi_giant.- Use callout(9) instead of timeout(9).- Use bus_*() instead of bus_space_*().Tested by: no one
Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCIcommand register. The lazy BAR allocation code in FreeBSD sometimesdisables this bit when it detects a range conflict, and w
Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCIcommand register. The lazy BAR allocation code in FreeBSD sometimesdisables this bit when it detects a range conflict, and will re-enableit on demand when a driver allocates the BAR. Thus, the bit is no longera reliable indication of capability, and should not be checked. Thisresults in the elimination of a lot of code from drivers, and also givesthe opportunity to simplify a lot of drivers to use a helper API to setthe busmaster enable bit.This changes fixes some recent reports of disk controllers and theirassociated drives/enclosures disappearing during boot.Submitted by: jhbReviewed by: jfv, marius, achadd, achimMFC after: 1 day
MFprojects/camlock r248982:Stop abusing xpt_periph in random plases that really have no periph relatedto CCB, for example, bus scanning. NULL value is fine in such cases and itis correctly logged
MFprojects/camlock r248982:Stop abusing xpt_periph in random plases that really have no periph relatedto CCB, for example, bus scanning. NULL value is fine in such cases and itis correctly logged in debug messages as "noperiph". If at some point weneed some real XPT periphs (alike to pmpX now), quite likely they will beper-bus, and not a single global instance as xpt_periph now.
Reform the busdma API so that new types may be added without modifyingevery architecture's busdma_machdep.c. It is done by unifying thebus_dmamap_load_buffer() routines so that they may be called
Reform the busdma API so that new types may be added without modifyingevery architecture's busdma_machdep.c. It is done by unifying thebus_dmamap_load_buffer() routines so that they may be called from MIcode. The MD busdma is then given a chance to do any final processingin the complete() callback.The cam changes unify the bus_dmamap_load* handling in cam drivers.The arm and mips implementations are updated to track virtualaddresses for sync(). Previously this was done in a type specificway. Now it is done in a generic way by recording the list ofvirtuals 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 <[email protected]>)
Remove bogus break statements.Obtained from: DragonFly
Convert a number of drivers to obtaining their parent DMA tag from theirPCI device attachment.
Add descriptor sense support to CAM, and honor sense residuals properly inCAM.Desriptor sense is a new sense data format that originated in SPC-3. Amongother things, it allows for an 8-byte info
Add descriptor sense support to CAM, and honor sense residuals properly inCAM.Desriptor sense is a new sense data format that originated in SPC-3. Amongother things, it allows for an 8-byte info field, which is necessary topass back block numbers larger than 4 bytes.This change adds a number of new functions to scsi_all.c (and thereforelibcam) that abstract out most access to sense data.This includes a bump of CAM_VERSION, because the CCB ABI has changed.Userland programs that use the CAM pass(4) driver will need to berecompiled.camcontrol.c: Change uses of scsi_extract_sense() to use scsi_extract_sense_len(). Use scsi_get_sks() instead of accessing sense key specific data directly.scsi_modes: Update the control mode page to the latest version (SPC-4).scsi_cmds.c,scsi_target.c: Change references to struct scsi_sense_data to struct scsi_sense_data_fixed. This should be changed to allow the user to specify fixed or descriptor sense, and then use scsi_set_sense_data() to build the sense data.ps3cdrom.c: Use scsi_set_sense_data() instead of setting sense data manually.cam_periph.c: Use scsi_extract_sense_len() instead of using scsi_extract_sense() or accessing sense data directly.cam_ccb.h: Bump the CAM_VERSION from 0x15 to 0x16. The change of struct scsi_sense_data from 32 to 252 bytes changes the size of struct ccb_scsiio, but not the size of union ccb. So the version must be bumped to prevent structure mis-matches.scsi_all.h: Lots of updated SCSI sense data and other structures. Add function prototypes for the new sense data functions. Take out the inline implementation of scsi_extract_sense(). It is now too large to put in a header file. Add macros to calculate whether fields are present and filled in fixed and descriptor sense datascsi_all.c: In scsi_op_desc(), allow the user to pass in NULL inquiry data, and we'll assume a direct access device in that case. Changed the SCSI RESERVED sense key name and description to COMPLETED, as it is now defined in the spec. Change the error recovery action for a number of read errors to prevent lots of retries when the drive has said that the block isn't accessible. This speeds up reconstruction of the block by any RAID software running on top of the drive (e.g. ZFS). In scsi_sense_desc(), allow for invalid sense key numbers. This allows calling this routine without checking the input values first. Change scsi_error_action() to use scsi_extract_sense_len(), and handle things when invalid asc/ascq values are encountered. Add a new routine, scsi_desc_iterate(), that will call the supplied function for every descriptor in descriptor format sense data. Add scsi_set_sense_data(), and scsi_set_sense_data_va(), which build descriptor and fixed format sense data. They currently default to fixed format sense data. Add a number of scsi_get_*() functions, which get different types of sense data fields from either fixed or descriptor format sense data, if the data is present. Add a number of scsi_*_sbuf() functions, which print formatted versions of various sense data fields. These functions work for either fixed or descriptor sense. Add a number of scsi_sense_*_sbuf() functions, which have a standard calling interface and print the indicated field. These functions take descriptors only. Add scsi_sense_desc_sbuf(), which will print a formatted version of the given sense descriptor. Pull out a majority of the scsi_sense_sbuf() function and put it into scsi_sense_only_sbuf(). This allows callers that don't use struct ccb_scsiio to easily utilize the printing routines. Revamp that function to handle descriptor sense and use the new sense fetching and printing routines. Move scsi_extract_sense() into scsi_all.c, and implement it in terms of the new function, scsi_extract_sense_len(). The _len() version takes a length (which should be the sense length - residual) and can indicate which fields are present and valid in the sense data. Add a couple of new scsi_get_*() routines to get the sense key, asc, and ascq only.mly.c: Rename struct scsi_sense_data to struct scsi_sense_data_fixed.sbp_targ.c: Use the new sense fetching routines to get sense data instead of accessing it directly.sbp.c: Change the firewire/SCSI sense data transformation code to use struct scsi_sense_data_fixed instead of struct scsi_sense_data. This should be changed later to use scsi_set_sense_data().ciss.c: Calculate the sense residual properly. Use scsi_get_sense_key() to fetch the sense key.mps_sas.c,mpt_cam.c: Set the sense residual properly.iir.c: Use scsi_set_sense_data() instead of building sense data by hand.iscsi_subr.c: Use scsi_extract_sense_len() instead of grabbing sense data directly.umass.c: Use scsi_set_sense_data() to build sense data. Grab the sense key using scsi_get_sense_key(). Calculate the sense residual properly.isp_freebsd.h: Use scsi_get_*() routines to grab asc, ascq, and sense key values. Calculate and set the sense residual.MFC after: 3 daysSponsored by: Spectra Logic Corporation
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 duplicatecode from many
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 duplicatecode 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 thatare 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 ofrequests priorities was extended. Priorities now split between several"run levels". Device can be freezed at specified level, allowing higherpriority 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 occupyingslots, required by higher levels to manage theit execution.- Two last changes were holding proper ATA reinitialization and errorrecovery implementation. Now it is done: SATA controllers and PortMultipliers now implement automatic hot-plug and should correctlyrecover from timeouts and bus resets.- Improve SCSI error recovery for devices on buses without automatic sensereporting, such as ATAPI or USB. For example, it allows CAM to wait, whileCD 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.
Spell "Hz" correctly wherever it is user-visible.PR: bin/142566Submitted by: N.J. Mann njm njm.me.ukApproved by: ed (mentor)MFC after: 2 weeks
Put mly_timeout() under MLY_DEBUG, so that newer GCC versions don'tcomplain about unused static function.Reviewed by: scottl
Convert mlx(4) and mly(4) to si_drv1 instead of dev2unit().
Replace all calls to minor() with dev2unit().After I removed all the unit2minor()/minor2unit() calls from the kernelyesterday, I realised calling minor() everywhere is quite confusing.Character d
Replace all calls to minor() with dev2unit().After I removed all the unit2minor()/minor2unit() calls from the kernelyesterday, I realised calling minor() everywhere is quite confusing.Character devices now only have the ability to store a unit number, nota minor number. Remove the confusion by using dev2unit() everywhere.This commit could also be considered as a bug fix. A lot of drivers callminor(), while they should actually be calling dev2unit(). In -CURRENTthis isn't a problem, but it turns out we never had any problem reportsrelated to that issue in the past. I suspect not many people connectmore than 256 pieces of the same hardware.Reviewed by: kib
Prepare for future integration between CAM and newbus. xpt_bus_registernow takes a device_t to be the parent of the bus that is being created.Most SIMs have been updated with a reasonable argument
Prepare for future integration between CAM and newbus. xpt_bus_registernow takes a device_t to be the parent of the bus that is being created.Most SIMs have been updated with a reasonable argument, but a few exceptionsjust pass NULL for now. This argument isn't used yet and the newbusintegration likely won't be ready until after 7.0-RELEASE.
Remove Giant from CAM. Drivers (SIMs) now register a mutex that CAM willuse to synchornize and protect all data objects that are used for thatSIM. Drivers that are not yet MPSAFE register Giant a
Remove Giant from CAM. Drivers (SIMs) now register a mutex that CAM willuse to synchornize and protect all data objects that are used for thatSIM. Drivers that are not yet MPSAFE register Giant and operate asusual. RIght now, no drivers are MPSAFE, though a few will be changedin the coming week as this work settles down.The driver API has changed, so all CAM drivers will need to be recompiled.The userland API has not changed, so tools like camcontrol do not need tobe recompiled.
o break newbus api: add a new argument of type driver_filter_t to bus_setup_intr()o add an int return code to all fast handlerso retire INTR_FAST/IH_FASTFor more info: http://docs.freebsd.org
o break newbus api: add a new argument of type driver_filter_t to bus_setup_intr()o add an int return code to all fast handlerso retire INTR_FAST/IH_FASTFor more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-currentReviewed by: manyApproved by: re@
Add MODULE_DEPENDS for cam, pci, mca, eisa and isa where needed.PR: 106543MFC after: 3 days
2nd and final commit that moves us to CAM_NEW_TRAN_CODEas the default.Reviewed by multitudes.
The first of 3 major steps to move the CAM layer forward to usingthe CAM_NEW_TRAN_CODE that has been in the tree for some years now.This first step consists solely of adding to or correctingCAM_N
The first of 3 major steps to move the CAM layer forward to usingthe CAM_NEW_TRAN_CODE that has been in the tree for some years now.This first step consists solely of adding to or correctingCAM_NEW_TRAN_CODE pieces in the kernel source tree suchthat a both a GENERIC (at least on i386) and a LINT buildwith CAM_NEW_TRAN_CODE as an option will compile correctlyand run (at least with some the h/w I have).After a short settle time, the other pieces (makingCAM_NEW_TRAN_CODE the default and updating libcamand camcontrol) will be brought in.This will be an incompatible change in that the size of structuresrelated to XPT_PATH_INQ and XPT_{GET,SET}_TRAN_SETTINGS changein both size and content. However, basic system operation andbasic system utilities work well enough with this change.Reviewed by: freebsd-scsi and specific stakeholders
123