aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/libata.h
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-04-02 10:30:40 -0400
committerJeff Garzik <jeff@garzik.org>2006-04-02 10:30:40 -0400
commit029f5468b5b5f93a09bf90326fdcb9124079658d (patch)
treef869fb02ad1ca49e0920e073b22cbb96a184ccae /include/linux/libata.h
parent8e181c14f2baa5be9b7f7c3917b7d4ecf7529110 (diff)
parent1ad8e7f9eb051b040880e45337ed74bfd916ef7f (diff)
Merge branch 'upstream'
Conflicts: drivers/scsi/libata-core.c drivers/scsi/pdc_adma.c drivers/scsi/sata_mv.c drivers/scsi/sata_nv.c drivers/scsi/sata_promise.c drivers/scsi/sata_qstor.c drivers/scsi/sata_sx4.c drivers/scsi/sata_vsc.c include/linux/libata.h
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r--include/linux/libata.h92
1 files changed, 57 insertions, 35 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index b0171e9accc4..cc6cc08e8010 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -120,10 +120,12 @@ enum {
120 ATA_SHT_USE_CLUSTERING = 1, 120 ATA_SHT_USE_CLUSTERING = 1,
121 121
122 /* struct ata_device stuff */ 122 /* struct ata_device stuff */
123 ATA_DFLAG_LBA48 = (1 << 0), /* device supports LBA48 */ 123 ATA_DFLAG_LBA = (1 << 0), /* device supports LBA */
124 ATA_DFLAG_PIO = (1 << 1), /* device currently in PIO mode */ 124 ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */
125 ATA_DFLAG_LBA = (1 << 2), /* device supports LBA */ 125 ATA_DFLAG_CDB_INTR = (1 << 2), /* device asserts INTRQ when ready for CDB */
126 ATA_DFLAG_CDB_INTR = (1 << 3), /* device asserts INTRQ when ready for CDB */ 126 ATA_DFLAG_CFG_MASK = (1 << 8) - 1,
127
128 ATA_DFLAG_PIO = (1 << 8), /* device currently in PIO mode */
127 129
128 ATA_DEV_UNKNOWN = 0, /* unknown device */ 130 ATA_DEV_UNKNOWN = 0, /* unknown device */
129 ATA_DEV_ATA = 1, /* ATA device */ 131 ATA_DEV_ATA = 1, /* ATA device */
@@ -133,33 +135,35 @@ enum {
133 ATA_DEV_NONE = 5, /* no device */ 135 ATA_DEV_NONE = 5, /* no device */
134 136
135 /* struct ata_port flags */ 137 /* struct ata_port flags */
136 ATA_FLAG_SLAVE_POSS = (1 << 1), /* host supports slave dev */ 138 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */
137 /* (doesn't imply presence) */ 139 /* (doesn't imply presence) */
138 ATA_FLAG_PORT_DISABLED = (1 << 2), /* port is disabled, ignore it */ 140 ATA_FLAG_SATA = (1 << 1),
139 ATA_FLAG_SATA = (1 << 3), 141 ATA_FLAG_NO_LEGACY = (1 << 2), /* no legacy mode check */
140 ATA_FLAG_NO_LEGACY = (1 << 4), /* no legacy mode check */ 142 ATA_FLAG_MMIO = (1 << 3), /* use MMIO, not PIO */
141 ATA_FLAG_SRST = (1 << 5), /* (obsolete) use ATA SRST, not E.D.D. */ 143 ATA_FLAG_SRST = (1 << 4), /* (obsolete) use ATA SRST, not E.D.D. */
142 ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */ 144 ATA_FLAG_SATA_RESET = (1 << 5), /* (obsolete) use COMRESET */
143 ATA_FLAG_SATA_RESET = (1 << 7), /* (obsolete) use COMRESET */ 145 ATA_FLAG_NO_ATAPI = (1 << 6), /* No ATAPI support */
144 ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */ 146 ATA_FLAG_PIO_DMA = (1 << 7), /* PIO cmds via DMA */
145 ATA_FLAG_PIO_POLLING = (1 << 9), /* use polling PIO if LLD 147 ATA_FLAG_PIO_LBA48 = (1 << 8), /* Host DMA engine is LBA28 only */
146 * doesn't handle PIO interrupts */ 148 ATA_FLAG_IRQ_MASK = (1 << 9), /* Mask IRQ in PIO xfers */
147 ATA_FLAG_DEBUGMSG = (1 << 10), 149 ATA_FLAG_PIO_POLLING = (1 << 10), /* use polling PIO if LLD
148 ATA_FLAG_NO_ATAPI = (1 << 11), /* No ATAPI support */ 150 * doesn't handle PIO interrupts */
149 151
150 ATA_FLAG_SUSPENDED = (1 << 12), /* port is suspended */ 152 ATA_FLAG_DEBUGMSG = (1 << 17),
151 153 ATA_FLAG_FLUSH_PORT_TASK = (1 << 18), /* flush port task */
152 ATA_FLAG_PIO_LBA48 = (1 << 13), /* Host DMA engine is LBA28 only */ 154
153 ATA_FLAG_IRQ_MASK = (1 << 14), /* Mask IRQ in PIO xfers */ 155 ATA_FLAG_DISABLED = (1 << 19), /* port is disabled, ignore it */
154 156 ATA_FLAG_SUSPENDED = (1 << 20), /* port is suspended */
155 ATA_FLAG_FLUSH_PORT_TASK = (1 << 15), /* Flush port task */ 157
156 ATA_FLAG_IN_EH = (1 << 16), /* EH in progress */ 158 /* bits 24:31 of ap->flags are reserved for LLDD specific flags */
157 159
158 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ 160 /* struct ata_queued_cmd flags */
159 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ 161 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */
160 ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */ 162 ATA_QCFLAG_SG = (1 << 1), /* have s/g table? */
163 ATA_QCFLAG_SINGLE = (1 << 2), /* no s/g, just a single buffer */
161 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE, 164 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE,
162 ATA_QCFLAG_EH_SCHEDULED = (1 << 5), /* EH scheduled */ 165 ATA_QCFLAG_IO = (1 << 3), /* standard IO command */
166 ATA_QCFLAG_EH_SCHEDULED = (1 << 4), /* EH scheduled */
163 167
164 /* host set flags */ 168 /* host set flags */
165 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host_set only */ 169 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host_set only */
@@ -205,10 +209,13 @@ enum {
205 /* size of buffer to pad xfers ending on unaligned boundaries */ 209 /* size of buffer to pad xfers ending on unaligned boundaries */
206 ATA_DMA_PAD_SZ = 4, 210 ATA_DMA_PAD_SZ = 4,
207 ATA_DMA_PAD_BUF_SZ = ATA_DMA_PAD_SZ * ATA_MAX_QUEUE, 211 ATA_DMA_PAD_BUF_SZ = ATA_DMA_PAD_SZ * ATA_MAX_QUEUE,
208 212
209 /* Masks for port functions */ 213 /* masks for port functions */
210 ATA_PORT_PRIMARY = (1 << 0), 214 ATA_PORT_PRIMARY = (1 << 0),
211 ATA_PORT_SECONDARY = (1 << 1), 215 ATA_PORT_SECONDARY = (1 << 1),
216
217 /* how hard are we gonna try to probe/recover devices */
218 ATA_PROBE_MAX_TRIES = 3,
212}; 219};
213 220
214enum hsm_task_states { 221enum hsm_task_states {
@@ -394,6 +401,7 @@ struct ata_port {
394 unsigned int mwdma_mask; 401 unsigned int mwdma_mask;
395 unsigned int udma_mask; 402 unsigned int udma_mask;
396 unsigned int cbl; /* cable type; ATA_CBL_xxx */ 403 unsigned int cbl; /* cable type; ATA_CBL_xxx */
404 unsigned int sata_spd_limit; /* SATA PHY speed limit */
397 405
398 struct ata_device device[ATA_MAX_DEVICES]; 406 struct ata_device device[ATA_MAX_DEVICES];
399 407
@@ -519,9 +527,6 @@ extern void ata_host_set_remove(struct ata_host_set *host_set);
519extern int ata_scsi_detect(struct scsi_host_template *sht); 527extern int ata_scsi_detect(struct scsi_host_template *sht);
520extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 528extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
521extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); 529extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
522extern int ata_scsi_error(struct Scsi_Host *host);
523extern void ata_eh_qc_complete(struct ata_queued_cmd *qc);
524extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
525extern int ata_scsi_release(struct Scsi_Host *host); 530extern int ata_scsi_release(struct Scsi_Host *host);
526extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); 531extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
527extern int ata_scsi_device_resume(struct scsi_device *); 532extern int ata_scsi_device_resume(struct scsi_device *);
@@ -570,7 +575,6 @@ extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
570extern u8 ata_bmdma_status(struct ata_port *ap); 575extern u8 ata_bmdma_status(struct ata_port *ap);
571extern void ata_bmdma_irq_clear(struct ata_port *ap); 576extern void ata_bmdma_irq_clear(struct ata_port *ap);
572extern void __ata_qc_complete(struct ata_queued_cmd *qc); 577extern void __ata_qc_complete(struct ata_queued_cmd *qc);
573extern void ata_eng_timeout(struct ata_port *ap);
574extern void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev, 578extern void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev,
575 struct scsi_cmnd *cmd, 579 struct scsi_cmnd *cmd,
576 void (*done)(struct scsi_cmnd *)); 580 void (*done)(struct scsi_cmnd *));
@@ -625,6 +629,14 @@ extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bit
625extern unsigned long ata_pci_default_filter(const struct ata_port *, struct ata_device *, unsigned long); 629extern unsigned long ata_pci_default_filter(const struct ata_port *, struct ata_device *, unsigned long);
626#endif /* CONFIG_PCI */ 630#endif /* CONFIG_PCI */
627 631
632/*
633 * EH
634 */
635extern int ata_scsi_error(struct Scsi_Host *host);
636extern void ata_eng_timeout(struct ata_port *ap);
637extern void ata_eh_qc_complete(struct ata_queued_cmd *qc);
638extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
639
628 640
629static inline int 641static inline int
630ata_sg_is_last(struct scatterlist *sg, struct ata_queued_cmd *qc) 642ata_sg_is_last(struct scatterlist *sg, struct ata_queued_cmd *qc)
@@ -678,6 +690,11 @@ static inline unsigned int ata_class_disabled(unsigned int class)
678 return class == ATA_DEV_ATA_UNSUP || class == ATA_DEV_ATAPI_UNSUP; 690 return class == ATA_DEV_ATA_UNSUP || class == ATA_DEV_ATAPI_UNSUP;
679} 691}
680 692
693static inline unsigned int ata_class_absent(unsigned int class)
694{
695 return !ata_class_enabled(class) && !ata_class_disabled(class);
696}
697
681static inline unsigned int ata_dev_enabled(const struct ata_device *dev) 698static inline unsigned int ata_dev_enabled(const struct ata_device *dev)
682{ 699{
683 return ata_class_enabled(dev->class); 700 return ata_class_enabled(dev->class);
@@ -688,6 +705,11 @@ static inline unsigned int ata_dev_disabled(const struct ata_device *dev)
688 return ata_class_disabled(dev->class); 705 return ata_class_disabled(dev->class);
689} 706}
690 707
708static inline unsigned int ata_dev_absent(const struct ata_device *dev)
709{
710 return ata_class_absent(dev->class);
711}
712
691static inline u8 ata_chk_status(struct ata_port *ap) 713static inline u8 ata_chk_status(struct ata_port *ap)
692{ 714{
693 return ap->ops->check_status(ap); 715 return ap->ops->check_status(ap);