futility: Auto-preserve SI_DESC and SI_ME when CSME is locked

When running futility update via the internal programmer, whether the
ME and descriptor regions can be updated depends on the hardware lock
state enforced by the underlying flash programmer (flashrom) and
chipset registers.

To better align section preservation with the hardware locking state
without relying solely on external quirks or update mode flags,
futility should proactively detect whether CSME is locked.

This patch introduces is_csme_locked() in platform_csme.c to inspect
the flash descriptor lock (FLMSTR1) and GPR0 status. When running on
the internal programmer, preserve_management_engine() now calls
is_csme_locked() and automatically preserves FMAP_SI_DESC and
FMAP_SI_ME if the CSME is locked.

BUG=b:540693049
BRANCH=none
TEST=make clean && make runfutiltests -j in cros_sdk
TAG=agy
CONV=0fe5cc8c-bd78-451f-abcc-fc9083e46712

Change-Id: I9b1bdd8abf1efe30f25589ef4b8a9e13c078124d
Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/8174263
Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
4 files changed