From owner-freebsd-bugs@FreeBSD.ORG Tue Jul 10 12:50:07 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67DC31065672 for ; Tue, 10 Jul 2012 12:50:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 3FF568FC1F for ; Tue, 10 Jul 2012 12:50:07 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q6ACo7j3009827 for ; Tue, 10 Jul 2012 12:50:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q6ACo7X5009826; Tue, 10 Jul 2012 12:50:07 GMT (envelope-from gnats) Resent-Date: Tue, 10 Jul 2012 12:50:07 GMT Resent-Message-Id: <201207101250.q6ACo7X5009826@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Steven Hartland Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2339D106567A for ; Tue, 10 Jul 2012 12:42:38 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id E8A6F8FC08 for ; Tue, 10 Jul 2012 12:42:37 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q6ACgbaX043646 for ; Tue, 10 Jul 2012 12:42:37 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q6ACgbOH043645; Tue, 10 Jul 2012 12:42:37 GMT (envelope-from nobody) Message-Id: <201207101242.q6ACgbOH043645@red.freebsd.org> Date: Tue, 10 Jul 2012 12:42:37 GMT From: Steven Hartland To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/169764: Patch which adds defines for ATA device values X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2012 12:50:07 -0000 >Number: 169764 >Category: misc >Synopsis: Patch which adds defines for ATA device values >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jul 10 12:50:06 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Steven Hartland >Release: 8.3-RELEASE >Organization: Multiplay >Environment: FreeBSD build 8.3-RELEASE-p3 FreeBSD 8.3-RELEASE-p3 #3: Tue Jul 3 13:16:31 UTC 2012 root@build:/usr/obj/usr/src/sys/MULTIPLAY amd64 >Description: Simple patch which adds the defines for the "magic" ATA values in the code in order to ensure its easy to know what the values mean >How-To-Repeat: N/A >Fix: Apply the attached patch Patch attached with submission follows: Adds ATA device register defines so that its clear what the various values are in the code instead of having "magic" 0x40's in the code --- sys/sys/ata.h.orig 2012-03-03 06:15:13.000000000 +0000 +++ sys/sys/ata.h 2012-07-10 00:23:09.558799761 +0000 @@ -261,6 +269,21 @@ /*255*/ u_int16_t integrity; } __packed; +/* + * ATA Device Register + * + * bit 7 Obsolete in LBA mode, should be set to 1 in CHS mode + * bit 6 Sets LBA/CHS mode. 1=LBA, 0=CHS + * bit 5 Obsolete in LBA mode, should be set to 1 in CHS mode + * bit 4 1 = Slave Drive, 0 = Master Drive + * bit 3-0 In LBA mode, 27-24 of address. In CHS mode, head number +*/ + +#define ATA_DEV_MASTER 0x00 +#define ATA_DEV_SLAVE 0x10 +#define ATA_DEV_CHS 0x00 +#define ATA_DEV_LBA 0x40 + /* ATA transfer modes */ #define ATA_MODE_MASK 0x0f --- sys/cam/ata/ata_all.c.orig 2012-06-20 01:26:17.664685074 +0000 +++ sys/cam/ata/ata_all.c 2012-06-20 01:27:03.929604041 +0000 @@ -333,7 +333,7 @@ ataio->cmd.lba_low = lba; ataio->cmd.lba_mid = lba >> 8; ataio->cmd.lba_high = lba >> 16; - ataio->cmd.device = 0x40 | ((lba >> 24) & 0x0f); + ataio->cmd.device = ATA_DEV_LBA | ((lba >> 24) & 0x0f); ataio->cmd.sector_count = sector_count; } @@ -358,7 +358,7 @@ ataio->cmd.lba_low = lba; ataio->cmd.lba_mid = lba >> 8; ataio->cmd.lba_high = lba >> 16; - ataio->cmd.device = 0x40; + ataio->cmd.device = ATA_DEV_LBA; ataio->cmd.lba_low_exp = lba >> 24; ataio->cmd.lba_mid_exp = lba >> 32; ataio->cmd.lba_high_exp = lba >> 40; @@ -378,7 +378,7 @@ ataio->cmd.lba_low = lba; ataio->cmd.lba_mid = lba >> 8; ataio->cmd.lba_high = lba >> 16; - ataio->cmd.device = 0x40; + ataio->cmd.device = ATA_DEV_LBA; ataio->cmd.lba_low_exp = lba >> 24; ataio->cmd.lba_mid_exp = lba >> 32; ataio->cmd.lba_high_exp = lba >> 40; >Release-Note: >Audit-Trail: >Unformatted: