* ecore_state_wait - wait until the given bit(state) is cleared * * @sc: device handle * @state: state which is to be cleared * @state_p: state buffer * */
| 282 | * |
| 283 | */ |
| 284 | static int ecore_state_wait(struct bnx2x_softc *sc, int state, |
| 285 | uint32_t *pstate) |
| 286 | { |
| 287 | /* can take a while if any port is running */ |
| 288 | int cnt = 5000; |
| 289 | |
| 290 | if (CHIP_REV_IS_EMUL(sc)) |
| 291 | cnt *= 20; |
| 292 | |
| 293 | ECORE_MSG(sc, "waiting for state to become %d", state); |
| 294 | |
| 295 | ECORE_MIGHT_SLEEP(); |
| 296 | while (cnt--) { |
| 297 | bnx2x_intr_legacy(sc); |
| 298 | if (!ECORE_TEST_BIT(state, pstate)) { |
| 299 | #ifdef ECORE_STOP_ON_ERROR |
| 300 | ECORE_MSG(sc, "exit (cnt %d)", 5000 - cnt); |
| 301 | #endif |
| 302 | rte_atomic32_set(&sc->scan_fp, 0); |
| 303 | return ECORE_SUCCESS; |
| 304 | } |
| 305 | |
| 306 | ECORE_WAIT(sc, delay_us); |
| 307 | |
| 308 | if (sc->panic) { |
| 309 | rte_atomic32_set(&sc->scan_fp, 0); |
| 310 | return ECORE_IO; |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | /* timeout! */ |
| 315 | PMD_DRV_LOG(ERR, sc, "timeout waiting for state %d", state); |
| 316 | rte_atomic32_set(&sc->scan_fp, 0); |
| 317 | #ifdef ECORE_STOP_ON_ERROR |
| 318 | ecore_panic(); |
| 319 | #endif |
| 320 | |
| 321 | return ECORE_TIMEOUT; |
| 322 | } |
| 323 | |
| 324 | static int ecore_raw_wait(struct bnx2x_softc *sc, struct ecore_raw_obj *raw) |
| 325 | { |
no test coverage detected