FreeBSD/sys/dev/bxe/bxe.c
/* issue a DMAE command over the init channel and wait for completion */
issue a DMAE command over the init channel and wait for completion
issue a DMAE command over the init channel and wait for completion
static int
bxe_issue_dmae_with_comp(struct bxe_softc    *sc,
                         struct dmae_cmd *dmae)
{
    uint32_t *wb_comp = BXE_SP(sc, wb_comp);
    int timeout = CHIP_REV_IS_SLOW(sc) ? 400000 : 4000;
    BXE_DMAE_LOCK(sc);
    *wb_comp = 0;
    bxe_post_dmae(sc, dmae, INIT_DMAE_C(sc));
    DELAY(5);
    while ((*wb_comp & ~DMAE_PCI_ERR_FLAG) != DMAE_COMP_VAL) {
        if (!timeout ||
            (sc->recovery_state != BXE_RECOVERY_DONE &&
             sc->recovery_state != BXE_RECOVERY_NIC_LOADING)) {
            BLOGE(sc, "DMAE timeout! *wb_comp 0x%x recovery_state 0x%x\n",
                *wb_comp, sc->recovery_state);
            BXE_DMAE_UNLOCK(sc);
            return (DMAE_TIMEOUT);
        }
        timeout--;
        DELAY(50);
    }
    if (*wb_comp & DMAE_PCI_ERR_FLAG) {
        BLOGE(sc, "DMAE PCI error! *wb_comp 0x%x recovery_state 0x%x\n",
                *wb_comp, sc->recovery_state);
        BXE_DMAE_UNLOCK(sc);
        return (DMAE_PCI_ERROR);
    }
    BXE_DMAE_UNLOCK(sc);
    return (0);
}
static int bxe_issue_dmae_with_comp ( struct bxe_softc * sc , struct dmae_cmd * dmae ) { uint32_t * wb_comp = BXE_SP ( sc , wb_comp ) ; int timeout = CHIP_REV_IS_SLOW ( sc ) ? 400000 : 4000 ; BXE_DMAE_LOCK ( sc ) ; * wb_comp = 0 ; bxe_post_dmae ( sc , dmae , INIT_DMAE_C ( sc ) ) ; DELAY ( 5 ) ; while ( ( * wb_comp & ~ DMAE_PCI_ERR_FLAG ) != DMAE_COMP_VAL ) { if ( ! timeout || ( sc -> recovery_state != BXE_RECOVERY_DONE && sc -> recovery_state != BXE_RECOVERY_NIC_LOADING ) ) { BLOGE ( sc , " \n " , * wb_comp , sc -> recovery_state ) ; BXE_DMAE_UNLOCK ( sc ) ; return ( DMAE_TIMEOUT ) ; } timeout -- ; DELAY ( 50 ) ; } if ( * wb_comp & DMAE_PCI_ERR_FLAG ) { BLOGE ( sc , " \n " , * wb_comp , sc -> recovery_state ) ; BXE_DMAE_UNLOCK ( sc ) ; return ( DMAE_PCI_ERROR ) ; } BXE_DMAE_UNLOCK ( sc ) ; return ( 0 ) ; }
issue a DMAE command over the init channel and wait for completion
issue a DMAE command over the init channel and wait for completion
/* reset completion */ /* post the command on the channel used for initializations */ /* wait for completion */