Fix some issues with the pccard shutdown path (during reboot and halt).
authorMatthew Dillon <dillon@dragonflybsd.org>
Sat, 10 Jul 2004 16:25:59 +0000 (16:25 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Sat, 10 Jul 2004 16:25:59 +0000 (16:25 +0000)
commit3c89d513b01da5c27d5d6734732ca55393a98638
tree7349caf15c5d08e28470dc168f2547eea46458e8
parent4372b8e4f16e3453658ea326d671b07acec500aa
Fix some issues with the pccard shutdown path (during reboot and halt).
pccard was resetting the bridge controller and unmapping the device
without first detaching/shutting down the helper thread or disabling the
interrupt, and without calling the shutdown function for the children,
leading to several actual and potential lockups during a halt/reboot
sequence.

There was also a bug in the thread termination code that could deadlock
the system... the thread interlock was being improperly held while
looping waiting for thread termination.  Finally, there was an instance
where sc->flags was being manipulated without holding the proper lock.

Rearrange the dev/pccard/pccbb shutdown code to (A) call the shutdown
vector for the children, (B) disable the associated interrupt, and
(C) properly terminate the helper thread, and fix the other bugs that
were found.

There are still known issues not addressed by this patch, including
interrupt storms from the cardbus system during halt/reboot (currently
mostly caught by our interrupt rate limiting code), and at least one
unknown deadlock can still occur during halt/reboot.

In discusssions with: Joerg Sonnenberger <joerg@britannica.bec.de>
sys/bus/pccard/pccard.c
sys/dev/pccard/pccbb/pccbb.c