summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2008-10-30 15:27:13 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2008-10-30 15:27:13 +0000
commit5c55d9c1df94b43c6addfdaa79a82e6f779b6cd1 (patch)
tree809d8cc03b1cf718c388d7e5d5e3820507adf952 /sys/powerpc
parent1f332d86bf5e4cfc63df682d8859c4f4fac21026 (diff)
downloadFreeBSD-src-5c55d9c1df94b43c6addfdaa79a82e6f779b6cd1.zip
FreeBSD-src-5c55d9c1df94b43c6addfdaa79a82e6f779b6cd1.tar.gz
Fix some possible infinite loops in the ADB code, and remove some hacks
that were inserted in desperation during bring-up. In addition, move ADB bus enumeration and child attachment to when interrupts are available.
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/powermac/cuda.c28
-rw-r--r--sys/powerpc/powermac/pmu.c2
2 files changed, 9 insertions, 21 deletions
diff --git a/sys/powerpc/powermac/cuda.c b/sys/powerpc/powermac/cuda.c
index 162c639..c17ca82 100644
--- a/sys/powerpc/powermac/cuda.c
+++ b/sys/powerpc/powermac/cuda.c
@@ -341,10 +341,7 @@ cuda_send(void *cookie, int poll, int length, uint8_t *msg)
mtx_lock(&sc->sc_mutex);
- if ((sc->sc_state == CUDA_IDLE) /*&&
- ((cuda_read_reg(sc, vBufB) & vPB3) == vPB3)*/) {
- /* fine */
- } else {
+ if (sc->sc_state != CUDA_IDLE) {
if (sc->sc_waiting == 0) {
sc->sc_waiting = 1;
} else {
@@ -381,12 +378,12 @@ cuda_poll(device_t dev)
{
struct cuda_softc *sc = device_get_softc(dev);
- while ((sc->sc_state != CUDA_IDLE) ||
- (cuda_intr_state(sc)) ||
- (sc->sc_waiting == 1)) {
- if ((cuda_read_reg(sc, vIFR) & vSR_INT) == vSR_INT)
- cuda_intr(dev);
- }
+ if (sc->sc_state == CUDA_IDLE && !cuda_intr_state(sc) &&
+ !sc->sc_waiting)
+ return;
+
+ if ((cuda_read_reg(sc, vIFR) & vSR_INT) == vSR_INT)
+ cuda_intr(dev);
}
static void
@@ -615,6 +612,7 @@ cuda_adb_autopoll(device_t dev, uint16_t mask) {
uint8_t cmd[] = {CUDA_PSEUDO, CMD_AUTOPOLL, mask != 0};
mtx_lock(&sc->sc_mutex);
+
if (cmd[2] == sc->sc_autopoll) {
mtx_unlock(&sc->sc_mutex);
return 0;
@@ -624,18 +622,10 @@ cuda_adb_autopoll(device_t dev, uint16_t mask) {
mtx_sleep(dev,&sc->sc_mutex,0,"cuda",1);
sc->sc_autopoll = -1;
- mtx_unlock(&sc->sc_mutex);
-
cuda_send(sc, 0, 3, cmd);
-
- mtx_lock(&sc->sc_mutex);
- while(sc->sc_autopoll == -1) {
- mtx_sleep(dev,&sc->sc_mutex,0,"cuda",100);
- cuda_poll(dev);
- }
mtx_unlock(&sc->sc_mutex);
-
+
return 0;
}
diff --git a/sys/powerpc/powermac/pmu.c b/sys/powerpc/powermac/pmu.c
index a5a5450..b5dcdf8 100644
--- a/sys/powerpc/powermac/pmu.c
+++ b/sys/powerpc/powermac/pmu.c
@@ -591,8 +591,6 @@ pmu_adb_autopoll(device_t dev, uint16_t mask)
{
struct pmu_softc *sc = device_get_softc(dev);
- mask = 0xffff;
-
/* magical incantation to re-enable autopolling */
uint8_t cmd[] = {0, PMU_SET_POLL_MASK, (mask >> 8) & 0xff, mask & 0xff};
uint8_t resp[16];
OpenPOWER on IntegriCloud