Home | History | Annotate | Download | only in ata
History log of /src/sys/dev/ata/wdvar.h
RevisionDateAuthorComments
 1.52  13-Apr-2025  jakllsch Add physical sector and alignment info to struct disk_geom and the
geometry plist, and handle in partutil.

Bump version for disk_geom addition.

Collect DIOCGSECTORALIGN handling into one place.
 1.51  28-Dec-2021  riastradh wd(4): Fix bugs in softbadsect handling.

- Don't copyout kernel virtual addresses (of SLIST entries) that
userland won't use anyway.
=> The structure still has space for this pointer; it's just always
null when userland gets it now.

- Don't copyout under a lock.

- Stop and return error if copyout fails (unless we've already copied
some out).

- Don't kmem_free under a lock.

XXX Unclear whether anyone actually uses WD_SOFTBADSECT or why --
it's always been disabled by default. Maybe we should just remove
it?
 1.50  02-Mar-2020  riastradh New ioctl DIOCGSECTORALIGN returns sector alignment parameters.

struct disk_sectoralign {
/* First aligned sector number. */
uint32_t dsa_firstaligned;

/* Number of sectors per aligned unit. */
uint32_t dsa_alignment;
};

- Teach wd(4) to get it from ATA.
- Teach cgd(4) to pass it through from the underlying disk.
- Teach dk(4) to pass it through with adjustments.
- Teach zpool (zfs) to take advantage of it.
=> XXX zpool doesn't seem to understand when the vdev's starting
sector is misaligned.

Missing:

- ccd(4) and raidframe(4) support -- these should support _using_
DIOCGSECTORALIGN to decide where to start putting ccd or raid
stripes on disk, and these should perhaps _implement_
DIOCGSECTORALIGN by reporting the stripe/interleave factor.

- sd(4) support -- I don't know any obvious way to get it from SCSI,
but if any SCSI wizards know better than I, please feel free to
teach sd(4) about it!

- any ld(4) attachments -- might be worth teaching the ld drivers for
nvme and various raid controllers to get the aligned sector size

There's some duplicate logic here for now. I'm doing it this way,
rather than gathering the logic into a new disklabel_sectoralign
function or something, so that this change is limited to adding a new
ioctl, without any new kernel symbols, in order to make it easy to
pull up to netbsd-9 without worrying about the module ABI.
 1.49  05-Apr-2019  bouyer branches: 1.49.4;
Implement a DIRTY flag (copied from sd(4)) so avoid flushing the cache if
there has been no write. This avoids a (long) timeout on the flush cache
command triggered by atactl sleep, when the device is open only by the atactl
command itself.
If a drive has no partition open and goes to sleep, the WDF_LOADED
flag is clear, and the next open will issue wd_get_params() command.
But to wake up the drive a reset is required, and wd_get_params() doens't
issue a reset on timeout, so there's no way to wake up the disk.
Add a retry after reset to wd_get_params().

Tested by Hauke Fath; fixes PR kern/49457
 1.48  19-Mar-2019  mlelstv Set disk model name as disk type. The information can be queried through
drvctl(4).
 1.47  22-Oct-2018  jdolecek Merge jdolecek-ncqfixes branch

- ata_xfer's are dynamicall allocated as needed using a pool, no longer
limited to number of possible openings supported by controller; dump
and recovery paths use dedicated pre-allocated storage
- moved callouts and condvars from ata_xfer to queue or channel, so that
ata_xfer does not need special initialization
- slot allocation now done when xfer is being activated, uncoupled
from memory allocation; active slots are no longer tracked by controller
code
- channel and drive reset is done always via the atabus thread, and
now executes with channel locked the whole time
- NCQ recovery moved to shared function, and run via the thread also
- added some workarounds for buggy error recovery AHCI emulation in QEMU
and Parallels

designed to primarily fix kern/52614, but might also help with kern/47041
and kern/53183
 1.46  03-Nov-2017  mlelstv branches: 1.46.2; 1.46.4; 1.46.6;
Add WDF_OPEN flag to really disallow opening of a disk that has been invalidated.

Restore wdbiorestart function to actually retry the failed I/O request instead
of just restarting the queue.

Fix compilation without ATADEBUG.
 1.45  01-Nov-2017  mlelstv refactor wd and ataraid drivers to use common disk subroutines.
 1.44  07-Oct-2017  jdolecek Merge support for SATA NCQ (Native Command Queueing) from jdolecek-ncq branch

