* ice_check_reset - Check to see if a global reset is complete * @hw: pointer to the hardware structure */
| 1212 | * @hw: pointer to the hardware structure |
| 1213 | */ |
| 1214 | enum ice_status ice_check_reset(struct ice_hw *hw) |
| 1215 | { |
| 1216 | u32 cnt, reg = 0, grst_timeout, uld_mask; |
| 1217 | |
| 1218 | /* Poll for Device Active state in case a recent CORER, GLOBR, |
| 1219 | * or EMPR has occurred. The grst delay value is in 100ms units. |
| 1220 | * Add 1sec for outstanding AQ commands that can take a long time. |
| 1221 | */ |
| 1222 | grst_timeout = ((rd32(hw, GLGEN_RSTCTL) & GLGEN_RSTCTL_GRSTDEL_M) >> |
| 1223 | GLGEN_RSTCTL_GRSTDEL_S) + 10; |
| 1224 | |
| 1225 | for (cnt = 0; cnt < grst_timeout; cnt++) { |
| 1226 | ice_msec_delay(100, true); |
| 1227 | reg = rd32(hw, GLGEN_RSTAT); |
| 1228 | if (!(reg & GLGEN_RSTAT_DEVSTATE_M)) |
| 1229 | break; |
| 1230 | } |
| 1231 | |
| 1232 | if (cnt == grst_timeout) { |
| 1233 | ice_debug(hw, ICE_DBG_INIT, "Global reset polling failed to complete.\n"); |
| 1234 | return ICE_ERR_RESET_FAILED; |
| 1235 | } |
| 1236 | |
| 1237 | #define ICE_RESET_DONE_MASK (GLNVM_ULD_PCIER_DONE_M |\ |
| 1238 | GLNVM_ULD_PCIER_DONE_1_M |\ |
| 1239 | GLNVM_ULD_CORER_DONE_M |\ |
| 1240 | GLNVM_ULD_GLOBR_DONE_M |\ |
| 1241 | GLNVM_ULD_POR_DONE_M |\ |
| 1242 | GLNVM_ULD_POR_DONE_1_M |\ |
| 1243 | GLNVM_ULD_PCIER_DONE_2_M) |
| 1244 | |
| 1245 | uld_mask = ICE_RESET_DONE_MASK; |
| 1246 | |
| 1247 | /* Device is Active; check Global Reset processes are done */ |
| 1248 | for (cnt = 0; cnt < ICE_PF_RESET_WAIT_COUNT; cnt++) { |
| 1249 | reg = rd32(hw, GLNVM_ULD) & uld_mask; |
| 1250 | if (reg == uld_mask) { |
| 1251 | ice_debug(hw, ICE_DBG_INIT, "Global reset processes done. %d\n", cnt); |
| 1252 | break; |
| 1253 | } |
| 1254 | ice_msec_delay(10, true); |
| 1255 | } |
| 1256 | |
| 1257 | if (cnt == ICE_PF_RESET_WAIT_COUNT) { |
| 1258 | ice_debug(hw, ICE_DBG_INIT, "Wait for Reset Done timed out. GLNVM_ULD = 0x%x\n", |
| 1259 | reg); |
| 1260 | return ICE_ERR_RESET_FAILED; |
| 1261 | } |
| 1262 | |
| 1263 | return ICE_SUCCESS; |
| 1264 | } |
| 1265 | |
| 1266 | /** |
| 1267 | * ice_pf_reset - Reset the PF |
no test coverage detected