internal/intel: Allow only forced write attempts with BWE unset
The running firmware can clear the BIOS Write Enable (BWE, later Write
Protect Disable, WPD) bit from SMM. If that happens after our attempt
to set it, don't bother any write attempts unless we are forced to.
Change-Id: Ib2374ba5f07847554ddd22142a9e0f8d1447699d
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/429
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/chipset_enable.c b/chipset_enable.c
index 2953c4b..c7b9327 100644
--- a/chipset_enable.c
+++ b/chipset_enable.c
@@ -361,8 +361,10 @@
"New value is 0x%02x.\n", bios_cntl, old, wanted, new);
/* Return an error if we could not set the write enable only. */
- if (!(new & (1 << 0)))
+ if (!(new & (1 << 0))) {
+ programmer_may_write = false;
return -1;
+ }
return 0;
}