1ca17f444SAlexander Motin.\" Copyright (c) 2009 Alexander Motin <mav@FreeBSD.org> 2ca17f444SAlexander Motin.\" All rights reserved. 3ca17f444SAlexander Motin.\" 4ca17f444SAlexander Motin.\" Redistribution and use in source and binary forms, with or without 5ca17f444SAlexander Motin.\" modification, are permitted provided that the following conditions 6ca17f444SAlexander Motin.\" are met: 7ca17f444SAlexander Motin.\" 1. Redistributions of source code must retain the above copyright 8ca17f444SAlexander Motin.\" notice, this list of conditions and the following disclaimer. 9ca17f444SAlexander Motin.\" 10ca17f444SAlexander Motin.\" 2. Redistributions in binary form must reproduce the above copyright 11ca17f444SAlexander Motin.\" notice, this list of conditions and the following disclaimer in the 12ca17f444SAlexander Motin.\" documentation and/or other materials provided with the distribution. 13ca17f444SAlexander Motin.\" 14ca17f444SAlexander Motin.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15ca17f444SAlexander Motin.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16ca17f444SAlexander Motin.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17ca17f444SAlexander Motin.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18ca17f444SAlexander Motin.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19ca17f444SAlexander Motin.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20ca17f444SAlexander Motin.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21ca17f444SAlexander Motin.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22ca17f444SAlexander Motin.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23ca17f444SAlexander Motin.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24ca17f444SAlexander Motin.\" SUCH DAMAGE. 25ca17f444SAlexander Motin.\" 26ca17f444SAlexander Motin.\" $FreeBSD$ 27ca17f444SAlexander Motin.\" 284f8244bbSAlexander Motin.Dd October 22, 2014 29ca17f444SAlexander Motin.Dt ADA 4 30ca17f444SAlexander Motin.Os 31ca17f444SAlexander Motin.Sh NAME 32ca17f444SAlexander Motin.Nm ada 33ca17f444SAlexander Motin.Nd ATA Direct Access device driver 34ca17f444SAlexander Motin.Sh SYNOPSIS 35ca17f444SAlexander Motin.Cd device ada 36ca17f444SAlexander Motin.Sh DESCRIPTION 37ca17f444SAlexander MotinThe 38ca17f444SAlexander Motin.Nm 39eaea8333SChristian Bruefferdriver provides support for direct access devices, implementing the 40ca17f444SAlexander Motin.Tn ATA 41ca17f444SAlexander Motincommand protocol, that are attached to the system through a host adapter 42eaea8333SChristian Brueffersupported by the CAM subsystem. 43ca17f444SAlexander Motin.Pp 44eaea8333SChristian BruefferThe host adapter must also be separately configured into the system before an 45ca17f444SAlexander Motin.Tn ATA 46ca17f444SAlexander Motindirect access device can be configured. 47ca17f444SAlexander Motin.Sh COMMAND QUEUING 48ca17f444SAlexander MotinCommand queueing allows the device to process multiple transactions 49ca17f444SAlexander Motinconcurrently, often re-ordering them to reduce the number and length of 50ca17f444SAlexander Motinseeks. 51ca17f444SAlexander Motin.Tn ATA 52ca17f444SAlexander Motindefines two types of queueing: 53ca17f444SAlexander Motin.Tn TCQ (Tagged Command Queueing, PATA legacy) 54ca17f444SAlexander Motinand 55ca17f444SAlexander Motin.Tn NCQ (Native Command Queueing, SATA) . 56ca17f444SAlexander MotinThe 57ca17f444SAlexander Motin.Nm 58eaea8333SChristian Bruefferdevice driver takes full advantage of NCQ, when supported. 59eaea8333SChristian BruefferTo ensure that transactions to distant parts of the media, 60eaea8333SChristian Bruefferwhich may be deferred indefinitely by servicing requests closer to the current 61ca17f444SAlexander Motinhead position, are completed in a timely fashion, an ordered 62ca17f444SAlexander Motintransaction is sent every 7 seconds during continuous device operation. 63ca17f444SAlexander Motin.Sh CACHE EFFECTS 64ca17f444SAlexander MotinMany direct access devices are equipped with read and/or write caches. 65ca17f444SAlexander MotinParameters affecting the device's cache are reported in device IDENTIFY data 66ca17f444SAlexander Motinand can be examined and modified via the 67ca17f444SAlexander Motin.Xr camcontrol 8 68ca17f444SAlexander Motinutility. 69ca17f444SAlexander Motin.Pp 70ca17f444SAlexander MotinThe read cache is used to store data from device-initiated read ahead 71ca17f444SAlexander Motinoperations as well as frequently used data. 72ca17f444SAlexander MotinThe read cache is transparent 73ca17f444SAlexander Motinto the user and can be enabled without any adverse effect. 74ca17f444SAlexander MotinMost devices 75ca17f444SAlexander Motinwith a read cache come from the factory with it enabled. 76ca17f444SAlexander Motin.Pp 77ca17f444SAlexander MotinThe write cache can greatly decrease the latency of write operations 78ca17f444SAlexander Motinand allows the device to reorganize writes to increase efficiency and 79ca17f444SAlexander Motinperformance. 80ca17f444SAlexander MotinThis performance gain comes at a price. 81ca17f444SAlexander MotinShould the device 82ca17f444SAlexander Motinlose power while its cache contains uncommitted write operations, these 83ca17f444SAlexander Motinwrites will be lost. 84ca17f444SAlexander MotinThe effect of a loss of write transactions on 85ca17f444SAlexander Motina file system is non-deterministic and can cause corruption. 86ca17f444SAlexander MotinMost 87eaea8333SChristian Bruefferdevices age write transactions to limit the vulnerability to a few transactions 88eaea8333SChristian Bruefferrecently reported as complete, but it is nonetheless recommended that 89ca17f444SAlexander Motinsystems with write cache enabled devices reside on an Uninterruptible 90ca17f444SAlexander MotinPower Supply (UPS). 91ca17f444SAlexander MotinThe 92ca17f444SAlexander Motin.Nm 93ca17f444SAlexander Motindevice driver ensures that the cache and media are synchronized upon 94ca17f444SAlexander Motinfinal close of the device or an unexpected shutdown (panic) event. 95ca17f444SAlexander MotinThis ensures that it is safe to disconnect power once the operating system 96ca17f444SAlexander Motinhas reported that it has halted. 97ca17f444SAlexander Motin.Sh SYSCTL VARIABLES 98ca17f444SAlexander MotinThe following variables are available as both 99ca17f444SAlexander Motin.Xr sysctl 8 100ca17f444SAlexander Motinvariables and 101ca17f444SAlexander Motin.Xr loader 8 102ca17f444SAlexander Motintunables: 103ca17f444SAlexander Motin.Bl -tag -width 12 104e3a6d3a4SAlexander Motin.It Va kern.cam.ada.retry_count 105ca17f444SAlexander Motin.Pp 106ca17f444SAlexander MotinThis variable determines how many times the 107ca17f444SAlexander Motin.Nm 108ca17f444SAlexander Motindriver will retry a READ or WRITE command. 109ca17f444SAlexander MotinThis does not affect the number of retries used during probe time or for 110ca17f444SAlexander Motinthe 111ca17f444SAlexander Motin.Nm 112ca17f444SAlexander Motindriver dump routine. 113ca17f444SAlexander MotinThis value currently defaults to 4. 114e3a6d3a4SAlexander Motin.It Va kern.cam.ada.default_timeout 115ca17f444SAlexander Motin.Pp 116ca17f444SAlexander MotinThis variable determines how long the 117ca17f444SAlexander Motin.Nm 118ca17f444SAlexander Motindriver will wait before timing out an outstanding command. 119ca17f444SAlexander MotinThe units for this value are seconds, and the default is currently 30 120ca17f444SAlexander Motinseconds. 121e3a6d3a4SAlexander Motin.It Va kern.cam.ada.spindown_shutdown 122fd104c15SRebecca Cran.Pp 123fd104c15SRebecca CranThis variable determines whether to spin-down disks when shutting down. 124827f816cSRebecca CranSet to 1 to enable spin-down, 0 to disable. 125827f816cSRebecca CranThe default is currently enabled. 1264f8244bbSAlexander Motin.It Va kern.cam.sort_io_queue 1274f8244bbSAlexander Motin.It Va kern.cam.ada. Ns Ar X Ns Va .sort_io_queue 1284f8244bbSAlexander Motin.Pp 1294f8244bbSAlexander MotinThese variables determine whether request queue should be sorted trying 1304f8244bbSAlexander Motinto optimize head seeks. 1314f8244bbSAlexander MotinSet to 1 to enable sorting, 0 to disable, -1 to leave it as-is. 1324f8244bbSAlexander MotinThe default is sorting enabled for HDDs and disabled SSDs. 133b81577ddSAlexander Motin.It Va kern.cam.ada.read_ahead 134b81577ddSAlexander Motin.It Va kern.cam.ada. Ns Ar X Ns Va .read_ahead 135e3a6d3a4SAlexander Motin.It Va kern.cam.ada.write_cache 136e3a6d3a4SAlexander Motin.It Va kern.cam.ada. Ns Ar X Ns Va .write_cache 137f513d14cSAlexander Motin.Pp 138b81577ddSAlexander MotinThese variables determine whether device read-ahead and write caches 139b81577ddSAlexander Motinshould be enabled globally or per-device or disabled. 140530d535dSAlexander MotinSet to 1 to enable write cache, 0 to disable, -1 to leave it as-is. 141f31fd475SIvan VorasValues modified at runtime take effect only after device reset 142f31fd475SIvan Voras.Pq using the reset subcommand of Xr camcontrol 8 . 143f31fd475SIvan VorasBecause of that, this setting should be changed in 144f31fd475SIvan Voras.Pa /boot/loader.conf 145f31fd475SIvan Vorasinstead of 146f31fd475SIvan Voras.Pa /etc/sysctl.conf . 147f31fd475SIvan VorasThe global default is currently 1. 148e3a6d3a4SAlexander MotinThe per-device default is to leave it as-is (follow global setting). 149ca17f444SAlexander Motin.El 150ca17f444SAlexander Motin.Sh FILES 151ca17f444SAlexander Motin.Bl -tag -width ".Pa /dev/ada*" -compact 152ca17f444SAlexander Motin.It Pa /dev/ada* 153ca17f444SAlexander MotinATA device nodes 154ca17f444SAlexander Motin.El 155ca17f444SAlexander Motin.Sh SEE ALSO 156ca17f444SAlexander Motin.Xr ahci 4 , 1572baf3a13SAlexander Motin.Xr cam 4 , 158eaea8333SChristian Brueffer.Xr da 4 , 159*6e8e105bSAlexander Motin.Xr mvs 4 , 160eaea8333SChristian Brueffer.Xr siis 4 161ca17f444SAlexander Motin.Sh HISTORY 162ca17f444SAlexander MotinThe 163ca17f444SAlexander Motin.Nm 164ca17f444SAlexander Motindriver first appeared in 165ca17f444SAlexander Motin.Fx 8.0 . 166ca17f444SAlexander Motin.Sh AUTHORS 1676c899950SBaptiste Daroussin.An Alexander Motin Aq Mt mav@FreeBSD.org 168