diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c index 220962218d45..da00908a5566 100644 --- a/sys/dev/isp/isp.c +++ b/sys/dev/isp/isp.c @@ -524,6 +524,7 @@ isp_reset(ispsoftc_t *isp) } } if (val & BIU2400_DMA_ACTIVE) { + ISP_RESET0(isp); isp_prt(isp, ISP_LOGERR, "DMA Failed to Stop on Reset"); return; } @@ -544,6 +545,7 @@ isp_reset(ispsoftc_t *isp) } } if (val & BIU2400_SOFT_RESET) { + ISP_RESET0(isp); isp_prt(isp, ISP_LOGERR, "Failed to come out of reset"); return; } @@ -585,6 +587,7 @@ isp_reset(ispsoftc_t *isp) USEC_DELAY(100); if (--loops < 0) { ISP_DUMPREGS(isp, "chip reset timed out"); + ISP_RESET0(isp); return; } } @@ -626,6 +629,7 @@ isp_reset(ispsoftc_t *isp) } } if (val != 0) { + ISP_RESET0(isp); isp_prt(isp, ISP_LOGERR, "reset didn't clear"); return; } @@ -691,6 +695,7 @@ isp_reset(ispsoftc_t *isp) while (ISP_READ(isp, OUTMAILBOX0) == MBOX_BUSY) { USEC_DELAY(100); if (--loops < 0) { + ISP_RESET0(isp); isp_prt(isp, ISP_LOGERR, "MBOX_BUSY never cleared on reset"); return; @@ -712,6 +717,7 @@ isp_reset(ispsoftc_t *isp) mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + ISP_RESET0(isp); return; } @@ -728,11 +734,13 @@ isp_reset(ispsoftc_t *isp) mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + ISP_RESET0(isp); return; } if (mbs.param[1] != 0xdead || mbs.param[2] != 0xbeef || mbs.param[3] != 0xffff || mbs.param[4] != 0x1111 || mbs.param[5] != 0xa5a5) { + ISP_RESET0(isp); isp_prt(isp, ISP_LOGERR, "Register Test Failed (0x%x 0x%x 0x%x 0x%x 0x%x)", mbs.param[1], mbs.param[2], mbs.param[3], @@ -820,6 +828,7 @@ isp_reset(ispsoftc_t *isp) if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { isp_prt(isp, ISP_LOGERR, "F/W Risc Ram Load Failed"); + ISP_RESET0(isp); return; } la += nw; @@ -881,6 +890,7 @@ isp_reset(ispsoftc_t *isp) if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { isp_prt(isp, ISP_LOGERR, "F/W Risc Ram Load Failed"); + ISP_RESET0(isp); return; } la += nw; @@ -897,6 +907,7 @@ isp_reset(ispsoftc_t *isp) isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { isp_prt(isp, ISP_LOGERR, dcrc); + ISP_RESET0(isp); return; } break; @@ -935,6 +946,7 @@ isp_reset(ispsoftc_t *isp) isp_prt(isp, ISP_LOGERR, "F/W download failed at word %d", isp->isp_mbxwrk1 - code_org); + ISP_RESET0(isp); return; } /* @@ -947,6 +959,7 @@ isp_reset(ispsoftc_t *isp) isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { isp_prt(isp, ISP_LOGERR, dcrc); + ISP_RESET0(isp); return; } isp->isp_loaded_fw = 1; @@ -989,6 +1002,7 @@ isp_reset(ispsoftc_t *isp) isp_mboxcmd(isp, &mbs); if (IS_2322(isp) || IS_24XX(isp)) { if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + ISP_RESET0(isp); return; } } @@ -1016,11 +1030,13 @@ isp_reset(ispsoftc_t *isp) mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + ISP_RESET0(isp); return; } if (IS_24XX(isp) && mbs.param[1] == 0xdead) { isp_prt(isp, ISP_LOGERR, "f/w didn't *really* start"); + ISP_RESET0(isp); return; } @@ -1107,6 +1123,7 @@ isp_reset(ispsoftc_t *isp) mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + ISP_RESET0(isp); return; } if (isp->isp_maxcmds >= mbs.param[2]) { diff --git a/sys/dev/isp/isp_pci.c b/sys/dev/isp/isp_pci.c index 6edffb1ae949..cb4588fb9c33 100644 --- a/sys/dev/isp/isp_pci.c +++ b/sys/dev/isp/isp_pci.c @@ -81,6 +81,7 @@ static void isp_pci_dmateardown(ispsoftc_t *, XS_T *, uint32_t); +static void isp_pci_reset0(ispsoftc_t *); static void isp_pci_reset1(ispsoftc_t *); static void isp_pci_dumpregs(ispsoftc_t *, const char *); @@ -91,7 +92,7 @@ static struct ispmdvec mdvec = { isp_pci_mbxdma, isp_pci_dmasetup, isp_pci_dmateardown, - NULL, + isp_pci_reset0, isp_pci_reset1, isp_pci_dumpregs, NULL, @@ -105,7 +106,7 @@ static struct ispmdvec mdvec_1080 = { isp_pci_mbxdma, isp_pci_dmasetup, isp_pci_dmateardown, - NULL, + isp_pci_reset0, isp_pci_reset1, isp_pci_dumpregs, NULL, @@ -119,7 +120,7 @@ static struct ispmdvec mdvec_12160 = { isp_pci_mbxdma, isp_pci_dmasetup, isp_pci_dmateardown, - NULL, + isp_pci_reset0, isp_pci_reset1, isp_pci_dumpregs, NULL, @@ -133,7 +134,7 @@ static struct ispmdvec mdvec_2100 = { isp_pci_mbxdma, isp_pci_dmasetup, isp_pci_dmateardown, - NULL, + isp_pci_reset0, isp_pci_reset1, isp_pci_dumpregs }; @@ -145,7 +146,7 @@ static struct ispmdvec mdvec_2200 = { isp_pci_mbxdma, isp_pci_dmasetup, isp_pci_dmateardown, - NULL, + isp_pci_reset0, isp_pci_reset1, isp_pci_dumpregs }; @@ -157,7 +158,7 @@ static struct ispmdvec mdvec_2300 = { isp_pci_mbxdma, isp_pci_dmasetup, isp_pci_dmateardown, - NULL, + isp_pci_reset0, isp_pci_reset1, isp_pci_dumpregs }; @@ -169,7 +170,7 @@ static struct ispmdvec mdvec_2400 = { isp_pci_mbxdma, isp_pci_dmasetup, isp_pci_dmateardown, - NULL, + isp_pci_reset0, isp_pci_reset1, NULL }; @@ -2881,6 +2882,12 @@ isp_pci_dmateardown(ispsoftc_t *isp, XS_T *xs, uint32_t handle) } +static void +isp_pci_reset0(ispsoftc_t *isp) +{ + ISP_DISABLE_INTS(isp); +} + static void isp_pci_reset1(ispsoftc_t *isp) { diff --git a/sys/dev/isp/isp_sbus.c b/sys/dev/isp/isp_sbus.c index bc18bf2cfdb7..1b70a958931f 100644 --- a/sys/dev/isp/isp_sbus.c +++ b/sys/dev/isp/isp_sbus.c @@ -63,6 +63,7 @@ isp_sbus_dmasetup(ispsoftc_t *, XS_T *, ispreq_t *, uint32_t *, uint32_t); static void isp_sbus_dmateardown(ispsoftc_t *, XS_T *, uint32_t); +static void isp_sbus_reset0(ispsoftc_t *); static void isp_sbus_reset1(ispsoftc_t *); static void isp_sbus_dumpregs(ispsoftc_t *, const char *); @@ -73,7 +74,7 @@ static struct ispmdvec mdvec = { isp_sbus_mbxdma, isp_sbus_dmasetup, isp_sbus_dmateardown, - NULL, + isp_sbus_reset0, isp_sbus_reset1, isp_sbus_dumpregs, NULL, @@ -825,6 +826,12 @@ isp_sbus_dmateardown(ispsoftc_t *isp, XS_T *xs, uint32_t handle) bus_dmamap_unload(sbs->dmat, *dp); } +static void +isp_sbus_reset0(ispsoftc_t *isp) +{ + ISP_DISABLE_INTS(isp); +} + static void isp_sbus_reset1(ispsoftc_t *isp) {