Re: ATAng support for reading from register on ATAREQUEST command?

From: Eduard Martinescu <martines_at_rochester.rr.com>
Date: Sun, 21 Nov 2004 15:03:59 -0500
Matt/Søren,

I did send Søren a patch to implement an optional READ parameter to the
IOCTL, but he decided instead to ALWAYS read back the registers on any
ATA_R_CONTROL command.

Smartmontools has been updated to take this into account, and the next
stable version should be more accurate.

Ed

On Sun, 2004-11-21 at 13:00 +0100, Søren Schmidt wrote:
> Matt Kucenski wrote:
> > I am trying to develop a program that will allow modifications to the Host Protected Area settings and one of the commands (READ NATIVE MAX ADDRESS) returns the native max address back in the register (LBA high, low, mid).
> > 
> > I have been looking at the smartmontools project for pointers on how to write this code and according to that source, this is not possible yet with ATAng.  There is a comment in their code that another command (ATA_CMD_READ_REG) patch has been submitted to ATAng, but it does not appear to have made it into any of the latest sources.
> > 
> > Can anyone offer any information on this?
> 
> The following patch returns the register values in the request you sent 
> through ioctl call. That should do the trick without any new calls..
> 
> 
> Plain text document attachment (ata-smart-patch)
> Index: ata-all.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/dev/ata/ata-all.c,v
> retrieving revision 1.233
> diff -u -r1.233 ata-all.c
> --- ata-all.c	19 Oct 2004 20:13:38 -0000	1.233
> +++ ata-all.c	19 Nov 2004 18:59:55 -0000
> _at__at_ -546,10 +546,10 _at__at_
>  	    bcopy(iocmd->u.request.u.atapi.ccb, request->u.atapi.ccb, 16);
>  	}
>  	else {
> -	     request->u.ata.command = iocmd->u.request.u.ata.command;
> -	     request->u.ata.feature = iocmd->u.request.u.ata.feature;
> -	     request->u.ata.lba = iocmd->u.request.u.ata.lba;
> -	     request->u.ata.count = iocmd->u.request.u.ata.count;
> +	    request->u.ata.command = iocmd->u.request.u.ata.command;
> +	    request->u.ata.feature = iocmd->u.request.u.ata.feature;
> +	    request->u.ata.lba = iocmd->u.request.u.ata.lba;
> +	    request->u.ata.count = iocmd->u.request.u.ata.count;
>  	}
>  
>  	request->timeout = iocmd->u.request.timeout;
> _at__at_ -566,6 +566,10 _at__at_
>  
>  	ata_queue_request(request);
>  
> +	iocmd->u.request.u.ata.command = request->u.ata.command;
> +	iocmd->u.request.u.ata.feature = request->u.ata.feature;
> +	iocmd->u.request.u.ata.lba = request->u.ata.lba;
> +	iocmd->u.request.u.ata.count = request->u.ata.count;
>  	if (request->result)
>  	    iocmd->u.request.error = request->result;
>  	else {
> _______________________________________________
> freebsd-current_at_freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
-- 
Eduard Martinescu <martines_at_rochester.rr.com>
Received on Sun Nov 21 2004 - 19:04:15 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:22 UTC