diff options
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r-- | include/linux/libata.h | 90 |
1 files changed, 60 insertions, 30 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index 66c3100c2b94..1ef3d3901b47 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -36,6 +36,8 @@ | |||
36 | #include <linux/workqueue.h> | 36 | #include <linux/workqueue.h> |
37 | #include <scsi/scsi_host.h> | 37 | #include <scsi/scsi_host.h> |
38 | 38 | ||
39 | #include <asm/libata-portmap.h> | ||
40 | |||
39 | /* | 41 | /* |
40 | * compile-time options: to be removed as soon as all the drivers are | 42 | * compile-time options: to be removed as soon as all the drivers are |
41 | * converted to the new debugging mechanism | 43 | * converted to the new debugging mechanism |
@@ -44,7 +46,7 @@ | |||
44 | #undef ATA_VERBOSE_DEBUG /* yet more debugging output */ | 46 | #undef ATA_VERBOSE_DEBUG /* yet more debugging output */ |
45 | #undef ATA_IRQ_TRAP /* define to ack screaming irqs */ | 47 | #undef ATA_IRQ_TRAP /* define to ack screaming irqs */ |
46 | #undef ATA_NDEBUG /* define to disable quick runtime checks */ | 48 | #undef ATA_NDEBUG /* define to disable quick runtime checks */ |
47 | #undef ATA_ENABLE_PATA /* define to enable PATA support in some | 49 | #define ATA_ENABLE_PATA /* define to enable PATA support in some |
48 | * low-level drivers */ | 50 | * low-level drivers */ |
49 | 51 | ||
50 | 52 | ||
@@ -112,8 +114,6 @@ enum { | |||
112 | /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ | 114 | /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ |
113 | ATA_MAX_QUEUE = 32, | 115 | ATA_MAX_QUEUE = 32, |
114 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, | 116 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, |
115 | ATA_MAX_SECTORS = 200, /* FIXME */ | ||
116 | ATA_MAX_SECTORS_LBA48 = 65535, | ||
117 | ATA_MAX_BUS = 2, | 117 | ATA_MAX_BUS = 2, |
118 | ATA_DEF_BUSY_WAIT = 10000, | 118 | ATA_DEF_BUSY_WAIT = 10000, |
119 | ATA_SHORT_PAUSE = (HZ >> 6) + 1, | 119 | ATA_SHORT_PAUSE = (HZ >> 6) + 1, |
@@ -197,8 +197,8 @@ enum { | |||
197 | ATA_QCFLAG_EH_SCHEDULED = (1 << 18), /* EH scheduled (obsolete) */ | 197 | ATA_QCFLAG_EH_SCHEDULED = (1 << 18), /* EH scheduled (obsolete) */ |
198 | 198 | ||
199 | /* host set flags */ | 199 | /* host set flags */ |
200 | ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host_set only */ | 200 | ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */ |
201 | 201 | ||
202 | /* various lengths of time */ | 202 | /* various lengths of time */ |
203 | ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ | 203 | ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ |
204 | ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ | 204 | ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ |
@@ -225,8 +225,8 @@ enum { | |||
225 | /* encoding various smaller bitmaps into a single | 225 | /* encoding various smaller bitmaps into a single |
226 | * unsigned int bitmap | 226 | * unsigned int bitmap |
227 | */ | 227 | */ |
228 | ATA_BITS_PIO = 5, | 228 | ATA_BITS_PIO = 7, |
229 | ATA_BITS_MWDMA = 3, | 229 | ATA_BITS_MWDMA = 5, |
230 | ATA_BITS_UDMA = 8, | 230 | ATA_BITS_UDMA = 8, |
231 | 231 | ||
232 | ATA_SHIFT_PIO = 0, | 232 | ATA_SHIFT_PIO = 0, |
@@ -289,6 +289,11 @@ enum { | |||
289 | * most devices. | 289 | * most devices. |
290 | */ | 290 | */ |
291 | ATA_SPINUP_WAIT = 8000, | 291 | ATA_SPINUP_WAIT = 8000, |
292 | |||
293 | /* Horkage types. May be set by libata or controller on drives | ||
294 | (some horkage may be drive/controller pair dependant */ | ||
295 | |||
296 | ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */ | ||
292 | }; | 297 | }; |
293 | 298 | ||
294 | enum hsm_task_states { | 299 | enum hsm_task_states { |
@@ -350,23 +355,32 @@ struct ata_probe_ent { | |||
350 | struct scsi_host_template *sht; | 355 | struct scsi_host_template *sht; |
351 | struct ata_ioports port[ATA_MAX_PORTS]; | 356 | struct ata_ioports port[ATA_MAX_PORTS]; |
352 | unsigned int n_ports; | 357 | unsigned int n_ports; |
353 | unsigned int hard_port_no; | 358 | unsigned int dummy_port_mask; |
354 | unsigned int pio_mask; | 359 | unsigned int pio_mask; |
355 | unsigned int mwdma_mask; | 360 | unsigned int mwdma_mask; |
356 | unsigned int udma_mask; | 361 | unsigned int udma_mask; |
357 | unsigned int legacy_mode; | ||
358 | unsigned long irq; | 362 | unsigned long irq; |
363 | unsigned long irq2; | ||
359 | unsigned int irq_flags; | 364 | unsigned int irq_flags; |
360 | unsigned long host_flags; | 365 | unsigned long port_flags; |
361 | unsigned long host_set_flags; | 366 | unsigned long _host_flags; |
362 | void __iomem *mmio_base; | 367 | void __iomem *mmio_base; |
363 | void *private_data; | 368 | void *private_data; |
369 | |||
370 | /* port_info for the secondary port. Together with irq2, it's | ||
371 | * used to implement non-uniform secondary port. Currently, | ||
372 | * the only user is ata_piix combined mode. This workaround | ||
373 | * will be removed together with ata_probe_ent when init model | ||
374 | * is updated. | ||
375 | */ | ||
376 | const struct ata_port_info *pinfo2; | ||
364 | }; | 377 | }; |
365 | 378 | ||
366 | struct ata_host_set { | 379 | struct ata_host { |
367 | spinlock_t lock; | 380 | spinlock_t lock; |
368 | struct device *dev; | 381 | struct device *dev; |
369 | unsigned long irq; | 382 | unsigned long irq; |
383 | unsigned long irq2; | ||
370 | void __iomem *mmio_base; | 384 | void __iomem *mmio_base; |
371 | unsigned int n_ports; | 385 | unsigned int n_ports; |
372 | void *private_data; | 386 | void *private_data; |
@@ -374,7 +388,6 @@ struct ata_host_set { | |||
374 | unsigned long flags; | 388 | unsigned long flags; |
375 | int simplex_claimed; /* Keep seperate in case we | 389 | int simplex_claimed; /* Keep seperate in case we |
376 | ever need to do this locked */ | 390 | ever need to do this locked */ |
377 | struct ata_host_set *next; /* for legacy mode */ | ||
378 | struct ata_port *ports[0]; | 391 | struct ata_port *ports[0]; |
379 | }; | 392 | }; |
380 | 393 | ||
@@ -420,7 +433,7 @@ struct ata_queued_cmd { | |||
420 | void *private_data; | 433 | void *private_data; |
421 | }; | 434 | }; |
422 | 435 | ||
423 | struct ata_host_stats { | 436 | struct ata_port_stats { |
424 | unsigned long unhandled_irq; | 437 | unsigned long unhandled_irq; |
425 | unsigned long idle_irq; | 438 | unsigned long idle_irq; |
426 | unsigned long rw_reqbuf; | 439 | unsigned long rw_reqbuf; |
@@ -468,6 +481,7 @@ struct ata_device { | |||
468 | 481 | ||
469 | /* error history */ | 482 | /* error history */ |
470 | struct ata_ering ering; | 483 | struct ata_ering ering; |
484 | unsigned int horkage; /* List of broken features */ | ||
471 | }; | 485 | }; |
472 | 486 | ||
473 | /* Offset into struct ata_device. Fields above it are maintained | 487 | /* Offset into struct ata_device. Fields above it are maintained |
@@ -498,14 +512,13 @@ struct ata_eh_context { | |||
498 | }; | 512 | }; |
499 | 513 | ||
500 | struct ata_port { | 514 | struct ata_port { |
501 | struct Scsi_Host *host; /* our co-allocated scsi host */ | 515 | struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ |
502 | const struct ata_port_operations *ops; | 516 | const struct ata_port_operations *ops; |
503 | spinlock_t *lock; | 517 | spinlock_t *lock; |
504 | unsigned long flags; /* ATA_FLAG_xxx */ | 518 | unsigned long flags; /* ATA_FLAG_xxx */ |
505 | unsigned int pflags; /* ATA_PFLAG_xxx */ | 519 | unsigned int pflags; /* ATA_PFLAG_xxx */ |
506 | unsigned int id; /* unique id req'd by scsi midlyr */ | 520 | unsigned int id; /* unique id req'd by scsi midlyr */ |
507 | unsigned int port_no; /* unique port #; from zero */ | 521 | unsigned int port_no; /* unique port #; from zero */ |
508 | unsigned int hard_port_no; /* hardware port #; from zero */ | ||
509 | 522 | ||
510 | struct ata_prd *prd; /* our SG list */ | 523 | struct ata_prd *prd; /* our SG list */ |
511 | dma_addr_t prd_dma; /* and its DMA mapping */ | 524 | dma_addr_t prd_dma; /* and its DMA mapping */ |
@@ -524,7 +537,7 @@ struct ata_port { | |||
524 | unsigned int hw_sata_spd_limit; | 537 | unsigned int hw_sata_spd_limit; |
525 | unsigned int sata_spd_limit; /* SATA PHY speed limit */ | 538 | unsigned int sata_spd_limit; /* SATA PHY speed limit */ |
526 | 539 | ||
527 | /* record runtime error info, protected by host_set lock */ | 540 | /* record runtime error info, protected by host lock */ |
528 | struct ata_eh_info eh_info; | 541 | struct ata_eh_info eh_info; |
529 | /* EH context owned by EH */ | 542 | /* EH context owned by EH */ |
530 | struct ata_eh_context eh_context; | 543 | struct ata_eh_context eh_context; |
@@ -538,8 +551,8 @@ struct ata_port { | |||
538 | unsigned int active_tag; | 551 | unsigned int active_tag; |
539 | u32 sactive; | 552 | u32 sactive; |
540 | 553 | ||
541 | struct ata_host_stats stats; | 554 | struct ata_port_stats stats; |
542 | struct ata_host_set *host_set; | 555 | struct ata_host *host; |
543 | struct device *dev; | 556 | struct device *dev; |
544 | 557 | ||
545 | struct work_struct port_task; | 558 | struct work_struct port_task; |
@@ -615,7 +628,7 @@ struct ata_port_operations { | |||
615 | int (*port_start) (struct ata_port *ap); | 628 | int (*port_start) (struct ata_port *ap); |
616 | void (*port_stop) (struct ata_port *ap); | 629 | void (*port_stop) (struct ata_port *ap); |
617 | 630 | ||
618 | void (*host_stop) (struct ata_host_set *host_set); | 631 | void (*host_stop) (struct ata_host *host); |
619 | 632 | ||
620 | void (*bmdma_stop) (struct ata_queued_cmd *qc); | 633 | void (*bmdma_stop) (struct ata_queued_cmd *qc); |
621 | u8 (*bmdma_status) (struct ata_port *ap); | 634 | u8 (*bmdma_status) (struct ata_port *ap); |
@@ -623,7 +636,7 @@ struct ata_port_operations { | |||
623 | 636 | ||
624 | struct ata_port_info { | 637 | struct ata_port_info { |
625 | struct scsi_host_template *sht; | 638 | struct scsi_host_template *sht; |
626 | unsigned long host_flags; | 639 | unsigned long flags; |
627 | unsigned long pio_mask; | 640 | unsigned long pio_mask; |
628 | unsigned long mwdma_mask; | 641 | unsigned long mwdma_mask; |
629 | unsigned long udma_mask; | 642 | unsigned long udma_mask; |
@@ -649,6 +662,8 @@ extern const unsigned long sata_deb_timing_normal[]; | |||
649 | extern const unsigned long sata_deb_timing_hotplug[]; | 662 | extern const unsigned long sata_deb_timing_hotplug[]; |
650 | extern const unsigned long sata_deb_timing_long[]; | 663 | extern const unsigned long sata_deb_timing_long[]; |
651 | 664 | ||
665 | extern const struct ata_port_operations ata_dummy_port_ops; | ||
666 | |||
652 | static inline const unsigned long * | 667 | static inline const unsigned long * |
653 | sata_ehc_deb_timing(struct ata_eh_context *ehc) | 668 | sata_ehc_deb_timing(struct ata_eh_context *ehc) |
654 | { | 669 | { |
@@ -658,6 +673,11 @@ sata_ehc_deb_timing(struct ata_eh_context *ehc) | |||
658 | return sata_deb_timing_normal; | 673 | return sata_deb_timing_normal; |
659 | } | 674 | } |
660 | 675 | ||
676 | static inline int ata_port_is_dummy(struct ata_port *ap) | ||
677 | { | ||
678 | return ap->ops == &ata_dummy_port_ops; | ||
679 | } | ||
680 | |||
661 | extern void ata_port_probe(struct ata_port *); | 681 | extern void ata_port_probe(struct ata_port *); |
662 | extern void __sata_phy_reset(struct ata_port *ap); | 682 | extern void __sata_phy_reset(struct ata_port *ap); |
663 | extern void sata_phy_reset(struct ata_port *ap); | 683 | extern void sata_phy_reset(struct ata_port *ap); |
@@ -676,19 +696,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, | 696 | extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, |
677 | unsigned int n_ports); | 697 | unsigned int n_ports); |
678 | extern void ata_pci_remove_one (struct pci_dev *pdev); | 698 | 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); | 699 | 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); | 700 | 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); | 701 | 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); | 702 | extern int ata_pci_device_resume(struct pci_dev *pdev); |
683 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); | 703 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); |
684 | #endif /* CONFIG_PCI */ | 704 | #endif /* CONFIG_PCI */ |
685 | extern int ata_device_add(const struct ata_probe_ent *ent); | 705 | extern int ata_device_add(const struct ata_probe_ent *ent); |
686 | extern void ata_port_detach(struct ata_port *ap); | 706 | extern void ata_port_detach(struct ata_port *ap); |
687 | extern void ata_host_set_remove(struct ata_host_set *host_set); | 707 | extern void ata_host_init(struct ata_host *, struct device *, |
708 | unsigned long, const struct ata_port_operations *); | ||
709 | extern void ata_host_remove(struct ata_host *host); | ||
688 | extern int ata_scsi_detect(struct scsi_host_template *sht); | 710 | 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); | 711 | 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 *)); | 712 | extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); |
691 | extern int ata_scsi_release(struct Scsi_Host *host); | 713 | extern int ata_scsi_release(struct Scsi_Host *host); |
714 | extern void ata_sas_port_destroy(struct ata_port *); | ||
715 | extern struct ata_port *ata_sas_port_alloc(struct ata_host *, | ||
716 | struct ata_port_info *, struct Scsi_Host *); | ||
717 | extern int ata_sas_port_init(struct ata_port *); | ||
718 | extern int ata_sas_port_start(struct ata_port *ap); | ||
719 | extern void ata_sas_port_stop(struct ata_port *ap); | ||
720 | extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); | ||
721 | extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), | ||
722 | struct ata_port *ap); | ||
692 | extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); | 723 | 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); | 724 | extern int sata_scr_valid(struct ata_port *ap); |
694 | extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val); | 725 | extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val); |
@@ -697,10 +728,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); | 728 | extern int ata_port_online(struct ata_port *ap); |
698 | extern int ata_port_offline(struct ata_port *ap); | 729 | extern int ata_port_offline(struct ata_port *ap); |
699 | extern int ata_scsi_device_resume(struct scsi_device *); | 730 | extern int ata_scsi_device_resume(struct scsi_device *); |
700 | extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state); | 731 | 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, | 732 | extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); |
702 | pm_message_t mesg); | 733 | 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); | 734 | extern int ata_ratelimit(void); |
705 | extern unsigned int ata_busy_sleep(struct ata_port *ap, | 735 | extern unsigned int ata_busy_sleep(struct ata_port *ap, |
706 | unsigned long timeout_pat, | 736 | unsigned long timeout_pat, |
@@ -725,7 +755,7 @@ extern u8 ata_altstatus(struct ata_port *ap); | |||
725 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); | 755 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); |
726 | extern int ata_port_start (struct ata_port *ap); | 756 | extern int ata_port_start (struct ata_port *ap); |
727 | extern void ata_port_stop (struct ata_port *ap); | 757 | extern void ata_port_stop (struct ata_port *ap); |
728 | extern void ata_host_stop (struct ata_host_set *host_set); | 758 | extern void ata_host_stop (struct ata_host *host); |
729 | extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); | 759 | 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, | 760 | extern void ata_mmio_data_xfer(struct ata_device *adev, unsigned char *buf, |
731 | unsigned int buflen, int write_data); | 761 | unsigned int buflen, int write_data); |
@@ -811,7 +841,7 @@ struct pci_bits { | |||
811 | unsigned long val; | 841 | unsigned long val; |
812 | }; | 842 | }; |
813 | 843 | ||
814 | extern void ata_pci_host_stop (struct ata_host_set *host_set); | 844 | extern void ata_pci_host_stop (struct ata_host *host); |
815 | extern struct ata_probe_ent * | 845 | extern struct ata_probe_ent * |
816 | ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); | 846 | 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); | 847 | extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); |