1.\" $NetBSD: wd.4,v 1.24 2020/01/18 11:22:49 simonb Exp $ 2.\" 3.\" 4.\" Copyright (c) 1994 James A. Jegers 5.\" All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. The name of the author may not be used to endorse or promote products 13.\" derived from this software without specific prior written permission 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25.\" 26.Dd January 13, 2020 27.Dt WD 4 28.Os 29.Sh NAME 30.Nm wd 31.Nd WD100x compatible hard disk driver 32.Sh SYNOPSIS 33.Cd "wd* at atabus? drive ? flags 0x0000" 34.Cd "wd* at umass?" 35.Cd options WD_SOFTBADSECT 36.Sh DESCRIPTION 37The 38.Nm wd 39driver supports hard disks that emulate the Western 40Digital WD100x. 41This includes standard MFM, RLL, ESDI, IDE, EIDE, and SATA drives. 42.Pp 43The flags are used only with controllers that support DMA operations and 44mode settings (like some pciide controllers). 45The lowest order nibble (rightmost digit) of the flags defines the PIO mode, 46the next four bits define the DMA mode and the third nibble defines the 47UltraDMA mode. 48For each set of four bits, the 3 lower bits define the mode to use 49and the last bit must be set to 1 for this setting to be used. 50For DMA and UDMA, 0xf (1111) means 'disable'. 51For example, a flags value of 0x0fac (1111 1010 1100) 52means 'use PIO mode 4, DMA mode 2, disable UltraDMA'. 530x0000 means "use whatever the drive claims to support." 54.Pp 55The kernel configuration option 56.Dq Cd options WD_SOFTBADSECT 57enables a software managed bad-sector list which will prevent further accesses 58to sectors where an unrecoverable read error occurred. 59A user interface is provided by 60.Xr dkctl 8 . 61Unlike the (historical) mechanisms provided by 62.Xr bad144 8 63and 64.Xr badsect 8 , 65the software list supports neither sector replacement nor retention 66across reboots. 67.Pp 68The following 69.Xr sysctl 8 70variables control behavior of disks attached using this driver: 71.Bl -tag -width 8n 72.It Dv hw.wdX.use_ncq 73Whether to use NCQ ATA commands for the disk. 74Only effective when the disk hardware actually claims to support 75NCQ. 76Default to true. 77.It Dv hw.wdX.use_ncq_prio 78Use optional NCQ priority for high-priority I/O like meta-data. 79Intended only for experimental use right now, might negatively 80affect performance. 81This setting only has effect if 82.Dv hw.wdX.use_ncq 83is also true. 84Default to false. 85.El 86.Sh NOTES 87Certain 88.Tn Seagate 89.Tn Barracuda 90drives sold around 2003 have a known firmware bug leading to corrupted 91write transfers for sector counts n*15 + 1, in combination with certain 92ATA controllers, most commonly 93.Tn Silicon Image 943xxx. 95Affected drives include, but are not limited to: 96.Pp 97.Bl -tag -width Ds -offset indent -compact 98.It Seagate ST3120023AS 99.It Seagate ST380023AS 100.It Seagate ST360015AS 101.El 102.Pp 103If you have one of these drives, it's recommended to replace the drive. 104There used to exist a driver workaround greatly reducing performance, 105but the code was completely removed in 106.Nx 8.0 . 107.Sh SEE ALSO 108.Xr ata 4 , 109.Xr intro 4 , 110.Xr pciide 4 , 111.Xr scsi 4 , 112.Xr umass 4 , 113.Xr wdc 4 , 114.Xr atactl 8 , 115.Xr dkctl 8 116.Sh BUGS 117The optional software bad sector list does not interoperate well with 118sector remapping features of modern disks. 119To let the disk remap a sector internally, the software bad sector list 120must be flushed or disabled before. 121