diff options
-rw-r--r-- | firmware/drivers/ata.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 14116a3a8f..cad67d1f97 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c | |||
@@ -60,6 +60,8 @@ | |||
60 | #define STATUS_DRQ 0x08 | 60 | #define STATUS_DRQ 0x08 |
61 | #define STATUS_ERR 0x01 | 61 | #define STATUS_ERR 0x01 |
62 | 62 | ||
63 | #define ERROR_ABRT 0x04 | ||
64 | |||
63 | #define CONTROL_nIEN 0x02 | 65 | #define CONTROL_nIEN 0x02 |
64 | #define CONTROL_SRST 0x04 | 66 | #define CONTROL_SRST 0x04 |
65 | 67 | ||
@@ -880,10 +882,22 @@ static int set_features(void) | |||
880 | { 83, 3, 0x05, 1 }, /* power management: lowest power */ | 882 | { 83, 3, 0x05, 1 }, /* power management: lowest power */ |
881 | { 83, 9, 0x42, 0x80 }, /* acoustic management: lowest noise */ | 883 | { 83, 9, 0x42, 0x80 }, /* acoustic management: lowest noise */ |
882 | { 82, 6, 0xaa, 0 }, /* enable read look-ahead */ | 884 | { 82, 6, 0xaa, 0 }, /* enable read look-ahead */ |
885 | { 83, 14, 0x03, 0 }, /* force PIO mode */ | ||
883 | { 0, 0, 0, 0 } /* <end of list> */ | 886 | { 0, 0, 0, 0 } /* <end of list> */ |
884 | }; | 887 | }; |
885 | int i; | 888 | int i; |
889 | int pio_mode = 2; | ||
890 | |||
891 | /* Find out the highest supported PIO mode */ | ||
892 | if(identify_info[64] & 2) | ||
893 | pio_mode = 4; | ||
894 | else | ||
895 | if(identify_info[64] & 1) | ||
896 | pio_mode = 3; | ||
886 | 897 | ||
898 | /* Update the table */ | ||
899 | features[3].parameter = 8 + pio_mode; | ||
900 | |||
887 | ATA_SELECT = ata_device; | 901 | ATA_SELECT = ata_device; |
888 | 902 | ||
889 | if (!wait_for_rdy()) { | 903 | if (!wait_for_rdy()) { |
@@ -899,7 +913,13 @@ static int set_features(void) | |||
899 | 913 | ||
900 | if (!wait_for_rdy()) { | 914 | if (!wait_for_rdy()) { |
901 | DEBUGF("set_features() - CMD failed\n"); | 915 | DEBUGF("set_features() - CMD failed\n"); |
902 | return -2 - i; | 916 | return -10 - i; |
917 | } | ||
918 | |||
919 | if(ATA_ALT_STATUS & STATUS_ERR) { | ||
920 | if(ATA_ERROR & ERROR_ABRT) { | ||
921 | return -20 - i; | ||
922 | } | ||
903 | } | 923 | } |
904 | } | 924 | } |
905 | } | 925 | } |