Commit Graph

319 Commits

Author SHA1 Message Date
martin
71c0010c51 Fix PR kern/48550 by aligning the single instance of scsipi_read_cd_cap_data
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-04-18 06:23:32 +00:00
martin
93c2e669d7 PR kern/48550: additional initialization and sanity checking on the reported
blocksize of the medium.
2014-03-19 15:48:23 +00:00
dholland
a68f9396b6 Change (mostly mechanically) every cdevsw/bdevsw I can find to use
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.
2014-03-16 05:20:22 +00:00
martin
6a2419fedf Turn a few __unused into __diagused 2013-10-25 11:35:55 +00:00
martin
4fc0fb89a3 Mark a potentially unused variable 2013-10-19 19:10:12 +00:00
skrll
0591a04731 Don't return EPASSTHROUGH when succeeding in ODIOCGDINFO or ODIOCGDEFLABEL 2013-09-28 09:00:26 +00:00
martin
2ef755c84e Remove unused variables 2013-09-12 12:26:13 +00:00
reinoud
d840ba4944 Small patch to clarify last_lba and now using size confusingly. No functional
change.
2013-07-02 15:05:53 +00:00
christos
7b845fa9dc phase 1 of disk geometry cleanup:
- centralize the geometry -> plist code so that we don't have
	  n useless copies of it.
2013-05-29 00:47:48 +00:00
martin
de625c77c3 Prompted by PR kern/47646, zero the value buffer before running the
GET_CONFIGURATION command and check for an unexpectedly large feature
length answer afterwards.
2013-03-15 16:16:12 +00:00
martin
a4c413ac1a When ejecting a medium, invalidate the in core disklabel - it is not
meaningfull anymore. This makes the following cdclose() use silent
mode and finally fixes PR kern/43785.
2012-05-06 17:23:10 +00:00
martin
11c99eb4d6 In cdopen: make the test for media presence always silent. In all cases
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-05-06 16:42:19 +00:00
bouyer
63d14cff85 Expand struct scsipi_bustype {} in a ABI-backward-compatible way to
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-04-19 17:45:20 +00:00
shattered
4490496cc9 Fix typos in comments.
OK by wiz@
2012-02-25 10:17:14 +00:00
tls
7b0b7dedd9 Entropy-pool implementation move and cleanup.
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.
2012-02-02 19:42:57 +00:00
joerg
67a671ee08 Replace memset with incorrect size argument with M_ZERO. 2011-11-25 12:39:55 +00:00
reinoud
9ba99564ec Fix size reporting for DVD+R/DL and BluRay's; the value was trunced due to a
32 bit trunc due to a lacking type cast. The number of sectors for such media
can be more than 1<<32-1.
2011-05-20 09:23:37 +00:00
martin
b1e20a7dbb cd_size: if we fake a size (and I realy have no idea why this would be a
good idea), at least set up all values to the fake values, as the caller
expects.
Should fix PR kern/39904, though if noone can find out why the fake value
would be needed, we should change it to just return 0 as suggested in the PR.
2010-04-04 21:36:22 +00:00
martin
ce69648c34 If we find a device in non-2048 byte/block mode and manage to switch
it over, we need to adjust the capacity - so just read it again.
2010-03-23 18:56:18 +00:00
martin
5a5dcf5530 Make cdclose() silent, if we only have the raw partition open (e.g. when
probing for media and not finding any)
2010-03-23 12:42:55 +00:00
martin
b1400f8892 Add a DIOCTUR (test unit ready) ioctl, to allow userland to easily
(and silently) check for presence of media. While this would be easy
to implement via SCIOCCOMMAND, our kernel has quirks for this
command, which otherwise would not be readily available to userland
applications.
2010-03-22 16:49:41 +00:00
mrg
ebc9e23316 various aprint_* fixes. 2010-03-11 03:54:56 +00:00
martin
a24c4f307b Some usb devices come with an internal emulated umass CD drive (containing
windows drivers). I have such a device that has 0 features - avoid wrappig
features_len to a very big unsiged 32bit number in this case.
2010-01-06 20:16:57 +00:00
dyoung
93c9b12505 Delete do-nothing device-activation hooks. 2009-12-06 22:48:17 +00:00
rmind
40cf6f3659 Remove uarea swap-out functionality:
- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code.  Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
2009-10-21 21:11:57 +00:00
reinoud
5e6bd1d549 Significantly bump time for SCSI track/disc closure. DVD-RW when used
sequentially can significantly take more time.
2009-07-26 15:29:00 +00:00
haad
f5b48500f1 Add support for DIOCGDISKINFO to disk like device drivers. Change
partutil.c::getdiskinfo to use it to get disk geometry info.
Use DIOCGWEDGEINFO ioctl to get information about partition size, if disk
driver doesn't support it use old DIOCGDINFO. This patch adds support for
wedge like devices(lvm logical volumes, ZFS zvol partitions) to newfs and
other tools.

