aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/ata.h14
-rw-r--r--include/linux/libata.h6
2 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h
index ca5fcadf9981..6962e26fc6df 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 {
@@ -243,6 +245,18 @@ struct ata_taskfile {
243 ((u64) (id)[(n) + 1] << 16) | \ 245 ((u64) (id)[(n) + 1] << 16) | \
244 ((u64) (id)[(n) + 0]) ) 246 ((u64) (id)[(n) + 0]) )
245 247
248static inline int ata_id_current_chs_valid(u16 *id)
249{
250 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
251 has not been issued to the device then the values of
252 id[54] to id[56] are vendor specific. */
253 return (id[53] & 0x01) && /* Current translation valid */
254 id[54] && /* cylinders in current translation */
255 id[55] && /* heads in current translation */
256 id[55] <= 16 &&
257 id[56]; /* sectors in current translation */
258}
259
246static inline int atapi_cdb_len(u16 *dev_id) 260static inline int atapi_cdb_len(u16 *dev_id)
247{ 261{
248 u16 tmp = dev_id[0] & 0x3; 262 u16 tmp = dev_id[0] & 0x3;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 6cd9ba63563b..973090be7fc4 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -95,6 +95,7 @@ enum {
95 ATA_DFLAG_LBA48 = (1 << 0), /* device supports LBA48 */ 95 ATA_DFLAG_LBA48 = (1 << 0), /* device supports LBA48 */
96 ATA_DFLAG_PIO = (1 << 1), /* device currently in PIO mode */ 96 ATA_DFLAG_PIO = (1 << 1), /* device currently in PIO mode */
97 ATA_DFLAG_LOCK_SECTORS = (1 << 2), /* don't adjust max_sectors */ 97 ATA_DFLAG_LOCK_SECTORS = (1 << 2), /* don't adjust max_sectors */
98 ATA_DFLAG_LBA = (1 << 3), /* device supports LBA */
98 99
99 ATA_DEV_UNKNOWN = 0, /* unknown device */ 100 ATA_DEV_UNKNOWN = 0, /* unknown device */
100 ATA_DEV_ATA = 1, /* ATA device */ 101 ATA_DEV_ATA = 1, /* ATA device */
@@ -278,6 +279,11 @@ struct ata_device {
278 u8 xfer_protocol; /* taskfile xfer protocol */ 279 u8 xfer_protocol; /* taskfile xfer protocol */
279 u8 read_cmd; /* opcode to use on read */ 280 u8 read_cmd; /* opcode to use on read */
280 u8 write_cmd; /* opcode to use on write */ 281 u8 write_cmd; /* opcode to use on write */
282
283 /* for CHS addressing */
284 u16 cylinders; /* Number of cylinders */
285 u16 heads; /* Number of heads */
286 u16 sectors; /* Number of sectors per track */
281}; 287};
282 288
283struct ata_port { 289struct ata_port {