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.h78
1 files changed, 39 insertions, 39 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 0cfbcb6f08eb..d8cfc72ea9c1 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -210,6 +210,7 @@ enum {
210 210
211 /* host set flags */ 211 /* host set flags */
212 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */ 212 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */
213 ATA_HOST_STARTED = (1 << 1), /* Host started */
213 214
214 /* various lengths of time */ 215 /* various lengths of time */
215 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ 216 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */
@@ -281,11 +282,13 @@ enum {
281 ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */ 282 ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */
282 ATA_EHI_QUIET = (1 << 3), /* be quiet */ 283 ATA_EHI_QUIET = (1 << 3), /* be quiet */
283 284
284 ATA_EHI_DID_RESET = (1 << 16), /* already reset this port */ 285 ATA_EHI_DID_SOFTRESET = (1 << 16), /* already soft-reset this port */
285 ATA_EHI_PRINTINFO = (1 << 17), /* print configuration info */ 286 ATA_EHI_DID_HARDRESET = (1 << 17), /* already soft-reset this port */
286 ATA_EHI_SETMODE = (1 << 18), /* configure transfer mode */ 287 ATA_EHI_PRINTINFO = (1 << 18), /* print configuration info */
287 ATA_EHI_POST_SETMODE = (1 << 19), /* revaildating after setmode */ 288 ATA_EHI_SETMODE = (1 << 19), /* configure transfer mode */
289 ATA_EHI_POST_SETMODE = (1 << 20), /* revaildating after setmode */
288 290
291 ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET,
289 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK, 292 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK,
290 293
291 /* max repeat if error condition is still set after ->error_handler */ 294 /* max repeat if error condition is still set after ->error_handler */
@@ -367,34 +370,6 @@ struct ata_ioports {
367 void __iomem *scr_addr; 370 void __iomem *scr_addr;
368}; 371};
369 372
370struct ata_probe_ent {
371 struct list_head node;
372 struct device *dev;
373 const struct ata_port_operations *port_ops;
374 struct scsi_host_template *sht;
375 struct ata_ioports port[ATA_MAX_PORTS];
376 unsigned int n_ports;
377 unsigned int dummy_port_mask;
378 unsigned int pio_mask;
379 unsigned int mwdma_mask;
380 unsigned int udma_mask;
381 unsigned long irq;
382 unsigned long irq2;
383 unsigned int irq_flags;
384 unsigned long port_flags;
385 unsigned long _host_flags;
386 void __iomem * const *iomap;
387 void *private_data;
388
389 /* port_info for the secondary port. Together with irq2, it's
390 * used to implement non-uniform secondary port. Currently,
391 * the only user is ata_piix combined mode. This workaround
392 * will be removed together with ata_probe_ent when init model
393 * is updated.
394 */
395 const struct ata_port_info *pinfo2;
396};
397
398struct ata_host { 373struct ata_host {
399 spinlock_t lock; 374 spinlock_t lock;
400 struct device *dev; 375 struct device *dev;
@@ -427,6 +402,7 @@ struct ata_queued_cmd {
427 int dma_dir; 402 int dma_dir;
428 403
429 unsigned int pad_len; 404 unsigned int pad_len;
405 unsigned int sect_size;
430 406
431 unsigned int nbytes; 407 unsigned int nbytes;
432 unsigned int curbytes; 408 unsigned int curbytes;
@@ -472,6 +448,7 @@ struct ata_device {
472 struct scsi_device *sdev; /* attached SCSI device */ 448 struct scsi_device *sdev; /* attached SCSI device */
473 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ 449 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
474 u64 n_sectors; /* size of device, if ATA */ 450 u64 n_sectors; /* size of device, if ATA */
451 u64 n_sectors_boot; /* size of ATA device at startup */
475 unsigned int class; /* ATA_DEV_xxx */ 452 unsigned int class; /* ATA_DEV_xxx */
476 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */ 453 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */
477 u8 pio_mode; 454 u8 pio_mode;
@@ -597,11 +574,11 @@ struct ata_port {
597struct ata_port_operations { 574struct ata_port_operations {
598 void (*port_disable) (struct ata_port *); 575 void (*port_disable) (struct ata_port *);
599 576
600 void (*dev_config) (struct ata_port *, struct ata_device *); 577 void (*dev_config) (struct ata_device *);
601 578
602 void (*set_piomode) (struct ata_port *, struct ata_device *); 579 void (*set_piomode) (struct ata_port *, struct ata_device *);
603 void (*set_dmamode) (struct ata_port *, struct ata_device *); 580 void (*set_dmamode) (struct ata_port *, struct ata_device *);
604 unsigned long (*mode_filter) (const struct ata_port *, struct ata_device *, unsigned long); 581 unsigned long (*mode_filter) (struct ata_device *, unsigned long);
605 582
606 void (*tf_load) (struct ata_port *ap, const struct ata_taskfile *tf); 583 void (*tf_load) (struct ata_port *ap, const struct ata_taskfile *tf);
607 void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); 584 void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf);
@@ -616,6 +593,8 @@ struct ata_port_operations {
616 593
617 void (*post_set_mode) (struct ata_port *ap); 594 void (*post_set_mode) (struct ata_port *ap);
618 595
596 int (*cable_detect) (struct ata_port *ap);
597
619 int (*check_atapi_dma) (struct ata_queued_cmd *qc); 598 int (*check_atapi_dma) (struct ata_queued_cmd *qc);
620 599
621 void (*bmdma_setup) (struct ata_queued_cmd *qc); 600 void (*bmdma_setup) (struct ata_queued_cmd *qc);
@@ -664,6 +643,7 @@ struct ata_port_info {
664 unsigned long mwdma_mask; 643 unsigned long mwdma_mask;
665 unsigned long udma_mask; 644 unsigned long udma_mask;
666 const struct ata_port_operations *port_ops; 645 const struct ata_port_operations *port_ops;
646 irq_handler_t irq_handler;
667 void *private_data; 647 void *private_data;
668}; 648};
669 649
@@ -686,6 +666,7 @@ extern const unsigned long sata_deb_timing_hotplug[];
686extern const unsigned long sata_deb_timing_long[]; 666extern const unsigned long sata_deb_timing_long[];
687 667
688extern const struct ata_port_operations ata_dummy_port_ops; 668extern const struct ata_port_operations ata_dummy_port_ops;
669extern const struct ata_port_info ata_dummy_port_info;
689 670
690static inline const unsigned long * 671static inline const unsigned long *
691sata_ehc_deb_timing(struct ata_eh_context *ehc) 672sata_ehc_deb_timing(struct ata_eh_context *ehc)
@@ -701,6 +682,7 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
701 return ap->ops == &ata_dummy_port_ops; 682 return ap->ops == &ata_dummy_port_ops;
702} 683}
703 684
685extern void sata_print_link_status(struct ata_port *ap);
704extern void ata_port_probe(struct ata_port *); 686extern void ata_port_probe(struct ata_port *);
705extern void __sata_phy_reset(struct ata_port *ap); 687extern void __sata_phy_reset(struct ata_port *ap);
706extern void sata_phy_reset(struct ata_port *ap); 688extern void sata_phy_reset(struct ata_port *ap);
@@ -728,7 +710,15 @@ extern int ata_pci_device_resume(struct pci_dev *pdev);
728#endif 710#endif
729extern int ata_pci_clear_simplex(struct pci_dev *pdev); 711extern int ata_pci_clear_simplex(struct pci_dev *pdev);
730#endif /* CONFIG_PCI */ 712#endif /* CONFIG_PCI */
731extern int ata_device_add(const struct ata_probe_ent *ent); 713extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
714extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
715 const struct ata_port_info * const * ppi, int n_ports);
716extern int ata_host_start(struct ata_host *host);
717extern int ata_host_register(struct ata_host *host,
718 struct scsi_host_template *sht);
719extern int ata_host_activate(struct ata_host *host, int irq,
720 irq_handler_t irq_handler, unsigned long irq_flags,
721 struct scsi_host_template *sht);
732extern void ata_host_detach(struct ata_host *host); 722extern void ata_host_detach(struct ata_host *host);
733extern void ata_host_init(struct ata_host *, struct device *, 723extern void ata_host_init(struct ata_host *, struct device *,
734 unsigned long, const struct ata_port_operations *); 724 unsigned long, const struct ata_port_operations *);
@@ -828,11 +818,17 @@ extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
828extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, 818extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
829 int queue_depth); 819 int queue_depth);
830extern struct ata_device *ata_dev_pair(struct ata_device *adev); 820extern struct ata_device *ata_dev_pair(struct ata_device *adev);
821extern int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev);
831extern u8 ata_irq_on(struct ata_port *ap); 822extern u8 ata_irq_on(struct ata_port *ap);
832extern u8 ata_dummy_irq_on(struct ata_port *ap); 823extern u8 ata_dummy_irq_on(struct ata_port *ap);
833extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq); 824extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq);
834extern u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq); 825extern u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq);
835 826
827extern int ata_cable_40wire(struct ata_port *ap);
828extern int ata_cable_80wire(struct ata_port *ap);
829extern int ata_cable_sata(struct ata_port *ap);
830extern int ata_cable_unknown(struct ata_port *ap);
831
836/* 832/*
837 * Timing helpers 833 * Timing helpers
838 */ 834 */
@@ -870,10 +866,13 @@ struct pci_bits {
870 unsigned long val; 866 unsigned long val;
871}; 867};
872 868
873extern struct ata_probe_ent * 869extern int ata_pci_init_native_host(struct ata_host *host,
874ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); 870 unsigned int port_mask);
871extern int ata_pci_prepare_native_host(struct pci_dev *pdev,
872 const struct ata_port_info * const * ppi,
873 int n_ports, struct ata_host **r_host);
875extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); 874extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
876extern unsigned long ata_pci_default_filter(const struct ata_port *, struct ata_device *, unsigned long); 875extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long);
877#endif /* CONFIG_PCI */ 876#endif /* CONFIG_PCI */
878 877
879/* 878/*
@@ -1173,6 +1172,7 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
1173 qc->n_elem = 0; 1172 qc->n_elem = 0;
1174 qc->err_mask = 0; 1173 qc->err_mask = 0;
1175 qc->pad_len = 0; 1174 qc->pad_len = 0;
1175 qc->sect_size = ATA_SECT_SIZE;
1176 1176
1177 ata_tf_init(qc->dev, &qc->tf); 1177 ata_tf_init(qc->dev, &qc->tf);
1178 1178
@@ -1220,7 +1220,7 @@ static inline void ata_pad_free(struct ata_port *ap, struct device *dev)
1220 1220
1221static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host) 1221static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host)
1222{ 1222{
1223 return (struct ata_port *) &host->hostdata[0]; 1223 return *(struct ata_port **)&host->hostdata[0];
1224} 1224}
1225 1225
1226#endif /* __LINUX_LIBATA_H__ */ 1226#endif /* __LINUX_LIBATA_H__ */