common/usb_update: add support for extra commands

Add support for 4 extra commands that are required to update
hammer:
 - UPDATE_EXTRA_CMD_IMMEDIATE_RESET
 - UPDATE_EXTRA_CMD_JUMP_TO_RW: Tells the RWSIG task to jump
   to RW as soon as possible (assuming the image verifies)
 - UPDATE_EXTRA_CMD_STAY_IN_RO: Tells the RWSIG task to not
   jump to RW, and stay in RO, to leave enough time for
   AP to update RW.
 - UPDATE_EXTRA_CMD_UNLOCK_RW: Tells EC to unlock the RW
   section so that it can be updated (on next reboot).

BRANCH=none
BUG=b:35587171
TEST=Test RO+RW update
     cd extra/usb_updater; make
     # Jump to RW
     sudo ./usb_updater2 -j
     sleep 0.5
     # Update RO, then reboot
     sudo ./usb_updater2 ../../build/hammer/ec.bin
     sleep 0.5
     # Update RW (first tell RO to not jump to RW)
     sudo ./usb_updater2 -s
     sudo ./usb_updater2 ../../build/hammer/ec.bin
TEST=Test RW update only, with RO protected
     On EC console: flashwp true; reboot
     cd extra/usb_updater; make
     # Tell RW to unprotect RW and jump back to RO
     sudo ./usb_updater2 -w
     sudo ./usb_updater2 -r
     sleep 0.5
     # Update RW, then reboot
     sudo ./usb_updater2 -s
     sudo ./usb_updater2 ../../build/hammer/ec.bin

Change-Id: I5e8df7bdb4f06f2ac7b47de53dcde69c5002f578
Reviewed-on: https://chromium-review.googlesource.com/458470
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2 files changed