DEV9: Rewrite suppression of diagnostics IRQ during reset

This commit is contained in:
TheLastRar 2024-10-13 16:28:18 +01:00 committed by lightningterror
parent 1a95bd3088
commit a8a0c5c0bf
4 changed files with 10 additions and 9 deletions

View File

@ -234,8 +234,8 @@ private:
void HDD_WriteDMA(bool isLBA48); void HDD_WriteDMA(bool isLBA48);
void PreCmdExecuteDeviceDiag(); void PreCmdExecuteDeviceDiag();
void PostCmdExecuteDeviceDiag(); void PostCmdExecuteDeviceDiag(bool sendIRQ);
void HDD_ExecuteDeviceDiag(); void HDD_ExecuteDeviceDiag(bool sendIRQ);
void PostCmdNoData(); void PostCmdNoData();
void CmdNoDataAbort(); void CmdNoDataAbort();

View File

@ -317,8 +317,7 @@ void ATA::ResetEnd(bool hard)
mdmaMode = 2; mdmaMode = 2;
} }
regControlEnableIRQ = false; HDD_ExecuteDeviceDiag(false);
HDD_ExecuteDeviceDiag();
regControlEnableIRQ = true; regControlEnableIRQ = true;
} }

View File

@ -12,20 +12,22 @@ void ATA::PreCmdExecuteDeviceDiag()
//dev9.spd.regIntStat &= unchecked((UInt16)~DEV9Header.ATA_INTR_DMA_RDY); //Is this correct? //dev9.spd.regIntStat &= unchecked((UInt16)~DEV9Header.ATA_INTR_DMA_RDY); //Is this correct?
} }
void ATA::PostCmdExecuteDeviceDiag() void ATA::PostCmdExecuteDeviceDiag(bool sendIRQ)
{ {
regStatus &= ~ATA_STAT_BUSY; regStatus &= ~ATA_STAT_BUSY;
regStatus |= ATA_STAT_READY; regStatus |= ATA_STAT_READY;
SetSelectedDevice(0); SetSelectedDevice(0);
if (regControlEnableIRQ) // If Device Diagnostics is performed as part of a reset
// then we don't raise an IRQ or set pending interrupt
if (regControlEnableIRQ && sendIRQ)
_DEV9irq(ATA_INTR_INTRQ, 1); _DEV9irq(ATA_INTR_INTRQ, 1);
} }
//GENRAL FEATURE SET //GENRAL FEATURE SET
void ATA::HDD_ExecuteDeviceDiag() void ATA::HDD_ExecuteDeviceDiag(bool sendIRQ)
{ {
PreCmdExecuteDeviceDiag(); PreCmdExecuteDeviceDiag();
//Perform Self Diag //Perform Self Diag
@ -44,5 +46,5 @@ void ATA::HDD_ExecuteDeviceDiag()
regStatus &= ~ATA_STAT_ECC; regStatus &= ~ATA_STAT_ECC;
regStatus &= ~ATA_STAT_ERR; regStatus &= ~ATA_STAT_ERR;
PostCmdExecuteDeviceDiag(); PostCmdExecuteDeviceDiag(sendIRQ);
} }

View File

@ -39,7 +39,7 @@ void ATA::IDE_ExecCmd(u16 value)
HDD_SeekCmd(); HDD_SeekCmd();
break; break;
case 0x90: case 0x90:
HDD_ExecuteDeviceDiag(); HDD_ExecuteDeviceDiag(true);
break; break;
case 0x91: case 0x91:
HDD_InitDevParameters(); HDD_InitDevParameters();