svn commit: r238793 - in stable/9/sys: cam/ata sys

Christian Brueffer brueffer at FreeBSD.org
Thu Jul 26 09:13:48 UTC 2012


Author: brueffer
Date: Thu Jul 26 09:13:47 2012
New Revision: 238793
URL: http://svn.freebsd.org/changeset/base/238793

Log:
  MFC: r238393
  
  Add and utilize defines for the ATA device register.
  
  Approved by:	re (kib)

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

Modified: stable/9/sys/cam/ata/ata_all.c
==============================================================================
--- stable/9/sys/cam/ata/ata_all.c	Thu Jul 26 09:11:37 2012	(r238792)
+++ stable/9/sys/cam/ata/ata_all.c	Thu Jul 26 09:13:47 2012	(r238793)
@@ -359,7 +359,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;
 }
 
@@ -384,7 +384,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;
@@ -404,7 +404,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/9/sys/sys/ata.h
==============================================================================
--- stable/9/sys/sys/ata.h	Thu Jul 26 09:11:37 2012	(r238792)
+++ stable/9/sys/sys/ata.h	Thu Jul 26 09:13:47 2012	(r238793)
@@ -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


More information about the svn-src-stable-9 mailing list