No objections on tech-userlevel@.
2009-06-05 21:52:31 +00:00
dyoung
3098a4fbed Detach atapibus(4), scsibus(4), cd(4), and sd(4) during shutdown.
Destroy sd->sc_callout in sddetach().  Delete some dead code in
cddetach().
2009-04-07 18:35:17 +00:00
reinoud
42726265fe Implement MMC_TRACKINFO_DATA and MMC_TRACKINFO_AUDIO detection for cdrom and
dvdrom devices. These two compatibility codes were forgotten when those were
introduced.
2009-04-01 12:19:04 +00:00
cegger
c363a9cb62 bzero -> memset 2009-03-18 16:00:08 +00:00
reinoud
83969672ba Fix long standing problem with CD/DVD writing with `dd'. If done this way the
device will remain in a wait-for-more-stuff-to-be-written state delaying other
SCSI calls, esp. some read-size or read-layout calls, until its told there is
no more comming.

To fix this, on last close explicitly flush the caches releasing the device
from this mode and allowing other SCSI commands to reach it.

This fixes PR 40528
2009-03-17 21:25:47 +00:00
ad
0fa70e9b6f 'boot -z' bogons 2009-03-14 11:08:28 +00:00
cegger
ecc4ad527f buildfix: re-adapt to major()/minor() returning a 32bit value. 2009-01-21 17:16:12 +00:00
yamt
70de973662 g/c BUFQ_FOO() macros and use bufq_foo() directly. 2009-01-13 13:33:58 +00:00
cegger
08ebead94e make this compile 2009-01-11 09:51:38 +00:00
reinoud
339f5c5772 Add ISO partition detection enabling auto-detection of iso9660 and UDF
partitions on optical media like CD/DVD/BD but also on all other media if
there is no NetBSD disklabel or MBR label.

Also fix cd's readdisklabel arguments so the ioctl's arrive at the right
device (!) and update its default label to make more sense.
2008-12-30 19:38:36 +00:00
gmcgarry
629a542107 Remove unreachable code introduced by rev 1.224. Fixes PR#38973. 2008-09-05 22:25:39 +00:00
cegger
708f88d69f use device_lookup_private to get softc 2008-06-12 23:06:14 +00:00
jnemeth
c93b478e9f add support for drvctl properties 2008-05-12 21:39:56 +00:00
tron
4f712549a9 Fix SSP kernel builds. 2008-05-12 09:41:02 +00:00
reinoud
ffc24fca06 Implement write support for the MMC framework. This consists of a setting
up of write parameters call and a call to perform a series of operations on
these devices.

Note that the MMC framework interface is still not exposed to userland
unless the expose_mmc flag is set. This is to prevent applications to build
on a possibly still moving target. This flag will eventually be removed.
2008-05-08 12:57:19 +00:00
yamt
c331e3e5e9 getiobuf(false, NULL) -> getiobuf(NULL, false) 2008-05-06 11:08:19 +00:00
reinoud
62c4a64698 Extend the MMC framework to also create sensible reports on audio discs. 2008-05-02 16:06:38 +00:00
reinoud
87bf4ab915 Fixup CD and DVD drives that appear to be on crack when reporting features.
They state f.e. that a recordable CD-R is rewritable or completely forget
that the fixed packet size formatted CD-RW is strict overwrite rewritable
and not randomly rewritable.
2008-05-02 15:53:10 +00:00
reinoud
8d14ab3bcb Make the SCSI sense code "Logical Unit Not Ready, Operation In Progress"
(Sense code 0x04, 0x07) not a fatal error anymore but retry command later.
This sense code can be returned on a CD-MRW write that encounters a bad
block resulting in the drive being busy relocating it. During that time it
can return this sense code to indicate its busy for a while.

Also reduce waiting time for the other "Logical Unix Not Ready, Long Write
In Progress" to half a second.
2008-05-02 15:34:16 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
cube
58f7b5e1f3 Split device_t for cd(4). 2008-03-24 18:27:06 +00:00
ad
4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
jmcneill
4c1d81b2b5 Merge jmcneill-pm branch. 2007-12-09 20:27:42 +00:00
reinoud
9c2e200bb1 Pullup fixes from UDF write development project. This patch fixes a
conceptional bug in mmc_discinfo, improves DVD+R feature detection and
prevents corruption of mmc_trackinfo readout on some devices that return
short trackinfo structures.
2007-11-27 18:06:37 +00:00