Do not indicate known-bad functions as untested

If a chip has any TEST_BAD_* flag set, we don't even list the
unsupported functions, giving the user the impression that the
unsupported functions are tested.

Corresponding to flashrom svn r352 and coreboot v2 svn r3780.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Peter Stuge <peter@stuge.se>
diff --git a/flash.h b/flash.h
index cbc2e48..70a390f 100644
--- a/flash.h
+++ b/flash.h
@@ -95,6 +95,7 @@
 #define TEST_BAD_READ	(1<<5)
 #define TEST_BAD_ERASE	(1<<6)
 #define TEST_BAD_WRITE	(1<<7)
+#define TEST_BAD_PREW	(TEST_BAD_PROBE|TEST_BAD_READ|TEST_BAD_ERASE|TEST_BAD_WRITE)
 #define TEST_BAD_MASK	0xf0
 
 extern struct flashchip flashchips[];
@@ -106,7 +107,7 @@
  *
  * All LPC/FWH parts (parallel flash) have 8-bit device IDs if there is no
  * continuation code.
- * All SPI parts have 16-bit device IDs.
+ * SPI parts have 16-bit device IDs if they support RDID.
  */
 
 #define GENERIC_DEVICE_ID	0xffff	/* Only match the vendor ID */
diff --git a/flashrom.c b/flashrom.c
index 9357d04..5e84134 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -499,15 +499,19 @@
 			if (flash->tested & TEST_BAD_WRITE)
 				printf(" WRITE");
 			printf("\n");
-		} else {
+		}
+		if ((!(flash->tested & TEST_BAD_PROBE) && !(flash->tested & TEST_OK_PROBE)) ||
+		    (!(flash->tested & TEST_BAD_READ) && !(flash->tested & TEST_OK_READ)) ||
+		    (!(flash->tested & TEST_BAD_ERASE) && !(flash->tested & TEST_OK_ERASE)) ||
+		    (!(flash->tested & TEST_BAD_WRITE) && !(flash->tested & TEST_OK_WRITE))) {
 			printf("This flash part has status UNTESTED for operations:");
-			if (!(flash->tested & TEST_OK_PROBE))
+			if (!(flash->tested & TEST_BAD_PROBE) && !(flash->tested & TEST_OK_PROBE))
 				printf(" PROBE");
-			if (!(flash->tested & TEST_OK_READ))
+			if (!(flash->tested & TEST_BAD_READ) && !(flash->tested & TEST_OK_READ))
 				printf(" READ");
-			if (!(flash->tested & TEST_OK_ERASE))
+			if (!(flash->tested & TEST_BAD_ERASE) && !(flash->tested & TEST_OK_ERASE))
 				printf(" ERASE");
-			if (!(flash->tested & TEST_OK_WRITE))
+			if (!(flash->tested & TEST_BAD_WRITE) && !(flash->tested & TEST_OK_WRITE))
 				printf(" WRITE");
 			printf("\n");
 		}