mmc-utils: Expand 'writeprotect boot'
This patch updates 'mmc writeprotect boot set' with a few more optional
parameters, so that it can be used to enable permanent write-protection
and so that the two boot partitions can be protected independently. It
also splits protection information output by 'mmc writeprotect boot get'
by partition.
BUG=b:151202634
TEST=Enabled different kinds of protection on my Trogdor.
Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I327fff23675b267a9f75d754ccc47db3f84c294c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/mmc-utils/+/2103512
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
diff --git a/mmc.h b/mmc.h
index 53f5b10..d82e182 100644
--- a/mmc.h
+++ b/mmc.h
@@ -77,6 +77,7 @@
#define EXT_CSD_PART_CONFIG 179
#define EXT_CSD_BOOT_BUS_CONDITIONS 177
#define EXT_CSD_ERASE_GROUP_DEF 175
+#define EXT_CSD_BOOT_WP_STATUS 174
#define EXT_CSD_BOOT_WP 173
#define EXT_CSD_USER_WP 171
#define EXT_CSD_FW_CONFIG 169 /* R/W */
@@ -147,9 +148,16 @@
#define EXT_CSD_HPI_SUPP (1<<0)
#define EXT_CSD_HPI_IMPL (1<<1)
#define EXT_CSD_CMD_SET_NORMAL (1<<0)
+#define EXT_CSD_BOOT_WP_S_AREA_2_PERM (0x08)
+#define EXT_CSD_BOOT_WP_S_AREA_2_PWR (0x04)
+#define EXT_CSD_BOOT_WP_S_AREA_1_PERM (0x02)
+#define EXT_CSD_BOOT_WP_S_AREA_1_PWR (0x01)
+#define EXT_CSD_BOOT_WP_B_SEC_WP_SEL (0x80)
#define EXT_CSD_BOOT_WP_B_PWR_WP_DIS (0x40)
#define EXT_CSD_BOOT_WP_B_PERM_WP_DIS (0x10)
+#define EXT_CSD_BOOT_WP_B_PERM_WP_SEC_SEL (0x08)
#define EXT_CSD_BOOT_WP_B_PERM_WP_EN (0x04)
+#define EXT_CSD_BOOT_WP_B_PWR_WP_SEC_SEL (0x02)
#define EXT_CSD_BOOT_WP_B_PWR_WP_EN (0x01)
#define EXT_CSD_BOOT_INFO_HS_MODE (1<<2)
#define EXT_CSD_BOOT_INFO_DDR_DDR (1<<1)