diff options
Diffstat (limited to 'include/linux/ata.h')
-rw-r--r-- | include/linux/ata.h | 163 |
1 files changed, 82 insertions, 81 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); |