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