summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTadas Slotkus <devtadas@gmail.com>2011-09-03 17:15:00 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2011-09-03 17:15:00 +0000
commitad470347fdf7da1da2b690c4ae0579b09b879bfa (patch)
tree47583e45701d93d66e0f8d34bf3d5c620305d71f
parent3093f8f75e807a17637921f2e20a4d3c83f5fd62 (diff)
downloadflashrom-ad470347fdf7da1da2b690c4ae0579b09b879bfa.tar.gz
flashrom-ad470347fdf7da1da2b690c4ae0579b09b879bfa.tar.bz2
flashrom-ad470347fdf7da1da2b690c4ae0579b09b879bfa.zip
Introduce ERROR_FATAL, abort upon failed chipset enables
Corresponding to flashrom svn r1426. Signed-off-by: Tadas Slotkus <devtadas@gmail.com> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
-rw-r--r--chipset_enable.c4
-rw-r--r--flash.h5
-rw-r--r--internal.c3
3 files changed, 10 insertions, 2 deletions
diff --git a/chipset_enable.c b/chipset_enable.c
index eb4031ba3..21f2e86d9 100644
--- a/chipset_enable.c
+++ b/chipset_enable.c
@@ -1325,6 +1325,10 @@ int chipset_flash_enable(void)
msg_pinfo("OK.\n");
else if (ret == ERROR_NONFATAL)
msg_pinfo("PROBLEMS, continuing anyway\n");
+ if (ret == ERROR_FATAL) {
+ msg_perr("FATAL ERROR!\n");
+ return ret;
+ }
}
s = flashbuses_to_text(buses_supported);
diff --git a/flash.h b/flash.h
index 3d47a165b..535c1b867 100644
--- a/flash.h
+++ b/flash.h
@@ -224,9 +224,12 @@ int write_buf_to_file(unsigned char *buf, unsigned long size, const char *filena
#define OK 0
#define NT 1 /* Not tested */
-/* Something happened that shouldn't happen, but we can go on */
+/* Something happened that shouldn't happen, but we can go on. */
#define ERROR_NONFATAL 0x100
+/* Something happened that shouldn't happen, we'll abort. */
+#define ERROR_FATAL -0xee
+
/* cli_output.c */
/* Let gcc and clang check for correct printf-style format strings. */
int print(int type, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
diff --git a/internal.c b/internal.c
index 846cf1e94..46836b7d3 100644
--- a/internal.c
+++ b/internal.c
@@ -268,7 +268,8 @@ int internal_init(void)
if (ret == -2) {
msg_perr("WARNING: No chipset found. Flash detection "
"will most likely fail.\n");
- }
+ } else if (ret == ERROR_FATAL)
+ return ret;
#if defined(__i386__) || defined(__x86_64__)
/* Probe unconditionally for IT87* LPC->SPI translation and for