disk_updater: Reset BH799 after upgrade
After fw-activate, nvme device that needs reset are supposed to say so
and nvme cli returns an error.
But the BH799 does not, so force a reest on it.
It matches the commands recommended by Bayhub:
Fixes commit 9d9d4fae544d ("disk_updater: Add support for BH799")
BUG=b:223440436
TEST=Check nipperkin with BAYHUB Samsung-CUTB42-0x0002-64GB gets
updated. Unit test.
Change-Id: I83cb738c1aa69c67346ed9cd0650745456e46d4c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/3617411
Reviewed-by: Rob Barnes <robbarnes@google.com>
Commit-Queue: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
(cherry picked from commit 0ec1215a043010c1f7d988df82aa05275ffca26b)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/3651450
diff --git a/disk_updater/scripts/chromeos-disk-firmware-update.sh b/disk_updater/scripts/chromeos-disk-firmware-update.sh
index 5d07fc1..f06f84a 100755
--- a/disk_updater/scripts/chromeos-disk-firmware-update.sh
+++ b/disk_updater/scripts/chromeos-disk-firmware-update.sh
@@ -614,6 +614,9 @@
elif [ "${rc}" -ne 0 ]; then
log_msg "Unable to activate ${fw_file} to ${device}"
return "${rc}"
+ elif echo "${fw_options}" | grep -q "bh799"; then
+ # BH799 report the firmware has been updated, but it needs a reset.
+ "${FLAGS_nvme}" reset "/dev/${device}"
fi
}
diff --git a/disk_updater/tests/nvme_upgraded_6 b/disk_updater/tests/nvme_upgraded_6
index b15adab..c6592ee 100644
--- a/disk_updater/tests/nvme_upgraded_6
+++ b/disk_updater/tests/nvme_upgraded_6
@@ -1,4 +1,4 @@
nvme fw-download /dev/nvme0 --fw=tests/test_nvme_dir/fw.bin
nvme fw-activate /dev/nvme0 --slot=1 --action=1
-mock reset for nvme0
+nvme reset /dev/nvme0
Upgraded nvme0:BAYHUB_HynixhC8aP>303064GB_Disk from 10100050 to 10100065
diff --git a/disk_updater/tests/unit_test.sh b/disk_updater/tests/unit_test.sh
index 015bd02..8b8ecc9 100755
--- a/disk_updater/tests/unit_test.sh
+++ b/disk_updater/tests/unit_test.sh
@@ -6,7 +6,6 @@
# Command for unit test.
echo "$(basename "$0")" "$@" | sed -E "s#/tmp/test_fw\..{6}#temp_dir#g"
case "$@" in
- *--action=1) exit 11;;
*--action=2) exit 11;;
*) exit 0;;
esac