aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/libata.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r--include/linux/libata.h51
1 files changed, 34 insertions, 17 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 745c4f9b4caa..47cd2a1c5544 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -116,6 +116,7 @@ static inline struct device *pci_dev_to_dev(struct pci_dev *pdev)
116enum { 116enum {
117 /* various global constants */ 117 /* various global constants */
118 LIBATA_MAX_PRD = ATA_MAX_PRD / 2, 118 LIBATA_MAX_PRD = ATA_MAX_PRD / 2,
119 LIBATA_DUMB_MAX_PRD = ATA_MAX_PRD / 4, /* Worst case */
119 ATA_MAX_PORTS = 8, 120 ATA_MAX_PORTS = 8,
120 ATA_DEF_QUEUE = 1, 121 ATA_DEF_QUEUE = 1,
121 /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ 122 /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */
@@ -136,6 +137,8 @@ enum {
136 ATA_DFLAG_CDB_INTR = (1 << 2), /* device asserts INTRQ when ready for CDB */ 137 ATA_DFLAG_CDB_INTR = (1 << 2), /* device asserts INTRQ when ready for CDB */
137 ATA_DFLAG_NCQ = (1 << 3), /* device supports NCQ */ 138 ATA_DFLAG_NCQ = (1 << 3), /* device supports NCQ */
138 ATA_DFLAG_FLUSH_EXT = (1 << 4), /* do FLUSH_EXT instead of FLUSH */ 139 ATA_DFLAG_FLUSH_EXT = (1 << 4), /* do FLUSH_EXT instead of FLUSH */
140 ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */
141 ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */
139 ATA_DFLAG_CFG_MASK = (1 << 8) - 1, 142 ATA_DFLAG_CFG_MASK = (1 << 8) - 1,
140 143
141 ATA_DFLAG_PIO = (1 << 8), /* device limited to PIO mode */ 144 ATA_DFLAG_PIO = (1 << 8), /* device limited to PIO mode */
@@ -193,9 +196,9 @@ enum {
193 ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */ 196 ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */
194 ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */ 197 ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */
195 198
196 ATA_PFLAG_FLUSH_PORT_TASK = (1 << 16), /* flush port task */
197 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */ 199 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */
198 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */ 200 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */
201 ATA_PFLAG_GTM_VALID = (1 << 19), /* acpi_gtm data valid */
199 202
200 /* struct ata_queued_cmd flags */ 203 /* struct ata_queued_cmd flags */
201 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */ 204 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */
@@ -298,7 +301,6 @@ enum {
298 ATA_HORKAGE_NODMA = (1 << 1), /* DMA problems */ 301 ATA_HORKAGE_NODMA = (1 << 1), /* DMA problems */
299 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */ 302 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */
300 ATA_HORKAGE_MAX_SEC_128 = (1 << 3), /* Limit max sects to 128 */ 303 ATA_HORKAGE_MAX_SEC_128 = (1 << 3), /* Limit max sects to 128 */
301 ATA_HORKAGE_DMA_RW_ONLY = (1 << 4), /* ATAPI DMA for RW only */
302}; 304};
303 305
304enum hsm_task_states { 306enum hsm_task_states {
@@ -364,6 +366,9 @@ struct ata_host {
364 void *private_data; 366 void *private_data;
365 const struct ata_port_operations *ops; 367 const struct ata_port_operations *ops;
366 unsigned long flags; 368 unsigned long flags;
369#ifdef CONFIG_ATA_ACPI
370 acpi_handle acpi_handle;
371#endif
367 struct ata_port *simplex_claimed; /* channel owning the DMA */ 372 struct ata_port *simplex_claimed; /* channel owning the DMA */
368 struct ata_port *ports[0]; 373 struct ata_port *ports[0];
369}; 374};
@@ -429,7 +434,11 @@ struct ata_device {
429 struct ata_port *ap; 434 struct ata_port *ap;
430 unsigned int devno; /* 0 or 1 */ 435 unsigned int devno; /* 0 or 1 */
431 unsigned long flags; /* ATA_DFLAG_xxx */ 436 unsigned long flags; /* ATA_DFLAG_xxx */
437 unsigned int horkage; /* List of broken features */
432 struct scsi_device *sdev; /* attached SCSI device */ 438 struct scsi_device *sdev; /* attached SCSI device */
439#ifdef CONFIG_ATA_ACPI
440 acpi_handle acpi_handle;
441#endif
433 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ 442 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
434 u64 n_sectors; /* size of device, if ATA */ 443 u64 n_sectors; /* size of device, if ATA */
435 unsigned int class; /* ATA_DEV_xxx */ 444 unsigned int class; /* ATA_DEV_xxx */
@@ -457,11 +466,6 @@ struct ata_device {
457 /* error history */ 466 /* error history */
458 struct ata_ering ering; 467 struct ata_ering ering;
459 int spdn_cnt; 468 int spdn_cnt;
460 unsigned int horkage; /* List of broken features */
461#ifdef CONFIG_ATA_ACPI
462 /* ACPI objects info */
463 acpi_handle obj_handle;
464#endif
465}; 469};
466 470
467/* Offset into struct ata_device. Fields above it are maintained 471/* Offset into struct ata_device. Fields above it are maintained
@@ -490,6 +494,17 @@ struct ata_eh_context {
490 unsigned int did_probe_mask; 494 unsigned int did_probe_mask;
491}; 495};
492 496
497struct ata_acpi_drive
498{
499 u32 pio;
500 u32 dma;
501} __packed;
502
503struct ata_acpi_gtm {
504 struct ata_acpi_drive drive[2];
505 u32 flags;
506} __packed;
507
493struct ata_port { 508struct ata_port {
494 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ 509 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */
495 const struct ata_port_operations *ops; 510 const struct ata_port_operations *ops;
@@ -550,6 +565,10 @@ struct ata_port {
550 565
551 void *private_data; 566 void *private_data;
552 567
568#ifdef CONFIG_ATA_ACPI
569 acpi_handle acpi_handle;
570 struct ata_acpi_gtm acpi_gtm;
571#endif
553 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */ 572 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */
554}; 573};
555 574
@@ -759,6 +778,7 @@ extern void ata_data_xfer(struct ata_device *adev, unsigned char *buf,
759 unsigned int buflen, int write_data); 778 unsigned int buflen, int write_data);
760extern void ata_data_xfer_noirq(struct ata_device *adev, unsigned char *buf, 779extern void ata_data_xfer_noirq(struct ata_device *adev, unsigned char *buf,
761 unsigned int buflen, int write_data); 780 unsigned int buflen, int write_data);
781extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc);
762extern void ata_qc_prep(struct ata_queued_cmd *qc); 782extern void ata_qc_prep(struct ata_queued_cmd *qc);
763extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); 783extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
764extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc); 784extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc);
@@ -773,7 +793,6 @@ extern void ata_id_string(const u16 *id, unsigned char *s,
773extern void ata_id_c_string(const u16 *id, unsigned char *s, 793extern void ata_id_c_string(const u16 *id, unsigned char *s,
774 unsigned int ofs, unsigned int len); 794 unsigned int ofs, unsigned int len);
775extern void ata_id_to_dma_mode(struct ata_device *dev, u8 unknown); 795extern void ata_id_to_dma_mode(struct ata_device *dev, u8 unknown);
776extern unsigned long ata_device_blacklisted(const struct ata_device *dev);
777extern void ata_bmdma_setup (struct ata_queued_cmd *qc); 796extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
778extern void ata_bmdma_start (struct ata_queued_cmd *qc); 797extern void ata_bmdma_start (struct ata_queued_cmd *qc);
779extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 798extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
@@ -850,11 +869,11 @@ struct pci_bits {
850 unsigned long val; 869 unsigned long val;
851}; 870};
852 871
853extern int ata_pci_init_native_host(struct ata_host *host); 872extern int ata_pci_init_sff_host(struct ata_host *host);
854extern int ata_pci_init_bmdma(struct ata_host *host); 873extern int ata_pci_init_bmdma(struct ata_host *host);
855extern int ata_pci_prepare_native_host(struct pci_dev *pdev, 874extern int ata_pci_prepare_sff_host(struct pci_dev *pdev,
856 const struct ata_port_info * const * ppi, 875 const struct ata_port_info * const * ppi,
857 struct ata_host **r_host); 876 struct ata_host **r_host);
858extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); 877extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
859extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long); 878extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long);
860#endif /* CONFIG_PCI */ 879#endif /* CONFIG_PCI */
@@ -1088,11 +1107,9 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
1088{ 1107{
1089 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); 1108 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
1090 1109
1091 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) { 1110 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ)))
1092 if (ata_msg_warn(ap)) 1111 DPRINTK("ATA: abnormal status 0x%X on port 0x%p\n",
1093 printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%p\n", 1112 status, ap->ioaddr.status_addr);
1094 status, ap->ioaddr.status_addr);
1095 }
1096 1113
1097 return status; 1114 return status;
1098} 1115}