diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ata.h | 163 | ||||
-rw-r--r-- | include/linux/libata.h | 10 | ||||
-rw-r--r-- | include/linux/pata_arasan_cf_data.h | 49 | ||||
-rw-r--r-- | include/scsi/sas_ata.h | 22 |
4 files changed, 158 insertions, 86 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h index 0c4929fa34d3..32df2b6ef0e0 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -89,6 +89,7 @@ enum { | |||
89 | ATA_ID_SPG = 98, | 89 | ATA_ID_SPG = 98, |
90 | ATA_ID_LBA_CAPACITY_2 = 100, | 90 | ATA_ID_LBA_CAPACITY_2 = 100, |
91 | ATA_ID_SECTOR_SIZE = 106, | 91 | ATA_ID_SECTOR_SIZE = 106, |
92 | ATA_ID_WWN = 108, | ||
92 | ATA_ID_LOGICAL_SECTOR_SIZE = 117, /* and 118 */ | 93 | ATA_ID_LOGICAL_SECTOR_SIZE = 117, /* and 118 */ |
93 | ATA_ID_LAST_LUN = 126, | 94 | ATA_ID_LAST_LUN = 126, |
94 | ATA_ID_DLF = 128, | 95 | ATA_ID_DLF = 128, |
@@ -103,6 +104,7 @@ enum { | |||
103 | ATA_ID_SERNO_LEN = 20, | 104 | ATA_ID_SERNO_LEN = 20, |
104 | ATA_ID_FW_REV_LEN = 8, | 105 | ATA_ID_FW_REV_LEN = 8, |
105 | ATA_ID_PROD_LEN = 40, | 106 | ATA_ID_PROD_LEN = 40, |
107 | ATA_ID_WWN_LEN = 8, | ||
106 | 108 | ||
107 | ATA_PCI_CTL_OFS = 2, | 109 | ATA_PCI_CTL_OFS = 2, |
108 | 110 | ||
@@ -598,42 +600,42 @@ static inline bool ata_id_has_dipm(const u16 *id) | |||
598 | } | 600 | } |
599 | 601 | ||
600 | 602 | ||
601 | static inline int ata_id_has_fua(const u16 *id) | 603 | static inline bool ata_id_has_fua(const u16 *id) |
602 | { | 604 | { |
603 | if ((id[ATA_ID_CFSSE] & 0xC000) != 0x4000) | 605 | if ((id[ATA_ID_CFSSE] & 0xC000) != 0x4000) |
604 | return 0; | 606 | return false; |
605 | return id[ATA_ID_CFSSE] & (1 << 6); | 607 | return id[ATA_ID_CFSSE] & (1 << 6); |
606 | } | 608 | } |
607 | 609 | ||
608 | static inline int ata_id_has_flush(const u16 *id) | 610 | static inline bool ata_id_has_flush(const u16 *id) |
609 | { | 611 | { |
610 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) | 612 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
611 | return 0; | 613 | return false; |
612 | return id[ATA_ID_COMMAND_SET_2] & (1 << 12); | 614 | return id[ATA_ID_COMMAND_SET_2] & (1 << 12); |
613 | } | 615 | } |
614 | 616 | ||
615 | static inline int ata_id_flush_enabled(const u16 *id) | 617 | static inline bool ata_id_flush_enabled(const u16 *id) |
616 | { | 618 | { |
617 | if (ata_id_has_flush(id) == 0) | 619 | if (ata_id_has_flush(id) == 0) |
618 | return 0; | 620 | return false; |
619 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) | 621 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) |
620 | return 0; | 622 | return false; |
621 | return id[ATA_ID_CFS_ENABLE_2] & (1 << 12); | 623 | return id[ATA_ID_CFS_ENABLE_2] & (1 << 12); |
622 | } | 624 | } |
623 | 625 | ||
624 | static inline int ata_id_has_flush_ext(const u16 *id) | 626 | static inline bool ata_id_has_flush_ext(const u16 *id) |
625 | { | 627 | { |
626 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) | 628 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
627 | return 0; | 629 | return false; |
628 | return id[ATA_ID_COMMAND_SET_2] & (1 << 13); | 630 | return id[ATA_ID_COMMAND_SET_2] & (1 << 13); |
629 | } | 631 | } |
630 | 632 | ||
631 | static inline int ata_id_flush_ext_enabled(const u16 *id) | 633 | static inline bool ata_id_flush_ext_enabled(const u16 *id) |
632 | { | 634 | { |
633 | if (ata_id_has_flush_ext(id) == 0) | 635 | if (ata_id_has_flush_ext(id) == 0) |
634 | return 0; | 636 | return false; |
635 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) | 637 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) |
636 | return 0; | 638 | return false; |
637 | /* | 639 | /* |
638 | * some Maxtor disks have bit 13 defined incorrectly | 640 | * some Maxtor disks have bit 13 defined incorrectly |
639 | * so check bit 10 too | 641 | * so check bit 10 too |
@@ -686,64 +688,64 @@ static inline u16 ata_id_logical_sector_offset(const u16 *id, | |||
686 | return 0; | 688 | return 0; |
687 | } | 689 | } |
688 | 690 | ||
689 | static inline int ata_id_has_lba48(const u16 *id) | 691 | static inline bool ata_id_has_lba48(const u16 *id) |
690 | { | 692 | { |
691 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) | 693 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
692 | return 0; | 694 | return false; |
693 | if (!ata_id_u64(id, ATA_ID_LBA_CAPACITY_2)) | 695 | if (!ata_id_u64(id, ATA_ID_LBA_CAPACITY_2)) |
694 | return 0; | 696 | return false; |
695 | return id[ATA_ID_COMMAND_SET_2] & (1 << 10); | 697 | return id[ATA_ID_COMMAND_SET_2] & (1 << 10); |
696 | } | 698 | } |
697 | 699 | ||
698 | static inline int ata_id_lba48_enabled(const u16 *id) | 700 | static inline bool ata_id_lba48_enabled(const u16 *id) |
699 | { | 701 | { |
700 | if (ata_id_has_lba48(id) == 0) | 702 | if (ata_id_has_lba48(id) == 0) |
701 | return 0; | 703 | return false; |
702 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) | 704 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) |
703 | return 0; | 705 | return false; |
704 | return id[ATA_ID_CFS_ENABLE_2] & (1 << 10); | 706 | return id[ATA_ID_CFS_ENABLE_2] & (1 << 10); |
705 | } | 707 | } |
706 | 708 | ||
707 | static inline int ata_id_hpa_enabled(const u16 *id) | 709 | static inline bool ata_id_hpa_enabled(const u16 *id) |
708 | { | 710 | { |
709 | /* Yes children, word 83 valid bits cover word 82 data */ | 711 | /* Yes children, word 83 valid bits cover word 82 data */ |
710 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) | 712 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
711 | return 0; | 713 | return false; |
712 | /* And 87 covers 85-87 */ | 714 | /* And 87 covers 85-87 */ |
713 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) | 715 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) |
714 | return 0; | 716 | return false; |
715 | /* Check command sets enabled as well as supported */ | 717 | /* Check command sets enabled as well as supported */ |
716 | if ((id[ATA_ID_CFS_ENABLE_1] & (1 << 10)) == 0) | 718 | if ((id[ATA_ID_CFS_ENABLE_1] & (1 << 10)) == 0) |
717 | return 0; | 719 | return false; |
718 | return id[ATA_ID_COMMAND_SET_1] & (1 << 10); | 720 | return id[ATA_ID_COMMAND_SET_1] & (1 << 10); |
719 | } | 721 | } |
720 | 722 | ||
721 | static inline int ata_id_has_wcache(const u16 *id) | 723 | static inline bool ata_id_has_wcache(const u16 *id) |
722 | { | 724 | { |
723 | /* Yes children, word 83 valid bits cover word 82 data */ | 725 | /* Yes children, word 83 valid bits cover word 82 data */ |
724 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) | 726 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
725 | return 0; | 727 | return false; |
726 | return id[ATA_ID_COMMAND_SET_1] & (1 << 5); | 728 | return id[ATA_ID_COMMAND_SET_1] & (1 << 5); |
727 | } | 729 | } |
728 | 730 | ||
729 | static inline int ata_id_has_pm(const u16 *id) | 731 | static inline bool ata_id_has_pm(const u16 *id) |
730 | { | 732 | { |
731 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) | 733 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
732 | return 0; | 734 | return false; |
733 | return id[ATA_ID_COMMAND_SET_1] & (1 << 3); | 735 | return id[ATA_ID_COMMAND_SET_1] & (1 << 3); |
734 | } | 736 | } |
735 | 737 | ||
736 | static inline int ata_id_rahead_enabled(const u16 *id) | 738 | static inline bool ata_id_rahead_enabled(const u16 *id) |
737 | { | 739 | { |
738 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) | 740 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) |
739 | return 0; | 741 | return false; |
740 | return id[ATA_ID_CFS_ENABLE_1] & (1 << 6); | 742 | return id[ATA_ID_CFS_ENABLE_1] & (1 << 6); |
741 | } | 743 | } |
742 | 744 | ||
743 | static inline int ata_id_wcache_enabled(const u16 *id) | 745 | static inline bool ata_id_wcache_enabled(const u16 *id) |
744 | { | 746 | { |
745 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) | 747 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) |
746 | return 0; | 748 | return false; |
747 | return id[ATA_ID_CFS_ENABLE_1] & (1 << 5); | 749 | return id[ATA_ID_CFS_ENABLE_1] & (1 << 5); |
748 | } | 750 | } |
749 | 751 | ||
@@ -773,7 +775,7 @@ static inline unsigned int ata_id_major_version(const u16 *id) | |||
773 | return mver; | 775 | return mver; |
774 | } | 776 | } |
775 | 777 | ||
776 | static inline int ata_id_is_sata(const u16 *id) | 778 | static inline bool ata_id_is_sata(const u16 *id) |
777 | { | 779 | { |
778 | /* | 780 | /* |
779 | * See if word 93 is 0 AND drive is at least ATA-5 compatible | 781 | * See if word 93 is 0 AND drive is at least ATA-5 compatible |
@@ -782,37 +784,40 @@ static inline int ata_id_is_sata(const u16 *id) | |||
782 | * 0x0000 and 0xffff along with the earlier ATA revisions... | 784 | * 0x0000 and 0xffff along with the earlier ATA revisions... |
783 | */ | 785 | */ |
784 | if (id[ATA_ID_HW_CONFIG] == 0 && (short)id[ATA_ID_MAJOR_VER] >= 0x0020) | 786 | if (id[ATA_ID_HW_CONFIG] == 0 && (short)id[ATA_ID_MAJOR_VER] >= 0x0020) |
785 | return 1; | 787 | return true; |
786 | return 0; | 788 | return false; |
787 | } | 789 | } |
788 | 790 | ||
789 | static inline int ata_id_has_tpm(const u16 *id) | 791 | static inline bool ata_id_has_tpm(const u16 *id) |
790 | { | 792 | { |
791 | /* The TPM bits are only valid on ATA8 */ | 793 | /* The TPM bits are only valid on ATA8 */ |
792 | if (ata_id_major_version(id) < 8) | 794 | if (ata_id_major_version(id) < 8) |
793 | return 0; | 795 | return false; |
794 | if ((id[48] & 0xC000) != 0x4000) | 796 | if ((id[48] & 0xC000) != 0x4000) |
795 | return 0; | 797 | return false; |
796 | return id[48] & (1 << 0); | 798 | return id[48] & (1 << 0); |
797 | } | 799 | } |
798 | 800 | ||
799 | static inline int ata_id_has_dword_io(const u16 *id) | 801 | static inline bool ata_id_has_dword_io(const u16 *id) |
800 | { | 802 | { |
801 | /* ATA 8 reuses this flag for "trusted" computing */ | 803 | /* ATA 8 reuses this flag for "trusted" computing */ |
802 | if (ata_id_major_version(id) > 7) | 804 | if (ata_id_major_version(id) > 7) |
803 | return 0; | 805 | return false; |
804 | if (id[ATA_ID_DWORD_IO] & (1 << 0)) | 806 | return id[ATA_ID_DWORD_IO] & (1 << 0); |
805 | return 1; | ||
806 | return 0; | ||
807 | } | 807 | } |
808 | 808 | ||
809 | static inline int ata_id_has_unload(const u16 *id) | 809 | static inline bool ata_id_has_unload(const u16 *id) |
810 | { | 810 | { |
811 | if (ata_id_major_version(id) >= 7 && | 811 | if (ata_id_major_version(id) >= 7 && |
812 | (id[ATA_ID_CFSSE] & 0xC000) == 0x4000 && | 812 | (id[ATA_ID_CFSSE] & 0xC000) == 0x4000 && |
813 | id[ATA_ID_CFSSE] & (1 << 13)) | 813 | id[ATA_ID_CFSSE] & (1 << 13)) |
814 | return 1; | 814 | return true; |
815 | return 0; | 815 | return false; |
816 | } | ||
817 | |||
818 | static inline bool ata_id_has_wwn(const u16 *id) | ||
819 | { | ||
820 | return (id[ATA_ID_CSF_DEFAULT] & 0xC100) == 0x4100; | ||
816 | } | 821 | } |
817 | 822 | ||
818 | static inline int ata_id_form_factor(const u16 *id) | 823 | static inline int ata_id_form_factor(const u16 *id) |
@@ -843,25 +848,25 @@ static inline int ata_id_rotation_rate(const u16 *id) | |||
843 | return val; | 848 | return val; |
844 | } | 849 | } |
845 | 850 | ||
846 | static inline int ata_id_has_trim(const u16 *id) | 851 | static inline bool ata_id_has_trim(const u16 *id) |
847 | { | 852 | { |
848 | if (ata_id_major_version(id) >= 7 && | 853 | if (ata_id_major_version(id) >= 7 && |
849 | (id[ATA_ID_DATA_SET_MGMT] & 1)) | 854 | (id[ATA_ID_DATA_SET_MGMT] & 1)) |
850 | return 1; | 855 | return true; |
851 | return 0; | 856 | return false; |
852 | } | 857 | } |
853 | 858 | ||
854 | static inline int ata_id_has_zero_after_trim(const u16 *id) | 859 | static inline bool ata_id_has_zero_after_trim(const u16 *id) |
855 | { | 860 | { |
856 | /* DSM supported, deterministic read, and read zero after trim set */ | 861 | /* DSM supported, deterministic read, and read zero after trim set */ |
857 | if (ata_id_has_trim(id) && | 862 | if (ata_id_has_trim(id) && |
858 | (id[ATA_ID_ADDITIONAL_SUPP] & 0x4020) == 0x4020) | 863 | (id[ATA_ID_ADDITIONAL_SUPP] & 0x4020) == 0x4020) |
859 | return 1; | 864 | return true; |
860 | 865 | ||
861 | return 0; | 866 | return false; |
862 | } | 867 | } |
863 | 868 | ||
864 | static inline int ata_id_current_chs_valid(const u16 *id) | 869 | static inline bool ata_id_current_chs_valid(const u16 *id) |
865 | { | 870 | { |
866 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command | 871 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command |
867 | has not been issued to the device then the values of | 872 | has not been issued to the device then the values of |
@@ -873,11 +878,11 @@ static inline int ata_id_current_chs_valid(const u16 *id) | |||
873 | id[ATA_ID_CUR_SECTORS]; /* sectors in current translation */ | 878 | id[ATA_ID_CUR_SECTORS]; /* sectors in current translation */ |
874 | } | 879 | } |
875 | 880 | ||
876 | static inline int ata_id_is_cfa(const u16 *id) | 881 | static inline bool ata_id_is_cfa(const u16 *id) |
877 | { | 882 | { |
878 | if ((id[ATA_ID_CONFIG] == 0x848A) || /* Traditional CF */ | 883 | if ((id[ATA_ID_CONFIG] == 0x848A) || /* Traditional CF */ |
879 | (id[ATA_ID_CONFIG] == 0x844A)) /* Delkin Devices CF */ | 884 | (id[ATA_ID_CONFIG] == 0x844A)) /* Delkin Devices CF */ |
880 | return 1; | 885 | return true; |
881 | /* | 886 | /* |
882 | * CF specs don't require specific value in the word 0 anymore and yet | 887 | * CF specs don't require specific value in the word 0 anymore and yet |
883 | * they forbid to report the ATA version in the word 80 and require the | 888 | * they forbid to report the ATA version in the word 80 and require the |
@@ -886,44 +891,40 @@ static inline int ata_id_is_cfa(const u16 *id) | |||
886 | * and while those that don't indicate CFA feature support need some | 891 | * and while those that don't indicate CFA feature support need some |
887 | * sort of quirk list, it seems impractical for the ones that do... | 892 | * sort of quirk list, it seems impractical for the ones that do... |
888 | */ | 893 | */ |
889 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC004) == 0x4004) | 894 | return (id[ATA_ID_COMMAND_SET_2] & 0xC004) == 0x4004; |
890 | return 1; | ||
891 | return 0; | ||
892 | } | 895 | } |
893 | 896 | ||
894 | static inline int ata_id_is_ssd(const u16 *id) | 897 | static inline bool ata_id_is_ssd(const u16 *id) |
895 | { | 898 | { |
896 | return id[ATA_ID_ROT_SPEED] == 0x01; | 899 | return id[ATA_ID_ROT_SPEED] == 0x01; |
897 | } | 900 | } |
898 | 901 | ||
899 | static inline int ata_id_pio_need_iordy(const u16 *id, const u8 pio) | 902 | static inline bool ata_id_pio_need_iordy(const u16 *id, const u8 pio) |
900 | { | 903 | { |
901 | /* CF spec. r4.1 Table 22 says no IORDY on PIO5 and PIO6. */ | 904 | /* CF spec. r4.1 Table 22 says no IORDY on PIO5 and PIO6. */ |
902 | if (pio > 4 && ata_id_is_cfa(id)) | 905 | if (pio > 4 && ata_id_is_cfa(id)) |
903 | return 0; | 906 | return false; |
904 | /* For PIO3 and higher it is mandatory. */ | 907 | /* For PIO3 and higher it is mandatory. */ |
905 | if (pio > 2) | 908 | if (pio > 2) |
906 | return 1; | 909 | return true; |
907 | /* Turn it on when possible. */ | 910 | /* Turn it on when possible. */ |
908 | if (ata_id_has_iordy(id)) | 911 | return ata_id_has_iordy(id); |
909 | return 1; | ||
910 | return 0; | ||
911 | } | 912 | } |
912 | 913 | ||
913 | static inline int ata_drive_40wire(const u16 *dev_id) | 914 | static inline bool ata_drive_40wire(const u16 *dev_id) |
914 | { | 915 | { |
915 | if (ata_id_is_sata(dev_id)) | 916 | if (ata_id_is_sata(dev_id)) |
916 | return 0; /* SATA */ | 917 | return false; /* SATA */ |
917 | if ((dev_id[ATA_ID_HW_CONFIG] & 0xE000) == 0x6000) | 918 | if ((dev_id[ATA_ID_HW_CONFIG] & 0xE000) == 0x6000) |
918 | return 0; /* 80 wire */ | 919 | return false; /* 80 wire */ |
919 | return 1; | 920 | return true; |
920 | } | 921 | } |
921 | 922 | ||
922 | static inline int ata_drive_40wire_relaxed(const u16 *dev_id) | 923 | static inline bool ata_drive_40wire_relaxed(const u16 *dev_id) |
923 | { | 924 | { |
924 | if ((dev_id[ATA_ID_HW_CONFIG] & 0x2000) == 0x2000) | 925 | if ((dev_id[ATA_ID_HW_CONFIG] & 0x2000) == 0x2000) |
925 | return 0; /* 80 wire */ | 926 | return false; /* 80 wire */ |
926 | return 1; | 927 | return true; |
927 | } | 928 | } |
928 | 929 | ||
929 | static inline int atapi_cdb_len(const u16 *dev_id) | 930 | static inline int atapi_cdb_len(const u16 *dev_id) |
@@ -936,12 +937,12 @@ static inline int atapi_cdb_len(const u16 *dev_id) | |||
936 | } | 937 | } |
937 | } | 938 | } |
938 | 939 | ||
939 | static inline int atapi_command_packet_set(const u16 *dev_id) | 940 | static inline bool atapi_command_packet_set(const u16 *dev_id) |
940 | { | 941 | { |
941 | return (dev_id[ATA_ID_CONFIG] >> 8) & 0x1f; | 942 | return (dev_id[ATA_ID_CONFIG] >> 8) & 0x1f; |
942 | } | 943 | } |
943 | 944 | ||
944 | static inline int atapi_id_dmadir(const u16 *dev_id) | 945 | static inline bool atapi_id_dmadir(const u16 *dev_id) |
945 | { | 946 | { |
946 | return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000); | 947 | return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000); |
947 | } | 948 | } |
@@ -954,13 +955,13 @@ static inline int atapi_id_dmadir(const u16 *dev_id) | |||
954 | * | 955 | * |
955 | * It is called only once for each device. | 956 | * It is called only once for each device. |
956 | */ | 957 | */ |
957 | static inline int ata_id_is_lba_capacity_ok(u16 *id) | 958 | static inline bool ata_id_is_lba_capacity_ok(u16 *id) |
958 | { | 959 | { |
959 | unsigned long lba_sects, chs_sects, head, tail; | 960 | unsigned long lba_sects, chs_sects, head, tail; |
960 | 961 | ||
961 | /* No non-LBA info .. so valid! */ | 962 | /* No non-LBA info .. so valid! */ |
962 | if (id[ATA_ID_CYLS] == 0) | 963 | if (id[ATA_ID_CYLS] == 0) |
963 | return 1; | 964 | return true; |
964 | 965 | ||
965 | lba_sects = ata_id_u32(id, ATA_ID_LBA_CAPACITY); | 966 | lba_sects = ata_id_u32(id, ATA_ID_LBA_CAPACITY); |
966 | 967 | ||
@@ -975,13 +976,13 @@ static inline int ata_id_is_lba_capacity_ok(u16 *id) | |||
975 | id[ATA_ID_SECTORS] == 63 && | 976 | id[ATA_ID_SECTORS] == 63 && |
976 | (id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) && | 977 | (id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) && |
977 | (lba_sects >= 16383 * 63 * id[ATA_ID_HEADS])) | 978 | (lba_sects >= 16383 * 63 * id[ATA_ID_HEADS])) |
978 | return 1; | 979 | return true; |
979 | 980 | ||
980 | chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS]; | 981 | chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS]; |
981 | 982 | ||
982 | /* perform a rough sanity check on lba_sects: within 10% is OK */ | 983 | /* perform a rough sanity check on lba_sects: within 10% is OK */ |
983 | if (lba_sects - chs_sects < chs_sects/10) | 984 | if (lba_sects - chs_sects < chs_sects/10) |
984 | return 1; | 985 | return true; |
985 | 986 | ||
986 | /* some drives have the word order reversed */ | 987 | /* some drives have the word order reversed */ |
987 | head = (lba_sects >> 16) & 0xffff; | 988 | head = (lba_sects >> 16) & 0xffff; |
@@ -990,10 +991,10 @@ static inline int ata_id_is_lba_capacity_ok(u16 *id) | |||
990 | 991 | ||
991 | if (lba_sects - chs_sects < chs_sects/10) { | 992 | if (lba_sects - chs_sects < chs_sects/10) { |
992 | *(__le32 *)&id[ATA_ID_LBA_CAPACITY] = __cpu_to_le32(lba_sects); | 993 | *(__le32 *)&id[ATA_ID_LBA_CAPACITY] = __cpu_to_le32(lba_sects); |
993 | return 1; /* LBA capacity is (now) good */ | 994 | return true; /* LBA capacity is (now) good */ |
994 | } | 995 | } |
995 | 996 | ||
996 | return 0; /* LBA capacity value may be bad */ | 997 | return false; /* LBA capacity value may be bad */ |
997 | } | 998 | } |
998 | 999 | ||
999 | static inline void ata_id_to_hd_driveid(u16 *id) | 1000 | static inline void ata_id_to_hd_driveid(u16 *id) |
@@ -1051,19 +1052,19 @@ static inline int is_multi_taskfile(struct ata_taskfile *tf) | |||
1051 | (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT); | 1052 | (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT); |
1052 | } | 1053 | } |
1053 | 1054 | ||
1054 | static inline int ata_ok(u8 status) | 1055 | static inline bool ata_ok(u8 status) |
1055 | { | 1056 | { |
1056 | return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR)) | 1057 | return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR)) |
1057 | == ATA_DRDY); | 1058 | == ATA_DRDY); |
1058 | } | 1059 | } |
1059 | 1060 | ||
1060 | static inline int lba_28_ok(u64 block, u32 n_block) | 1061 | static inline bool lba_28_ok(u64 block, u32 n_block) |
1061 | { | 1062 | { |
1062 | /* check the ending block number: must be LESS THAN 0x0fffffff */ | 1063 | /* check the ending block number: must be LESS THAN 0x0fffffff */ |
1063 | return ((block + n_block) < ((1 << 28) - 1)) && (n_block <= 256); | 1064 | return ((block + n_block) < ((1 << 28) - 1)) && (n_block <= 256); |
1064 | } | 1065 | } |
1065 | 1066 | ||
1066 | static inline int lba_48_ok(u64 block, u32 n_block) | 1067 | static inline bool lba_48_ok(u64 block, u32 n_block) |
1067 | { | 1068 | { |
1068 | /* check the ending block number */ | 1069 | /* check the ending block number */ |
1069 | return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= 65536); | 1070 | return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= 65536); |
diff --git a/include/linux/libata.h b/include/linux/libata.h index c9c5d7ad1a2b..c71f46960f39 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -179,10 +179,6 @@ enum { | |||
179 | ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ | 179 | ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ |
180 | /* (doesn't imply presence) */ | 180 | /* (doesn't imply presence) */ |
181 | ATA_FLAG_SATA = (1 << 1), | 181 | ATA_FLAG_SATA = (1 << 1), |
182 | ATA_FLAG_NO_LEGACY = (1 << 2), /* no legacy mode check */ | ||
183 | ATA_FLAG_MMIO = (1 << 3), /* use MMIO, not PIO */ | ||
184 | ATA_FLAG_SRST = (1 << 4), /* (obsolete) use ATA SRST, not E.D.D. */ | ||
185 | ATA_FLAG_SATA_RESET = (1 << 5), /* (obsolete) use COMRESET */ | ||
186 | ATA_FLAG_NO_ATAPI = (1 << 6), /* No ATAPI support */ | 182 | ATA_FLAG_NO_ATAPI = (1 << 6), /* No ATAPI support */ |
187 | ATA_FLAG_PIO_DMA = (1 << 7), /* PIO cmds via DMA */ | 183 | ATA_FLAG_PIO_DMA = (1 << 7), /* PIO cmds via DMA */ |
188 | ATA_FLAG_PIO_LBA48 = (1 << 8), /* Host DMA engine is LBA28 only */ | 184 | ATA_FLAG_PIO_LBA48 = (1 << 8), /* Host DMA engine is LBA28 only */ |
@@ -198,7 +194,6 @@ enum { | |||
198 | ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ | 194 | ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ |
199 | ATA_FLAG_AN = (1 << 18), /* controller supports AN */ | 195 | ATA_FLAG_AN = (1 << 18), /* controller supports AN */ |
200 | ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ | 196 | ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ |
201 | ATA_FLAG_LPM = (1 << 20), /* driver can handle LPM */ | ||
202 | ATA_FLAG_EM = (1 << 21), /* driver supports enclosure | 197 | ATA_FLAG_EM = (1 << 21), /* driver supports enclosure |
203 | * management */ | 198 | * management */ |
204 | ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity | 199 | ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity |
@@ -1050,6 +1045,8 @@ extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, | |||
1050 | int queue_depth, int reason); | 1045 | int queue_depth, int reason); |
1051 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); | 1046 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); |
1052 | extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); | 1047 | extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); |
1048 | extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap); | ||
1049 | extern void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap, struct list_head *eh_q); | ||
1053 | 1050 | ||
1054 | extern int ata_cable_40wire(struct ata_port *ap); | 1051 | extern int ata_cable_40wire(struct ata_port *ap); |
1055 | extern int ata_cable_80wire(struct ata_port *ap); | 1052 | extern int ata_cable_80wire(struct ata_port *ap); |
@@ -1613,6 +1610,9 @@ extern void ata_sff_irq_on(struct ata_port *ap); | |||
1613 | extern void ata_sff_irq_clear(struct ata_port *ap); | 1610 | extern void ata_sff_irq_clear(struct ata_port *ap); |
1614 | extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, | 1611 | extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, |
1615 | u8 status, int in_wq); | 1612 | u8 status, int in_wq); |
1613 | extern void ata_sff_queue_work(struct work_struct *work); | ||
1614 | extern void ata_sff_queue_delayed_work(struct delayed_work *dwork, | ||
1615 | unsigned long delay); | ||
1616 | extern void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay); | 1616 | extern void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay); |
1617 | extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); | 1617 | extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); |
1618 | extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc); | 1618 | extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc); |
diff --git a/include/linux/pata_arasan_cf_data.h b/include/linux/pata_arasan_cf_data.h new file mode 100644 index 000000000000..a6ee9aa898bb --- /dev/null +++ b/include/linux/pata_arasan_cf_data.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * include/linux/pata_arasan_cf_data.h | ||
3 | * | ||
4 | * Arasan Compact Flash host controller platform data header file | ||
5 | * | ||
6 | * Copyright (C) 2011 ST Microelectronics | ||
7 | * Viresh Kumar <viresh.kumar@st.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef _PATA_ARASAN_CF_DATA_H | ||
15 | #define _PATA_ARASAN_CF_DATA_H | ||
16 | |||
17 | #include <linux/platform_device.h> | ||
18 | |||
19 | struct arasan_cf_pdata { | ||
20 | u8 cf_if_clk; | ||
21 | #define CF_IF_CLK_100M (0x0) | ||
22 | #define CF_IF_CLK_75M (0x1) | ||
23 | #define CF_IF_CLK_66M (0x2) | ||
24 | #define CF_IF_CLK_50M (0x3) | ||
25 | #define CF_IF_CLK_40M (0x4) | ||
26 | #define CF_IF_CLK_33M (0x5) | ||
27 | #define CF_IF_CLK_25M (0x6) | ||
28 | #define CF_IF_CLK_125M (0x7) | ||
29 | #define CF_IF_CLK_150M (0x8) | ||
30 | #define CF_IF_CLK_166M (0x9) | ||
31 | #define CF_IF_CLK_200M (0xA) | ||
32 | /* | ||
33 | * Platform specific incapabilities of CF controller is handled via | ||
34 | * quirks | ||
35 | */ | ||
36 | u32 quirk; | ||
37 | #define CF_BROKEN_PIO (1) | ||
38 | #define CF_BROKEN_MWDMA (1 << 1) | ||
39 | #define CF_BROKEN_UDMA (1 << 2) | ||
40 | /* This is platform specific data for the DMA controller */ | ||
41 | void *dma_priv; | ||
42 | }; | ||
43 | |||
44 | static inline void | ||
45 | set_arasan_cf_pdata(struct platform_device *pdev, struct arasan_cf_pdata *data) | ||
46 | { | ||
47 | pdev->dev.platform_data = data; | ||
48 | } | ||
49 | #endif /* _PATA_ARASAN_CF_DATA_H */ | ||
diff --git a/include/scsi/sas_ata.h b/include/scsi/sas_ata.h index c583193ae929..9c159f74c6d0 100644 --- a/include/scsi/sas_ata.h +++ b/include/scsi/sas_ata.h | |||
@@ -39,6 +39,11 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev, | |||
39 | struct scsi_target *starget); | 39 | struct scsi_target *starget); |
40 | 40 | ||
41 | void sas_ata_task_abort(struct sas_task *task); | 41 | void sas_ata_task_abort(struct sas_task *task); |
42 | void sas_ata_strategy_handler(struct Scsi_Host *shost); | ||
43 | int sas_ata_timed_out(struct scsi_cmnd *cmd, struct sas_task *task, | ||
44 | enum blk_eh_timer_return *rtn); | ||
45 | int sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, | ||
46 | struct list_head *done_q); | ||
42 | 47 | ||
43 | #else | 48 | #else |
44 | 49 | ||
@@ -55,6 +60,23 @@ static inline int sas_ata_init_host_and_port(struct domain_device *found_dev, | |||
55 | static inline void sas_ata_task_abort(struct sas_task *task) | 60 | static inline void sas_ata_task_abort(struct sas_task *task) |
56 | { | 61 | { |
57 | } | 62 | } |
63 | |||
64 | static inline void sas_ata_strategy_handler(struct Scsi_Host *shost) | ||
65 | { | ||
66 | } | ||
67 | |||
68 | static inline int sas_ata_timed_out(struct scsi_cmnd *cmd, | ||
69 | struct sas_task *task, | ||
70 | enum blk_eh_timer_return *rtn) | ||
71 | { | ||
72 | return 0; | ||
73 | } | ||
74 | static inline int sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, | ||
75 | struct list_head *done_q) | ||
76 | { | ||
77 | return 0; | ||
78 | } | ||
79 | |||
58 | #endif | 80 | #endif |
59 | 81 | ||
60 | #endif /* _SAS_ATA_H_ */ | 82 | #endif /* _SAS_ATA_H_ */ |