[flashrom] [PATCH 2/5] Move check_chip_supported() to cli_classic.c.
Stefan Tauner
stefan.tauner at alumni.tuwien.ac.at
Mon Jun 9 14:41:16 CEST 2014
This function clearly belongs to the command line interface and should
therefore reside in cli_classic.c and not in flashrom.c.
Signed-off-by: Stefan Tauner <stefan.tauner at alumni.tuwien.ac.at>
---
cli_classic.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
flashrom.c | 67 -----------------------------------------------------------
programmer.h | 1 -
3 files changed, 67 insertions(+), 68 deletions(-)
diff --git a/cli_classic.c b/cli_classic.c
index fc1b9ba..54b0d07 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -89,6 +89,73 @@ static int check_filename(char *filename, char *type)
return 0;
}
+static void check_chip_supported(const struct flashchip *chip)
+{
+ if (chip->feature_bits & FEATURE_OTP) {
+ msg_cdbg("This chip may contain one-time programmable memory. "
+ "flashrom cannot read\nand may never be able to write "
+ "it, hence it may not be able to completely\n"
+ "clone the contents of this chip (see man page for "
+ "details).\n");
+ }
+
+ if ((chip->tested.erase == NA) && (chip->tested.write == NA)) {
+ msg_cdbg("This chip's main memory can not be erased/written by design.\n");
+ }
+
+ 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)){
+ msg_cinfo("===\n");
+ if ((chip->tested.probe == BAD) ||
+ (chip->tested.read == BAD) ||
+ (chip->tested.erase == BAD) ||
+ (chip->tested.write == BAD)) {
+ msg_cinfo("This flash part has status NOT WORKING for operations:");
+ if (chip->tested.probe == BAD)
+ msg_cinfo(" PROBE");
+ if (chip->tested.read == BAD)
+ msg_cinfo(" READ");
+ if (chip->tested.erase == BAD)
+ msg_cinfo(" ERASE");
+ if (chip->tested.write == BAD)
+ msg_cinfo(" WRITE");
+ msg_cinfo("\n");
+ }
+ if ((chip->tested.probe == NT) ||
+ (chip->tested.read == NT) ||
+ (chip->tested.erase == NT) ||
+ (chip->tested.write == NT)) {
+ msg_cinfo("This flash part has status UNTESTED for operations:");
+ if (chip->tested.probe == NT)
+ msg_cinfo(" PROBE");
+ if (chip->tested.read == NT)
+ msg_cinfo(" READ");
+ if (chip->tested.erase == NT)
+ msg_cinfo(" ERASE");
+ if (chip->tested.write == NT)
+ msg_cinfo(" WRITE");
+ msg_cinfo("\n");
+ }
+ /* FIXME: This message is designed towards CLI users. */
+ msg_cinfo("The test status of this chip may have been updated "
+ "in the latest development\n"
+ "version of flashrom. If you are running the latest "
+ "development version,\n"
+ "please email a report to flashrom at flashrom.org if "
+ "any of the above operations\n"
+ "work correctly for you with this flash part. Please "
+ "include the flashrom\n"
+ "output with the additional -V option for all "
+ "operations you tested (-V, -Vr,\n"
+ "-VE, -Vw), and mention which mainboard or "
+ "programmer you tested.\n"
+ "Please mention your board in the subject line. "
+ "Thanks for your help!\n");
+ }
+}
+
int main(int argc, char *argv[])
{
unsigned long size;
diff --git a/flashrom.c b/flashrom.c
index a8a8533..f8978f1 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1798,73 +1798,6 @@ int selfcheck(void)
return ret;
}
-void check_chip_supported(const struct flashchip *chip)
-{
- if (chip->feature_bits & FEATURE_OTP) {
- msg_cdbg("This chip may contain one-time programmable memory. "
- "flashrom cannot read\nand may never be able to write "
- "it, hence it may not be able to completely\n"
- "clone the contents of this chip (see man page for "
- "details).\n");
- }
-
- if ((chip->tested.erase == NA) && (chip->tested.write == NA)) {
- msg_cdbg("This chip's main memory can not be erased/written by design.\n");
- }
-
- 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)){
- msg_cinfo("===\n");
- if ((chip->tested.probe == BAD) ||
- (chip->tested.read == BAD) ||
- (chip->tested.erase == BAD) ||
- (chip->tested.write == BAD)) {
- msg_cinfo("This flash part has status NOT WORKING for operations:");
- if (chip->tested.probe == BAD)
- msg_cinfo(" PROBE");
- if (chip->tested.read == BAD)
- msg_cinfo(" READ");
- if (chip->tested.erase == BAD)
- msg_cinfo(" ERASE");
- if (chip->tested.write == BAD)
- msg_cinfo(" WRITE");
- msg_cinfo("\n");
- }
- if ((chip->tested.probe == NT) ||
- (chip->tested.read == NT) ||
- (chip->tested.erase == NT) ||
- (chip->tested.write == NT)) {
- msg_cinfo("This flash part has status UNTESTED for operations:");
- if (chip->tested.probe == NT)
- msg_cinfo(" PROBE");
- if (chip->tested.read == NT)
- msg_cinfo(" READ");
- if (chip->tested.erase == NT)
- msg_cinfo(" ERASE");
- if (chip->tested.write == NT)
- msg_cinfo(" WRITE");
- msg_cinfo("\n");
- }
- /* FIXME: This message is designed towards CLI users. */
- msg_cinfo("The test status of this chip may have been updated "
- "in the latest development\n"
- "version of flashrom. If you are running the latest "
- "development version,\n"
- "please email a report to flashrom at flashrom.org if "
- "any of the above operations\n"
- "work correctly for you with this flash part. Please "
- "include the flashrom\n"
- "output with the additional -V option for all "
- "operations you tested (-V, -Vr,\n"
- "-VE, -Vw), and mention which mainboard or "
- "programmer you tested.\n"
- "Please mention your board in the subject line. "
- "Thanks for your help!\n");
- }
-}
-
/* FIXME: This function signature needs to be improved once doit() has a better
* function signature.
*/
diff --git a/programmer.h b/programmer.h
index d299656..867eee9 100644
--- a/programmer.h
+++ b/programmer.h
@@ -503,7 +503,6 @@ struct decode_sizes {
extern struct decode_sizes max_rom_decode;
extern int programmer_may_write;
extern unsigned long flashbase;
-void check_chip_supported(const struct flashchip *chip);
int check_max_decode(enum chipbustype buses, uint32_t size);
char *extract_programmer_param(const char *param_name);
--
Kind regards, Stefan Tauner
More information about the flashrom
mailing list