diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/ata.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 9331cd60d9..d3ccf0e662 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c | |||
@@ -111,7 +111,7 @@ static int wait_for_bsy(void) | |||
111 | { | 111 | { |
112 | int timeout = current_tick + HZ*10; | 112 | int timeout = current_tick + HZ*10; |
113 | last_disk_activity = timeout; | 113 | last_disk_activity = timeout; |
114 | while (TIME_BEFORE(current_tick, timeout) && (ATA_ALT_STATUS & STATUS_BSY)) | 114 | while (TIME_BEFORE(current_tick, timeout) && (ATA_STATUS & STATUS_BSY)) |
115 | yield(); | 115 | yield(); |
116 | 116 | ||
117 | if (TIME_BEFORE(current_tick, timeout)) | 117 | if (TIME_BEFORE(current_tick, timeout)) |
@@ -676,14 +676,14 @@ static int master_slave_detect(void) | |||
676 | { | 676 | { |
677 | /* master? */ | 677 | /* master? */ |
678 | ATA_SELECT = 0; | 678 | ATA_SELECT = 0; |
679 | if ( ATA_STATUS & STATUS_RDY ) { | 679 | if ( ATA_STATUS & (STATUS_RDY|STATUS_BSY) ) { |
680 | ata_device = 0; | 680 | ata_device = 0; |
681 | DEBUGF("Found master harddisk\n"); | 681 | DEBUGF("Found master harddisk\n"); |
682 | } | 682 | } |
683 | else { | 683 | else { |
684 | /* slave? */ | 684 | /* slave? */ |
685 | ATA_SELECT = SELECT_DEVICE1; | 685 | ATA_SELECT = SELECT_DEVICE1; |
686 | if ( ATA_STATUS & STATUS_RDY ) { | 686 | if ( ATA_STATUS & (STATUS_RDY|STATUS_BSY) ) { |
687 | ata_device = SELECT_DEVICE1; | 687 | ata_device = SELECT_DEVICE1; |
688 | DEBUGF("Found slave harddisk\n"); | 688 | DEBUGF("Found slave harddisk\n"); |
689 | } | 689 | } |
@@ -697,7 +697,7 @@ static int io_address_detect(void) | |||
697 | { | 697 | { |
698 | unsigned char tmp = ATA_STATUS & 0xf9; /* Mask the IDX and CORR bits */ | 698 | unsigned char tmp = ATA_STATUS & 0xf9; /* Mask the IDX and CORR bits */ |
699 | unsigned char dummy; | 699 | unsigned char dummy; |
700 | 700 | ||
701 | /* We compare the STATUS register with the ALT_STATUS register, which | 701 | /* We compare the STATUS register with the ALT_STATUS register, which |
702 | is located at the same address as CONTROL. If they are the same, we | 702 | is located at the same address as CONTROL. If they are the same, we |
703 | assume that we have the correct address. | 703 | assume that we have the correct address. |
@@ -725,7 +725,7 @@ static int io_address_detect(void) | |||
725 | } | 725 | } |
726 | 726 | ||
727 | /* Let's check again, to be sure */ | 727 | /* Let's check again, to be sure */ |
728 | if(tmp != ATA_CONTROL) | 728 | if(tmp != (ATA_ALT_STATUS & 0xf9)) |
729 | { | 729 | { |
730 | DEBUGF("ATA I/O address detection failed\n"); | 730 | DEBUGF("ATA I/O address detection failed\n"); |
731 | return -1; | 731 | return -1; |
@@ -797,10 +797,10 @@ unsigned short* ata_get_identify(void) | |||
797 | 797 | ||
798 | int ata_init(void) | 798 | int ata_init(void) |
799 | { | 799 | { |
800 | int rc; | 800 | int rc; |
801 | bool coldstart = (PACR2 & 0x4000) != 0; | 801 | bool coldstart = (PACR2 & 0x4000) != 0; |
802 | 802 | ||
803 | mutex_init(&ata_mtx); | 803 | mutex_init(&ata_mtx); |
804 | 804 | ||
805 | led(false); | 805 | led(false); |
806 | 806 | ||