disk_updater: Upgrade firmware immediately if possible

When upgrading with action 3 (update firmware without reboot),
we need first to upload the firmware with action 0 (upload without update).
Use one unused slot to do the operation.
If slot N is used, use slot N+1 or the first writable slot if we are
exceeding the number of slots.

BUG=chromium:669596
TEST=Unit test + tested on Eve. Build 2 firmware packages, and ping-pong
between firmware.

Change-Id: I6382d1a248beec6a330ba89cca94b1de00e30923
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/636702
Reviewed-by: Mike Frysinger <vapier@chromium.org>
(cherry picked from commit 976d03d733bfc7c557c5a6a1382532cd87c6a472)
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1136990
Reviewed-by: Wei-Han Chen <stimim@chromium.org>
11 files changed