ATA subsystem was changed to support several outstanding commands, and use
NCQ xfers if supported by both the controller and the disk, including NCQ
error recovery. Set NCQ high priority for BPRIO_TIMECRITICAL xfers
if supported. Added FUA support.

Done some work towards MP-safe, all ATA code tsleep()/wakeup() replaced
by condvars, and switched most code from spl* to mutexes (separate
wd(4) and ata channel lock).

Introduced new option WD_CHAOS_MONKEY to facilitate testing of error
handling, fixed several uncovered issues. Also fixed several problems
with kernel dump to wd(4) disk.

Tested with ahcisata(4), mvsata(4), siisata(4), piixide(4) on amd64,
with and without port multiplier, both disk and ATAPI devices; other
drivers and archs mechanically adjusted and compile-tested. NCQ is
supported for ahcisata(4) and siisata(4) for any controller, for
mvsata(4) only Gen IIe ones for now. Also enabled ATAPI support in
mvsata(4).

Thanks to Matt Thomas for initial ATA infrastructure patch, and
Jonathan A.Kollasch for siisata(4) NCQ changes and general testing.

Also fixes PR kern/43169 (wd(4)); and PR kern/11811, PR kern/47041,
PR kern/51979 (kernel dump)
 1.43  22-Jul-2016  jakllsch branches: 1.43.4;
Add ATA8-ACS Long Logical Sector Feature Set support to wd(4).
 1.42  13-Apr-2015  riastradh branches: 1.42.2;
Convert sys/dev to use <sys/rndsource.h>.
 1.41  10-Sep-2014  matt branches: 1.41.2;
g/u_int[0-9]*_t/ s/u_int/uint/g
 1.40  02-Feb-2012  tls branches: 1.40.6;
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.
 1.39  19-Nov-2011  tls branches: 1.39.2;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.38  17-Dec-2009  bouyer branches: 1.38.12;
ATA sepcs changed the LBA48 boundary from 0xfffffff to 0xffffffe between
ATA6r1 and ATA6r3, which caused drives conform to ATA6r3 or later to
reject LBA28 commands at sector 0xfffffff.
Get the right idea from the LBA48 boundary from IDENTIFY words 60-61.
Remove the WD_QUIRK_FORCE_LBA48 quirk, associated tables entries and
autodetect code, it's not needed any more.
Based on patch sent to teck-kern by Christoph Badura, use of words 60-61
instead of a constant for the LBA48 boundary by me.
 1.37  19-Oct-2009  bouyer Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsen
for the booring work !
 1.36  18-Mar-2008  cube branches: 1.36.4; 1.36.14; 1.36.22;
Split device_t and softc for ATA devices, as well as wd(4). Other
cosmetic changes where appropriate.
 1.35  28-Feb-2008  drochner use pmf again to register the shutdown handler, instead of
shutdownhook_establish()
 1.34  22-Feb-2008  dogcow As pointed out by Geoff Wing, 1.356 of wd.c needs sc_sdhook restored.
 1.33  09-Dec-2007  jmcneill branches: 1.33.6; 1.33.10;
Merge jmcneill-pm branch.
 1.32  11-Dec-2005  christos branches: 1.32.44; 1.32.46; 1.32.56; 1.32.58;
merge ktrace-lwp.
 1.31  15-Oct-2005  yamt - change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
