Fixed AHA and BusLogic mailbox processing so that an outgoing mailbox is not marked as free until it's been completely processed and correctly implemented the AHA-1542C/CF Shadow RAM - the AHA-1542C/CF should be fully working now.

This commit is contained in:
OBattler
2017-10-10 04:15:29 +02:00
parent 8650020d40
commit e88899bb3c
2 changed files with 106 additions and 130 deletions

View File

@@ -511,6 +511,7 @@ typedef struct {
uint8_t SCAMData[65536];
event_t *evt;
int scan_restart;
uint8_t ToRaise;
} Buslogic_t;
#pragma pack(pop)
@@ -937,9 +938,9 @@ BuslogicMailboxIn(Buslogic_t *bl)
if (bl->MailboxInPosCur >= bl->MailboxCount)
bl->MailboxInPosCur = 0;
BuslogicRaiseInterrupt(bl, 0, INTR_MBIF | INTR_ANY);
while (bl->Interrupt) {
bl->ToRaise = INTR_MBIF | INTR_ANY;
if (bl->MailboxOutInterrupts) {
bl->ToRaise |= INTR_MBOA;
}
}
@@ -2512,23 +2513,6 @@ BuslogicProcessMailbox(Buslogic_t *bl)
Outgoing = BuslogicMailboxOut(bl, &mb32);
}
if (mb32.u.out.ActionCode != MBO_FREE) {
/* We got the mailbox, mark it as free in the guest. */
pclog("BuslogicProcessMailbox(): Writing %i bytes at %08X\n", sizeof(CmdStatus), Outgoing + CodeOffset);
DMAPageWrite(Outgoing + CodeOffset, (char *)&CmdStatus, sizeof(CmdStatus));
}
else
{
return 0;
}
if (bl->MailboxOutInterrupts) {
BuslogicRaiseInterrupt(bl, 0, INTR_MBOA | INTR_ANY);
while (bl->Interrupt) {
}
}
#if 0
pclog("BuslogicProcessMailbox(): Outgoing mailbox action code: %i\n", mb32.u.out.ActionCode);
#endif
@@ -2543,6 +2527,17 @@ BuslogicProcessMailbox(Buslogic_t *bl)
pclog("Invalid action code: %02X\n", mb32.u.out.ActionCode);
}
if ((mb32.u.out.ActionCode == MBO_START) || (mb32.u.out.ActionCode == MBO_ABORT)) {
/* We got the mailbox, mark it as free in the guest. */
pclog("BuslogicProcessMailbox(): Writing %i bytes at %08X\n", sizeof(CmdStatus), Outgoing + CodeOffset);
DMAPageWrite(Outgoing + CodeOffset, (char *)&CmdStatus, sizeof(CmdStatus));
BuslogicRaiseInterrupt(bl, 0, bl->ToRaise);
while (bl->Interrupt) {
}
}
/* Advance to the next mailbox. */
if (! bl->LocalRAM.structured.autoSCSIData.fAggressiveRoundRobinMode)
BuslogicMailboxOutAdvance(bl);