summaryrefslogtreecommitdiff
path: root/util/nvmutil
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2022-11-26 23:29:41 +0000
committerLeah Rowe <leah@libreboot.org>2022-11-26 23:29:41 +0000
commitc2ed251ca6a2c143e72f922c115f3696806c2914 (patch)
treebf37a3c1f07d6dbad7b65b1513971626a800a3cd /util/nvmutil
parenteaad16edad243dc7ca9e66bd88ea106e83c7f105 (diff)
util/nvmutil: move cmd brick to own function
Diffstat (limited to 'util/nvmutil')
-rw-r--r--util/nvmutil/nvmutil.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index 7ea39537..8052bca8 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -42,6 +42,7 @@ void cmd_dump(void);
void showmac(int partnum);
void hexdump(int partnum);
void cmd_setchecksum(void);
+void cmd_brick(void);
int validChecksum(int partnum);
uint16_t word(int pos16, int partnum);
void setWord(int pos16, int partnum, uint16_t val);
@@ -244,8 +245,7 @@ cmd(const char *command)
} else if (strcmp(command, "setchecksum") == 0) {
cmd_setchecksum();
} else if (strcmp(command, "brick") == 0) {
- if (validChecksum(part))
- setWord(0x3F, part, (word(0x3F, part)) ^ 0xFF);
+ cmd_brick();
} else if (strcmp(command, "swap") == 0) {
part0 = validChecksum(0);
part1 = validChecksum(1);
@@ -332,6 +332,13 @@ cmd_setchecksum(void)
setWord(0x3F, part, 0xBABA - val16);
}
+void
+cmd_brick(void)
+{
+ if (validChecksum(part))
+ setWord(0x3F, part, (word(0x3F, part)) ^ 0xFF);
+}
+
int
validChecksum(int partnum)
{