aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/ata.h20
-rw-r--r--include/linux/libata.h26
2 files changed, 33 insertions, 13 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h
index a5b74efab067..ecb7346d0c16 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -132,6 +132,7 @@ enum {
132 ATA_CMD_PACKET = 0xA0, 132 ATA_CMD_PACKET = 0xA0,
133 ATA_CMD_VERIFY = 0x40, 133 ATA_CMD_VERIFY = 0x40,
134 ATA_CMD_VERIFY_EXT = 0x42, 134 ATA_CMD_VERIFY_EXT = 0x42,
135 ATA_CMD_INIT_DEV_PARAMS = 0x91,
135 136
136 /* SETFEATURES stuff */ 137 /* SETFEATURES stuff */
137 SETFEATURES_XFER = 0x03, 138 SETFEATURES_XFER = 0x03,
@@ -146,14 +147,14 @@ enum {
146 XFER_MW_DMA_2 = 0x22, 147 XFER_MW_DMA_2 = 0x22,
147 XFER_MW_DMA_1 = 0x21, 148 XFER_MW_DMA_1 = 0x21,
148 XFER_MW_DMA_0 = 0x20, 149 XFER_MW_DMA_0 = 0x20,
150 XFER_SW_DMA_2 = 0x12,
151 XFER_SW_DMA_1 = 0x11,
152 XFER_SW_DMA_0 = 0x10,
149 XFER_PIO_4 = 0x0C, 153 XFER_PIO_4 = 0x0C,
150 XFER_PIO_3 = 0x0B, 154 XFER_PIO_3 = 0x0B,
151 XFER_PIO_2 = 0x0A, 155 XFER_PIO_2 = 0x0A,
152 XFER_PIO_1 = 0x09, 156 XFER_PIO_1 = 0x09,
153 XFER_PIO_0 = 0x08, 157 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, 158 XFER_PIO_SLOW = 0x00,
158 159
159 /* ATAPI stuff */ 160 /* ATAPI stuff */
@@ -181,6 +182,7 @@ enum {
181 ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */ 182 ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */
182 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */ 183 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */
183 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */ 184 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */
185 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */
184}; 186};
185 187
186enum ata_tf_protocols { 188enum ata_tf_protocols {
@@ -250,6 +252,18 @@ struct ata_taskfile {
250 ((u64) (id)[(n) + 1] << 16) | \ 252 ((u64) (id)[(n) + 1] << 16) | \
251 ((u64) (id)[(n) + 0]) ) 253 ((u64) (id)[(n) + 0]) )
252 254
255static inline int ata_id_current_chs_valid(u16 *id)
256{
257 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
258 has not been issued to the device then the values of
259 id[54] to id[56] are vendor specific. */
260 return (id[53] & 0x01) && /* Current translation valid */
261 id[54] && /* cylinders in current translation */
262 id[55] && /* heads in current translation */
263 id[55] <= 16 &&
264 id[56]; /* sectors in current translation */
265}
266
253static inline int atapi_cdb_len(u16 *dev_id) 267static inline int atapi_cdb_len(u16 *dev_id)
254{ 268{
255 u16 tmp = dev_id[0] & 0x3; 269 u16 tmp = dev_id[0] & 0x3;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index ceee1fc42c60..4739a75b983d 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -97,6 +97,7 @@ enum {
97 ATA_DFLAG_LBA48 = (1 << 0), /* device supports LBA48 */ 97 ATA_DFLAG_LBA48 = (1 << 0), /* device supports LBA48 */
98 ATA_DFLAG_PIO = (1 << 1), /* device currently in PIO mode */ 98 ATA_DFLAG_PIO = (1 << 1), /* device currently in PIO mode */
99 ATA_DFLAG_LOCK_SECTORS = (1 << 2), /* don't adjust max_sectors */ 99 ATA_DFLAG_LOCK_SECTORS = (1 << 2), /* don't adjust max_sectors */
100 ATA_DFLAG_LBA = (1 << 3), /* device supports LBA */
100 101
101 ATA_DEV_UNKNOWN = 0, /* unknown device */ 102 ATA_DEV_UNKNOWN = 0, /* unknown device */
102 ATA_DEV_ATA = 1, /* ATA device */ 103 ATA_DEV_ATA = 1, /* ATA device */
@@ -156,15 +157,15 @@ enum {
156 ATA_SHIFT_PIO = 11, 157 ATA_SHIFT_PIO = 11,
157}; 158};
158 159
159enum pio_task_states { 160enum hsm_task_states {
160 PIO_ST_UNKNOWN, 161 HSM_ST_UNKNOWN,
161 PIO_ST_IDLE, 162 HSM_ST_IDLE,
162 PIO_ST_POLL, 163 HSM_ST_POLL,
163 PIO_ST_TMOUT, 164 HSM_ST_TMOUT,
164 PIO_ST, 165 HSM_ST,
165 PIO_ST_LAST, 166 HSM_ST_LAST,
166 PIO_ST_LAST_POLL, 167 HSM_ST_LAST_POLL,
167 PIO_ST_ERR, 168 HSM_ST_ERR,
168}; 169};
169 170
170/* forward declarations */ 171/* forward declarations */
@@ -282,6 +283,11 @@ struct ata_device {
282 u8 xfer_protocol; /* taskfile xfer protocol */ 283 u8 xfer_protocol; /* taskfile xfer protocol */
283 u8 read_cmd; /* opcode to use on read */ 284 u8 read_cmd; /* opcode to use on read */
284 u8 write_cmd; /* opcode to use on write */ 285 u8 write_cmd; /* opcode to use on write */
286
287 /* for CHS addressing */
288 u16 cylinders; /* Number of cylinders */
289 u16 heads; /* Number of heads */
290 u16 sectors; /* Number of sectors per track */
285}; 291};
286 292
287struct ata_port { 293struct ata_port {
@@ -319,7 +325,7 @@ struct ata_port {
319 struct work_struct packet_task; 325 struct work_struct packet_task;
320 326
321 struct work_struct pio_task; 327 struct work_struct pio_task;
322 unsigned int pio_task_state; 328 unsigned int hsm_task_state;
323 unsigned long pio_task_timeout; 329 unsigned long pio_task_timeout;
324 330
325 void *private_data; 331 void *private_data;