Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jul 2012 09:27:01 +0000 (UTC)
From:      Christian Brueffer <brueffer@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r238794 - in stable/8/sys: cam/ata sys
Message-ID:  <201207260927.q6Q9R11e061698@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brueffer
Date: Thu Jul 26 09:27:00 2012
New Revision: 238794
URL: http://svn.freebsd.org/changeset/base/238794

Log:
  MFC: r238393
  
  Add and utilize defines for the ATA device register.

Modified:
  stable/8/sys/cam/ata/ata_all.c
  stable/8/sys/sys/ata.h
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/cam/ata/ata_all.c
==============================================================================
--- stable/8/sys/cam/ata/ata_all.c	Thu Jul 26 09:13:47 2012	(r238793)
+++ stable/8/sys/cam/ata/ata_all.c	Thu Jul 26 09:27:00 2012	(r238794)
@@ -334,7 +334,7 @@ ata_28bit_cmd(struct ccb_ataio *ataio, u
 	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;
 }
 
@@ -359,7 +359,7 @@ ata_48bit_cmd(struct ccb_ataio *ataio, u
 	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;
@@ -379,7 +379,7 @@ ata_ncq_cmd(struct ccb_ataio *ataio, uin
 	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;

Modified: stable/8/sys/sys/ata.h
==============================================================================
--- stable/8/sys/sys/ata.h	Thu Jul 26 09:13:47 2012	(r238793)
+++ stable/8/sys/sys/ata.h	Thu Jul 26 09:27:00 2012	(r238794)
@@ -261,6 +261,20 @@ struct ata_params {
 /*255*/ u_int16_t       integrity;
 } __packed;
 
+/*
+ * ATA Device Register
+ *
+ * bit 7 Obsolete (was 1 in early ATA specs)
+ * bit 6 Sets LBA/CHS mode. 1=LBA, 0=CHS 
+ * bit 5 Obsolete (was 1 in early ATA specs)
+ * 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_LBA		0x40
+
 
 /* ATA transfer modes */
 #define ATA_MODE_MASK           0x0f



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207260927.q6Q9R11e061698>