aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/ata.h24
-rw-r--r--include/linux/libata.h40
2 files changed, 46 insertions, 18 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h
index a5b74efab067..630908c9378b 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -128,10 +128,15 @@ enum {
128 ATA_CMD_PIO_READ_EXT = 0x24, 128 ATA_CMD_PIO_READ_EXT = 0x24,
129 ATA_CMD_PIO_WRITE = 0x30, 129 ATA_CMD_PIO_WRITE = 0x30,
130 ATA_CMD_PIO_WRITE_EXT = 0x34, 130 ATA_CMD_PIO_WRITE_EXT = 0x34,
131 ATA_CMD_READ_MULTI = 0xC4,
132 ATA_CMD_READ_MULTI_EXT = 0x29,
133 ATA_CMD_WRITE_MULTI = 0xC5,
134 ATA_CMD_WRITE_MULTI_EXT = 0x39,
131 ATA_CMD_SET_FEATURES = 0xEF, 135 ATA_CMD_SET_FEATURES = 0xEF,
132 ATA_CMD_PACKET = 0xA0, 136 ATA_CMD_PACKET = 0xA0,
133 ATA_CMD_VERIFY = 0x40, 137 ATA_CMD_VERIFY = 0x40,
134 ATA_CMD_VERIFY_EXT = 0x42, 138 ATA_CMD_VERIFY_EXT = 0x42,
139 ATA_CMD_INIT_DEV_PARAMS = 0x91,
135 140
136 /* SETFEATURES stuff */ 141 /* SETFEATURES stuff */
137 SETFEATURES_XFER = 0x03, 142 SETFEATURES_XFER = 0x03,
@@ -146,14 +151,14 @@ enum {
146 XFER_MW_DMA_2 = 0x22, 151 XFER_MW_DMA_2 = 0x22,
147 XFER_MW_DMA_1 = 0x21, 152 XFER_MW_DMA_1 = 0x21,
148 XFER_MW_DMA_0 = 0x20, 153 XFER_MW_DMA_0 = 0x20,
154 XFER_SW_DMA_2 = 0x12,
155 XFER_SW_DMA_1 = 0x11,
156 XFER_SW_DMA_0 = 0x10,
149 XFER_PIO_4 = 0x0C, 157 XFER_PIO_4 = 0x0C,
150 XFER_PIO_3 = 0x0B, 158 XFER_PIO_3 = 0x0B,
151 XFER_PIO_2 = 0x0A, 159 XFER_PIO_2 = 0x0A,
152 XFER_PIO_1 = 0x09, 160 XFER_PIO_1 = 0x09,
153 XFER_PIO_0 = 0x08, 161 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, 162 XFER_PIO_SLOW = 0x00,
158 163
159 /* ATAPI stuff */ 164 /* ATAPI stuff */
@@ -181,6 +186,7 @@ enum {
181 ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */ 186 ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */
182 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */ 187 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */
183 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */ 188 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */
189 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */
184}; 190};
185 191
186enum ata_tf_protocols { 192enum ata_tf_protocols {
@@ -250,6 +256,18 @@ struct ata_taskfile {
250 ((u64) (id)[(n) + 1] << 16) | \ 256 ((u64) (id)[(n) + 1] << 16) | \
251 ((u64) (id)[(n) + 0]) ) 257 ((u64) (id)[(n) + 0]) )
252 258
259static inline int ata_id_current_chs_valid(u16 *id)
260{
261 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
262 has not been issued to the device then the values of
263 id[54] to id[56] are vendor specific. */
264 return (id[53] & 0x01) && /* Current translation valid */
265 id[54] && /* cylinders in current translation */
266 id[55] && /* heads in current translation */
267 id[55] <= 16 &&
268 id[56]; /* sectors in current translation */
269}
270
253static inline int atapi_cdb_len(u16 *dev_id) 271static inline int atapi_cdb_len(u16 *dev_id)
254{ 272{
255 u16 tmp = dev_id[0] & 0x3; 273 u16 tmp = dev_id[0] & 0x3;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index ceee1fc42c60..0261c55f3483 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 */
@@ -154,17 +155,21 @@ enum {
154 ATA_SHIFT_UDMA = 0, 155 ATA_SHIFT_UDMA = 0,
155 ATA_SHIFT_MWDMA = 8, 156 ATA_SHIFT_MWDMA = 8,
156 ATA_SHIFT_PIO = 11, 157 ATA_SHIFT_PIO = 11,
158
159 /* Masks for port functions */
160 ATA_PORT_PRIMARY = (1 << 0),
161 ATA_PORT_SECONDARY = (1 << 1),
157}; 162};
158 163
159enum pio_task_states { 164enum hsm_task_states {
160 PIO_ST_UNKNOWN, 165 HSM_ST_UNKNOWN,
161 PIO_ST_IDLE, 166 HSM_ST_IDLE,
162 PIO_ST_POLL, 167 HSM_ST_POLL,
163 PIO_ST_TMOUT, 168 HSM_ST_TMOUT,
164 PIO_ST, 169 HSM_ST,
165 PIO_ST_LAST, 170 HSM_ST_LAST,
166 PIO_ST_LAST_POLL, 171 HSM_ST_LAST_POLL,
167 PIO_ST_ERR, 172 HSM_ST_ERR,
168}; 173};
169 174
170/* forward declarations */ 175/* forward declarations */
@@ -278,10 +283,13 @@ struct ata_device {
278 u8 xfer_mode; 283 u8 xfer_mode;
279 unsigned int xfer_shift; /* ATA_SHIFT_xxx */ 284 unsigned int xfer_shift; /* ATA_SHIFT_xxx */
280 285
281 /* cache info about current transfer mode */ 286 unsigned int multi_count; /* sectors count for
282 u8 xfer_protocol; /* taskfile xfer protocol */ 287 READ/WRITE MULTIPLE */
283 u8 read_cmd; /* opcode to use on read */ 288
284 u8 write_cmd; /* opcode to use on write */ 289 /* for CHS addressing */
290 u16 cylinders; /* Number of cylinders */
291 u16 heads; /* Number of heads */
292 u16 sectors; /* Number of sectors per track */
285}; 293};
286 294
287struct ata_port { 295struct ata_port {
@@ -319,7 +327,7 @@ struct ata_port {
319 struct work_struct packet_task; 327 struct work_struct packet_task;
320 328
321 struct work_struct pio_task; 329 struct work_struct pio_task;
322 unsigned int pio_task_state; 330 unsigned int hsm_task_state;
323 unsigned long pio_task_timeout; 331 unsigned long pio_task_timeout;
324 332
325 void *private_data; 333 void *private_data;
@@ -400,6 +408,8 @@ extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmn
400extern int ata_scsi_error(struct Scsi_Host *host); 408extern int ata_scsi_error(struct Scsi_Host *host);
401extern int ata_scsi_release(struct Scsi_Host *host); 409extern int ata_scsi_release(struct Scsi_Host *host);
402extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); 410extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
411extern int ata_ratelimit(void);
412
403/* 413/*
404 * Default driver ops implementations 414 * Default driver ops implementations
405 */ 415 */
@@ -452,7 +462,7 @@ struct pci_bits {
452 462
453extern void ata_pci_host_stop (struct ata_host_set *host_set); 463extern void ata_pci_host_stop (struct ata_host_set *host_set);
454extern struct ata_probe_ent * 464extern struct ata_probe_ent *
455ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port); 465ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask);
456extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits); 466extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits);
457 467
458#endif /* CONFIG_PCI */ 468#endif /* CONFIG_PCI */