diff options
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r-- | include/linux/libata.h | 98 |
1 files changed, 68 insertions, 30 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index 66c3100c2b94..d6a3d4b345fc 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -37,6 +37,16 @@ | |||
37 | #include <scsi/scsi_host.h> | 37 | #include <scsi/scsi_host.h> |
38 | 38 | ||
39 | /* | 39 | /* |
40 | * Define if arch has non-standard setup. This is a _PCI_ standard | ||
41 | * not a legacy or ISA standard. | ||
42 | */ | ||
43 | #ifdef CONFIG_ATA_NONSTANDARD | ||
44 | #include <asm/libata-portmap.h> | ||
45 | #else | ||
46 | #include <asm-generic/libata-portmap.h> | ||
47 | #endif | ||
48 | |||
49 | /* | ||
40 | * compile-time options: to be removed as soon as all the drivers are | 50 | * compile-time options: to be removed as soon as all the drivers are |
41 | * converted to the new debugging mechanism | 51 | * converted to the new debugging mechanism |
42 | */ | 52 | */ |
@@ -44,7 +54,7 @@ | |||
44 | #undef ATA_VERBOSE_DEBUG /* yet more debugging output */ | 54 | #undef ATA_VERBOSE_DEBUG /* yet more debugging output */ |
45 | #undef ATA_IRQ_TRAP /* define to ack screaming irqs */ | 55 | #undef ATA_IRQ_TRAP /* define to ack screaming irqs */ |
46 | #undef ATA_NDEBUG /* define to disable quick runtime checks */ | 56 | #undef ATA_NDEBUG /* define to disable quick runtime checks */ |
47 | #undef ATA_ENABLE_PATA /* define to enable PATA support in some | 57 | #define ATA_ENABLE_PATA /* define to enable PATA support in some |
48 | * low-level drivers */ | 58 | * low-level drivers */ |
49 | 59 | ||
50 | 60 | ||
@@ -112,8 +122,6 @@ enum { | |||
112 | /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ | 122 | /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ |
113 | ATA_MAX_QUEUE = 32, | 123 | ATA_MAX_QUEUE = 32, |
114 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, | 124 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, |
115 | ATA_MAX_SECTORS = 200, /* FIXME */ | ||
116 | ATA_MAX_SECTORS_LBA48 = 65535, | ||
117 | ATA_MAX_BUS = 2, | 125 | ATA_MAX_BUS = 2, |
118 | ATA_DEF_BUSY_WAIT = 10000, | 126 | ATA_DEF_BUSY_WAIT = 10000, |
119 | ATA_SHORT_PAUSE = (HZ >> 6) + 1, | 127 | ATA_SHORT_PAUSE = (HZ >> 6) + 1, |
@@ -197,8 +205,8 @@ enum { | |||
197 | ATA_QCFLAG_EH_SCHEDULED = (1 << 18), /* EH scheduled (obsolete) */ | 205 | ATA_QCFLAG_EH_SCHEDULED = (1 << 18), /* EH scheduled (obsolete) */ |
198 | 206 | ||
199 | /* host set flags */ | 207 | /* host set flags */ |
200 | ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host_set only */ | 208 | ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */ |
201 | 209 | ||
202 | /* various lengths of time */ | 210 | /* various lengths of time */ |
203 | ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ | 211 | ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ |
204 | ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ | 212 | ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ |
@@ -225,8 +233,8 @@ enum { | |||
225 | /* encoding various smaller bitmaps into a single | 233 | /* encoding various smaller bitmaps into a single |
226 | * unsigned int bitmap | 234 | * unsigned int bitmap |
227 | */ | 235 | */ |
228 | ATA_BITS_PIO = 5, | 236 | ATA_BITS_PIO = 7, |
229 | ATA_BITS_MWDMA = 3, | 237 | ATA_BITS_MWDMA = 5, |
230 | ATA_BITS_UDMA = 8, | 238 | ATA_BITS_UDMA = 8, |
231 | 239 | ||
232 | ATA_SHIFT_PIO = 0, | 240 | ATA_SHIFT_PIO = 0, |
@@ -289,6 +297,11 @@ enum { | |||
289 | * most devices. | 297 | * most devices. |
290 | */ | 298 | */ |
291 | ATA_SPINUP_WAIT = 8000, | 299 | ATA_SPINUP_WAIT = 8000, |
300 | |||
301 | /* Horkage types. May be set by libata or controller on drives | ||
302 | (some horkage may be drive/controller pair dependant */ | ||
303 | |||
304 | ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */ | ||
292 | }; | 305 | }; |
293 | 306 | ||
294 | enum hsm_task_states { | 307 | enum hsm_task_states { |
@@ -350,23 +363,32 @@ struct ata_probe_ent { | |||
350 | struct scsi_host_template *sht; | 363 | struct scsi_host_template *sht; |
351 | struct ata_ioports port[ATA_MAX_PORTS]; | 364 | struct ata_ioports port[ATA_MAX_PORTS]; |
352 | unsigned int n_ports; | 365 | unsigned int n_ports; |
353 | unsigned int hard_port_no; | 366 | unsigned int dummy_port_mask; |
354 | unsigned int pio_mask; | 367 | unsigned int pio_mask; |
355 | unsigned int mwdma_mask; | 368 | unsigned int mwdma_mask; |
356 | unsigned int udma_mask; | 369 | unsigned int udma_mask; |
357 | unsigned int legacy_mode; | ||
358 | unsigned long irq; | 370 | unsigned long irq; |
371 | unsigned long irq2; | ||
359 | unsigned int irq_flags; | 372 | unsigned int irq_flags; |
360 | unsigned long host_flags; | 373 | unsigned long port_flags; |
361 | unsigned long host_set_flags; | 374 | unsigned long _host_flags; |
362 | void __iomem *mmio_base; | 375 | void __iomem *mmio_base; |
363 | void *private_data; | 376 | void *private_data; |
377 | |||
378 | /* port_info for the secondary port. Together with irq2, it's | ||
379 | * used to implement non-uniform secondary port. Currently, | ||
380 | * the only user is ata_piix combined mode. This workaround | ||
381 | * will be removed together with ata_probe_ent when init model | ||
382 | * is updated. | ||
383 | */ | ||
384 | const struct ata_port_info *pinfo2; | ||
364 | }; | 385 | }; |
365 | 386 | ||
366 | struct ata_host_set { | 387 | struct ata_host { |
367 | spinlock_t lock; | 388 | spinlock_t lock; |
368 | struct device *dev; | 389 | struct device *dev; |
369 | unsigned long irq; | 390 | unsigned long irq; |
391 | unsigned long irq2; | ||
370 | void __iomem *mmio_base; | 392 | void __iomem *mmio_base; |
371 | unsigned int n_ports; | 393 | unsigned int n_ports; |
372 | void *private_data; | 394 | void *private_data; |
@@ -374,7 +396,6 @@ struct ata_host_set { | |||
374 | unsigned long flags; | 396 | unsigned long flags; |
375 | int simplex_claimed; /* Keep seperate in case we | 397 | int simplex_claimed; /* Keep seperate in case we |
376 | ever need to do this locked */ | 398 | ever need to do this locked */ |
377 | struct ata_host_set *next; /* for legacy mode */ | ||
378 | struct ata_port *ports[0]; | 399 | struct ata_port *ports[0]; |
379 | }; | 400 | }; |
380 | 401 | ||
@@ -420,7 +441,7 @@ struct ata_queued_cmd { | |||
420 | void *private_data; | 441 | void *private_data; |
421 | }; | 442 | }; |
422 | 443 | ||
423 | struct ata_host_stats { | 444 | struct ata_port_stats { |
424 | unsigned long unhandled_irq; | 445 | unsigned long unhandled_irq; |
425 | unsigned long idle_irq; | 446 | unsigned long idle_irq; |
426 | unsigned long rw_reqbuf; | 447 | unsigned long rw_reqbuf; |
@@ -468,6 +489,7 @@ struct ata_device { | |||
468 | 489 | ||
469 | /* error history */ | 490 | /* error history */ |
470 | struct ata_ering ering; | 491 | struct ata_ering ering; |
492 | unsigned int horkage; /* List of broken features */ | ||
471 | }; | 493 | }; |
472 | 494 | ||
473 | /* Offset into struct ata_device. Fields above it are maintained | 495 | /* Offset into struct ata_device. Fields above it are maintained |
@@ -498,14 +520,13 @@ struct ata_eh_context { | |||
498 | }; | 520 | }; |
499 | 521 | ||
500 | struct ata_port { | 522 | struct ata_port { |
501 | struct Scsi_Host *host; /* our co-allocated scsi host */ | 523 | struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ |
502 | const struct ata_port_operations *ops; | 524 | const struct ata_port_operations *ops; |
503 | spinlock_t *lock; | 525 | spinlock_t *lock; |
504 | unsigned long flags; /* ATA_FLAG_xxx */ | 526 | unsigned long flags; /* ATA_FLAG_xxx */ |
505 | unsigned int pflags; /* ATA_PFLAG_xxx */ | 527 | unsigned int pflags; /* ATA_PFLAG_xxx */ |
506 | unsigned int id; /* unique id req'd by scsi midlyr */ | 528 | unsigned int id; /* unique id req'd by scsi midlyr */ |
507 | unsigned int port_no; /* unique port #; from zero */ | 529 | unsigned int port_no; /* unique port #; from zero */ |
508 | unsigned int hard_port_no; /* hardware port #; from zero */ | ||
509 | 530 | ||
510 | struct ata_prd *prd; /* our SG list */ | 531 | struct ata_prd *prd; /* our SG list */ |
511 | dma_addr_t prd_dma; /* and its DMA mapping */ | 532 | dma_addr_t prd_dma; /* and its DMA mapping */ |
@@ -524,7 +545,7 @@ struct ata_port { | |||
524 | unsigned int hw_sata_spd_limit; | 545 | unsigned int hw_sata_spd_limit; |
525 | unsigned int sata_spd_limit; /* SATA PHY speed limit */ | 546 | unsigned int sata_spd_limit; /* SATA PHY speed limit */ |
526 | 547 | ||
527 | /* record runtime error info, protected by host_set lock */ | 548 | /* record runtime error info, protected by host lock */ |
528 | struct ata_eh_info eh_info; | 549 | struct ata_eh_info eh_info; |
529 | /* EH context owned by EH */ | 550 | /* EH context owned by EH */ |
530 | struct ata_eh_context eh_context; | 551 | struct ata_eh_context eh_context; |
@@ -538,8 +559,8 @@ struct ata_port { | |||
538 | unsigned int active_tag; | 559 | unsigned int active_tag; |
539 | u32 sactive; | 560 | u32 sactive; |
540 | 561 | ||
541 | struct ata_host_stats stats; | 562 | struct ata_port_stats stats; |
542 | struct ata_host_set *host_set; | 563 | struct ata_host *host; |
543 | struct device *dev; | 564 | struct device *dev; |
544 | 565 | ||
545 | struct work_struct port_task; | 566 | struct work_struct port_task; |
@@ -615,7 +636,7 @@ struct ata_port_operations { | |||
615 | int (*port_start) (struct ata_port *ap); | 636 | int (*port_start) (struct ata_port *ap); |
616 | void (*port_stop) (struct ata_port *ap); | 637 | void (*port_stop) (struct ata_port *ap); |
617 | 638 | ||
618 | void (*host_stop) (struct ata_host_set *host_set); | 639 | void (*host_stop) (struct ata_host *host); |
619 | 640 | ||
620 | void (*bmdma_stop) (struct ata_queued_cmd *qc); | 641 | void (*bmdma_stop) (struct ata_queued_cmd *qc); |
621 | u8 (*bmdma_status) (struct ata_port *ap); | 642 | u8 (*bmdma_status) (struct ata_port *ap); |
@@ -623,7 +644,7 @@ struct ata_port_operations { | |||
623 | 644 | ||
624 | struct ata_port_info { | 645 | struct ata_port_info { |
625 | struct scsi_host_template *sht; | 646 | struct scsi_host_template *sht; |
626 | unsigned long host_flags; | 647 | unsigned long flags; |
627 | unsigned long pio_mask; | 648 | unsigned long pio_mask; |
628 | unsigned long mwdma_mask; | 649 | unsigned long mwdma_mask; |
629 | unsigned long udma_mask; | 650 | unsigned long udma_mask; |
@@ -649,6 +670,8 @@ extern const unsigned long sata_deb_timing_normal[]; | |||
649 | extern const unsigned long sata_deb_timing_hotplug[]; | 670 | extern const unsigned long sata_deb_timing_hotplug[]; |
650 | extern const unsigned long sata_deb_timing_long[]; | 671 | extern const unsigned long sata_deb_timing_long[]; |
651 | 672 | ||
673 | extern const struct ata_port_operations ata_dummy_port_ops; | ||
674 | |||
652 | static inline const unsigned long * | 675 | static inline const unsigned long * |
653 | sata_ehc_deb_timing(struct ata_eh_context *ehc) | 676 | sata_ehc_deb_timing(struct ata_eh_context *ehc) |
654 | { | 677 | { |
@@ -658,6 +681,11 @@ sata_ehc_deb_timing(struct ata_eh_context *ehc) | |||
658 | return sata_deb_timing_normal; | 681 | return sata_deb_timing_normal; |
659 | } | 682 | } |
660 | 683 | ||
684 | static inline int ata_port_is_dummy(struct ata_port *ap) | ||
685 | { | ||
686 | return ap->ops == &ata_dummy_port_ops; | ||
687 | } | ||
688 | |||
661 | extern void ata_port_probe(struct ata_port *); | 689 | extern void ata_port_probe(struct ata_port *); |
662 | extern void __sata_phy_reset(struct ata_port *ap); | 690 | extern void __sata_phy_reset(struct ata_port *ap); |
663 | extern void sata_phy_reset(struct ata_port *ap); | 691 | extern void sata_phy_reset(struct ata_port *ap); |
@@ -676,19 +704,30 @@ extern void ata_std_ports(struct ata_ioports *ioaddr); | |||
676 | extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | 704 | extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, |
677 | unsigned int n_ports); | 705 | unsigned int n_ports); |
678 | extern void ata_pci_remove_one (struct pci_dev *pdev); | 706 | extern void ata_pci_remove_one (struct pci_dev *pdev); |
679 | extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t state); | 707 | extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg); |
680 | extern void ata_pci_device_do_resume(struct pci_dev *pdev); | 708 | extern void ata_pci_device_do_resume(struct pci_dev *pdev); |
681 | extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state); | 709 | extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); |
682 | extern int ata_pci_device_resume(struct pci_dev *pdev); | 710 | extern int ata_pci_device_resume(struct pci_dev *pdev); |
683 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); | 711 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); |
684 | #endif /* CONFIG_PCI */ | 712 | #endif /* CONFIG_PCI */ |
685 | extern int ata_device_add(const struct ata_probe_ent *ent); | 713 | extern int ata_device_add(const struct ata_probe_ent *ent); |
686 | extern void ata_port_detach(struct ata_port *ap); | 714 | extern void ata_port_detach(struct ata_port *ap); |
687 | extern void ata_host_set_remove(struct ata_host_set *host_set); | 715 | extern void ata_host_init(struct ata_host *, struct device *, |
716 | unsigned long, const struct ata_port_operations *); | ||
717 | extern void ata_host_remove(struct ata_host *host); | ||
688 | extern int ata_scsi_detect(struct scsi_host_template *sht); | 718 | extern int ata_scsi_detect(struct scsi_host_template *sht); |
689 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); | 719 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); |
690 | extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); | 720 | extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); |
691 | extern int ata_scsi_release(struct Scsi_Host *host); | 721 | extern int ata_scsi_release(struct Scsi_Host *host); |
722 | extern void ata_sas_port_destroy(struct ata_port *); | ||
723 | extern struct ata_port *ata_sas_port_alloc(struct ata_host *, | ||
724 | struct ata_port_info *, struct Scsi_Host *); | ||
725 | extern int ata_sas_port_init(struct ata_port *); | ||
726 | extern int ata_sas_port_start(struct ata_port *ap); | ||
727 | extern void ata_sas_port_stop(struct ata_port *ap); | ||
728 | extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); | ||
729 | extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), | ||
730 | struct ata_port *ap); | ||
692 | extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); | 731 | extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); |
693 | extern int sata_scr_valid(struct ata_port *ap); | 732 | extern int sata_scr_valid(struct ata_port *ap); |
694 | extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val); | 733 | extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val); |
@@ -697,10 +736,9 @@ extern int sata_scr_write_flush(struct ata_port *ap, int reg, u32 val); | |||
697 | extern int ata_port_online(struct ata_port *ap); | 736 | extern int ata_port_online(struct ata_port *ap); |
698 | extern int ata_port_offline(struct ata_port *ap); | 737 | extern int ata_port_offline(struct ata_port *ap); |
699 | extern int ata_scsi_device_resume(struct scsi_device *); | 738 | extern int ata_scsi_device_resume(struct scsi_device *); |
700 | extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state); | 739 | extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t mesg); |
701 | extern int ata_host_set_suspend(struct ata_host_set *host_set, | 740 | extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); |
702 | pm_message_t mesg); | 741 | extern void ata_host_resume(struct ata_host *host); |
703 | extern void ata_host_set_resume(struct ata_host_set *host_set); | ||
704 | extern int ata_ratelimit(void); | 742 | extern int ata_ratelimit(void); |
705 | extern unsigned int ata_busy_sleep(struct ata_port *ap, | 743 | extern unsigned int ata_busy_sleep(struct ata_port *ap, |
706 | unsigned long timeout_pat, | 744 | unsigned long timeout_pat, |
@@ -725,7 +763,7 @@ extern u8 ata_altstatus(struct ata_port *ap); | |||
725 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); | 763 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); |
726 | extern int ata_port_start (struct ata_port *ap); | 764 | extern int ata_port_start (struct ata_port *ap); |
727 | extern void ata_port_stop (struct ata_port *ap); | 765 | extern void ata_port_stop (struct ata_port *ap); |
728 | extern void ata_host_stop (struct ata_host_set *host_set); | 766 | extern void ata_host_stop (struct ata_host *host); |
729 | extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); | 767 | extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); |
730 | extern void ata_mmio_data_xfer(struct ata_device *adev, unsigned char *buf, | 768 | extern void ata_mmio_data_xfer(struct ata_device *adev, unsigned char *buf, |
731 | unsigned int buflen, int write_data); | 769 | unsigned int buflen, int write_data); |
@@ -811,7 +849,7 @@ struct pci_bits { | |||
811 | unsigned long val; | 849 | unsigned long val; |
812 | }; | 850 | }; |
813 | 851 | ||
814 | extern void ata_pci_host_stop (struct ata_host_set *host_set); | 852 | extern void ata_pci_host_stop (struct ata_host *host); |
815 | extern struct ata_probe_ent * | 853 | extern struct ata_probe_ent * |
816 | ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); | 854 | ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); |
817 | extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); | 855 | extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); |