diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2000-04-02 23:51:17 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2000-04-02 23:51:17 +0000 |
commit | 3c9037921dd11b5332d701c45741925c53e23e21 (patch) | |
tree | 9b2edff5656665358b3c17b05982a4b93e8c82ff | |
parent | a7f429e1b3f8b346b2ad176de625c11889edb495 (diff) |
Stop losing carriers during bus reset, by not re-init'ing icq_sp/irq_sp
-rw-r--r-- | sys/dev/ic/adwlib.c | 120 |
1 files changed, 68 insertions, 52 deletions
diff --git a/sys/dev/ic/adwlib.c b/sys/dev/ic/adwlib.c index 67d3d8f61f7..4db6ad7b194 100644 --- a/sys/dev/ic/adwlib.c +++ b/sys/dev/ic/adwlib.c @@ -608,19 +608,24 @@ ADW_SOFTC *sc; /* - * Set-up the Host->RISC Initiator Command Queue (ICQ). + * Set-up the Host->RISC Initiator Command Queue (ICQ) if + * one is not already set up, i.e. this is the first + * time through as opposed to a bus reset. */ - if ((sc->icq_sp = sc->carr_freelist) == NULL) { - return ASC_IERR_NO_CARRIER; - } - sc->carr_freelist = adw_carrier_phys_kv(sc, - ASC_GET_CARRP(sc->icq_sp->next_vpa)); + if (sc->icq_sp == NULL) { + sc->carr_pending_cnt = 0; + if ((sc->icq_sp = sc->carr_freelist) == NULL) { + return ASC_IERR_NO_CARRIER; + } + sc->carr_freelist = adw_carrier_phys_kv(sc, + ASC_GET_CARRP(sc->icq_sp->next_vpa)); - /* - * The first command issued will be placed in the stopper carrier. - */ - sc->icq_sp->next_vpa = ASC_CQ_STOPPER; + /* + * The first command issued will be placed in the stopper carrier. + */ + sc->icq_sp->next_vpa = ASC_CQ_STOPPER; + } /* * Set RISC ICQ physical address start value. @@ -628,28 +633,31 @@ ADW_SOFTC *sc; ADW_WRITE_DWORD_LRAM(iot, ioh, ASC_MC_ICQ, sc->icq_sp->carr_pa); /* - * Set-up the RISC->Host Initiator Response Queue (IRQ). + * Set-up the RISC->Host Initiator Response Queue (IRQ) if + * one is not already set up, i.e. this is the first + * time through as opposed to a bus reset. */ - if ((sc->irq_sp = sc->carr_freelist) == NULL) { - return ASC_IERR_NO_CARRIER; - } - sc->carr_freelist = adw_carrier_phys_kv(sc, - ASC_GET_CARRP(sc->irq_sp->next_vpa)); + if (sc->irq_sp == NULL) { + if ((sc->irq_sp = sc->carr_freelist) == NULL) { + return ASC_IERR_NO_CARRIER; + } + sc->carr_freelist = adw_carrier_phys_kv(sc, + ASC_GET_CARRP(sc->irq_sp->next_vpa)); - /* - * The first command completed by the RISC will be placed in - * the stopper. - * - * Note: Set 'next_vpa' to ASC_CQ_STOPPER. When the request is - * completed the RISC will set the ASC_RQ_STOPPER bit. - */ - sc->irq_sp->next_vpa = ASC_CQ_STOPPER; + /* + * The first command completed by the RISC will be placed in + * the stopper. + * + * Note: Set 'next_vpa' to ASC_CQ_STOPPER. When the request is + * completed the RISC will set the ASC_RQ_DONE bit. + */ + sc->irq_sp->next_vpa = ASC_CQ_STOPPER; + } /* - * Set RISC IRQ physical address start value. - */ + * Set RISC IRQ physical address start value. + */ ADW_WRITE_DWORD_LRAM(iot, ioh, ASC_MC_IRQ, sc->irq_sp->carr_pa); - sc->carr_pending_cnt = 0; ADW_WRITE_BYTE_REGISTER(iot, ioh, IOPB_INTR_ENABLES, (ADW_INTR_ENABLE_HOST_INTR | ADW_INTR_ENABLE_GLOBAL_INTR)); @@ -1140,20 +1148,25 @@ ADW_SOFTC *sc; /* - * Set-up the Host->RISC Initiator Command Queue (ICQ). + * Set-up the Host->RISC Initiator Command Queue (ICQ) if + * one is not already set up, i.e. this is the first + * time through as opposed to a bus reset. */ - if ((sc->icq_sp = sc->carr_freelist) == NULL) { - return ASC_IERR_NO_CARRIER; - } - sc->carr_freelist = adw_carrier_phys_kv(sc, - ASC_GET_CARRP(sc->icq_sp->next_vpa)); + if (sc->icq_sp == NULL) { + sc->carr_pending_cnt = 0; + if ((sc->icq_sp = sc->carr_freelist) == NULL) { + return ASC_IERR_NO_CARRIER; + } + sc->carr_freelist = adw_carrier_phys_kv(sc, + ASC_GET_CARRP(sc->icq_sp->next_vpa)); - /* - * The first command issued will be placed in the stopper carrier. - */ - sc->icq_sp->next_vpa = ASC_CQ_STOPPER; + /* + * The first command issued will be placed in the stopper carrier. + */ + sc->icq_sp->next_vpa = ASC_CQ_STOPPER; + } /* * Set RISC ICQ physical address start value. @@ -1161,28 +1174,31 @@ ADW_SOFTC *sc; ADW_WRITE_DWORD_LRAM(iot, ioh, ASC_MC_ICQ, sc->icq_sp->carr_pa); /* - * Set-up the RISC->Host Initiator Response Queue (IRQ). + * Set-up the RISC->Host Initiator Response Queue (IRQ) if + * one is not already set up, i.e. this is the first + * time through as opposed to a bus reset. */ - if ((sc->irq_sp = sc->carr_freelist) == NULL) { - return ASC_IERR_NO_CARRIER; - } - sc->carr_freelist = adw_carrier_phys_kv(sc, - ASC_GET_CARRP(sc->irq_sp->next_vpa)); + if (sc->irq_sp == NULL) { + if ((sc->irq_sp = sc->carr_freelist) == NULL) { + return ASC_IERR_NO_CARRIER; + } + sc->carr_freelist = adw_carrier_phys_kv(sc, + ASC_GET_CARRP(sc->irq_sp->next_vpa)); - /* - * The first command completed by the RISC will be placed in - * the stopper. - * - * Note: Set 'next_vpa' to ASC_CQ_STOPPER. When the request is - * completed the RISC will set the ASC_RQ_STOPPER bit. - */ - sc->irq_sp->next_vpa = ASC_CQ_STOPPER; + /* + * The first command completed by the RISC will be placed in + * the stopper. + * + * Note: Set 'next_vpa' to ASC_CQ_STOPPER. When the request is + * completed the RISC will set the ASC_RQ_DONE bit. + */ + sc->irq_sp->next_vpa = ASC_CQ_STOPPER; + } /* * Set RISC IRQ physical address start value. */ ADW_WRITE_DWORD_LRAM(iot, ioh, ASC_MC_IRQ, sc->irq_sp->carr_pa); - sc->carr_pending_cnt = 0; ADW_WRITE_BYTE_REGISTER(iot, ioh, IOPB_INTR_ENABLES, (ADW_INTR_ENABLE_HOST_INTR | ADW_INTR_ENABLE_GLOBAL_INTR)); |