Add and utilize defines for the ATA device register.

PR:		169764
Submitted by:	Steven Hartland <steven.hartland@multiplay.co.uk>
Reviewed by:	mav
MFC after:	2 weeks
This commit is contained in:
Christian Brueffer 2012-07-12 10:09:34 +00:00
parent 7e003b0a8b
commit 97ab227579
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=238393
2 changed files with 17 additions and 3 deletions

View File

@ -359,7 +359,7 @@ ata_28bit_cmd(struct ccb_ataio *ataio, uint8_t cmd, uint8_t features,
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, uint8_t cmd, uint16_t features,
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, uint8_t cmd,
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;

View File

@ -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