Subject: Re: atactl, ATAIOCCOMMAND and SMART status cylinder value
To: Frank van der Linden <>
From: Manuel Bouyer <>
List: tech-kern
Date: 11/17/2004 16:22:56
On Wed, Nov 17, 2004 at 10:37:22AM +0100, Frank van der Linden wrote:
> I recently had some problems with "atactl smart status" on a big-endian
> system. The drive rejected the command, and I tried to figure out why.
> I noticed that, in atactl.c, the magic number for the SMART command
> is always set as a little-endian value:
> 	req.cylinder = htole16(WDSMART_CYL);
> Where WDSMART_CYL is 0xc24f.
> However, that doesn't seem correct to me. Reading the ATA spec, it
> simply requires that "LBA mid" (cyl_lo) and "LBA high" (cyl_hi)
> are 0x4f and 0xc2 respectively. If you follow the path of the
> r_cylinder value as passed in through the ATAIOCCOMMAND, it will
> always be assigned as:
> 	cyl_lo = cyl;
> 	cyl_hi = cyl >> 8;
> In other words, native byte order is the right way to go, and atactl.c
> should be changed.

Looks good to me.

Manuel Bouyer <>
     NetBSD: 26 ans d'experience feront toujours la difference