diff options
Diffstat (limited to 'include/linux/ata.h')
-rw-r--r-- | include/linux/ata.h | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h index a5b74efab067..d2873b732bb1 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -42,13 +42,18 @@ enum { | |||
42 | ATA_SECT_SIZE = 512, | 42 | ATA_SECT_SIZE = 512, |
43 | 43 | ||
44 | ATA_ID_WORDS = 256, | 44 | ATA_ID_WORDS = 256, |
45 | ATA_ID_PROD_OFS = 27, | ||
46 | ATA_ID_FW_REV_OFS = 23, | ||
47 | ATA_ID_SERNO_OFS = 10, | 45 | ATA_ID_SERNO_OFS = 10, |
48 | ATA_ID_MAJOR_VER = 80, | 46 | ATA_ID_FW_REV_OFS = 23, |
49 | ATA_ID_PIO_MODES = 64, | 47 | ATA_ID_PROD_OFS = 27, |
48 | ATA_ID_OLD_PIO_MODES = 51, | ||
49 | ATA_ID_FIELD_VALID = 53, | ||
50 | ATA_ID_MWDMA_MODES = 63, | 50 | ATA_ID_MWDMA_MODES = 63, |
51 | ATA_ID_PIO_MODES = 64, | ||
52 | ATA_ID_EIDE_DMA_MIN = 65, | ||
53 | ATA_ID_EIDE_PIO = 67, | ||
54 | ATA_ID_EIDE_PIO_IORDY = 68, | ||
51 | ATA_ID_UDMA_MODES = 88, | 55 | ATA_ID_UDMA_MODES = 88, |
56 | ATA_ID_MAJOR_VER = 80, | ||
52 | ATA_ID_PIO4 = (1 << 1), | 57 | ATA_ID_PIO4 = (1 << 1), |
53 | 58 | ||
54 | ATA_PCI_CTL_OFS = 2, | 59 | ATA_PCI_CTL_OFS = 2, |
@@ -128,10 +133,15 @@ enum { | |||
128 | ATA_CMD_PIO_READ_EXT = 0x24, | 133 | ATA_CMD_PIO_READ_EXT = 0x24, |
129 | ATA_CMD_PIO_WRITE = 0x30, | 134 | ATA_CMD_PIO_WRITE = 0x30, |
130 | ATA_CMD_PIO_WRITE_EXT = 0x34, | 135 | ATA_CMD_PIO_WRITE_EXT = 0x34, |
136 | ATA_CMD_READ_MULTI = 0xC4, | ||
137 | ATA_CMD_READ_MULTI_EXT = 0x29, | ||
138 | ATA_CMD_WRITE_MULTI = 0xC5, | ||
139 | ATA_CMD_WRITE_MULTI_EXT = 0x39, | ||
131 | ATA_CMD_SET_FEATURES = 0xEF, | 140 | ATA_CMD_SET_FEATURES = 0xEF, |
132 | ATA_CMD_PACKET = 0xA0, | 141 | ATA_CMD_PACKET = 0xA0, |
133 | ATA_CMD_VERIFY = 0x40, | 142 | ATA_CMD_VERIFY = 0x40, |
134 | ATA_CMD_VERIFY_EXT = 0x42, | 143 | ATA_CMD_VERIFY_EXT = 0x42, |
144 | ATA_CMD_INIT_DEV_PARAMS = 0x91, | ||
135 | 145 | ||
136 | /* SETFEATURES stuff */ | 146 | /* SETFEATURES stuff */ |
137 | SETFEATURES_XFER = 0x03, | 147 | SETFEATURES_XFER = 0x03, |
@@ -146,14 +156,14 @@ enum { | |||
146 | XFER_MW_DMA_2 = 0x22, | 156 | XFER_MW_DMA_2 = 0x22, |
147 | XFER_MW_DMA_1 = 0x21, | 157 | XFER_MW_DMA_1 = 0x21, |
148 | XFER_MW_DMA_0 = 0x20, | 158 | XFER_MW_DMA_0 = 0x20, |
159 | XFER_SW_DMA_2 = 0x12, | ||
160 | XFER_SW_DMA_1 = 0x11, | ||
161 | XFER_SW_DMA_0 = 0x10, | ||
149 | XFER_PIO_4 = 0x0C, | 162 | XFER_PIO_4 = 0x0C, |
150 | XFER_PIO_3 = 0x0B, | 163 | XFER_PIO_3 = 0x0B, |
151 | XFER_PIO_2 = 0x0A, | 164 | XFER_PIO_2 = 0x0A, |
152 | XFER_PIO_1 = 0x09, | 165 | XFER_PIO_1 = 0x09, |
153 | XFER_PIO_0 = 0x08, | 166 | XFER_PIO_0 = 0x08, |
154 | XFER_SW_DMA_2 = 0x12, | ||
155 | XFER_SW_DMA_1 = 0x11, | ||
156 | XFER_SW_DMA_0 = 0x10, | ||
157 | XFER_PIO_SLOW = 0x00, | 167 | XFER_PIO_SLOW = 0x00, |
158 | 168 | ||
159 | /* ATAPI stuff */ | 169 | /* ATAPI stuff */ |
@@ -181,6 +191,7 @@ enum { | |||
181 | ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */ | 191 | ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */ |
182 | ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */ | 192 | ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */ |
183 | ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */ | 193 | ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */ |
194 | ATA_TFLAG_LBA = (1 << 4), /* enable LBA */ | ||
184 | }; | 195 | }; |
185 | 196 | ||
186 | enum ata_tf_protocols { | 197 | enum ata_tf_protocols { |
@@ -250,7 +261,19 @@ struct ata_taskfile { | |||
250 | ((u64) (id)[(n) + 1] << 16) | \ | 261 | ((u64) (id)[(n) + 1] << 16) | \ |
251 | ((u64) (id)[(n) + 0]) ) | 262 | ((u64) (id)[(n) + 0]) ) |
252 | 263 | ||
253 | static inline int atapi_cdb_len(u16 *dev_id) | 264 | static inline int ata_id_current_chs_valid(const u16 *id) |
265 | { | ||
266 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command | ||
267 | has not been issued to the device then the values of | ||
268 | id[54] to id[56] are vendor specific. */ | ||
269 | return (id[53] & 0x01) && /* Current translation valid */ | ||
270 | id[54] && /* cylinders in current translation */ | ||
271 | id[55] && /* heads in current translation */ | ||
272 | id[55] <= 16 && | ||
273 | id[56]; /* sectors in current translation */ | ||
274 | } | ||
275 | |||
276 | static inline int atapi_cdb_len(const u16 *dev_id) | ||
254 | { | 277 | { |
255 | u16 tmp = dev_id[0] & 0x3; | 278 | u16 tmp = dev_id[0] & 0x3; |
256 | switch (tmp) { | 279 | switch (tmp) { |
@@ -260,7 +283,7 @@ static inline int atapi_cdb_len(u16 *dev_id) | |||
260 | } | 283 | } |
261 | } | 284 | } |
262 | 285 | ||
263 | static inline int is_atapi_taskfile(struct ata_taskfile *tf) | 286 | static inline int is_atapi_taskfile(const struct ata_taskfile *tf) |
264 | { | 287 | { |
265 | return (tf->protocol == ATA_PROT_ATAPI) || | 288 | return (tf->protocol == ATA_PROT_ATAPI) || |
266 | (tf->protocol == ATA_PROT_ATAPI_NODATA) || | 289 | (tf->protocol == ATA_PROT_ATAPI_NODATA) || |