Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons, Nikolai Artemiev.

Sergii Dmytruk would like Nico Huber, Edward O'Callaghan, Angel Pons and Nikolai Artemiev to review this change.

View Change

flash.h: extend `struct tested` with .wp field

"W" and "P" letters were already taken, so using "X" to represent
protection in macros. One can think of execution permission on Unix-like
systems, that also prevents running commands.

TICKET=https://ticket.coreboot.org/issues/377

Change-Id: I791400889159bc6f305fb05f3e2dd9a90dbe18a4
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
---
M cli_common.c
M include/flash.h
M include/libflashrom.h
3 files changed, 39 insertions(+), 12 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/79/68179/1
diff --git a/cli_common.c b/cli_common.c
index 9375859..5373585 100644
--- a/cli_common.c
+++ b/cli_common.c
@@ -35,12 +35,14 @@
if ((chip->tested.probe == BAD) || (chip->tested.probe == NT) ||
(chip->tested.read == BAD) || (chip->tested.read == NT) ||
(chip->tested.erase == BAD) || (chip->tested.erase == NT) ||
- (chip->tested.write == BAD) || (chip->tested.write == NT)){
+ (chip->tested.write == BAD) || (chip->tested.write == NT) ||
+ (chip->tested.wp == BAD) || (chip->tested.wp == NT)){
msg_cinfo("===\n");
if ((chip->tested.probe == BAD) ||
(chip->tested.read == BAD) ||
(chip->tested.erase == BAD) ||
- (chip->tested.write == BAD)) {
+ (chip->tested.write == BAD) ||
+ (chip->tested.wp == BAD)) {
msg_cinfo("This flash part has status NOT WORKING for operations:");
if (chip->tested.probe == BAD)
msg_cinfo(" PROBE");
@@ -50,12 +52,15 @@
msg_cinfo(" ERASE");
if (chip->tested.write == BAD)
msg_cinfo(" WRITE");
+ if (chip->tested.wp == BAD)
+ msg_cinfo(" WP");
msg_cinfo("\n");
}
if ((chip->tested.probe == NT) ||
(chip->tested.read == NT) ||
(chip->tested.erase == NT) ||
- (chip->tested.write == NT)) {
+ (chip->tested.write == NT) ||
+ (chip->tested.wp == NT)) {
msg_cinfo("This flash part has status UNTESTED for operations:");
if (chip->tested.probe == NT)
msg_cinfo(" PROBE");
@@ -65,6 +70,8 @@
msg_cinfo(" ERASE");
if (chip->tested.write == NT)
msg_cinfo(" WRITE");
+ if (chip->tested.wp == NT)
+ msg_cinfo(" WP");
msg_cinfo("\n");
}
msg_cinfo("The test status of this chip may have been updated in the latest development\n"
diff --git a/include/flash.h b/include/flash.h
index 79aaa64..53afccc 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -161,17 +161,19 @@
NA, /* Not applicable (e.g. write support on ROM chips) */
};

-#define TEST_UNTESTED (struct tested){ .probe = NT, .read = NT, .erase = NT, .write = NT }
+#define TEST_UNTESTED (struct tested){ .probe = NT, .read = NT, .erase = NT, .write = NT, .wp = NT }

-#define TEST_OK_PROBE (struct tested){ .probe = OK, .read = NT, .erase = NT, .write = NT }
-#define TEST_OK_PR (struct tested){ .probe = OK, .read = OK, .erase = NT, .write = NT }
-#define TEST_OK_PRE (struct tested){ .probe = OK, .read = OK, .erase = OK, .write = NT }
-#define TEST_OK_PREW (struct tested){ .probe = OK, .read = OK, .erase = OK, .write = OK }
+#define TEST_OK_PROBE (struct tested){ .probe = OK, .read = NT, .erase = NT, .write = NT, .wp = NT }
+#define TEST_OK_PR (struct tested){ .probe = OK, .read = OK, .erase = NT, .write = NT, .wp = NT }
+#define TEST_OK_PRE (struct tested){ .probe = OK, .read = OK, .erase = OK, .write = NT, .wp = NT }
+#define TEST_OK_PREW (struct tested){ .probe = OK, .read = OK, .erase = OK, .write = OK, .wp = NT }
+#define TEST_OK_PREWX (struct tested){ .probe = OK, .read = OK, .erase = OK, .write = OK, .wp = OK }

-#define TEST_BAD_PROBE (struct tested){ .probe = BAD, .read = NT, .erase = NT, .write = NT }
-#define TEST_BAD_PR (struct tested){ .probe = BAD, .read = BAD, .erase = NT, .write = NT }
-#define TEST_BAD_PRE (struct tested){ .probe = BAD, .read = BAD, .erase = BAD, .write = NT }
-#define TEST_BAD_PREW (struct tested){ .probe = BAD, .read = BAD, .erase = BAD, .write = BAD }
+#define TEST_BAD_PROBE (struct tested){ .probe = BAD, .read = NT, .erase = NT, .write = NT, .wp = NT }
+#define TEST_BAD_PR (struct tested){ .probe = BAD, .read = BAD, .erase = NT, .write = NT, .wp = NT }
+#define TEST_BAD_PRE (struct tested){ .probe = BAD, .read = BAD, .erase = BAD, .write = NT, .wp = NT }
+#define TEST_BAD_PREW (struct tested){ .probe = BAD, .read = BAD, .erase = BAD, .write = BAD, .wp = NT }
+#define TEST_BAD_PREWX (struct tested){ .probe = BAD, .read = BAD, .erase = BAD, .write = BAD, .wp = BAD }

struct flashrom_flashctx;
#define flashctx flashrom_flashctx /* TODO: Agree on a name and convert all occurrences. */
@@ -231,6 +233,7 @@
enum test_state read;
enum test_state erase;
enum test_state write;
+ enum test_state wp;
} tested;

/*
diff --git a/include/libflashrom.h b/include/libflashrom.h
index 21a5785..9bbdcc5 100644
--- a/include/libflashrom.h
+++ b/include/libflashrom.h
@@ -121,6 +121,7 @@
enum flashrom_test_state read;
enum flashrom_test_state erase;
enum flashrom_test_state write;
+ enum flashrom_test_state wp;
} tested;
};


To view, visit change 68179. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I791400889159bc6f305fb05f3e2dd9a90dbe18a4
Gerrit-Change-Number: 68179
Gerrit-PatchSet: 1
Gerrit-Owner: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev@google.com>
Gerrit-Attention: Nico Huber <nico.h@gmx.de>
Gerrit-Attention: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus@gmail.com>
Gerrit-Attention: Nikolai Artemiev <nartemiev@google.com>
Gerrit-MessageType: newchange