summaryrefslogtreecommitdiff
path: root/sys/dev/scsipi/cd.c
AgeCommit message (Collapse)Author
2022-06-26s/Ramdom/Random/ in comments.andvar
2021-10-12fix various typos, mainly in comments.andvar
2021-08-21fix mainly same typos as in my previous commit but outside sys/dev/dm.andvar
2021-04-16Limit buffer size for device capabilities requests as a work-around for PRreinoud
kern/56109.
2021-02-10PR/55986: Ryo Onodera: DK_BUSY must have mask as second argument. Make cd.cchristos
consistent by also using __BIT()
2020-10-26Avoid buffer overflow when copying from bounce buffer.mlelstv
Fixes PR 54810 Don't use uninitialized pointer in split bounce buffer case and free a partially allocated bounce buffer on error.
2020-09-29s/settng/setting/msaitoh
2020-09-29s/implicitely/implicitly/msaitoh
2020-09-29s/occurence/occurrence/msaitoh
2020-09-29s/parition/partition/msaitoh
2020-04-13constifymaxv
2020-03-27Allow open of RAWPART even when no medium is loaded.mlelstv
Keep errors silent if no medium is loaded. Fixes PR kern/55104
2018-09-03Rename min/max -> uimin/uimax for better honesty.riastradh
These functions are defined on unsigned int. The generic name min/max should not silently truncate to 32 bits on 64-bit systems. This is purely a name change -- no functional change intended. HOWEVER! Some subsystems have #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b)) even though our standard name for that is MIN/MAX. Although these may invite multiple evaluation bugs, these do _not_ cause integer truncation. To avoid `fixing' these cases, I first changed the name in libkern, and then compile-tested every file where min/max occurred in order to confirm that it failed -- and thus confirm that nothing shadowed min/max -- before changing it. I have left a handful of bootloaders that are too annoying to compile-test, and some dead code: cobalt ews4800mips hp300 hppa ia64 luna68k vax acorn32/if_ie.c (not included in any kernels) macppc/if_gm.c (superseded by gem(4)) It should be easy to fix the fallout once identified -- this way of doing things fails safe, and the goal here, after all, is to _avoid_ silent integer truncations, not introduce them. Maybe one day we can reintroduce min/max as type-generic things that never silently truncate. But we should avoid doing that for a while, so that existing code has a chance to be detected by the compiler for conversion to uimin/uimax without changing the semantics until we can properly audit it all. (Who knows, maybe in some cases integer truncation is actually intended!)
2017-06-17The atapibus detach path did hold the channel mutex while calling into autoconf,mlelstv
which would trigger a panic when unplugging a USB ATAPI CDROM. Align detach code for scsibus and atapibus to fix this. Also avoid races when detaching devices by replacing callout_stop with callout_halt.
2017-04-08ignore a failed scspi_prevent when accessing the RAW_PART as before.mlelstv
2017-01-05Fix memory leak.mlelstv
Found by maxv@
2016-12-21really keep request queued after resource shortagemlelstv
2016-12-21cdrestart takes a softc parameter, not a periph.mlelstv
2016-12-16add comment about "missing" dk_start.mlelstv
2016-12-10appease gcc.mlelstv
2016-12-10Refactored sd and cd to use common disk subroutines.mlelstv
2016-11-20Make scsipi framework MPSAFE.mlelstv
Data structures are now protected by a per-adapter mutex at IPL_BIO that is created by the scsibus or atapibus instance when the adapter is configured. The enable reference counter and the channel freeze counter which are currently used by HBA code before the adapter is configured, are made atomic. The target drivers are now all tagged as D_MPSAFE. Almost all HBA drivers still require the kernel lock to present, so all callbacks into HBA code are still protected by kernel lock unless the driver is tagged as SCSIPI_ADAPT_MPSAFE. TODO: refactor sd and cd to use dksubr.
2016-11-20Avoid calling bufq_free() from critical code sections.pgoyette
2016-05-15Use _align(2) workaround for PR kern/51141. This fixes odd CD lengthreinoud
reporting.
2015-04-26Use C99-style initializers for struct dkdriver.mlelstv
2015-04-13Convert sys/dev to use <sys/rndsource.h>.riastradh
2015-01-02We have three sets of DTYPE_ constants in the kernel:christos
altq Drop Type disklabel Disk Type file Descriptor Type (not to mention constants that contain the string DTYPE). Let's make them two, by changing the disklabel one to be DisK TYPE since the other disklabel constants seem to do that. Not many userland programs use these constants (and the ones that they do are mostly in ifdefs). They will be fixed shortly.
2014-12-31make more drivers use disk_ioctl, and add a dev parameter to it so thatchristos
we can merge the "easy" disklabel ioctls to it. Ultimately all this will go do dk_ioctl once all the drivers have been converted.
2014-12-31forgot this one. disk_set_info includes the functionality of disk_blocksize.mlelstv
2014-10-18src is too big these days to tolerate superfluous apostrophes. It'ssnj
"its", people!
2014-10-03Use uint32_t for blocksize as per other uses and to fix warningsjustin
2014-08-10Merge tls-earlyentropy branch into HEAD.tls
2014-07-25Add d_discard to all struct cdevsw instances I could find.dholland
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25Add d_discard to all struct bdevsw instances I could find.dholland
I've set them all to nodiscard. Some of them (wd, dk, vnd, ld, raidframe, maybe cgd) should be implemented for real.
2014-07-12Prevent detaching an open device unless forced.hannken
2014-04-18Fix PR kern/48550 by aligning the single instance of scsipi_read_cd_cap_datamartin
that we found misaligned in the wild so far properly for the ahcisata driver. Also point at PR kern/48754 for the real issue.
2014-03-19PR kern/48550: additional initialization and sanity checking on the reportedmartin
blocksize of the medium.
2014-03-16Change (mostly mechanically) every cdevsw/bdevsw I can find to usedholland
designated initializers. I have not built every extant kernel so I have probably broken at least one build; however I've also found and fixed some wrong cdevsw/bdevsw entries so even if so I think we come out ahead.
2013-10-25Turn a few __unused into __diagusedmartin
2013-10-19Mark a potentially unused variablemartin
2013-09-28Don't return EPASSTHROUGH when succeeding in ODIOCGDINFO or ODIOCGDEFLABELskrll
2013-09-12Remove unused variablesmartin
2013-07-02Small patch to clarify last_lba and now using size confusingly. No functionalreinoud
change.
2013-05-29phase 1 of disk geometry cleanup:christos
- centralize the geometry -> plist code so that we don't have n useless copies of it.
2013-03-15Prompted by PR kern/47646, zero the value buffer before running themartin
GET_CONFIGURATION command and check for an unexpectedly large feature length answer afterwards.
2012-05-06When ejecting a medium, invalidate the in core disklabel - it is notmartin
meaningfull anymore. This makes the following cdclose() use silent mode and finally fixes PR kern/43785.
2012-05-06In cdopen: make the test for media presence always silent. In all casesmartin
requiring a message, we will most likely get that from the spinup attempt anyway. This avoids the spurious "Check Condition on CDB, Not Ready, Medium Not Present, Tray Closed" messages at boot/shutdown time.
2012-04-19Expand struct scsipi_bustype {} in a ABI-backward-compatible way tobouyer
pass more informations about the bus: - bustype_type has 2 different bytes, one holding the existing SCSIPI_BUSTYPE_* (scsi, atapi, ata), and one for a per-SCSIPI_BUSTYPE_* subtype. Introduce macros to build or extract bustype_type. - for SCSIPI_BUSTYPE_SCSI, define subtypes for parallel SCSI, Fibre Channel, SAS and USB, to specify the transport method. SCSIPI_BUSTYPE_SCSI_PSCSI is 0 so that bustype_type value doesn't change for existing code - for non-SCSIPI_BUSTYPE_SCSI busses there's no defined subtype yet, so the bustype_type value doesn't change. - provide scsi_fc_bustype, scsi_sas_bustype and scsi_usb_bustype along with scsi_bustype to be used by bus driver where appropriate - scsipi_print_xfer_mode(): more existing code under a (SCSIPI_BUSTYPE_SCSI, SCSIPI_BUSTYPE_SCSI_PSCSI) case, as sync/wide parameters only make sense for parallel SCSI. For (SCSIPI_BUSTYPE_SCSI, SCSIPI_BUSTYPE_SCSI_FC) and (SCSIPI_BUSTYPE_SCSI, SCSIPI_BUSTYPE_SCSI_SAS), only print tagged queing status if enabled. Just be silent for other bustypes. This change is prompted by this problem: right now, FC (e.g. isp(4)) and SAS (e.g. mfi(4)) don't do anything for ADAPTER_REQ_SET_XFER_MODE, and especially never call scsipi_async_event(ASYNC_EVENT_XFER_MODE), so sd(4) always runs untagged. Doing a scsipi_async_event(ASYNC_EVENT_XFER_MODE) with appropriate parameters is enough to enable tagged queuing, but then scsipi will print: sd0: async, 8-bit transfers, tagged queueing which is harmless (async, 8-bit transfers doens't make sense on SAS anyway) but will confuse users. With this change scsipi will only print: sd0: tagged queueing which is correct. In the long run, knowning the underlying transport in scsipi will allow better handling of device which are not parallel SCSI. Another change adding an extra callback to struct scsipi_bustype {} will come (so that scsipi_print_xfer_mode(), which is SCSI-specific, can be moved out of scsipi_base, and split into per-subtype callback), but this will break kernel ABI and so is not suitable for netbsd-6, so will be commmited later. The above is enough to get tagged queuing on FC and SAS in netbsd-6.
2012-02-25Fix typos in comments.shattered
OK by wiz@
2012-02-02Entropy-pool implementation move and cleanup.tls
1) Move core entropy-pool code and source/sink/sample management code to sys/kern from sys/dev. 2) Remove use of NRND as test for presence of entropy-pool code throughout source tree. 3) Remove use of RND_ENABLED in device drivers as microoptimization to avoid expensive operations on disabled entropy sources; make the rnd_add calls do this directly so all callers benefit. 4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might have lead to slight entropy overestimation for some sources. 5) Add new source types for environmental sensors, power sensors, VM system events, and skew between clocks, with a sample implementation for each. ok releng to go in before the branch due to the difficulty of later pullup (widespread #ifdef removal and moved files). Tested with release builds on amd64 and evbarm and live testing on amd64.