aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ata.h
diff options
context:
space:
mode:
authorAlbert Lee <albertcc@tw.ibm.com>2005-05-12 15:29:42 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-05-12 15:29:42 -0400
commit8bf62ecee58360749c5f0e68bc97d5e02a6816b1 (patch)
treea3da6e695fc5a71ac7f3246707380a9ac22f6402 /include/linux/ata.h
parent88d7bd8cb9eb8d64bf7997600b0d64f7834047c5 (diff)
[libata] C/H/S support, for older devices
Diffstat (limited to 'include/linux/ata.h')
-rw-r--r--include/linux/ata.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h
index f178894edd04..d8981402cd5b 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -125,6 +125,7 @@ enum {
125 ATA_CMD_PACKET = 0xA0, 125 ATA_CMD_PACKET = 0xA0,
126 ATA_CMD_VERIFY = 0x40, 126 ATA_CMD_VERIFY = 0x40,
127 ATA_CMD_VERIFY_EXT = 0x42, 127 ATA_CMD_VERIFY_EXT = 0x42,
128 ATA_CMD_INIT_DEV_PARAMS = 0x91,
128 129
129 /* SETFEATURES stuff */ 130 /* SETFEATURES stuff */
130 SETFEATURES_XFER = 0x03, 131 SETFEATURES_XFER = 0x03,
@@ -174,6 +175,7 @@ enum {
174 ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */ 175 ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */
175 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */ 176 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */
176 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */ 177 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */
178 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */
177}; 179};
178 180
179enum ata_tf_protocols { 181enum ata_tf_protocols {
@@ -242,6 +244,18 @@ struct ata_taskfile {
242 ((u64) (id)[(n) + 1] << 16) | \ 244 ((u64) (id)[(n) + 1] << 16) | \
243 ((u64) (id)[(n) + 0]) ) 245 ((u64) (id)[(n) + 0]) )
244 246
247static inline int ata_id_current_chs_valid(u16 *id)
248{
249 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
250 has not been issued to the device then the values of
251 id[54] to id[56] are vendor specific. */
252 return (id[53] & 0x01) && /* Current translation valid */
253 id[54] && /* cylinders in current translation */
254 id[55] && /* heads in current translation */
255 id[55] <= 16 &&
256 id[56]; /* sectors in current translation */
257}
258
245static inline int atapi_cdb_len(u16 *dev_id) 259static inline int atapi_cdb_len(u16 *dev_id)
246{ 260{
247 u16 tmp = dev_id[0] & 0x3; 261 u16 tmp = dev_id[0] & 0x3;