diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 477369bea1..41d74d3bdd 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -23,6 +23,7 @@ #include "sh7034.h" #include "system.h" #include "debug.h" +#include "panic.h" #define SECTOR_SIZE 512 #define ATA_DATA (*((volatile unsigned short*)0x06104100)) @@ -328,7 +329,8 @@ static int master_slave_detect(void) static int io_address_detect(void) { - unsigned char tmp = ATA_STATUS; + unsigned char tmp = ATA_STATUS & 0xf9; /* Mask the IDX and CORR bits */ + unsigned char tmp2; unsigned char dummy; /* We compare the STATUS register with the ALT_STATUS register, which @@ -340,8 +342,9 @@ static int io_address_detect(void) to the ATA controller. We read a register that we know exists to make sure that the data on the bus isn't identical to the STATUS register contents. */ + ATA_SECTOR = 0; dummy = ATA_SECTOR; - if(tmp == *ATA_CONTROL2) + if(tmp == (*ATA_CONTROL2) & 0xf9) { DEBUGF("CONTROL is at 0x306\n"); ata_control = ATA_CONTROL2;