More SCSI threading bugfixes - should fix the annoying crashes on hard reset.
This commit is contained in:
@@ -640,6 +640,7 @@ aha_reset(aha_t *dev)
|
||||
thread_destroy_event(dev->evt);
|
||||
dev->evt = NULL;
|
||||
if (poll_tid) {
|
||||
thread_kill(poll_tid);
|
||||
poll_tid = NULL;
|
||||
}
|
||||
}
|
||||
@@ -1234,14 +1235,6 @@ aha_do_mail(aha_t *dev)
|
||||
|
||||
CodeOffset = dev->Mbx24bit ? 0 : 7;
|
||||
|
||||
#if 0
|
||||
if (dev->Interrupt || dev->PendingInterrupt)
|
||||
{
|
||||
aha_log("%s: Interrupt set, waiting...\n", dev->name);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t MailboxCur = dev->MailboxOutPosCur;
|
||||
|
||||
/* Search for a filled mailbox - stop if we have scanned all mailboxes. */
|
||||
@@ -1294,13 +1287,22 @@ aha_event_restart:
|
||||
dev->evt = thread_create_event();
|
||||
|
||||
aha_scan_restart:
|
||||
while (aha_do_mail(dev) != 0)
|
||||
while (aha_do_mail(dev) && dev->MailboxCount)
|
||||
{
|
||||
thread_wait_event(dev->evt, 10);
|
||||
}
|
||||
|
||||
if (!dev->MailboxCount)
|
||||
{
|
||||
thread_destroy_event(dev->evt);
|
||||
dev->evt = NULL;
|
||||
poll_tid = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (dev->scan_restart)
|
||||
{
|
||||
dev->scan_restart = 0;
|
||||
goto aha_scan_restart;
|
||||
}
|
||||
|
||||
@@ -1309,6 +1311,7 @@ aha_scan_restart:
|
||||
|
||||
if (dev->scan_restart)
|
||||
{
|
||||
dev->scan_restart = 0;
|
||||
goto aha_event_restart;
|
||||
}
|
||||
|
||||
@@ -2166,10 +2169,13 @@ aha_close(void *priv)
|
||||
|
||||
if (dev)
|
||||
{
|
||||
dev->MailboxCount = 0;
|
||||
|
||||
if (dev->evt) {
|
||||
thread_destroy_event(dev->evt);
|
||||
dev->evt = NULL;
|
||||
if (poll_tid) {
|
||||
thread_kill(poll_tid);
|
||||
poll_tid = NULL;
|
||||
}
|
||||
}
|
||||
|
@@ -806,6 +806,7 @@ BuslogicReset(Buslogic_t *bl)
|
||||
bl->evt = NULL;
|
||||
if (poll_tid)
|
||||
{
|
||||
thread_kill(poll_tid);
|
||||
poll_tid = NULL;
|
||||
}
|
||||
}
|
||||
@@ -934,6 +935,10 @@ BuslogicMailboxIn(Buslogic_t *bl)
|
||||
bl->MailboxInPosCur = 0;
|
||||
|
||||
BuslogicRaiseInterrupt(bl, 0, INTR_MBIF | INTR_ANY);
|
||||
|
||||
while (bl->Interrupt) {
|
||||
thread_wait_event(bl->evt, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2485,12 +2490,6 @@ BuslogicProcessMailbox(Buslogic_t *bl)
|
||||
pclog("BuslogicProcessMailbox(): Operating in %s mode\n", bl->LocalRAM.structured.autoSCSIData.fAggressiveRoundRobinMode ? "aggressive" : "strict");
|
||||
#endif
|
||||
|
||||
if (bl->Interrupt || bl->PendingInterrupt)
|
||||
{
|
||||
/* pclog("Interrupt set, waiting...\n"); */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 0 = strict, 1 = aggressive */
|
||||
if (bl->LocalRAM.structured.autoSCSIData.fAggressiveRoundRobinMode) {
|
||||
uint8_t MailboxCur = bl->MailboxOutPosCur;
|
||||
@@ -2517,9 +2516,14 @@ BuslogicProcessMailbox(Buslogic_t *bl)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bl->MailboxOutInterrupts)
|
||||
if (bl->MailboxOutInterrupts) {
|
||||
BuslogicRaiseInterrupt(bl, 0, INTR_MBOA | INTR_ANY);
|
||||
|
||||
while (bl->Interrupt) {
|
||||
thread_wait_event(bl->evt, 10);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
pclog("BuslogicProcessMailbox(): Outgoing mailbox action code: %i\n", mb32.u.out.ActionCode);
|
||||
#endif
|
||||
@@ -2564,12 +2568,22 @@ BuslogicEventRestart:
|
||||
bl->evt = thread_create_event();
|
||||
|
||||
BuslogicScanRestart:
|
||||
while (BuslogicProcessMailbox(bl) != 0)
|
||||
while (BuslogicProcessMailbox(bl) && bl->MailboxCount)
|
||||
{
|
||||
thread_wait_event(bl->evt, 10);
|
||||
}
|
||||
|
||||
if (!bl->MailboxCount)
|
||||
{
|
||||
thread_destroy_event(bl->evt);
|
||||
bl->evt = NULL;
|
||||
poll_tid = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (bl->scan_restart)
|
||||
{
|
||||
bl->scan_restart = 0;
|
||||
goto BuslogicScanRestart;
|
||||
}
|
||||
|
||||
@@ -2578,6 +2592,7 @@ BuslogicScanRestart:
|
||||
|
||||
if (bl->scan_restart)
|
||||
{
|
||||
bl->scan_restart = 0;
|
||||
goto BuslogicEventRestart;
|
||||
}
|
||||
|
||||
@@ -3009,6 +3024,8 @@ BuslogicClose(void *p)
|
||||
Buslogic_t *bl = (Buslogic_t *)p;
|
||||
if (bl)
|
||||
{
|
||||
bl->MailboxCount = 0;
|
||||
|
||||
if (bl->evt)
|
||||
{
|
||||
thread_destroy_event(bl->evt);
|
||||
@@ -3016,6 +3033,7 @@ BuslogicClose(void *p)
|
||||
|
||||
if (poll_tid)
|
||||
{
|
||||
thread_kill(poll_tid);
|
||||
poll_tid = NULL;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user