+ /*
+ * NVRAM updates can take a long time (e.g. up to 1 minute for bundle
+ * images). Polling for NVRAM update completion ensures that other MCDI
+ * commands can be issued before the background NVRAM update completes.
+ *
+ * Without polling, other MCDI commands can only be issued before the
+ * NVRAM update completes if the MCDI transport and the firmware
+ * support the Asynchronous MCDI protocol extensions in SF-116575-PS.
+ *
+ * The initial call either completes the update synchronously, or
+ * returns RC_PENDING to indicate processing is continuing. In the
+ * latter case, we poll for at least 1 minute, at increasing intervals
+ * (10ms, 100ms, 1s).
+ */
+ while (verify_result == MC_CMD_NVRAM_VERIFY_RC_PENDING) {
+
+ if (poll_retry > EF10_NVRAM_POLL_RETRIES) {
+ rc = ETIMEDOUT;
+ goto fail1;
+ }
+ poll_retry++;
+
+ EFSYS_SLEEP(poll_delay_us);
+ if (poll_delay_us < EF10_NVRAM_MAX_POLL_DELAY_US)
+ poll_delay_us *= 10;
+
+ /* Poll for completion of background NVRAM update. */
+ verify_result = MC_CMD_NVRAM_VERIFY_RC_UNKNOWN;
+
+ rc = efx_mcdi_nvram_update_finish(enp, partn, reboot,
+ EFX_NVRAM_UPDATE_FLAGS_POLL, &verify_result);
+ if (rc != 0) {
+ /* Poll failed, so assume NVRAM update failed. */
+ goto fail2;
+ }
+ }
+
+ if (verify_resultp != NULL)
+ *verify_resultp = verify_result;