svn commit: r238393 - in head/sys: cam/ata sys

Christian Brueffer brueffer at FreeBSD.org
Thu Jul 12 10:09:35 UTC 2012


Author: brueffer
Date: Thu Jul 12 10:09:34 2012
New Revision: 238393
URL: http://svn.freebsd.org/changeset/base/238393

Log:
  Add and utilize defines for the ATA device register.
  
  PR:		169764
  Submitted by:	Steven Hartland <steven.hartland at multiplay.co.uk>
  Reviewed by:	mav
  MFC after:	2 weeks

Modified:
  head/sys/cam/ata/ata_all.c
  head/sys/sys/ata.h

Modified: head/sys/cam/ata/ata_all.c
==============================================================================
--- head/sys/cam/ata/ata_all.c	Thu Jul 12 07:34:09 2012	(r238392)
+++ head/sys/cam/ata/ata_all.c	Thu Jul 12 10:09:34 2012	(r238393)
@@ -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: head/sys/sys/ata.h
==============================================================================
--- head/sys/sys/ata.h	Thu Jul 12 07:34:09 2012	(r238392)
+++ head/sys/sys/ata.h	Thu Jul 12 10:09:34 2012	(r238393)
@@ -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-head mailing list