diff options
author | Tejun Heo <htejun@gmail.com> | 2008-03-25 09:16:41 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-04-17 15:44:18 -0400 |
commit | 624d5c514eed18d5a93062e9d86d67065175f30a (patch) | |
tree | 61f89b05b70e9b443cf09083b4ae3d102dd357b7 /include | |
parent | 272f7884e8c0effe594e5537092b9c0ccc0140b0 (diff) |
libata: reorganize SFF related stuff
* Move SFF related functions from libata-core.c to libata-sff.c.
ata_[bmdma_]sff_port_ops, ata_devchk(), ata_dev_try_classify(),
ata_std_dev_select(), ata_tf_to_host(), ata_busy_sleep(),
ata_wait_after_reset(), ata_wait_ready(), ata_bus_post_reset(),
ata_bus_softreset(), ata_bus_reset(), ata_std_softreset(),
sata_std_hardreset(), ata_fill_sg(), ata_fill_sg_dumb(),
ata_qc_prep(), ata_dump_qc_prep(), ata_data_xfer(),
ata_data_xfer_noirq(), ata_pio_sector(), ata_pio_sectors(),
atapi_send_cdb(), __atapi_pio_bytes(), atapi_pio_bytes(),
ata_hsm_ok_in_wq(), ata_hsm_qc_complete(), ata_hsm_move(),
ata_pio_task(), ata_qc_issue_prot(), ata_host_intr(),
ata_interrupt(), ata_std_ports()
* Make ata_pio_queue_task() global as it's now called from
libata-sff.c.
* Move SFF related stuff in include/linux/libata.h and
drivers/ata/libata.h into one place. While at it, move timing
constants into the global enum definition and fortify comments a
bit.
This patch strictly moves stuff around and as such doesn't cause any
functional difference.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/libata.h | 379 |
1 files changed, 190 insertions, 189 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index 01c233303aee..673f34b256ba 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -349,6 +349,22 @@ enum { | |||
349 | ATAPI_READ_CD = 2, /* READ CD [MSF] */ | 349 | ATAPI_READ_CD = 2, /* READ CD [MSF] */ |
350 | ATAPI_PASS_THRU = 3, /* SAT pass-thru */ | 350 | ATAPI_PASS_THRU = 3, /* SAT pass-thru */ |
351 | ATAPI_MISC = 4, /* the rest */ | 351 | ATAPI_MISC = 4, /* the rest */ |
352 | |||
353 | /* Timing constants */ | ||
354 | ATA_TIMING_SETUP = (1 << 0), | ||
355 | ATA_TIMING_ACT8B = (1 << 1), | ||
356 | ATA_TIMING_REC8B = (1 << 2), | ||
357 | ATA_TIMING_CYC8B = (1 << 3), | ||
358 | ATA_TIMING_8BIT = ATA_TIMING_ACT8B | ATA_TIMING_REC8B | | ||
359 | ATA_TIMING_CYC8B, | ||
360 | ATA_TIMING_ACTIVE = (1 << 4), | ||
361 | ATA_TIMING_RECOVER = (1 << 5), | ||
362 | ATA_TIMING_CYCLE = (1 << 6), | ||
363 | ATA_TIMING_UDMA = (1 << 7), | ||
364 | ATA_TIMING_ALL = ATA_TIMING_SETUP | ATA_TIMING_ACT8B | | ||
365 | ATA_TIMING_REC8B | ATA_TIMING_CYC8B | | ||
366 | ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER | | ||
367 | ATA_TIMING_CYCLE | ATA_TIMING_UDMA, | ||
352 | }; | 368 | }; |
353 | 369 | ||
354 | enum ata_xfer_mask { | 370 | enum ata_xfer_mask { |
@@ -779,6 +795,9 @@ struct ata_timing { | |||
779 | 795 | ||
780 | #define FIT(v, vmin, vmax) max_t(short, min_t(short, v, vmax), vmin) | 796 | #define FIT(v, vmin, vmax) max_t(short, min_t(short, v, vmax), vmin) |
781 | 797 | ||
798 | /* | ||
799 | * Core layer - drivers/ata/libata-core.c | ||
800 | */ | ||
782 | extern const unsigned long sata_deb_timing_normal[]; | 801 | extern const unsigned long sata_deb_timing_normal[]; |
783 | extern const unsigned long sata_deb_timing_hotplug[]; | 802 | extern const unsigned long sata_deb_timing_hotplug[]; |
784 | extern const unsigned long sata_deb_timing_long[]; | 803 | extern const unsigned long sata_deb_timing_long[]; |
@@ -802,22 +821,14 @@ static inline int ata_port_is_dummy(struct ata_port *ap) | |||
802 | 821 | ||
803 | extern void sata_print_link_status(struct ata_link *link); | 822 | extern void sata_print_link_status(struct ata_link *link); |
804 | extern void ata_port_probe(struct ata_port *); | 823 | extern void ata_port_probe(struct ata_port *); |
805 | extern void ata_bus_reset(struct ata_port *ap); | ||
806 | extern int sata_set_spd(struct ata_link *link); | 824 | extern int sata_set_spd(struct ata_link *link); |
807 | extern int sata_link_debounce(struct ata_link *link, | 825 | extern int sata_link_debounce(struct ata_link *link, |
808 | const unsigned long *params, unsigned long deadline); | 826 | const unsigned long *params, unsigned long deadline); |
809 | extern int sata_link_resume(struct ata_link *link, const unsigned long *params, | 827 | extern int sata_link_resume(struct ata_link *link, const unsigned long *params, |
810 | unsigned long deadline); | 828 | unsigned long deadline); |
811 | extern int ata_std_prereset(struct ata_link *link, unsigned long deadline); | ||
812 | extern int ata_std_softreset(struct ata_link *link, unsigned int *classes, | ||
813 | unsigned long deadline); | ||
814 | extern int sata_link_hardreset(struct ata_link *link, | 829 | extern int sata_link_hardreset(struct ata_link *link, |
815 | const unsigned long *timing, unsigned long deadline); | 830 | const unsigned long *timing, unsigned long deadline); |
816 | extern int sata_std_hardreset(struct ata_link *link, unsigned int *class, | ||
817 | unsigned long deadline); | ||
818 | extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); | ||
819 | extern void ata_port_disable(struct ata_port *); | 831 | extern void ata_port_disable(struct ata_port *); |
820 | extern void ata_std_ports(struct ata_ioports *ioaddr); | ||
821 | 832 | ||
822 | extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); | 833 | extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); |
823 | extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, | 834 | extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, |
@@ -843,7 +854,6 @@ extern void ata_sas_port_stop(struct ata_port *ap); | |||
843 | extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); | 854 | extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); |
844 | extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), | 855 | extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), |
845 | struct ata_port *ap); | 856 | struct ata_port *ap); |
846 | extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); | ||
847 | extern int sata_scr_valid(struct ata_link *link); | 857 | extern int sata_scr_valid(struct ata_link *link); |
848 | extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); | 858 | extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); |
849 | extern int sata_scr_write(struct ata_link *link, int reg, u32 val); | 859 | extern int sata_scr_write(struct ata_link *link, int reg, u32 val); |
@@ -855,21 +865,9 @@ extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); | |||
855 | extern void ata_host_resume(struct ata_host *host); | 865 | extern void ata_host_resume(struct ata_host *host); |
856 | #endif | 866 | #endif |
857 | extern int ata_ratelimit(void); | 867 | extern int ata_ratelimit(void); |
858 | extern int ata_busy_sleep(struct ata_port *ap, | ||
859 | unsigned long timeout_pat, unsigned long timeout); | ||
860 | extern void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline); | ||
861 | extern int ata_wait_ready(struct ata_port *ap, unsigned long deadline); | ||
862 | extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, | 868 | extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, |
863 | unsigned long interval_msec, | 869 | unsigned long interval_msec, |
864 | unsigned long timeout_msec); | 870 | unsigned long timeout_msec); |
865 | extern unsigned int ata_dev_try_classify(struct ata_device *dev, int present, | ||
866 | u8 *r_err); | ||
867 | |||
868 | /* | ||
869 | * Default driver ops implementations | ||
870 | */ | ||
871 | extern void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); | ||
872 | extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | ||
873 | extern int atapi_cmd_type(u8 opcode); | 871 | extern int atapi_cmd_type(u8 opcode); |
874 | extern void ata_tf_to_fis(const struct ata_taskfile *tf, | 872 | extern void ata_tf_to_fis(const struct ata_taskfile *tf, |
875 | u8 pmp, int is_cmd, u8 *fis); | 873 | u8 pmp, int is_cmd, u8 *fis); |
@@ -885,22 +883,9 @@ extern int ata_xfer_mode2shift(unsigned long xfer_mode); | |||
885 | extern const char *ata_mode_string(unsigned long xfer_mask); | 883 | extern const char *ata_mode_string(unsigned long xfer_mask); |
886 | extern unsigned long ata_id_xfermask(const u16 *id); | 884 | extern unsigned long ata_id_xfermask(const u16 *id); |
887 | extern void ata_noop_dev_select(struct ata_port *ap, unsigned int device); | 885 | extern void ata_noop_dev_select(struct ata_port *ap, unsigned int device); |
888 | extern void ata_std_dev_select(struct ata_port *ap, unsigned int device); | ||
889 | extern u8 ata_check_status(struct ata_port *ap); | ||
890 | extern u8 ata_altstatus(struct ata_port *ap); | ||
891 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); | ||
892 | extern int ata_port_start(struct ata_port *ap); | 886 | extern int ata_port_start(struct ata_port *ap); |
893 | extern int ata_sff_port_start(struct ata_port *ap); | ||
894 | extern irqreturn_t ata_interrupt(int irq, void *dev_instance); | ||
895 | extern unsigned int ata_data_xfer(struct ata_device *dev, | ||
896 | unsigned char *buf, unsigned int buflen, int rw); | ||
897 | extern unsigned int ata_data_xfer_noirq(struct ata_device *dev, | ||
898 | unsigned char *buf, unsigned int buflen, int rw); | ||
899 | extern int ata_std_qc_defer(struct ata_queued_cmd *qc); | 887 | extern int ata_std_qc_defer(struct ata_queued_cmd *qc); |
900 | extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc); | ||
901 | extern void ata_qc_prep(struct ata_queued_cmd *qc); | ||
902 | extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); | 888 | extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); |
903 | extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc); | ||
904 | extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, | 889 | extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, |
905 | unsigned int n_elem); | 890 | unsigned int n_elem); |
906 | extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); | 891 | extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); |
@@ -909,18 +894,7 @@ extern void ata_id_string(const u16 *id, unsigned char *s, | |||
909 | unsigned int ofs, unsigned int len); | 894 | unsigned int ofs, unsigned int len); |
910 | extern void ata_id_c_string(const u16 *id, unsigned char *s, | 895 | extern void ata_id_c_string(const u16 *id, unsigned char *s, |
911 | unsigned int ofs, unsigned int len); | 896 | unsigned int ofs, unsigned int len); |
912 | extern void ata_bmdma_setup(struct ata_queued_cmd *qc); | ||
913 | extern void ata_bmdma_start(struct ata_queued_cmd *qc); | ||
914 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); | ||
915 | extern u8 ata_bmdma_status(struct ata_port *ap); | ||
916 | extern void ata_bmdma_irq_clear(struct ata_port *ap); | ||
917 | extern void ata_noop_irq_clear(struct ata_port *ap); | 897 | extern void ata_noop_irq_clear(struct ata_port *ap); |
918 | extern void ata_bmdma_freeze(struct ata_port *ap); | ||
919 | extern void ata_bmdma_thaw(struct ata_port *ap); | ||
920 | extern void ata_bmdma_error_handler(struct ata_port *ap); | ||
921 | extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc); | ||
922 | extern int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, | ||
923 | u8 status, int in_wq); | ||
924 | extern void ata_qc_complete(struct ata_queued_cmd *qc); | 898 | extern void ata_qc_complete(struct ata_queued_cmd *qc); |
925 | extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active, | 899 | extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active, |
926 | void (*finish_qc)(struct ata_queued_cmd *)); | 900 | void (*finish_qc)(struct ata_queued_cmd *)); |
@@ -935,7 +909,6 @@ extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, | |||
935 | int queue_depth); | 909 | int queue_depth); |
936 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); | 910 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); |
937 | extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); | 911 | extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); |
938 | extern u8 ata_irq_on(struct ata_port *ap); | ||
939 | 912 | ||
940 | extern int ata_cable_40wire(struct ata_port *ap); | 913 | extern int ata_cable_40wire(struct ata_port *ap); |
941 | extern int ata_cable_80wire(struct ata_port *ap); | 914 | extern int ata_cable_80wire(struct ata_port *ap); |
@@ -943,10 +916,7 @@ extern int ata_cable_sata(struct ata_port *ap); | |||
943 | extern int ata_cable_ignore(struct ata_port *ap); | 916 | extern int ata_cable_ignore(struct ata_port *ap); |
944 | extern int ata_cable_unknown(struct ata_port *ap); | 917 | extern int ata_cable_unknown(struct ata_port *ap); |
945 | 918 | ||
946 | /* | 919 | /* Timing helpers */ |
947 | * Timing helpers | ||
948 | */ | ||
949 | |||
950 | extern unsigned int ata_pio_need_iordy(const struct ata_device *); | 920 | extern unsigned int ata_pio_need_iordy(const struct ata_device *); |
951 | extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); | 921 | extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); |
952 | extern int ata_timing_compute(struct ata_device *, unsigned short, | 922 | extern int ata_timing_compute(struct ata_device *, unsigned short, |
@@ -956,24 +926,31 @@ extern void ata_timing_merge(const struct ata_timing *, | |||
956 | unsigned int); | 926 | unsigned int); |
957 | extern u8 ata_timing_cycle2mode(unsigned int xfer_shift, int cycle); | 927 | extern u8 ata_timing_cycle2mode(unsigned int xfer_shift, int cycle); |
958 | 928 | ||
959 | enum { | 929 | /* PCI */ |
960 | ATA_TIMING_SETUP = (1 << 0), | 930 | #ifdef CONFIG_PCI |
961 | ATA_TIMING_ACT8B = (1 << 1), | 931 | struct pci_dev; |
962 | ATA_TIMING_REC8B = (1 << 2), | 932 | |
963 | ATA_TIMING_CYC8B = (1 << 3), | 933 | struct pci_bits { |
964 | ATA_TIMING_8BIT = ATA_TIMING_ACT8B | ATA_TIMING_REC8B | | 934 | unsigned int reg; /* PCI config register to read */ |
965 | ATA_TIMING_CYC8B, | 935 | unsigned int width; /* 1 (8 bit), 2 (16 bit), 4 (32 bit) */ |
966 | ATA_TIMING_ACTIVE = (1 << 4), | 936 | unsigned long mask; |
967 | ATA_TIMING_RECOVER = (1 << 5), | 937 | unsigned long val; |
968 | ATA_TIMING_CYCLE = (1 << 6), | ||
969 | ATA_TIMING_UDMA = (1 << 7), | ||
970 | ATA_TIMING_ALL = ATA_TIMING_SETUP | ATA_TIMING_ACT8B | | ||
971 | ATA_TIMING_REC8B | ATA_TIMING_CYC8B | | ||
972 | ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER | | ||
973 | ATA_TIMING_CYCLE | ATA_TIMING_UDMA, | ||
974 | }; | 938 | }; |
975 | 939 | ||
976 | /* libata-acpi.c */ | 940 | extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); |
941 | extern void ata_pci_remove_one(struct pci_dev *pdev); | ||
942 | |||
943 | #ifdef CONFIG_PM | ||
944 | extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg); | ||
945 | extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev); | ||
946 | extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); | ||
947 | extern int ata_pci_device_resume(struct pci_dev *pdev); | ||
948 | #endif /* CONFIG_PM */ | ||
949 | #endif /* CONFIG_PCI */ | ||
950 | |||
951 | /* | ||
952 | * ACPI - drivers/ata/libata-acpi.c | ||
953 | */ | ||
977 | #ifdef CONFIG_ATA_ACPI | 954 | #ifdef CONFIG_ATA_ACPI |
978 | static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap) | 955 | static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap) |
979 | { | 956 | { |
@@ -1017,43 +994,8 @@ static inline int ata_acpi_cbl_80wire(struct ata_port *ap, | |||
1017 | } | 994 | } |
1018 | #endif | 995 | #endif |
1019 | 996 | ||
1020 | #ifdef CONFIG_PCI | ||
1021 | struct pci_dev; | ||
1022 | |||
1023 | extern int ata_pci_init_one(struct pci_dev *pdev, | ||
1024 | const struct ata_port_info * const * ppi, | ||
1025 | struct scsi_host_template *sht, void *host_priv); | ||
1026 | extern void ata_pci_remove_one(struct pci_dev *pdev); | ||
1027 | #ifdef CONFIG_PM | ||
1028 | extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg); | ||
1029 | extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev); | ||
1030 | extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); | ||
1031 | extern int ata_pci_device_resume(struct pci_dev *pdev); | ||
1032 | #endif | ||
1033 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); | ||
1034 | |||
1035 | struct pci_bits { | ||
1036 | unsigned int reg; /* PCI config register to read */ | ||
1037 | unsigned int width; /* 1 (8 bit), 2 (16 bit), 4 (32 bit) */ | ||
1038 | unsigned long mask; | ||
1039 | unsigned long val; | ||
1040 | }; | ||
1041 | |||
1042 | extern int ata_pci_init_sff_host(struct ata_host *host); | ||
1043 | extern int ata_pci_init_bmdma(struct ata_host *host); | ||
1044 | extern int ata_pci_prepare_sff_host(struct pci_dev *pdev, | ||
1045 | const struct ata_port_info * const * ppi, | ||
1046 | struct ata_host **r_host); | ||
1047 | extern int ata_pci_activate_sff_host(struct ata_host *host, | ||
1048 | irq_handler_t irq_handler, | ||
1049 | struct scsi_host_template *sht); | ||
1050 | extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); | ||
1051 | extern unsigned long ata_pci_default_filter(struct ata_device *dev, | ||
1052 | unsigned long xfer_mask); | ||
1053 | #endif /* CONFIG_PCI */ | ||
1054 | |||
1055 | /* | 997 | /* |
1056 | * PMP | 998 | * PMP - drivers/ata/libata-pmp.c |
1057 | */ | 999 | */ |
1058 | extern int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc); | 1000 | extern int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc); |
1059 | extern int sata_pmp_std_prereset(struct ata_link *link, unsigned long deadline); | 1001 | extern int sata_pmp_std_prereset(struct ata_link *link, unsigned long deadline); |
@@ -1063,7 +1005,7 @@ extern void sata_pmp_std_postreset(struct ata_link *link, unsigned int *class); | |||
1063 | extern void sata_pmp_error_handler(struct ata_port *ap); | 1005 | extern void sata_pmp_error_handler(struct ata_port *ap); |
1064 | 1006 | ||
1065 | /* | 1007 | /* |
1066 | * EH | 1008 | * EH - drivers/ata/libata-eh.c |
1067 | */ | 1009 | */ |
1068 | extern void ata_port_schedule_eh(struct ata_port *ap); | 1010 | extern void ata_port_schedule_eh(struct ata_port *ap); |
1069 | extern int ata_link_abort(struct ata_link *link); | 1011 | extern int ata_link_abort(struct ata_link *link); |
@@ -1106,8 +1048,6 @@ extern void ata_std_error_handler(struct ata_port *ap); | |||
1106 | extern const struct ata_port_operations ata_base_port_ops; | 1048 | extern const struct ata_port_operations ata_base_port_ops; |
1107 | extern const struct ata_port_operations sata_port_ops; | 1049 | extern const struct ata_port_operations sata_port_ops; |
1108 | extern const struct ata_port_operations sata_pmp_port_ops; | 1050 | extern const struct ata_port_operations sata_pmp_port_ops; |
1109 | extern const struct ata_port_operations ata_sff_port_ops; | ||
1110 | extern const struct ata_port_operations ata_bmdma_port_ops; | ||
1111 | 1051 | ||
1112 | #define ATA_BASE_SHT(drv_name) \ | 1052 | #define ATA_BASE_SHT(drv_name) \ |
1113 | .module = THIS_MODULE, \ | 1053 | .module = THIS_MODULE, \ |
@@ -1124,17 +1064,6 @@ extern const struct ata_port_operations ata_bmdma_port_ops; | |||
1124 | .slave_destroy = ata_scsi_slave_destroy, \ | 1064 | .slave_destroy = ata_scsi_slave_destroy, \ |
1125 | .bios_param = ata_std_bios_param | 1065 | .bios_param = ata_std_bios_param |
1126 | 1066 | ||
1127 | /* PIO only, sg_tablesize and dma_boundary limits can be removed */ | ||
1128 | #define ATA_PIO_SHT(drv_name) \ | ||
1129 | ATA_BASE_SHT(drv_name), \ | ||
1130 | .sg_tablesize = LIBATA_MAX_PRD, \ | ||
1131 | .dma_boundary = ATA_DMA_BOUNDARY | ||
1132 | |||
1133 | #define ATA_BMDMA_SHT(drv_name) \ | ||
1134 | ATA_BASE_SHT(drv_name), \ | ||
1135 | .sg_tablesize = LIBATA_MAX_PRD, \ | ||
1136 | .dma_boundary = ATA_DMA_BOUNDARY | ||
1137 | |||
1138 | #define ATA_NCQ_SHT(drv_name) \ | 1067 | #define ATA_NCQ_SHT(drv_name) \ |
1139 | ATA_BASE_SHT(drv_name), \ | 1068 | ATA_BASE_SHT(drv_name), \ |
1140 | .change_queue_depth = ata_scsi_change_queue_depth | 1069 | .change_queue_depth = ata_scsi_change_queue_depth |
@@ -1287,11 +1216,6 @@ static inline struct ata_link *ata_port_next_link(struct ata_link *link) | |||
1287 | for ((dev) = (link)->device + ata_link_max_devices(link) - 1; \ | 1216 | for ((dev) = (link)->device + ata_link_max_devices(link) - 1; \ |
1288 | (dev) >= (link)->device || ((dev) = NULL); (dev)--) | 1217 | (dev) >= (link)->device || ((dev) = NULL); (dev)--) |
1289 | 1218 | ||
1290 | static inline u8 ata_chk_status(struct ata_port *ap) | ||
1291 | { | ||
1292 | return ap->ops->check_status(ap); | ||
1293 | } | ||
1294 | |||
1295 | /** | 1219 | /** |
1296 | * ata_ncq_enabled - Test whether NCQ is enabled | 1220 | * ata_ncq_enabled - Test whether NCQ is enabled |
1297 | * @dev: ATA device to test for | 1221 | * @dev: ATA device to test for |
@@ -1308,74 +1232,6 @@ static inline int ata_ncq_enabled(struct ata_device *dev) | |||
1308 | ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; | 1232 | ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; |
1309 | } | 1233 | } |
1310 | 1234 | ||
1311 | /** | ||
1312 | * ata_pause - Flush writes and pause 400 nanoseconds. | ||
1313 | * @ap: Port to wait for. | ||
1314 | * | ||
1315 | * LOCKING: | ||
1316 | * Inherited from caller. | ||
1317 | */ | ||
1318 | |||
1319 | static inline void ata_pause(struct ata_port *ap) | ||
1320 | { | ||
1321 | ata_altstatus(ap); | ||
1322 | ndelay(400); | ||
1323 | } | ||
1324 | |||
1325 | |||
1326 | /** | ||
1327 | * ata_busy_wait - Wait for a port status register | ||
1328 | * @ap: Port to wait for. | ||
1329 | * @bits: bits that must be clear | ||
1330 | * @max: number of 10uS waits to perform | ||
1331 | * | ||
1332 | * Waits up to max*10 microseconds for the selected bits in the port's | ||
1333 | * status register to be cleared. | ||
1334 | * Returns final value of status register. | ||
1335 | * | ||
1336 | * LOCKING: | ||
1337 | * Inherited from caller. | ||
1338 | */ | ||
1339 | |||
1340 | static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, | ||
1341 | unsigned int max) | ||
1342 | { | ||
1343 | u8 status; | ||
1344 | |||
1345 | do { | ||
1346 | udelay(10); | ||
1347 | status = ata_chk_status(ap); | ||
1348 | max--; | ||
1349 | } while (status != 0xff && (status & bits) && (max > 0)); | ||
1350 | |||
1351 | return status; | ||
1352 | } | ||
1353 | |||
1354 | |||
1355 | /** | ||
1356 | * ata_wait_idle - Wait for a port to be idle. | ||
1357 | * @ap: Port to wait for. | ||
1358 | * | ||
1359 | * Waits up to 10ms for port's BUSY and DRQ signals to clear. | ||
1360 | * Returns final value of status register. | ||
1361 | * | ||
1362 | * LOCKING: | ||
1363 | * Inherited from caller. | ||
1364 | */ | ||
1365 | |||
1366 | static inline u8 ata_wait_idle(struct ata_port *ap) | ||
1367 | { | ||
1368 | u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); | ||
1369 | |||
1370 | #ifdef ATA_DEBUG | ||
1371 | if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) | ||
1372 | ata_port_printk(ap, KERN_DEBUG, "abnormal Status 0x%X\n", | ||
1373 | status); | ||
1374 | #endif | ||
1375 | |||
1376 | return status; | ||
1377 | } | ||
1378 | |||
1379 | static inline void ata_qc_set_polling(struct ata_queued_cmd *qc) | 1235 | static inline void ata_qc_set_polling(struct ata_queued_cmd *qc) |
1380 | { | 1236 | { |
1381 | qc->tf.ctl |= ATA_NIEN; | 1237 | qc->tf.ctl |= ATA_NIEN; |
@@ -1468,4 +1324,149 @@ static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host) | |||
1468 | return *(struct ata_port **)&host->hostdata[0]; | 1324 | return *(struct ata_port **)&host->hostdata[0]; |
1469 | } | 1325 | } |
1470 | 1326 | ||
1327 | /************************************************************************** | ||
1328 | * SFF - drivers/ata/libata-sff.c | ||
1329 | */ | ||
1330 | extern const struct ata_port_operations ata_sff_port_ops; | ||
1331 | extern const struct ata_port_operations ata_bmdma_port_ops; | ||
1332 | |||
1333 | /* PIO only, sg_tablesize and dma_boundary limits can be removed */ | ||
1334 | #define ATA_PIO_SHT(drv_name) \ | ||
1335 | ATA_BASE_SHT(drv_name), \ | ||
1336 | .sg_tablesize = LIBATA_MAX_PRD, \ | ||
1337 | .dma_boundary = ATA_DMA_BOUNDARY | ||
1338 | |||
1339 | #define ATA_BMDMA_SHT(drv_name) \ | ||
1340 | ATA_BASE_SHT(drv_name), \ | ||
1341 | .sg_tablesize = LIBATA_MAX_PRD, \ | ||
1342 | .dma_boundary = ATA_DMA_BOUNDARY | ||
1343 | |||
1344 | extern void ata_qc_prep(struct ata_queued_cmd *qc); | ||
1345 | extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc); | ||
1346 | extern void ata_std_dev_select(struct ata_port *ap, unsigned int device); | ||
1347 | extern u8 ata_check_status(struct ata_port *ap); | ||
1348 | extern u8 ata_altstatus(struct ata_port *ap); | ||
1349 | extern int ata_busy_sleep(struct ata_port *ap, | ||
1350 | unsigned long timeout_pat, unsigned long timeout); | ||
1351 | extern int ata_wait_ready(struct ata_port *ap, unsigned long deadline); | ||
1352 | extern void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); | ||
1353 | extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | ||
1354 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); | ||
1355 | extern unsigned int ata_data_xfer(struct ata_device *dev, | ||
1356 | unsigned char *buf, unsigned int buflen, int rw); | ||
1357 | extern unsigned int ata_data_xfer_noirq(struct ata_device *dev, | ||
1358 | unsigned char *buf, unsigned int buflen, int rw); | ||
1359 | extern u8 ata_irq_on(struct ata_port *ap); | ||
1360 | extern void ata_bmdma_irq_clear(struct ata_port *ap); | ||
1361 | extern int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, | ||
1362 | u8 status, int in_wq); | ||
1363 | extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc); | ||
1364 | extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); | ||
1365 | extern irqreturn_t ata_interrupt(int irq, void *dev_instance); | ||
1366 | extern void ata_bmdma_freeze(struct ata_port *ap); | ||
1367 | extern void ata_bmdma_thaw(struct ata_port *ap); | ||
1368 | extern int ata_std_prereset(struct ata_link *link, unsigned long deadline); | ||
1369 | extern unsigned int ata_dev_try_classify(struct ata_device *dev, int present, | ||
1370 | u8 *r_err); | ||
1371 | extern void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline); | ||
1372 | extern int ata_std_softreset(struct ata_link *link, unsigned int *classes, | ||
1373 | unsigned long deadline); | ||
1374 | extern int sata_std_hardreset(struct ata_link *link, unsigned int *class, | ||
1375 | unsigned long deadline); | ||
1376 | extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); | ||
1377 | extern void ata_bmdma_error_handler(struct ata_port *ap); | ||
1378 | extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc); | ||
1379 | extern int ata_sff_port_start(struct ata_port *ap); | ||
1380 | extern void ata_std_ports(struct ata_ioports *ioaddr); | ||
1381 | extern void ata_bmdma_setup(struct ata_queued_cmd *qc); | ||
1382 | extern void ata_bmdma_start(struct ata_queued_cmd *qc); | ||
1383 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); | ||
1384 | extern u8 ata_bmdma_status(struct ata_port *ap); | ||
1385 | extern void ata_bus_reset(struct ata_port *ap); | ||
1386 | |||
1387 | #ifdef CONFIG_PCI | ||
1388 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); | ||
1389 | extern unsigned long ata_pci_default_filter(struct ata_device *dev, | ||
1390 | unsigned long xfer_mask); | ||
1391 | extern int ata_pci_init_bmdma(struct ata_host *host); | ||
1392 | extern int ata_pci_init_sff_host(struct ata_host *host); | ||
1393 | extern int ata_pci_prepare_sff_host(struct pci_dev *pdev, | ||
1394 | const struct ata_port_info * const * ppi, | ||
1395 | struct ata_host **r_host); | ||
1396 | extern int ata_pci_activate_sff_host(struct ata_host *host, | ||
1397 | irq_handler_t irq_handler, | ||
1398 | struct scsi_host_template *sht); | ||
1399 | extern int ata_pci_init_one(struct pci_dev *pdev, | ||
1400 | const struct ata_port_info * const * ppi, | ||
1401 | struct scsi_host_template *sht, void *host_priv); | ||
1402 | #endif /* CONFIG_PCI */ | ||
1403 | |||
1404 | static inline u8 ata_chk_status(struct ata_port *ap) | ||
1405 | { | ||
1406 | return ap->ops->check_status(ap); | ||
1407 | } | ||
1408 | |||
1409 | /** | ||
1410 | * ata_pause - Flush writes and pause 400 nanoseconds. | ||
1411 | * @ap: Port to wait for. | ||
1412 | * | ||
1413 | * LOCKING: | ||
1414 | * Inherited from caller. | ||
1415 | */ | ||
1416 | static inline void ata_pause(struct ata_port *ap) | ||
1417 | { | ||
1418 | ata_altstatus(ap); | ||
1419 | ndelay(400); | ||
1420 | } | ||
1421 | |||
1422 | /** | ||
1423 | * ata_busy_wait - Wait for a port status register | ||
1424 | * @ap: Port to wait for. | ||
1425 | * @bits: bits that must be clear | ||
1426 | * @max: number of 10uS waits to perform | ||
1427 | * | ||
1428 | * Waits up to max*10 microseconds for the selected bits in the port's | ||
1429 | * status register to be cleared. | ||
1430 | * Returns final value of status register. | ||
1431 | * | ||
1432 | * LOCKING: | ||
1433 | * Inherited from caller. | ||
1434 | */ | ||
1435 | static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, | ||
1436 | unsigned int max) | ||
1437 | { | ||
1438 | u8 status; | ||
1439 | |||
1440 | do { | ||
1441 | udelay(10); | ||
1442 | status = ata_chk_status(ap); | ||
1443 | max--; | ||
1444 | } while (status != 0xff && (status & bits) && (max > 0)); | ||
1445 | |||
1446 | return status; | ||
1447 | } | ||
1448 | |||
1449 | /** | ||
1450 | * ata_wait_idle - Wait for a port to be idle. | ||
1451 | * @ap: Port to wait for. | ||
1452 | * | ||
1453 | * Waits up to 10ms for port's BUSY and DRQ signals to clear. | ||
1454 | * Returns final value of status register. | ||
1455 | * | ||
1456 | * LOCKING: | ||
1457 | * Inherited from caller. | ||
1458 | */ | ||
1459 | static inline u8 ata_wait_idle(struct ata_port *ap) | ||
1460 | { | ||
1461 | u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); | ||
1462 | |||
1463 | #ifdef ATA_DEBUG | ||
1464 | if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) | ||
1465 | ata_port_printk(ap, KERN_DEBUG, "abnormal Status 0x%X\n", | ||
1466 | status); | ||
1467 | #endif | ||
1468 | |||
1469 | return status; | ||
1470 | } | ||
1471 | |||
1471 | #endif /* __LINUX_LIBATA_H__ */ | 1472 | #endif /* __LINUX_LIBATA_H__ */ |