#
267654 |
|
19-Jun-2014 |
gjb |
Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
257050 |
|
24-Oct-2013 |
mav |
MFC r256552: Unify periph invalidation and destruction reporting. Print message containing device model and serial number on invalidation.
|
#
256216 |
|
09-Oct-2013 |
mav |
MFC r249466, r249481, r250025: Remove multilevel freezing mechanism, implemented to handle specifics of the ATA/SATA error recovery, when post-reset recovery commands should be allocated when queues are already full of payload requests. Instead of removing frozen CCBs with specified range of priorities from the queue to provide free openings, use simple hack, allowing explicit CCBs over- allocation for requests with priority higher (numerically lower) then CAM_PRIORITY_OOB threshold.
Simplify CCB allocation logic by removing SIM-level allocation queue. After that SIM-level queue manages only CCBs execution, while allocation logic is localized within each single device.
|
#
251897 |
|
18-Jun-2013 |
scottl |
Merge the second part of the unmapped I/O changes. This enables the infrastructure in the block layer and UFS filesystem as well as a few drivers. The list of MFC revisions is long, so I won't quote changelogs.
r248508,248510,248511,248512,248514,248515,248516,248517,248518, 248519,248520,248521,248550,248568,248789,248790,249032,250936
Submitted by: kib Approved by: kib Obtained from: Netflix
|
#
251386 |
|
04-Jun-2013 |
smh |
MFC r250792: Added output of device QUIRKS for CAM and AHCI devices during boot.
|
#
249615 |
|
18-Apr-2013 |
mav |
MFC r249106: Replace some direct mutex operations with wrappers.
|
#
249614 |
|
18-Apr-2013 |
mav |
MFC r249105: Remove extra NULL checks. d_drv1 can never be NULL during periph life cycle.
|
#
249158 |
|
05-Apr-2013 |
mav |
MFC r245310: - Add missig xpt_schedule() call for cases when requested immediate CCB priority is lower then payload/TUR one.
- Reduce TUR priority and avoid sending them if there are any other outstanding commands, alike to DA driver.
|
#
249152 |
|
05-Apr-2013 |
mav |
MFC r238886, r238892: Implement media change notification for DA and CD removable media devices. It includes three parts: 1) Modifications to CAM to detect media media changes and report them to disk(9) layer. For modern SATA (and potentially UAS) devices it utilizes Asynchronous Notification mechanism to receive events from hardware. Active polling with TEST UNIT READY commands with 3 seconds period is used for incapable hardware. After that both CD and DA drivers work the same way, detecting two conditions: "NOT READY: Medium not present" after medium was detected previously, and "UNIT ATTENTION: Not ready to ready change, medium may have changed". First one reported to disk(9) as media removal, second as media insert/change. To reliably receive second event new AC_UNIT_ATTENTION async added to make UAs broadcasted to all periphs by generic error handling code in cam_periph_error(). 2) Modifications to GEOM core to handle media remove and change events. Media removal handled by spoiling all consumers attached to the provider. Media change event also schedules provider retaste after spoiling to probe new media. New flag G_CF_ORPHAN was added to consumers to reflect that consumer is in process of destruction. It allows retaste to create new geom instance of the same class, while previous one is still dying. 3) Modifications to some GEOM classes: DEV -- to report media change events to devd; PART class already handles spoiling alike to orphan.
|
#
249135 |
|
05-Apr-2013 |
mav |
MFC r237689 (by imp): Add a sysctl to set the cdrom timeout. Data recovery operations from a CD or DVD drive with a damaged disc often benefit from a shorter timeout. Also, when retries are set to 0, an application is expecting errors and recovering them so do not print the error into the log. The number of expected errors can literally be in the hundreds of thousands which significantly slows data recovery.
|
#
249134 |
|
05-Apr-2013 |
mav |
MFC r237478: Add scsi_extract_sense_ccb() -- wrapper around scsi_extract_sense_len(). It allows to remove number of duplicate checks from several places.
|
#
249132 |
|
05-Apr-2013 |
mav |
MFC r227293 (by ed): Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.
This means that their use is restricted to a single C file.
|
#
248085 |
|
09-Mar-2013 |
marius |
MFC: r227309 (partial)
Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.
The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static.
|
#
241939 |
|
23-Oct-2012 |
mav |
MFC r241410: There are SCSI conditions that are not an errors. In those cases cderror() returns zero while request status is not CAM_REQ_CMP. That could cause partial device attach or other unexpected results.
|
#
241937 |
|
23-Oct-2012 |
mav |
MFC r241404: Remove 'periph == NULL' check from bunch of periph drivers. This condition can never be true as functions are called from single place and the checks just pollute the code and confuse Clang Static Analyzer.
|
#
240919 |
|
25-Sep-2012 |
tijl |
MFC r240701:
Fix a panic when trying to play invalid audio tracks.
PR: kern/167340 Reported by: Michael L. Semon <mlsemon35 gmail com>
|
#
237873 |
|
01-Jul-2012 |
ken |
MFC 237518, 237545, 237648:
r237518 | ken | 2012-06-23 22:29:03 -0600 (Sat, 23 Jun 2012) | 72 lines
Fix a bug which causes a panic in daopen(). The panic is caused by a da(4) instance going away while GEOM is still probing it.
In this case, the GEOM disk class instance has been created by disk_create(), and the taste of the disk is queued in the GEOM event queue.
While that event is queued, the da(4) instance goes away. When the open call comes into the da(4) driver, it dereferences the freed (but non-NULL) peripheral pointer provided by GEOM, which results in a panic.
The solution is to add a callback to the GEOM disk code that is called when all of its resources are cleaned up. This is implemented inside GEOM by adding an optional callback that is called when all consumers have detached from a provider, and the provider is about to be deleted.
scsi_cd.c, scsi_da.c: In the register routine for the cd(4) and da(4) routines, acquire a reference to the CAM peripheral instance just before we call disk_create().
Use the new GEOM disk d_gone() callback to register a callback (dadiskgonecb()/cddiskgonecb()) that decrements the peripheral reference count once GEOM has finished cleaning up its resources.
In the cd(4) driver, clean up open and close behavior slightly. GEOM makes sure we only get one open() and one close call, so there is no need to set an open flag and decrement the reference count if we are not the first open.
In the cd(4) driver, use cam_periph_release_locked() in a couple of error scenarios to avoid extra mutex calls.
geom.h: Add a new, optional, providergone callback that is called when a provider is about to be deleted.
geom_disk.h: Add a new d_gone() callback to the GEOM disk interface.
Bump the DISK_VERSION to version 2. This probably should have been done after a couple of previous changes, especially the addition of the d_getattr() callback.
geom_disk.c: Add a providergone callback for the disk class, g_disk_providergone(), that calls the user's d_gone() callback if it exists.
Bump the DISK_VERSION to 2.
geom_subr.c: In g_destroy_provider(), call the providergone callback if it has been provided.
In g_new_geomf(), propagate the class's providergone callback to the new geom instance.
blkfront.c: Callers of disk_create() are supposed to pass in DISK_VERSION, not an explicit disk API version number. Update the blkfront driver to do that.
disk.9: Update the disk(9) man page to include information on the new d_gone() callback, as well as the previously added d_getattr() callback, d_descr field, and HBA PCI ID fields.
r237545 | ken | 2012-06-24 22:26:10 -0600 (Sun, 24 Jun 2012) | 7 lines
Consume spare fields for the providergone pointers added to the g_class and g_geom structures in change 237518. The original change would have broken the ABI.
Suggested by: ae
r237648 | ken | 2012-06-27 10:05:09 -0600 (Wed, 27 Jun 2012) | 6 lines
In g_disk_providergone(), don't continue if the softc is NULL. This may be the case if we've already gone through g_disk_destroy().
Reported by: Michael Butler <imb@protected-networks.net>
|
#
237532 |
|
24-Jun-2012 |
mav |
MFC r237225: Remove never used CD/DA_FLAG_TAGGED_QUEUING flags.
|
#
237471 |
|
23-Jun-2012 |
mav |
MFC r237336: Remove unused error variables in cdclose() and daclose().
|
#
237469 |
|
23-Jun-2012 |
mav |
MFC r237335: Check status of cam_periph_hold() inside cdclose(). If cd device was invalidated while open, cam_periph_hold() will return error and won't get the reference. Following reference release will crash the system.
Sponsored by: iXsystems, Inc.
|
#
237305 |
|
20-Jun-2012 |
mav |
MFC r236602, r236613: Tune and add some missing CAM_DEBUG() points for better consistency.
|
#
230014 |
|
12-Jan-2012 |
mav |
MFC r228808, r228847, 229395:
r228808, r228847: Make cd driver to handle Audio CDs, reporting their 2352 bytes sectors to GEOM and using READ CD command for reading data, same as acd driver does. Audio CDs identified by checking respective bit of the control field of the first track in TOC.
229395: Add support for CDRIOCGETBLOCKSIZE and CDRIOCSETBLOCKSIZE IOCTLs to control sector size same as acd driver does. Together with r228808 and r228847 this allows existing multimedia/vlc to play Audio CDs via CAM cd driver.
PR: ports/162190 Sponsored by: iXsystems, Inc.
|
#
226067 |
|
06-Oct-2011 |
ken |
MFC r225950:
Add descriptor sense support to CAM, and honor sense residuals properly in CAM.
Desriptor sense is a new sense data format that originated in SPC-3. Among other things, it allows for an 8-byte info field, which is necessary to pass back block numbers larger than 4 bytes.
This change adds a number of new functions to scsi_all.c (and therefore libcam) 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 be recompiled.
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 data
scsi_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.
Approved by: re (kib) Sponsored by: Spectra Logic Corporation
|
#
225736 |
|
22-Sep-2011 |
kensmith |
Copy head to stable/9 as part of 9.0-RELEASE release cycle.
Approved by: re (implicit)
|
#
223557 |
|
25-Jun-2011 |
gibbs |
cam/scsi/scsi_cd.c: In cdregister(), hold the periph lock semaphore during changer probe/configuration. This removes a window where an open of the cd device may succeed before probe processing has completed.
|
#
221585 |
|
07-May-2011 |
avg |
scsi_cd: silence READ_TOC errors in CDIOREADTOCHEADER ioctl
An optical disk may not have a TOC (e.g. for blank media) and userland software may legitimately try to use CDIOREADTOCHEADER to find out about the TOC.
Silence from: scsi@ MFC after: 10 days
|
#
220686 |
|
16-Apr-2011 |
jh |
Move TUNABLE_INT_FETCH() out of the SIM lock to avoid sleeping while holding the lock. The fix is analogous to r220618 for ada(4).
Reviewed by: mav
|
#
220644 |
|
14-Apr-2011 |
mav |
Make CAM report devices with ATA/SATA transport to devstat(9) as IDE.
|
#
219056 |
|
26-Feb-2011 |
nwhitehorn |
Add the disk ident and a human-meaningful description (here, the disk model string) to the geom_disk config XML so that they are easily accessible from userland.
MFC after: 1 week
|
#
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.
|
#
208800 |
|
04-Jun-2010 |
avg |
scsi_cd: pass correct pointer to free()
Found with: Coverity Prevent(tm) CID: 2986 MFC after: 4 days
|
#
206651 |
|
15-Apr-2010 |
avg |
scsi_cd: CD_FLAG_VALID_MEDIA is sufficient to set d_sectorsize and d_mediasize
[Forced commit to correct PR number.] CD_FLAG_VALID_TOC is not required for setting those media properties.
PR: kern/138789 Submitted by: Juergen Lock <nox@jelal.kn-bremen.de> a slightly different version Tested by: Pavel Sukhoy <sukhoy@ripn.net>, Markus Wild <m.wild@cybernet.ch>, Juergen Lock <nox@jelal.kn-bremen.de>, uqs MFC after: 1 week
|
#
206648 |
|
15-Apr-2010 |
avg |
scsi_cd: CD_FLAG_VALID_MEDIA is sufficient to set d_sectorsize and d_mediasize
CD_FLAG_VALID_TOC is not required for setting those media properties.
PR: kern/145385 Submitted by: Juergen Lock <nox@jelal.kn-bremen.de> a slightly different version Tested by: Pavel Sukhoy <sukhoy@ripn.net>, Markus Wild <m.wild@cybernet.ch>, Juergen Lock <nox@jelal.kn-bremen.de>, uqs MFC after: 1 week
|
#
203931 |
|
15-Feb-2010 |
mav |
Make CD driver a bit more robust and predictable to unreported errors.
|
#
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.
|
#
200668 |
|
18-Dec-2009 |
mav |
Remove duplicate devstat_start_transaction_bio() call. It is already called from geom_disk. Dulicate call causes wrong queue depth and busy accounting.
|
#
200295 |
|
09-Dec-2009 |
mav |
Clear result before requesting XPT_PATH_INQ. Many SIMs doesn't fill maxio field yet.
|
#
200171 |
|
05-Dec-2009 |
mav |
MFp4: Introduce ATA_CAM kernel option, turning ata(4) controller drivers into cam(4) interface modules. When enabled, this options deprecates all ata(4) peripheral drivers (ad, acd, ...) and interfaces and allows cam(4) drivers (ada, cd, ...) and interfaces to be natively used instead.
As side effect of this, ata(4) mode setting code was completely rewritten to make controller API more strict and permit above change. While doing this, SATA revision was separated from PATA mode. It allows DMA-incapable SATA devices to operate and makes hw.ata.atapi_dma tunable work again.
Also allow ata(4) controller drivers (except some specific or broken ones) to handle larger data transfers. Previous constraint of 64K was artificial and is not really required by PCI ATA BM specification or hardware.
Submitted by: nwitehorn (powerpc part)
|
#
200036 |
|
02-Dec-2009 |
scottl |
Fix several cases where the periph lock was held over malloc.
Submitted by: Jaakko Heinonen
|
#
199279 |
|
14-Nov-2009 |
mav |
MFp4: Fix several device freeze counting bugs.
|
#
198382 |
|
23-Oct-2009 |
mav |
Replace most of priority numbers with defines. No logical changes.
|
#
196983 |
|
08-Sep-2009 |
scottl |
Free the correct buffer in an error case.
Submitted by: phk
|
#
196970 |
|
08-Sep-2009 |
phk |
Revert previous commit and add myself to the list of people who should know better than to commit with a cat in the area.
|
#
196969 |
|
08-Sep-2009 |
phk |
Add necessary include.
|
#
195534 |
|
10-Jul-2009 |
scottl |
Separate the parallel scsi knowledge out of the core of the XPT, and modularize it so that new transports can be created.
Add a transport for SATA
Add a periph+protocol layer for ATA
Add a driver for AHCI-compliant hardware.
Add a maxio field to CAM so that drivers can advertise their max I/O capability. Modify various drivers so that they are insulated from the value of MAXPHYS.
The new ATA/SATA code supports AHCI-compliant hardware, and will override the classic ATA driver if it is loaded as a module at boot time or compiled into the kernel. The stack now support NCQ (tagged queueing) for increased performance on modern SATA drives. It also supports port multipliers.
ATA drives are accessed via 'ada' device nodes. ATAPI drives are accessed via 'cd' device nodes. They can all be enumerated and manipulated via camcontrol, just like SCSI drives. SCSI commands are not translated to their ATA equivalents; ATA native commands are used throughout the entire stack, including camcontrol. See the camcontrol manpage for further details. Testing this code may require that you update your fstab, and possibly modify your BIOS to enable AHCI functionality, if available.
This code is very experimental at the moment. The userland ABI/API has changed, so applications will need to be recompiled. It may change further in the near future. The 'ada' device name may also change as more infrastructure is completed in this project. The goal is to eventually put all CAM busses and devices until newbus, allowing for interesting topology and management options.
Few functional changes will be seen with existing SCSI/SAS/FC drivers, though the userland ABI has still changed. In the future, transports specific modules for SAS and FC may appear in order to better support the topologies and capabilities of these technologies.
The modularization of CAM and the addition of the ATA/SATA modules is meant to break CAM out of the mold of being specific to SCSI, letting it grow to be a framework for arbitrary transports and protocols. It also allows drivers to be written to support discrete hardware without jeopardizing the stability of non-related hardware. While only an AHCI driver is provided now, a Silicon Image driver is also in the works. Drivers for ICH1-4, ICH5-6, PIIX, classic IDE, and any other hardware is possible and encouraged. Help with new transports is also encouraged.
Submitted by: scottl, mav Approved by: re
|
#
188503 |
|
11-Feb-2009 |
jhb |
Reorder dacleanup() and cdcleanup() slightly so that the sysctl context is freed while the periph lock is not held. While here, wait until after freeing the softc before reacquiring the periph lock.
Tested by: sbruno
|
#
188458 |
|
10-Feb-2009 |
jhb |
Adding dynamic sysctls no longer requires Giant.
Submitted by: rdivacky
|
#
186882 |
|
07-Jan-2009 |
imp |
Make it possible to override the number of retries for the CD media. When trying to read scratched or damaged CDs and DVDs, the default mechanism is sub-optimal. Programs like ddrescue do much better if you turn off retries entirely, since their algorithms are designed scan big areas fast, then winnow the areas down. Turning off retries speeds these programs up by as much as 20x, since the drive is able to 'stream past' many small errors...
The sysctl/tunable kern.cam.cd.retry_count controls this. That defaults to '4' (for a total of 5 attempts). Setting to 0 turns off all retry attempts.
Reviewed by: scottl@
|
#
186371 |
|
21-Dec-2008 |
scottl |
Fix refcount locking in cd, pass, and sg periphs.
|
#
171529 |
|
21-Jul-2007 |
kan |
Do not forget to cam_periph_unhold the peripheral before exiting due to error.
PR: kern/114636 Submitted by: Tijl Coosemans Approved by: re (hrs)
|
#
169605 |
|
16-May-2007 |
scottl |
Add a helper function for registering async callbacks. Besides eliminating a lot of duplicated code, this also fixes a locking edge case.
|
#
169562 |
|
14-May-2007 |
scottl |
Eliminate the use of M_TEMP.
|
#
168786 |
|
16-Apr-2007 |
scottl |
Drop the periph/sim lock when calling disk_destroy().
|
#
168752 |
|
15-Apr-2007 |
scottl |
Remove Giant from CAM. Drivers (SIMs) now register a mutex that CAM will use to synchornize and protect all data objects that are used for that SIM. Drivers that are not yet MPSAFE register Giant and operate as usual. RIght now, no drivers are MPSAFE, though a few will be changed in 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 to be recompiled.
|
#
164906 |
|
05-Dec-2006 |
mjacob |
Add an xpt_print function to reduce most of the xpt_print_path/printf pairs. Convert the core code to use it.
Reviewed by: scsi (various folks weighing in with good advice) MFC after: 2 weeks
|
#
160345 |
|
14-Jul-2006 |
delphij |
Drop Giant before returning in error path, thus eliminates two mutex leaks.
Submitted by: Beyond Luo <fedora ercist iscas ac cn> PR: kern/100046 Reviewed by: ken, scottl
|
#
157806 |
|
17-Apr-2006 |
maxim |
o Do not double i/o stats for cd(4) already acounted in g_disk_done().
PR: kern/95707 Submitted by: Andre Albsmeier Reviewed by: phk MFC after: 2 weeks
|
#
152565 |
|
18-Nov-2005 |
jdp |
Fix a bug that caused some /dev entries to continue to exist after the underlying drive had been hot-unplugged from the system. Here is a specific example. Filesystem code had opened /dev/da1s1e. Subsequently, the drive was hot-unplugged. This (correctly) caused all of the associated /dev/da1* entries to be deleted. When the filesystem later realized that the drive was gone it closed the device, reducing the write-access counts to 0 on the geom providers for da1s1e, da1s1, and da1. This caused geom to re-taste the providers, resulting in the devices being created again. When the drive was hot-plugged back in, it resulted in duplicate /dev entries for da1s1e, da1s1, and da1.
This fix adds a new disk_gone() function which is called by CAM when a drive goes away. It orphans all of the providers associated with the drive, setting an error condition of ENXIO in each one. In addition, we prevent a re-taste on last close for writing if an error condition has been set in the provider.
Sponsored by: Isilon Systems Reviewed by: phk MFC after: 1 week
|
#
144135 |
|
26-Mar-2005 |
ken |
Fix a problem with the cd(4) driver -- the CAMGETPASSTHRU ioctl wouldn't succeed if there was no media in the drive.
This was broken in rev 1.72 when the media check was added to cdioctl().
For now, check the ioctl group to decide whether to check for media or not. (We only need to check for media on CD-specific ioctls.)
Reported by: bland MFC after: 3 days
|
#
141031 |
|
30-Jan-2005 |
sobomax |
Boot away another stackgap (one of the lest ones in linuxlator/i386) by providing special version of CDIOCREADSUBCHANNEL ioctl(), which assumes that result has to be placed into kernel space not user space. In the long run more generic solution has to be designed WRT emulating various ioctl()s that operate on userspace buffers, but right now there is only one such ioctl() is emulated, so that it makes little sense.
MFC after: 2 weeks
|
#
139743 |
|
05-Jan-2005 |
imp |
Start each of the license/copyright comments with /*-
|
#
134824 |
|
05-Sep-2004 |
phk |
For removable devices without media we set a zero mediasize but a non-zero sectorsize in order to avoid a lot of checks around various divisions etc.
Enforce the sectorsize being > 0 with a KASSERT on successful open.
Fix scsi_cd.c to return 2k sectors when no media inserted.
|
#
125975 |
|
18-Feb-2004 |
phk |
Change the disk(9) API in order to make device removal more robust.
Previously the "struct disk" were owned by the device driver and this gave us problems when the device disappared and the users of that device were not immediately disappearing.
Now the struct disk is allocate with a new call, disk_alloc() and owned by geom_disk and just abandonned by the device driver when disk_create() is called.
Unfortunately, this results in a ton of "s/\./->/" changes to device drivers.
Since I'm doing the sweep anyway, a couple of other API improvements have been carried out at the same time:
The Giant awareness flag has been flipped from DISKFLAG_NOGIANT to DISKFLAG_NEEDSGIANT
A version number have been added to disk_create() so that we can detect, report and ignore binary drivers with old ABI in the future.
Manual page update to follow shortly.
|
#
121602 |
|
27-Oct-2003 |
ken |
In camperiphdone(), make sure we check for fatal errors and bail out instead of retrying them blindly.
This should fix some of the problems people have been having with cdrom drives taking a long time to probe. This should also eliminate the need for the initial TUR in cdsize().
cam_periph.c: Don't keep retrying if the error we get back is a fatal error. This should help us detect the transition from "Logical unit not ready, cause not reportable" to "Medium not present" in the "TUR many" handler. (The TUR many handler gets triggered for Logical unit not ready, cause not reportable errors.)
scsi_cd.c: Remove the initial test unit ready in cdsize(). Hopefully it isn't necessary after the above change.
Submitted by: gibbs (mostly) Tested by: peter MFC After: 2 weeks
|
#
121209 |
|
18-Oct-2003 |
phk |
Use bio_offset instead of bio_blkno
|
#
120884 |
|
07-Oct-2003 |
thomas |
(cdcleanup): Defend against calling sysctl_ctx_free before the sysctl_ctx has been initialized. (cdsysctlinit): Set flag CD_FLAG_SCTX_INIT after sysctl_ctx has been initialized.
This resolves a panic encountered when a cd drive is sucessfully probed but fails to attach.
Reviewed by: ken
|
#
120854 |
|
06-Oct-2003 |
phk |
Add disk_destroy() call to detach processing.
Add short tempered TUR to cdsize() as a workaround.
|
#
120599 |
|
30-Sep-2003 |
phk |
GEOMify.
|
#
119994 |
|
11-Sep-2003 |
phk |
Disable the use of cloning use in floppy and CD drivers.
This commit puts the relevant code snippets under #ifdef GONE_IN_5 (rather than #ifndef BURN_BRIDGES) thereby disabling the code now.
The code wil be entirely removed before 5.2 unless we find reasons why this would be a bad idea.
Approach suggested by: imp
|
#
119761 |
|
05-Sep-2003 |
phk |
Put the device cloning functions for disk-drivers under #ifndef BURN_BRIDGES.
For the floppy driver, use fdcontrol to manipulate density selection.
For the CD drivers, the 'a' and 'c' suffix is without actual effect and any applications insisting on it can be satisfied with a symlink: ln -s /dev/cd0 /dev/cd0a
Ongoing discussion may result in these pieces of code being removed before the 5-stable branch as opposed to after.
|
#
119708 |
|
03-Sep-2003 |
ken |
Move dynamic sysctl(8) variable creation for the cd(4) and da(4) drivers out of cdregister() and daregister(), which are run from interrupt context.
The sysctl code does blocking mallocs (M_WAITOK), which causes problems if malloc(9) actually needs to sleep.
The eventual fix for this issue will involve moving the CAM probe process inside a kernel thread. For now, though, I have fixed the issue by moving dynamic sysctl variable creation for these two drivers to a task queue running in a kernel thread.
The existing task queues (taskqueue_swi and taskqueue_swi_giant) run in software interrupt handlers, which wouldn't fix the problem at hand. So I have created a new task queue, taskqueue_thread, that runs inside a kernel thread. (It also runs outside of Giant -- clients must explicitly acquire and release Giant in their taskqueue functions.)
scsi_cd.c: Remove sysctl variable creation code from cdregister(), and move it to a new function, cdsysctlinit(). Queue cdsysctlinit() to the taskqueue_thread taskqueue once we have fully registered the cd(4) driver instance.
scsi_da.c: Remove sysctl variable creation code from daregister(), and move it to move it to a new function, dasysctlinit(). Queue dasysctlinit() to the taskqueue_thread taskqueue once we have fully registered the da(4) instance.
taskqueue.h: Declare the new taskqueue_thread taskqueue, update some comments.
subr_taskqueue.c: Create the new kernel thread taskqueue. This taskqueue runs outside of Giant, so any functions queued to it would need to explicitly acquire/release Giant if they need it.
cd.4: Update the cd(4) man page to talk about the minimum command size sysctl/loader tunable. Also note that the changer variables are available as loader tunables as well.
da.4: Update the da(4) man page to cover the retry_count, default_timeout and minimum_cmd_size sysctl variables/loader tunables. Remove references to /dev/r???, they aren't used any longer.
cd.9: Update the cd(9) man page to describe the CD_Q_10_BYTE_ONLY quirk.
taskqueue.9: Update the taskqueue(9) man page to describe the new thread task queue, and the taskqueue_swi_giant queue.
MFC after: 3 days
|
#
118105 |
|
28-Jul-2003 |
njl |
Add a PATH_INQ flag, PIM_NO_6_BYTE, which indicates the SIM never wishes to receive 6 byte commands. Add a check for this flag to da(4) and cd(4) so that they honor it. This is a quick workaround for many devices (especially USB) that require da(4) quirks to operate. The more complete approach is to finish the new transport code which will be aware of the SCSI version a transport implements.
MFC after: 1 day
|
#
116162 |
|
10-Jun-2003 |
obrien |
Use __FBSDID().
|
#
112946 |
|
01-Apr-2003 |
phk |
Use bioq_flush() to drain a bio queue with a specific error code. Retain the mistake of not updating the devstat API for now.
Spell bioq_disksort() consistently with the remaining bioq_*().
#include <geom/geom_disk.h> where this is more appropriate.
|
#
112668 |
|
26-Mar-2003 |
ken |
Clean up dynamically allocated sysctl variables when we run dacleanup() and cdcleanup(). This fixes sysctl problems ("can't re-use a leaf") when someone adds another peripheral at the same unit number. (e.g. rescan da0, it goes away, then rescan again and da0 comes back, but since we haven't cleaned up the sysctl variables from the last da0 instance, we can't register the variables for the new instance under the same name.)
Reported by: njl Tested by: njl
|
#
112262 |
|
15-Mar-2003 |
phk |
Don't use the devstat->busy_count for state decisions in the device drivers. Doing so imposes atomicity and locking constraints on the devstat API.
By: ken
|
#
112260 |
|
15-Mar-2003 |
phk |
Call devstat_start_transaction_bio() instead of devstat_start_transaction()
|
#
112006 |
|
08-Mar-2003 |
phk |
Allocate the devstat structure with devstat_new_entry().
|
#
111815 |
|
03-Mar-2003 |
phk |
Gigacommit to improve device-driver source compatibility between branches:
Initialize struct cdevsw using C99 sparse initializtion and remove all initializations to default values.
This patch is automatically generated and has been tested by compiling LINT with all the fields in struct cdevsw in reverse order on alpha, sparc64 and i386.
Approved by: re(scottl)
|
#
111206 |
|
21-Feb-2003 |
ken |
Fix ATAPI/USB/Firewire CDROM drive handling in cd(4) and hopefully fix a number of related problems along the way.
- Automatically detect CDROM drives that can't handle 6 byte mode sense and mode select, and adjust our command size accordingly. We have to handle this in the cd(4) driver (where the buffers are allocated), since the parameter list length is different for the 6 and 10 byte mode sense commands.
- Remove MODE_SENSE and MODE_SELECT translation removed in ATAPICAM and in the umass(4) driver, since there's no way for that to work properly.
- Add a quirk entry for CDROM drives that just hang when they get a 6 byte mode sense or mode select. The reason for the quirk must be documented in a PR, and all quirks must be approved by ken@FreeBSD.org. This is to make sure that we fully understand why each quirk is needed. Once the CAM_NEW_TRAN_CODE is finished, we should be able to remove any such quirks, since we'll know what protocol the drive speaks (SCSI, ATAPI, etc.) and therefore whether we should use 6 or 10 byte mode sense/select commands.
- Change the way the da(4) handles the no_6_byte sysctl. There is now a per-drive sysctl to set the minimum command size for that particular disk. (Since you could have multiple disks with multiple requirements in one system.)
- Loader tunable support for all the sysctls in the da(4) and cd(4) drivers.
- Add a CDIOCCLOSE ioctl for cd(4) (bde pointed this out a long time ago).
- Add a media validation routine (cdcheckmedia()) to the cd(4) driver, to fix some problems bde pointed out a long time ago. We now allow open() to succeed no matter what, but if we don't detect valid media, the user can only issue CDIOCCLOSE or CDIOCEJECT ioctls.
- The media validation routine also reads the table of contents off the drive. We use the table of contents to implement the CDIOCPLAYTRACKS ioctl using the PLAY AUDIO MSF command. The PLAY AUDIO TRACK INDEX command that we previously used was deprecated after SCSI-2. It works in every SCSI CDROM I've tried, but doesn't seem to work on ATAPI CDROM drives. We still use the play audio track index command if we don't have a valid TOC, but I suppose it'll fail anyway in that case.
- Add _len() versions of scsi_mode_sense() and scsi_mode_select() so that we can specify the minimum command length.
- Fix a couple of formatting problems in the sense printing code.
MFC after: 4 weeks
|
#
111119 |
|
19-Feb-2003 |
imp |
Back out M_* changes, per decision of the TRB.
Approved by: trb
|
#
110232 |
|
02-Feb-2003 |
alfred |
Consolidate MIN/MAX macros into one place (param.h).
Submitted by: Hiten Pandya <hiten@unixdaemons.com>
|
#
109623 |
|
21-Jan-2003 |
alfred |
Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
|
#
107193 |
|
23-Nov-2002 |
njl |
Allow acd(4) and cd(4) to support old behavior for CDRIOC*SPEED ioctls. If the value from the user is less than 177, assume it is a multiple of a single speed CDROM and convert to KB/sec.
No complaints from: sos Reviewed by: ken Approved by: re MFC after: 1 day
|
#
105421 |
|
18-Oct-2002 |
njl |
* Add CDRIOC{READ,WRITE}SPEED ioctls to cd(4). Units are in KB/sec. * Change atapi-cd ioctls to use the same units. * Change burncd, cdcontrol to convert CDROM speed to KB/sec before calling the ioctl. Add a "max" speed option for their command lines.
This change does not break ABI but does change the units passed through the ioctl so 3rd party software that uses cdrio.h will have to convert (most likely by multiplying CDROM speed by 177 to get KB/s).
PR: kern/36845 Submitted by: Philipp Mergenthaler <p@i609a.hadiko.de> (CAM ioctls) Reviewed by: sos, ken MFC after: 1 month
|
#
105378 |
|
18-Oct-2002 |
pirzyk |
Backout my previous "brain cramp" commit.
Requested by: Most developers Apologies to: Most developers, with special note to <ken@kdm.org> Collabroation in the future with: Kenneth D. Merry <ken@kdm.org>
|
#
105363 |
|
17-Oct-2002 |
pirzyk |
Changed the scsi mode command to use 10 bytes scsi commands instead of the 6 byte ones. This helps with using a IDE cdrom behind a USB interface.
PR: kern/43885
|
#
104880 |
|
11-Oct-2002 |
phk |
Trapdoor access to cd%da and cd%c so they still work, but do not let them show up in /dev.
|
#
104611 |
|
07-Oct-2002 |
phk |
Correctly convert to appropriate blocksize.
note to self: Never check block-size sensitive patches on Sun compatible CD drives.
Sponsored by: DARPA & NAI Labs.
|
#
104456 |
|
04-Oct-2002 |
phk |
Unhook the SCSI CD driver from the disk "mini-layer" and/or GEOM.
SCSI disks are too square pegs for the round holes in both of these.
And since atapi-cd has clearly shown that there are better acccess models for CD media than trying to pretend to be a classical disk, we stop the masquerade rather than patch up the costume.
But do implement the DIOCGMEDIASIZE and DIOCGSECTORSIZE so it will be possible to manually attach to GEOM, should some the need arise.
Ideally, this driver should do media-detection and call make_dev() when a CD is inserted and destroy_dev() when it is removed, this would allow our future devd(8) to automount etc etc but coding that takes SCSI-clue beyond anything I posses.
Tested on: sparc64
|
#
104094 |
|
28-Sep-2002 |
phk |
Be consistent about "static" functions: if the function is marked static in its prototype, mark it static at the definition too.
Inspired by: FlexeLint warning #512
|
#
103714 |
|
20-Sep-2002 |
phk |
(This commit touches about 15 disk device drivers in a very consistent and predictable way, and I apologize if I have gotten it wrong anywhere, getting prior review on a patch like this is not feasible, considering the number of people involved and hardware availability etc.)
If struct disklabel is the messenger: kill the messenger.
Inside struct disk we had a struct disklabel which disk drivers used to communicate certain metrics to the disklayer above (GEOM or the disk mini-layer). This commit changes this communication to use four explicit fields instead.
Amongst the benefits is that the fields do not get overwritten by wrong or bogus on-disk disklabels.
Once that is clear, <sys/disk.h> which is included in the drivers no longer need to pull <sys/disklabel.h> and <sys/diskslice.h> in, the few places that needs them, have gotten explicit #includes for them.
The disklabel inside struct disk is now only for internal use in the disk mini-layer, so instead of embedding it, we malloc it as we need it.
This concludes (modulus any mistakes) the series of disklabel related commits.
I belive it all amounts to a NOP for all the rest of you :-)
Sponsored by: DARPA & NAI Labs.
|
#
101940 |
|
15-Aug-2002 |
njl |
Remove usage of cam_extend.c, replace with dev->si_drv1
PR: kern/39809 Approved by: gibbs
|
#
91062 |
|
22-Feb-2002 |
phk |
GC: BIO_ORDERED going away.
|
#
90868 |
|
18-Feb-2002 |
mike |
o Move NTOHL() and associated macros into <sys/param.h>. These are deprecated in favor of the POSIX-defined lowercase variants. o Change all occurrences of NTOHL() and associated marcros in the source tree to use the lowercase function variants. o Add missing license bits to sparc64's <machine/endian.h>. Approved by: jake o Clean up <machine/endian.h> files. o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>. o Remove prototypes for non-existent bswapXX() functions. o Include <machine/endian.h> in <arpa/inet.h> to define the POSIX-required ntohl() family of functions. o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>, and <sys/param.h>. o Prepend underscores to the ntohl() family to help deal with complexities associated with having MD (asm and inline) versions, and having to prevent exposure of these functions in other headers that happen to make use of endian-specific defines. o Create weak aliases to the canonical function name to help deal with third-party software forgetting to include an appropriate header. o Remove some now unneeded pollution from <sys/types.h>. o Add missing <arpa/inet.h> includes in userland.
Tested on: alpha, i386 Reviewed by: bde, jake, tmm
|
#
89114 |
|
09-Jan-2002 |
msmith |
Define the kern.cam sysctl in the cam layer, rather than multiply in several peripheral drivers. Remove Ken's comment to the effect that this needed to be done.
Staticise camnet_ih and cambio_ih.
|
#
83366 |
|
12-Sep-2001 |
julian |
KSE Milestone 2 Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process.
Sorry john! (your next MFC will be a doosie!)
Reviewed by: peter@freebsd.org, dillon@freebsd.org
X-MFC after: ha ha ha ha
|
#
82850 |
|
03-Sep-2001 |
ken |
Attach to a CD device even when the SCSI status is 'busy'.
Reported by: Thomas Quinot <thomas@cuivre.fr.eu.org> MFC after: 3 weeks
|
#
79575 |
|
11-Jul-2001 |
dd |
Call disk_destroy in cdcleanup() as appropriate.
PR: 24596 Reviewed by: ken
|
#
79177 |
|
04-Jul-2001 |
mjacob |
Check the void * argument in the AC_FOUND_DEV case against NULL. Whether correctly or not, this sometimes is propagated up via XPT.
|
#
76362 |
|
08-May-2001 |
phk |
Exploit recent improvements in the disk minilayer to simplify error handling a bit.
Dogmatic lingupurists can celebrate that a number of gotos got removed.
Reviewed by: mjacob, ken
|
#
76322 |
|
06-May-2001 |
phk |
Actually biofinish(struct bio *, struct devstat *, int error) is more general than the bioerror().
Most of this patch is generated by scripts.
|
#
74840 |
|
27-Mar-2001 |
ken |
Rewrite of the CAM error recovery code.
Some of the major changes include:
- The SCSI error handling portion of cam_periph_error() has been broken out into a number of subfunctions to better modularize the code that handles the hierarchy of SCSI errors. As a result, the code is now much easier to read.
- String handling and error printing has been significantly revamped. We now use sbufs to do string formatting instead of using printfs (for the kernel) and snprintf/strncat (for userland) as before.
There is a new catchall error printing routine, cam_error_print() and its string-based counterpart, cam_error_string() that allow the kernel and userland applications to pass in a CCB and have errors printed out properly, whether or not they're SCSI errors. Among other things, this helped eliminate a fair amount of duplicate code in camcontrol.
We now print out more information than before, including the CAM status and SCSI status and the error recovery action taken to remedy the problem.
- sbufs are now available in userland, via libsbuf. This change was necessary since most of the error printing code is shared between libcam and the kernel.
- A new transfer settings interface is included in this checkin. This code is #ifdef'ed out, and is primarily intended to aid discussion with HBA driver authors on the final form the interface should take. There is example code in the ahc(4) driver that implements the HBA driver side of the new interface. The new transfer settings code won't be enabled until we're ready to switch all HBA drivers over to the new interface.
src/Makefile.inc1, lib/Makefile: Add libsbuf. It must be built before libcam, since libcam uses sbuf routines.
libcam/Makefile: libcam now depends on libsbuf.
libsbuf/Makefile: Add a makefile for libsbuf. This pulls in the sbuf sources from sys/kern.
bsd.libnames.mk: Add LIBSBUF.
camcontrol/Makefile: Add -lsbuf. Since camcontrol is statically linked, we can't depend on the dynamic linker to pull in libsbuf.
camcontrol.c: Use cam_error_print() instead of checking for CAM_SCSI_STATUS_ERROR on every failed CCB.
sbuf.9: Change the prototypes for sbuf_cat() and sbuf_cpy() so that the source string is now a const char *. This is more in line wth the standard system string functions, and helps eliminate warnings when dealing with a const source buffer.
Fix a typo.
cam.c: Add description strings for the various CAM error status values, as well as routines to look up those strings.
Add new cam_error_string() and cam_error_print() routines for userland and the kernel.
cam.h: Add a new CAM flag, CAM_RETRY_SELTO.
Add enumerated types for the various options available with cam_error_print() and cam_error_string().
cam_ccb.h: Add new transfer negotiation structures/types.
Change inq_len in the ccb_getdev structure to be "reserved". This field has never been filled in, and will be removed when we next bump the CAM version.
cam_debug.h: Fix typo.
cam_periph.c: Modularize cam_periph_error(). The SCSI error handling part of cam_periph_error() is now in camperiphscsistatuserror() and camperiphscsisenseerror().
In cam_periph_lock(), increase the reference count on the periph while we wait for our lock attempt to succeed so that the periph won't go away while we're sleeping.
cam_xpt.c: Add new transfer negotiation code. (ifdefed out)
Add a new function, xpt_path_string(). This is a string/sbuf analog to xpt_print_path().
scsi_all.c: Revamp string handing and error printing code. We now use sbufs for much of the string formatting code. More of that code is shared between userland the kernel.
scsi_all.h: Get rid of SS_TURSTART, it wasn't terribly useful in the first place.
Add a new error action, SS_REQSENSE. (Send a request sense and then retry the command.) This is useful when the controller hasn't performed autosense for some reason.
Change the default actions around a bit.
scsi_cd.c, scsi_da.c, scsi_pt.c, scsi_ses.c: SF_RETRY_SELTO -> CAM_RETRY_SELTO. Selection timeouts shouldn't be covered by a sense flag.
scsi_pass.[ch]: SF_RETRY_SELTO -> CAM_RETRY_SELTO.
Get rid of the last vestiges of a read/write interface.
libkern/bsearch.c, sys/libkern.h, conf/files: Add bsearch.c, which is needed for some of the new table lookup routines.
aic7xxx_freebsd.c: Define AHC_NEW_TRAN_SETTINGS if CAM_NEW_TRAN_CODE is defined.
sbuf.h, subr_sbuf.c: Add the appropriate #ifdefs so sbufs can compile and run in userland.
Change sbuf_printf() to use vsnprintf() instead of kvprintf(), which is only available in the kernel.
Change the source string for sbuf_cpy() and sbuf_cat() to be a const char *.
Add __BEGIN_DECLS and __END_DECLS around function prototypes since they're now exported to userland.
kdump/mkioctls: Include stdio.h before cam.h since cam.h now includes a function with a FILE * argument.
Submitted by: gibbs (mostly) Reviewed by: jdp, marcel (libsbuf makefile changes) Reviewed by: des (sbuf changes) Reviewed by: ken
|
#
74810 |
|
26-Mar-2001 |
phk |
Send the remains (such as I have located) of "block major numbers" to the bit-bucket.
|
#
72119 |
|
07-Feb-2001 |
peter |
Change the peripheral driver list from a linker set to module driven driver registration. This should allow things like da, sa, cd etc to be in seperate KLD's to the cam core and make them preloadable.
|
#
71999 |
|
04-Feb-2001 |
phk |
Mechanical change to use <sys/queue.h> macro API instead of fondling implementation details.
Created with: sed(1) Reviewed by: md5(1)
|
#
71752 |
|
28-Jan-2001 |
ken |
Fix region code reporting.
Reported by: Andrew Gordon <arg@arg1.demon.co.uk>
|
#
69577 |
|
04-Dec-2000 |
joerg |
Turn off the load_eject bit in cdstartunit(). It causes an `Invalid field in CDB' error when attempting to start a caddy-type CD drive, since those drives apparently in general refuse to load a medium. Since we never advertised the feature to load the medium upon calling cdstartunit() (i. e. upon receipt of a CDIOCSTART ioctl command), nobody should have relied on it. Besides, nobody noticed so far at all that this command is failing for caddy-type drives... Only few applications seem to use it at all (among them is workman, which made me notice it).
Reviewed by: ken
|
#
68294 |
|
04-Nov-2000 |
ken |
Fix a problem with the previous revision (1.42) that showed up with audio CDs.
With audio CDs, you can't just do a READ(10) call on most drives without first setting the blocksize with a mode select command. The disklabel code does a read of the first sector of the media to find a label if it exists.
This caused drives to return an error when an audio CD was in the drive, due to the problem described above.
The solution is to read the table of contents on the CD, and only attempt to read the disklabel if the first track is a data track.
This works on all the various CD and DVD media I have tried, but further testing (especially with Video CDs and other mode 2 media) will be needed to determine if this is a universal solution.
|
#
67928 |
|
30-Oct-2000 |
ken |
Write support for the cd(4) driver.
This allows writing to DVD-RAM, PD and similar drives that probe as CD devices. Note that these are randomly writeable devices, not sequential-only devices like CD-R drives, which are supported by cdrecord.
Add a new flag value for dsopen(), DSO_COMPATLABEL. The cd(4) driver now uses this flag instead of the DSO_NOLABELS flag. The DSO_NOLABELS always used a "fake" disklabel for the entire disk, provided by the caller.
With the DSO_COMPATLABEL flag, dsopen() will first search the media for a label, and if it finds a label, it will use that label. Otherwise it will use the fake disklabel provided by the caller. This provides backwards compatibility, since we will still have labels for ISO9660 media.
It also provides new functionality, since you can now have a regular BSD disklabel on read-only media, or on writeable media (e.g. DVD-RAM).
Bruce and I both think that we should eventually (in a few years) get away from using disklabels for ISO9660 media, and just use the whole disk device (/dev/cd0). At that point disklabel handling in the cd(4) driver could follow the "normal" model, as used in the da(4) driver.
Also, clean up the path in a couple of places in cdregister(). (Thanks to Nick Hibma for catching that bug.)
Reviewed by: bde
|
#
67888 |
|
29-Oct-2000 |
dwmalone |
Add the use of M_ZERO to some malloc calls.
Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net> Approved by: gibbs
|
#
67752 |
|
28-Oct-2000 |
ken |
Add a quirk entry for Nakamichi MJ-* changers. The changer in question is a <NAKAMICH MJ-5.16S 1.06>.
Submitted by: Kevin Van Maren <vanmaren@fast.cs.utah.edu>
|
#
60938 |
|
26-May-2000 |
jake |
Back out the previous change to the queue(3) interface. It was not discussed and should probably not happen.
Requested by: msmith and others
|
#
60833 |
|
23-May-2000 |
jake |
Change the way that the queue(3) structures are declared; don't assume that the type argument to *_HEAD and *_ENTRY is a struct.
Suggested by: phk Reviewed by: phk Approved by: mdodd
|
#
60806 |
|
22-May-2000 |
joerg |
Apply a `fixup' to the blocksize gathered from the device after a READ CAPACITY operation. SCSI-3 mandates this to be 2048, but some older drives like my old Plasmon CD-R report weird numbers between 2048 and up to 2352 bytes depending on the mode of the last track etc. This in turn confuses stuff like the slice code since it refuses to work with devices that do not have a blocksize which is a multiple of 512 bytes.
Reviewed by: ken
|
#
60422 |
|
12-May-2000 |
ken |
Add support for the DVD ioctl interface.
|
#
60041 |
|
05-May-2000 |
phk |
Separate the struct bio related stuff out of <sys/buf.h> into <sys/bio.h>.
<sys/bio.h> is now a prerequisite for <sys/buf.h> but it shall not be made a nested include according to bdes teachings on the subject of nested includes.
Diskdrivers and similar stuff below specfs::strategy() should no longer need to include <sys/buf.> unless they need caching of data.
Still a few bogus uses of struct buf to track down.
Repocopy by: peter
|
#
59249 |
|
15-Apr-2000 |
phk |
Complete the bio/buf divorce for all code below devfs::strategy
Exceptions: Vinum untouched. This means that it cannot be compiled. Greg Lehey is on the case.
CCD not converted yet, casts to struct buf (still safe)
atapi-cd casts to struct buf to examine B_PHYS
|
#
58934 |
|
02-Apr-2000 |
phk |
Move B_ERROR flag to b_ioflags and call it BIO_ERROR.
(Much of this done by script)
Move B_ORDERED flag to b_ioflags and call it BIO_ORDERED.
Move b_pblkno and b_iodone_chain to struct bio while we transition, they will be obsoleted once bio structs chain/stack.
Add bio_queue field for struct bio aware disksort.
Address a lot of stylistic issues brought up by bde.
|
#
58345 |
|
20-Mar-2000 |
phk |
Remove B_READ, B_WRITE and B_FREEBUF and replace them with a new field in struct buf: b_iocmd. The b_iocmd is enforced to have exactly one bit set.
B_WRITE was bogusly defined as zero giving rise to obvious coding mistakes.
Also eliminate the redundant struct buf flag B_CALL, it can just as efficiently be done by comparing b_iodone to NULL.
Should you get a panic or drop into the debugger, complaining about "b_iocmd", don't continue. It is likely to write on your disk where it should have been reading.
This change is a step in the direction towards a stackable BIO capability.
A lot of this patch were machine generated (Thanks to style(9) compliance!)
Vinum users: Greg has not had time to test this yet, be careful.
|
#
56148 |
|
17-Jan-2000 |
mjacob |
Do the minor changes needed because of change to ccb_getdev structure. JKH Trading Stamps applied.
Reviewed by: gibbs@freebsd.org, ken@freebsd.org
|
#
54451 |
|
11-Dec-1999 |
ken |
Quirk all Pioneer changers as changers up front, instead of waiting for the second LUN to show up.
mjacob's change (which is correct) in rev 1.21 of cam_periph.c to elminiate infinite retries of the SCSI busy status bit seems to have broken probing of Pioneer changers that aren't already quirked.
The right way to fix this is probably to change things around so we can guarantee 100% sequential probing of LUN-based changers even if they aren't quirked. This should fix things for now, though.
|
#
54246 |
|
07-Dec-1999 |
ken |
Recognize the Pioneer CD-ROM DRM-6324X as a changer.
PR: kern/15198 Submitted by: Don Lewis <truckman@FreeBSD.org>
|
#
51836 |
|
01-Oct-1999 |
phk |
Introduce the disk mini-layer and devstat_end_transaction_buf() in cam/scsi.
Somewhat reviewed by: ken
|
#
51658 |
|
25-Sep-1999 |
phk |
Remove five now unused fields from struct cdevsw. They should never have been there in the first place. A GENERIC kernel shrinks almost 1k.
Add a slightly different safetybelt under nostop for tty drivers.
Add some missing FreeBSD tags
|
#
50511 |
|
28-Aug-1999 |
phk |
We don't need to pass the diskname argument all over the diskslice/label code, we can find the name from any convenient dev_t
|
#
50477 |
|
27-Aug-1999 |
peter |
$Id$ -> $FreeBSD$
|
#
49771 |
|
14-Aug-1999 |
phk |
Spring cleaning around strategy and disklabels/slices:
Introduce BUF_STRATEGY(struct buf *, int flag) macro, and use it throughout. please see comment in sys/conf.h about the flag argument.
Remove strategy argument from all the diskslice/label/bad144 implementations, it should be found from the dev_t.
Remove bogus and unused strategy1 routines.
Remove open/close arguments from dssize(). Pick them up from dev_t.
Remove unused and unfinished setgeom support from diskslice/label/bad144 code.
|
#
47640 |
|
31-May-1999 |
phk |
Simplify cdevsw registration.
The cdevsw_add() function now finds the major number(s) in the struct cdevsw passed to it. cdevsw_add_generic() is no longer needed, cdevsw_add() does the same thing.
cdevsw_add() will print an message if the d_maj field looks bogus.
Remove nblkdev and nchrdev variables. Most places they were used bogusly. Instead check a dev_t for validity by seeing if devsw() or bdevsw() returns NULL.
Move bdevsw() and devsw() functions to kern/kern_conf.c
Bump __FreeBSD_version to 400006
This commit removes: 72 bogus makedev() calls 26 bogus SYSINIT functions
if_xe.c bogusly accessed cdevsw[], author/maintainer please fix.
I4b and vinum not changed. Patches emailed to authors. LINT probably broken until they catch up.
|
#
47625 |
|
30-May-1999 |
phk |
This commit should be a extensive NO-OP:
Reformat and initialize correctly all "struct cdevsw".
Initialize the d_maj and d_bmaj fields.
The d_reset field was not removed, although it is never used.
I used a program to do most of this, so all the files now use the same consistent format. Please keep it that way.
Vinum and i4b not modified, patches emailed to respective authors.
|
#
47413 |
|
22-May-1999 |
gibbs |
Add a default async handler funstion to cam_periph.c to remove duplicated code in all initiator type peripheral drivers.
scsi_target.c: Release ATIO structures that wind up in the 'unkown command queue' for consumption by our userland counterpart, back to the controller when the exception for that command is cleared.
|
#
46747 |
|
08-May-1999 |
ken |
Add a facility in the CAM error handling code to retry selection timeouts. If the client requests that the error recovery code retry a selection timeout, it will be retried after half a second. The delay is to give the device time to recover.
For most of these drivers, I only added selection timeout retries where they were also retrying unit attention type errors. The sa(4) driver calls saerror() in a number of places, but most of them don't request retrying unit attentions.
Also, bump the default minimum CD changer timeout from 2 to 5 seconds and the maximum timeout from 10 to 15 seconds. Some Pioneer changers seem to have trouble with the shorter timeout.
Reviewed by: gibbs
|
#
46625 |
|
07-May-1999 |
phk |
Introduce two functions: physread() and physwrite() and use these directly in *devsw[] rather than the 46 local copies of the same functions.
(grog will do the same for vinum when he has time)
|
#
46581 |
|
06-May-1999 |
ken |
Add a number of interrelated CAM feature enhancements and bug fixes.
NOTE: These changes will require recompilation of any userland applications, like cdrecord, xmcd, etc., that use the CAM passthrough interface. A make world is recommended.
camcontrol.[c8]: - We now support two new commands, "tags" and "negotiate".
- The tags commands allows users to view the number of tagged openings for a device as well as a number of other related parameters, and it allows users to set tagged openings for a device.
- The negotiate command allows users to enable and disable disconnection and tagged queueing, set sync rates, offsets and bus width. Note that not all of those features are available for all controllers. Only the adv, ahc, and ncr drivers fully support all of the features at this point. Some cards do not allow the setting of sync rates, offsets and the like, and some of the drivers don't have any facilities to do so. Some drivers, like the adw driver, only support enabling or disabling sync negotiation, but do not support setting sync rates.
- new description in the camcontrol man page of how to format a disk - cleanup of the camcontrol inquiry command - add support in the 'devlist' command for skipping unconfigured devices if -v was not specified on the command line. - make use of the new base_transfer_speed in the path inquiry CCB. - fix CCB bzero cases
cam_xpt.c, cam_sim.[ch], cam_ccb.h:
- new flags on many CCB function codes to designate whether they're non-immediate, use a user-supplied CCB, and can only be passed from userland programs via the xpt device. Use these flags in the transport layer and pass driver to categorize CCBs.
- new flag in the transport layer device matching code for device nodes that indicates whether a device is unconfigured
- bump the CAM version from 0x10 to 0x11
- Change the CAM ioctls to use the version as their group code, so we can force users to recompile code even when the CCB size doesn't change.
- add + fill in a new value in the path inquiry CCB, base_transfer_speed. Remove a corresponding field from the cam_sim structure, and add code to every SIM to set this field to the proper value.
- Fix the set transfer settings code in the transport layer.
scsi_cd.c:
- make some variables volatile instead of just casting them in various places - fix a race condition in the changer code - attach unless we get a "logical unit not supported" error. This should fix all of the cases where people have devices that return weird errors when they don't have media in the drive.
scsi_da.c:
- attach unless we get a "logical unit not supported" error
scsi_pass.c:
- for immediate CCBs, just malloc a CCB to send the user request in. This gets rid of the 'held' count problem in camcontrol tags.
scsi_pass.h:
- change the CAM ioctls to use the CAM version as their group code.
adv driver:
- Allow changing the sync rate and offset separately.
adw driver
- Allow changing the sync rate and offset separately.
aha driver:
- Don't return CAM_REQ_CMP for SET_TRAN_SETTINGS CCBs.
ahc driver:
- Allow setting offset and sync rate separately
bt driver:
- Don't return CAM_REQ_CMP for SET_TRAN_SETTINGS CCBs.
NCR driver:
- Fix the ultra/ultra 2 negotiation bug - allow setting both the sync rate and offset separately
Other HBA drivers: - Put code in to set the base_transfer_speed field for XPT_GET_TRAN_SETTINGS CCBs.
Reviewed by: gibbs, mjacob (isp), imp (aha)
|
#
45845 |
|
19-Apr-1999 |
gibbs |
Use macros for accessing the head of the heap so that code is isolated from implementation details of the heap.
|
#
45442 |
|
07-Apr-1999 |
gibbs |
Remove camq_regen(). We already perform modular comparisons for generation counts, so no further steps to deal with generation count wrap are required.
|
#
43819 |
|
09-Feb-1999 |
ken |
Add a prioritization field to the devstat_add_entry() call so that peripheral drivers can determine where in the devstat(9) list they are inserted.
This requires recompilation of libdevstat, systat, vmstat, rpc.rstatd, and any ports that depend on the devstat code, since the size of the devstat structure has changed. The devstat version number has been incremented as well to reflect the change.
This sorts devices in the devstat list in "more interesting" to "less interesting" order. So, for instance, da devices are now more important than floppy drives, and so will appear before floppy drives in the default output from systat, iostat, vmstat, etc.
The order of devices is, for now, kept in a central table in devicestat.h. If individual drivers were able to make a meaningful decision on what priority they should be at attach time, we could consider splitting the priority information out into the various drivers. For now, though, they have no way of knowing that, so it's easier to put them in an easy to find table.
Also, move the checkversion() call in vmstat(8) to a more logical place.
Thanks to Bruce and David O'Brien for suggestions, for reviewing this, and for putting up with the long time it has taken me to commit it. Bruce did object somewhat to the central priority table (he would rather the priorities be distributed in each driver), so his objection is duly noted here.
Reviewed by: bde, obrien
|
#
42590 |
|
12-Jan-1999 |
eivind |
Make dsopen() and dsioctl() use cdstrategy1 instead of cdstrategy. This silence the warnings and makes it more obvious where the bugs have to be fixed.
|
#
42531 |
|
11-Jan-1999 |
eivind |
Add 'static' to the declaration, too.
|
#
42378 |
|
07-Jan-1999 |
mjacob |
Like the problems just fixed in scsi_da.c, make sure to release the probe ccb before taking down the periph. Also, don't do cdscheduling if you're not going to attach the device after all. Reviewed by: ken@freebsd.org
|
#
42017 |
|
22-Dec-1998 |
eivind |
Staticize.
Reviewed by: gibbs
|
#
41514 |
|
04-Dec-1998 |
archie |
Examine all occurrences of sprintf(), strcat(), and str[n]cpy() for possible buffer overflow problems. Replaced most sprintf()'s with snprintf(); for others cases, added terminating NUL bytes where appropriate, replaced constants like "16" with sizeof(), etc.
These changes include several bug fixes, but most changes are for maintainability's sake. Any instance where it wasn't "immediately obvious" that a buffer overflow could not occur was made safer.
Reviewed by: Bruce Evans <bde@zeta.org.au> Reviewed by: Matthew Dillon <dillon@apollo.backplane.com> Reviewed by: Mike Spengler <mks@networkcs.com>
|
#
41297 |
|
22-Nov-1998 |
ken |
Fix a few problems that Bruce noticed about a month ago, and fix oup one other problem.
- Hold onto splsoftcam() in the peripheral driver open routines until we have locked the periph. This eliminates a race condition.
- Disallow opening the pass driver when securelevel > 1.
- If a user tries to open the pass driver with O_NONBLOCK set, return EINVAL instead of ENODEV. (noticed by gibbs)
|
#
40603 |
|
22-Oct-1998 |
ken |
Fix a problem with the way we handled device invalidation when attaching to a device failed.
In theory, the same steps that happen when we get an AC_LOST_DEVICE async notification should have been taken when a driver fails to attach. In practice, that wasn't the case.
This only affected the da, cd and ch drivers, but the fix affects all peripheral drivers.
There were several possible problems: - In the da driver, we didn't remove the peripheral's softc from the da driver's linked list of softcs. Once the peripheral and softc got removed, we'd get a kernel panic the next time the timeout routine called dasendorderedtag(). - In the da, cd and possibly ch drivers, we didn't remove the peripheral's devstat structure from the devstat queue. Once the peripheral and softc were removed, this could cause a panic if anyone tried to access device statistics. (one component of the linked list wouldn't exist anymore) - In the cd driver, we didn't take the peripheral off the changer run queue if it was scheduled to run. In practice, it's highly unlikely, and maybe impossible that the peripheral would have been on the changer run queue at that stage of the probe process.
The fix is: - Add a new peripheral callback function (the "oninvalidate" function) that is called the first time cam_periph_invalidate() is called for a peripheral.
- Create new foooninvalidate() routines for each peripheral driver. This routine is always called at splsoftcam(), and contains all the stuff that used to be in the AC_LOST_DEVICE case of the async callback handler.
- Move the devstat cleanup call to the destructor/cleanup routines, since some of the drivers do I/O in their close routines.
- Make sure that when we're flushing the buffer queue, we traverse it at splbio().
- Add a check for the invalid flag in the pt driver's open routine.
Reviewed by: gibbs
|
#
40398 |
|
15-Oct-1998 |
ken |
Clean up some unused variables.
Reviewed by: ken Submitted by: phk
|
#
40262 |
|
12-Oct-1998 |
ken |
Bring over a quirk entry from the old SCSI code for a Chinon CDROM drive that returns track numbers in BCD.
Reviewed by: gibbs
|
#
40020 |
|
07-Oct-1998 |
ken |
Some fixes for the CD and DA drivers from bde. (and some of my own as well) Among them:
[ cd driver ] 1. Old labeling code was still there. 2. Error handling for dsopen() was broken (no test for the `error' returned by dsopen(); bogus test of an `error' that is known to be 0). 3. cdopen() closed the physical device after certain errors although there may still be open partitions on it. 4. cdclose() closed the physical device although there may still be open partitions on it. 5. Some printf format fixes was incomplete or missing. 6. cdioctl() truncated unit numbers mod 256. 7. cdioctl() was missing locking.
[ da driver ] 1. daclose() closed the physical device although there may still be open partitions on it. This was fixed many years ago in sd.c rev.1.57. 2. A minor optimization (the dk_slices != NULL test) in sdopen() became uglier in daopen(). It is not worth doing. da only regressed compared with od and my version of sd, since I never committed the change to sd. daopen() should probably do less if some partition is already open. This is not addressed by the diffs. [ ... ] 5. "opt_hw_wdog.h" was not included, so the HW_WDOG code was unreachable.
- Added a getdev CCB call in the cdopen() and daopen() calls so that the vendor name and device name are available for the disklabel. (suggested by bde)
- Removed vestigal devfs support in both drivers, since we can't properly work with devfs yet. (ask bde for details on this)
- Cleaned up the probe code in both drivers in the failure cases. There were a number of things wrong here. The peripheral driver instances weren't getting properly cleaned up. Sometimes the wrong probe message would get printed out (with the failure message appended), so it wasn't very clear that we failed to attach. SCSI sense information was printed, even when the error in question wasn't a SCSI error. I put similar fixes into the changer driver in revision 1.2 of scsi_ch.c.
Reviewed by: gibbs Submitted by: bde (partially)
|
#
39580 |
|
23-Sep-1998 |
ken |
Treat not ready errors (asc 0x04) as non-fatal errors for attach. We already allowed medium not present type errors (0x3a), but some Philips and HP WORM drives return 0x04,0x00 when you issue a read capacity without media in the drive.
|
#
39531 |
|
20-Sep-1998 |
ken |
Some fixes to the CD driver that may fix PR kern/7996. The data direction flags on some of the operations in the driver weren't quite right. Also, clean up scsi_cd.h, change u_char to u_int8_t.
I'm surprised this problem didn't show up sooner. (the code has been in there almost a year and a half)
PR: 7996 Reviewed by: ken Submitted (mostly) by: gibbs
|
#
39514 |
|
20-Sep-1998 |
gibbs |
Don't invalidate devices due to unexpected unit attention errors. In a perfect world, we'd notice the UA and do some device validation to ensure that the device hasn't changed. We may get this before the year ends, but not before 3.0R. This change gives the adminstrator ample ammunition to take off a foot or two, but hey this *is* UN*X.
|
#
39213 |
|
15-Sep-1998 |
gibbs |
SCSI Peripheral drivers for CAM:
da - Direct Access Devices (disks, optical devices, SS disks) cd - CDROM (or devices that can act like them, WORM, CD-RW, etc) ch - Medium Changer devices. sa - Sequential Access Devices (tape drives) pass - Application pass-thru driver targ - Target Mode "Processor Target" Emulator pt - Processor Target Devices (scanners, cpus, etc.)
Submitted by: The CAM Team
|