from sys/bufq.h to sys/bufq_impl.h.
(is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c. (not tested)
 1.30  25-Jul-2005  drochner remove unused (hopefully:-) softc fields for disk geometry
 1.29  27-Feb-2005  perry branches: 1.29.4;
nuke trailing whitespace
 1.28  25-Sep-2004  thorpej branches: 1.28.4; 1.28.6;
Add support for wedges to the ATA disk driver.
 1.27  30-Aug-2004  drochner make the software managed bad-sector list optional
(kernel option WD_SOFTBADSECT)
 1.26  14-Dec-2003  thorpej Move the wddone() prototype to wd.c
 1.25  14-Dec-2003  thorpej Garbage-collect __ATA_DISK_PRIVATE; it is no longer needed.
 1.24  14-Dec-2003  thorpej Move struct ata_device from wdvar.h to atavar.h.
 1.23  14-Dec-2003  thorpej Move struct ata_bustype from wdvar.h to atavar.h.
 1.22  14-Dec-2003  thorpej Move struct ata_bio from wdvar.h to atavar.h.
 1.21  07-Nov-2003  mycroft Replace home-grown locks with lockmgr().
 1.20  02-Nov-2003  wiz Fix some typos. From Tom Cosgrove via jmc@openbsd.
 1.19  08-Oct-2003  bouyer Make the ATA mid-layer appears as atabus, as proposed in
http://mail-index.netbsd.org/tech-kern/2003/09/25/0006.html
This adds a device (atabus) between IDE controllers and wd or atapibus, to
have each ATA channel show up in the device tree. Later there will be atabus
devices in /dev, so that we can do IOCTL on them.
Each atabus has its own kernel thread, to handle operations that needs polling,
e.g. reset and others.

Device probing on each bus it defered to the atabus thread creation.
This allows to do the reset and basic device probes in parallel, which reduce
boot time on systems with several pciide controllers.
 1.18  05-Oct-2003  bouyer Remove references to University of California from my copyright notices.
 1.17  15-Apr-2003  darrenr branches: 1.17.2;
Implement (and document!) "dkctl <dev> badsector .." to `manage' the bad
sector information in the kernel. Doing this uncovered some shortcomings
that should have been pretty obvious with the code committed prior, addressing
the major kludge with a new struct - disk_bacsecinfo to be passed into
DIOCBSLIST.
 1.16  15-Apr-2003  darrenr Automatically build up a list of bad sectors from failed read operations and
prempt read operations on matching regions with a failure rather than waiting
for the device to return a failure. The I/O operation must have already failed
MAXRETRIES times before being added to the list - this can generally take up
to 12 seconds.
List is made accessible to userspace via DIOCBSLIST and DIOCBSFLUSH.
 1.15  03-Apr-2003  fvdl Check RAW_PART against the media size instead of the disklabel.
Add the media size in 512-byte sectors to the softc, to avoid
some 64 bit computations. Bump the capacity stored in softcs
for disks to 64 bits.
 1.14  21-Mar-2003  thorpej Work around a buggy PHY in some Seagate S-ATA drives which get confused
by the way some S-ATA controllers packetize data when the sector count of
the transfer mod 15 is 1.
 1.13  27-Jan-2003  thorpej Experimental support for RAID volumes configured by ATA "RAID" controllers.
Such RAID controllers are actually just IDE controllers with a BIOS that
can create RAID volumes and write the configuration info to config blocks
on the disks. The BIOS can do I/O to these volumes, and the OS must
understand the config blocks and implement RAID in software in order to be
able to use these volumes.

Only SPAN (simple concatenation) and RAID0 are supported at this time,
and writing back config blocks is also not supported at this time. Currently,
only the Promise configuration scheme is supported, although supporting
the Highpoint scheme should not be too difficult.

In any case, this is sufficient to use the Promise RAID0 volume (thus
preserving the win2k AS installation) on this new Intel server I have.

Thanks to Soren Schmidt for doing the work in FreeBSD; it made this
task much easier. The config block parsing code is adapted from his
work.
 1.12  23-Apr-2002  bouyer More copyright fixes, pointed out by Thomas. Thanks !
 1.11  13-Jan-2002  christos Add LBA48 support based on patches from Keisuke YOSHIDA. KNF a bit while
I am there.
 1.10  03-Dec-2001  bouyer Update my copyrigth.
 1.9  03-Dec-2001  bouyer Allow wd to attach to something else than wdc/pciide (like USB<->ATA bridges):
- move some functions from ata.c to ata_wdc.c or wdc.c.
- add callbacks to struct ata_bustype so that wd.c doesn't call directly
functions from the lower level driver.
 1.8  02-Dec-2001  bouyer Clean up attach of wd/atapibus:
kill ata_atapi_attach. Change atapibus to use a struct scsipi_channel instead
of ata_atapi_attach as attach arch. Create a ata_device, compatible with
scsipi_channel, to attach wd.
 1.7  08-Jul-2001  wiz branches: 1.7.2;
Correct various misspellings of 'transfer' and inflected forms.
 1.6  15-May-2000  bouyer branches: 1.6.6;
Sync my copyrigth notice
 1.5  01-Apr-2000  bouyer - DMA code cleanup: pciide_dma_finish() doesn't stop/unload the current DMA op
if an IRQ was not detected, unless the force flag was given. Use this to
detect if the IRQ was for us (closer to shared IRQ for controllers which
don't have their own IRQ handler in pciide.c) and to poll for DMA xfer.
Also makes the timeout recovery code simpler.
- ATAPI cleanup: don't call controller-specific functions from atapiconf.c
(wdc_*), so that it's possible to attach an atapibus to something else
than a wdc/pciide (Hi Lennart :).
Overload struct scsi_adapter with struct atapi_adapter, defined
as struct scsi_adapter + atapi-specific callbacks. scsipi_link still points
to an scsi_adapter, atapi code casts it to atapi_adapter if needed.
Move atapi_softc to atapiconf.h so that it can be used by the underlying
controller code (e.g. atapi_wdc.c).
Add an atapi-specific callback *atapi_probedev(), which probe a drive
in a controller-specific way, allocate the sc_link and fills in the
ataparams if needed. It then calls atapi_probedev() (from atapiconf.c)
to do the generic initialisations and attach the device.
- While I'm there merge and centralise the state definitions in atavar.h.
It should now be possible to use a common ata/atapi routine to set the
drive's modes (will do later).
 1.4  20-Oct-1999  enami Cancel active transfers on aic/wdc detach.
Also makes LS-120 drive works for me again.
 1.3  11-Nov-1998  bouyer branches: 1.3.4; 1.3.10; 1.3.12; 1.3.14;
- clearify the boot messages (features supported vs features used). Thanks to
Havard Eidnes for his complains about this :)
- fix some typo in comments
- hoppefully better detection of drives reporting bogus PIO modes.
 1.2  12-Oct-1998  bouyer Merge bouyer-ide
 1.1  04-Jun-1998  bouyer branches: 1.1.2;
file wdvar.h was initially added on branch bouyer-ide.
 1.1.2.2  13-Aug-1998  bouyer - sync with HEAD
- better error detection and report for wd drives
- better wddump() support
- wdcwait() now takes a timout argument, so that we can honnor the
timeout argument of scsipi cmds.
 1.1.2.1  04-Jun-1998  bouyer Commit changes to the IDE system in a branch. This allows a better separation
between higth-level and low-level (i.e. registers read/write) and generalize
the queue for all commands. This also add supports for IDE DMA.
 1.3.14.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.12.1  15-Nov-1999  fvdl Sync with -current
 1.3.10.2  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.10.1  20-Oct-1999  thorpej Sync w/ trunk.
 1.3.4.1  07-Jul-2000  he Apply patch (requested by bouyer):
Add support for the following PCIIDE controllers:
o AMD 756
o CMD PCI0648 and PCI0649
o Hightpoint HPT366
o OPTi 82c621 (and a few of its derivatives)
o Promise Ultra/33 and Ultra/66
o Intel 82801 (ICH/ICH0)
Also fix PR#10437 (detect more ATAPI devices).
 1.6.6.4  20-Jun-2002  nathanw Catch up to -current.
 1.6.6.3  28-Feb-2002  nathanw Catch up to -current.
 1.6.6.2  08-Jan-2002  nathanw Catch up to -current.
 1.6.6.1  24-Aug-2001  nathanw Catch up with -current.
 1.7.2.3  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.2.2  11-Feb-2002  jdolecek Sync w/ -current.
 1.7.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.17.2.7  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.17.2.6  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.17.2.5  19-Oct-2004  skrll Sync with HEAD
 1.17.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.17.2.2  03-Sep-2004  skrll Sync with HEAD
 1.17.2.1  03-Aug-2004  skrll Sync with HEAD
 1.28.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.28.4.1  29-Apr-2005  kent sync with -current
 1.29.4.5  24-Mar-2008  yamt sync with head.
 1.29.4.4  17-Mar-2008  yamt sync with head.
 1.29.4.3  27-Feb-2008  yamt sync with head.
 1.29.4.2  21-Jan-2008  yamt sync with head
 1.29.4.1  21-Jun-2006  yamt sync with head.
 1.32.58.1  11-Dec-2007  yamt sync with head.
 1.32.56.1  26-Dec-2007  ad Sync with head.
 1.32.46.2  23-Mar-2008  matt sync with HEAD
 1.32.46.1  09-Jan-2008  matt sync with HEAD
 1.32.44.2  06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.32.44.1  16-Oct-2007  joerg Replace shutdown hook to flush cache with PNP style power handler to
flush the disk cache also on suspend.
 1.33.10.1  03-Apr-2008  mjf Sync with HEAD.
 1.33.6.1  24-Mar-2008  keiichi sync with head.
 1.36.22.1  21-Apr-2010  matt sync to netbsd-5
 1.36.14.1  10-Jan-2010  snj Pull up following revision(s) (requested by dsl in ticket #1220):
sys/dev/ata/wd.c: revision 1.380
sys/dev/ata/wdvar.h: revision 1.38
ATA sepcs changed the LBA48 boundary from 0xfffffff to 0xffffffe between
ATA6r1 and ATA6r3, which caused drives conform to ATA6r3 or later to
reject LBA28 commands at sector 0xfffffff.
Get the right idea from the LBA48 boundary from IDENTIFY words 60-61.
Remove the WD_QUIRK_FORCE_LBA48 quirk, associated tables entries and
autodetect code, it's not needed any more.
Based on patch sent to teck-kern by Christoph Badura, use of words 60-61
instead of a constant for the LBA48 boundary by me.
 1.36.4.1  11-Mar-2010  yamt sync with head
 1.38.12.1  17-Apr-2012  yamt sync with head
 1.39.2.1  18-Feb-2012  mrg merge to -current.
 1.40.6.1  03-Dec-2017  jdolecek update from HEAD
 1.41.2.2  05-Oct-2016  skrll Sync with HEAD
 1.41.2.1  06-Jun-2015  skrll Sync with HEAD
 1.42.2.1  26-Jul-2016  pgoyette Sync with HEAD
 1.43.4.10  07-Oct-2017  jdolecek make usage of NCQ 'high' priority for BPRIO_TIMECRITICAL xfers settable via
sysctl, too
 1.43.4.9  28-Sep-2017  jdolecek add sysctls to control if NCQ is being used, and how many max tags;
I have a drive which is significantly slower with NCQ than non-NCQ,
and it's generally useful to have this easily overridable

while here, also move the frequency settings for WD_CHAOS_MONKEY
to a sysctl and make it per-drive
 1.43.4.8  02-Sep-2017  jdolecek include opt_wd.h instead of opt_wd_softbadsect.h, the option doesn't have private file any more
 1.43.4.7  19-Jul-2017  jdolecek tighen and expand error handling, mostly for NCQ use cases:
- make retry timeout callout per xfer, i.e. retry separately
- zero whole bio struct on retry to avoid more stale state
- add a REQUEUE option, which doesn't bump retry count
- add ata_read_log_ext_ncq() for NCQ recovery
- adjust logic for activating xfers - allow next command only when
it's for same drive, several concurrent are only supported when HBA
and driver support FIS-based switching
- add new ata_timeout() which handles race between callout_stop()
and the invokation, add appropriate handling on deactivate/free paths
- stop using ch_status/ch_error in non-wdc code; later it will be dropped
completely
 1.43.4.6  23-Jun-2017  jdolecek restart I/O processing after freeing xfer, i.e. now even after commands
like cache flush or standby; the command handling no longer use on-stack xfer,
hence use queue slot and compete with normal I/O for the xfers

the restart give change to all drives attached to the same channel
in round-robin fashion, for fair usage and to recover from situation
when disk is idle due to all xfers being consumed by other drives

make special concession for flush cache - ignore any new I/O requests
on the particular disk while the flush cache is waiting for xfer,
so that I/O queue won't starve the flush cache and the flush cache would
be done ASAP

tested on piixide(4), ahci(4), siisata(4)
 1.43.4.5  23-Apr-2017  jakllsch Simplify wi_find() with container_of().

No need to search a list of wd_ioctls when the *bp is always going to be within the wd_ioctl structure.

Correctly initialize wi->wi_bp.b_dev in the non-data case anyway.

Fixes ATAIOCCOMMAND procesing on driver instances other than wd0.
 1.43.4.4  19-Apr-2017  jdolecek adjust ata code to support more than one active command, including the
timeout handling, add support for NCQ commands

move probe for NCQ and number of tags to middle layer, negotiate mutual
support between drive and controller

implement NCQ support in ahci(4)
 1.43.4.3  15-Apr-2017  jdolecek probe for NCQ and WRITE DMA FUA EXT support
 1.43.4.2  15-Apr-2017  jdolecek make ata_xfer's allocated as part of ata_queue and make it include ata_bio;
they are pre-allocated on attach and ata_get_xfer() now never sleep, drop the
pool

modify wd(4) to file the bio requests using the xfers and hence
make it possible to have more than one active I/O request in flight;
ata_bio callback doesn't need to allocate any memory any more,
require it to never return ATACMD_TRY_AGAIN

move lp, badsect, multi from ata_bio to ata_drive_datas, as they are per-drive,
not per transfer

drop unused drv atac_claim_hw/atac_free_hw hooks, and also drop again ata_bio
c_hwslot
 1.43.4.1  12-Apr-2017  jdolecek convert to mutex, mark MPSAFE
 1.46.6.4  22-Sep-2018  jdolecek remove explicit ata_channel_start() calls, it's no longer necessary
now that ata_xfer's are allocated via pool and not really limited;
replace by just a callout to restart the processing for rare cases
where system runs out of memory
 1.46.6.3  22-Sep-2018  jdolecek fix use-after-free in wd(4) dump, detected by switch to the pool

change code in wd_dumpblocks() to use it's own non-pool ata_xfer,
which skips the deallocation step and thus keeps the contents when the I/O
is finished
 1.46.6.2  22-Sep-2018  jdolecek separate ata_xfer slot allocation and the memory allocation, so that
there can be more queued xfers than number of supported slots by controller,
and use a pool instead of custom pre-allocation

primarily to help PR kern/52614

remove no longer needed custom wd(4) logic for flush cache

switch also wd(4) trim/suspend/setcache/wdioctlstrategy to sleep waiting
for the memory, they are all called from process context and this
avoids spurious failures
 1.46.6.1  31-Aug-2018  jdolecek refactor ata_xfer to be just dumb structure; move all callouts/condvars out

retry callout to wd(4); reset callout and the active/cmd finish condvars
to channel queue; change code using the condvars so it works if there
are multiple waiters

simplify the async wait code for cmds, replace ata_wait_xfer()/ata_wake_xfer()
with ata_wait_cmd()

fix the callout_invoking/ack race handling code for timeouts to
actually have chance to work; change mvsata(4) to use generic timeout func

towards resolution of kern/52614
 1.46.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.46.4.1  10-Jun-2019  christos Sync with HEAD
 1.46.2.1  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.49.4.1  21-Mar-2020  martin Pull up following revision(s) (requested by riastradh in ticket #788):

sys/sys/dkio.h: revision 1.26
sys/dev/dkwedge/dk.c: revision 1.100
sys/sys/disk.h: revision 1.75
external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c: revision 1.14
external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c: revision 1.15
sys/dev/cgd.c: revision 1.121
sys/dev/ata/wdvar.h: revision 1.50
sys/kern/subr_disk_open.c: revision 1.15
sys/dev/ata/wd.c: revision 1.459

New ioctl DIOCGSECTORALIGN returns sector alignment parameters.

struct disk_sectoralign {
/* First aligned sector number. */
uint32_t dsa_firstaligned;
/* Number of sectors per aligned unit. */
uint32_t dsa_alignment;
};

- Teach wd(4) to get it from ATA.
- Teach cgd(4) to pass it through from the underlying disk.
- Teach dk(4) to pass it through with adjustments.
- Teach zpool (zfs) to take advantage of it.
=> XXX zpool doesn't seem to understand when the vdev's starting
sector is misaligned.

Missing:
- ccd(4) and raidframe(4) support -- these should support _using_
DIOCGSECTORALIGN to decide where to start putting ccd or raid
stripes on disk, and these should perhaps _implement_
DIOCGSECTORALIGN by reporting the stripe/interleave factor.
- sd(4) support -- I don't know any obvious way to get it from SCSI,
but if any SCSI wizards know better than I, please feel free to
teach sd(4) about it!
- any ld(4) attachments -- might be worth teaching the ld drivers for
nvme and various raid controllers to get the aligned sector size

There's some duplicate logic here for now. I'm doing it this way,
rather than gathering the logic into a new disklabel_sectoralign
function or something, so that this change is limited to adding a new
ioctl, without any new kernel symbols, in order to make it easy to
pull up to netbsd-9 without worrying about the module ABI.

Make getdiskinfo() compatible with a DIOCGWEDGEINFO.

dkw_parent is defined to hold the disk name as used by disk_find(), not
a partition (i.e. no partition letter appended).

Use utility functions to handle disk geometry.

RSS XML Feed