atom feed3 messages in net.sourceforge.lists.smartmontools-support[smartmontools-support] ERC patch
FromSent OnAttachments
Richard GregoryNov 20, 2009 7:14 pm.patch, .gz
Mario 'BitKoenig' HolbeNov 25, 2009 6:41 am 
Richard GregoryNov 26, 2009 4:53 pm 
Subject:[smartmontools-support] ERC patch
From:Richard Gregory (R.Gr@liverpool.ac.uk)
Date:Nov 20, 2009 7:14:06 pm
List:net.sourceforge.lists.smartmontools-support
Attachments:
smartmontools-erc.patch.gz - 7k

Hi,

Attached is a patch against CVS to get and set the Error Recovery Control parameters in recentish ATA drives. This is the standardised equivalent of Western Digital's TLER, as used in their enterprise SATA drives for RAID configurations, and editable by their WDTLER.EXE utility, mainly for use with non-enterprise SATA drives. Although ERC is now part of the ATA spec, there are no Linux programs to change it, hence this patch.

The meat of this patch extends the WRITE_LOG command to return the ATA registers back to the higher level code. With this the ERC value, which is returned in SectorCount and LBA_Low, can be queried.

To support this, have also extended the man page, the command line options and the SCT capabilities reporting.

This has been tested on Hitachi HDP725050GLA360 (500GB), Western Digital WD20EADS (2TB GP) and Western Digital WD2002FYPS (2TB RE4-GP). It has also been tested to not break existing functionality. ata, sat and hpt devices are supported.

Unlike WDTLER, changes to the ERC options are lost after a reset or power-loss.

To work with High Point controllers (I tested the RR2320), the driver must be patched to pass back the results of a TASKFILE ioctl(). This small patch is also attached.

Richard

+-- --+ | Biological Sciences, Room 231 | | http://www.csc.liv.ac.uk/~greg | +-- --+

diff -bw -N -c -r rr232x-linux-src-v1.10/osm/linux/osm_linux.c
rr232x-linux-src-v1.10-minimal/osm/linux/osm_linux.c *** rr232x-linux-src-v1.10/osm/linux/osm_linux.c 2009-07-16 02:28:28.000000000
+0100 --- rr232x-linux-src-v1.10-minimal/osm/linux/osm_linux.c 2009-11-19
21:24:50.000000000 +0000 *************** *** 1949,1956 **** ioctl_arg.lpOutBuffer=buff+sizeof(IDE_PASS_THROUGH_HEADER);

if ( ide_passthrough_header.protocol==IO_COMMAND_WRITE && copydata ) { ! if ( hpt_verify_area(VERIFY_READ, (void *)(HPT_UPTR)(arg+40), copydata) ! ||copy_from_user(buff+sizeof(IDE_PASS_THROUGH_HEADER), arg+40, copydata)
) { KdPrint(("Got bad user address")); goto invalid; } --- 1949,1956 ---- ioctl_arg.lpOutBuffer=buff+sizeof(IDE_PASS_THROUGH_HEADER);

if ( ide_passthrough_header.protocol==IO_COMMAND_WRITE && copydata ) { ! if ( hpt_verify_area(VERIFY_READ, (void *)(HPT_UPTR)(arg+48), copydata) ! ||copy_from_user(buff+sizeof(IDE_PASS_THROUGH_HEADER), arg+48, copydata)
) { KdPrint(("Got bad user address")); goto invalid; } *************** *** 1962,1968 **** switch (cmd){ case 0x031d: if (copy_to_user(arg, buff+sizeof(IDE_PASS_THROUGH_HEADER)+7, 1) || ! copy_to_user(arg+1, buff+sizeof(IDE_PASS_THROUGH_HEADER)+1, 6) ) goto invalid; break; case 0x031f: --- 1962,1969 ---- switch (cmd){ case 0x031d: if (copy_to_user(arg, buff+sizeof(IDE_PASS_THROUGH_HEADER)+7, 1) || ! copy_to_user(arg+1, buff+sizeof(IDE_PASS_THROUGH_HEADER)+1, 6) || ! copy_to_user(arg,
buff+sizeof(IDE_PASS_THROUGH_HEADER), sizeof(IDE_PASS_THROUGH_HEADER)) ) //
necessary for returning TASKFILE status field goto invalid; break; case 0x031f:

------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july