OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the flashrom project. | 2 * This file is part of the flashrom project. |
3 * | 3 * |
4 * Copyright (C) 2000 Silicon Integrated System Corporation | 4 * Copyright (C) 2000 Silicon Integrated System Corporation |
5 * Copyright (C) 2004 Tyan Corp <yhlu@tyan.com> | 5 * Copyright (C) 2004 Tyan Corp <yhlu@tyan.com> |
6 * Copyright (C) 2005-2008 coresystems GmbH | 6 * Copyright (C) 2005-2008 coresystems GmbH |
7 * Copyright (C) 2008,2009,2010 Carl-Daniel Hailfinger | 7 * Copyright (C) 2008,2009,2010 Carl-Daniel Hailfinger |
8 * | 8 * |
9 * This program is free software; you can redistribute it and/or modify | 9 * This program is free software; you can redistribute it and/or modify |
10 * it under the terms of the GNU General Public License as published by | 10 * it under the terms of the GNU General Public License as published by |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include <getopt.h> | 30 #include <getopt.h> |
31 #include <errno.h> | 31 #include <errno.h> |
32 #include "big_lock.h" | 32 #include "big_lock.h" |
33 #include "flash.h" | 33 #include "flash.h" |
34 #include "flashchips.h" | 34 #include "flashchips.h" |
35 #include "programmer.h" | 35 #include "programmer.h" |
36 #include "writeprotect.h" | 36 #include "writeprotect.h" |
37 | 37 |
38 #define LOCK_TIMEOUT_SECS 30 | 38 #define LOCK_TIMEOUT_SECS 30 |
39 | 39 |
| 40 /* This variable is shared with doit() in flashrom.c */ |
| 41 int set_ignore_fmap = 0; |
| 42 |
40 void cli_mfg_usage(const char *name) | 43 void cli_mfg_usage(const char *name) |
41 { | 44 { |
42 const char *pname; | 45 const char *pname; |
43 int pnamelen; | 46 int pnamelen; |
44 int remaining = 0; | 47 int remaining = 0; |
45 enum programmer p; | 48 enum programmer p; |
46 | 49 |
47 printf("Usage: %s [-n] [-V] [-f] [-h|-R|-L|" | 50 printf("Usage: %s [-n] [-V] [-f] [-h|-R|-L|" |
48 #if CONFIG_PRINT_WIKI == 1 | 51 #if CONFIG_PRINT_WIKI == 1 |
49 "-z|" | 52 "-z|" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 "from flash layout.\n" | 89 "from flash layout.\n" |
87 " the content are included " | 90 " the content are included " |
88 "in <file> if specified.\n" | 91 "in <file> if specified.\n" |
89 " -L | --list-supported print supported devices\n" | 92 " -L | --list-supported print supported devices\n" |
90 #if CONFIG_PRINT_WIKI == 1 | 93 #if CONFIG_PRINT_WIKI == 1 |
91 " -z | --list-supported-wiki print supported devices " | 94 " -z | --list-supported-wiki print supported devices " |
92 "in wiki syntax\n" | 95 "in wiki syntax\n" |
93 #endif | 96 #endif |
94 " -p | --programmer <name>[:<param>] specify the programmer " | 97 " -p | --programmer <name>[:<param>] specify the programmer " |
95 "device" | 98 "device" |
| 99 " --ignore-fmap don't try to parse the " |
| 100 "fmap structure on the flash\n" |
96 ); | 101 ); |
97 | 102 |
98 for (p = 0; p < PROGRAMMER_INVALID; p++) { | 103 for (p = 0; p < PROGRAMMER_INVALID; p++) { |
99 pname = programmer_table[p].name; | 104 pname = programmer_table[p].name; |
100 pnamelen = strlen(pname); | 105 pnamelen = strlen(pname); |
101 if (remaining - pnamelen - 2 < 0) { | 106 if (remaining - pnamelen - 2 < 0) { |
102 printf("\n "); | 107 printf("\n "); |
103 remaining = 43; | 108 remaining = 43; |
104 } else { | 109 } else { |
105 printf(" "); | 110 printf(" "); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 148 } |
144 | 149 |
145 enum LONGOPT_RETURN_VALUES { | 150 enum LONGOPT_RETURN_VALUES { |
146 /* start after ASCII chars */ | 151 /* start after ASCII chars */ |
147 LONGOPT_GET_SIZE = 256, | 152 LONGOPT_GET_SIZE = 256, |
148 LONGOPT_WP_STATUS, | 153 LONGOPT_WP_STATUS, |
149 LONGOPT_WP_SET_RANGE, | 154 LONGOPT_WP_SET_RANGE, |
150 LONGOPT_WP_ENABLE, | 155 LONGOPT_WP_ENABLE, |
151 LONGOPT_WP_DISABLE, | 156 LONGOPT_WP_DISABLE, |
152 LONGOPT_WP_LIST, | 157 LONGOPT_WP_LIST, |
| 158 LONGOPT_IGNORE_FMAP, |
153 }; | 159 }; |
154 | 160 |
155 int cli_mfg(int argc, char *argv[]) | 161 int cli_mfg(int argc, char *argv[]) |
156 { | 162 { |
157 unsigned long size; | 163 unsigned long size; |
158 /* Probe for up to three flash chips. */ | 164 /* Probe for up to three flash chips. */ |
159 struct flashchip *flash, *flashes[3]; | 165 struct flashchip *flash, *flashes[3]; |
160 const char *name; | 166 const char *name; |
161 int namelen; | 167 int namelen; |
162 int opt; | 168 int opt; |
(...skipping 27 matching lines...) Expand all Loading... |
190 {"list-supported-wiki", 0, 0, 'z'}, | 196 {"list-supported-wiki", 0, 0, 'z'}, |
191 {"programmer", 1, 0, 'p'}, | 197 {"programmer", 1, 0, 'p'}, |
192 {"help", 0, 0, 'h'}, | 198 {"help", 0, 0, 'h'}, |
193 {"version", 0, 0, 'R'}, | 199 {"version", 0, 0, 'R'}, |
194 {"get-size", 0, 0, LONGOPT_GET_SIZE}, | 200 {"get-size", 0, 0, LONGOPT_GET_SIZE}, |
195 {"wp-status", 0, 0, LONGOPT_WP_STATUS}, | 201 {"wp-status", 0, 0, LONGOPT_WP_STATUS}, |
196 {"wp-range", 0, 0, LONGOPT_WP_SET_RANGE}, | 202 {"wp-range", 0, 0, LONGOPT_WP_SET_RANGE}, |
197 {"wp-enable", 0, 0, LONGOPT_WP_ENABLE}, | 203 {"wp-enable", 0, 0, LONGOPT_WP_ENABLE}, |
198 {"wp-disable", 0, 0, LONGOPT_WP_DISABLE}, | 204 {"wp-disable", 0, 0, LONGOPT_WP_DISABLE}, |
199 {"wp-list", 0, 0, LONGOPT_WP_LIST}, | 205 {"wp-list", 0, 0, LONGOPT_WP_LIST}, |
| 206 {"ignore-fmap", 0, 0, LONGOPT_IGNORE_FMAP}, |
200 {0, 0, 0, 0} | 207 {0, 0, 0, 0} |
201 }; | 208 }; |
202 | 209 |
203 char *filename = NULL; | 210 char *filename = NULL; |
204 | 211 |
205 char *tempstr = NULL; | 212 char *tempstr = NULL; |
206 char *pparam = NULL; | 213 char *pparam = NULL; |
207 | 214 |
208 print_version(); | 215 print_version(); |
209 | 216 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 break; | 386 break; |
380 case LONGOPT_WP_SET_RANGE: | 387 case LONGOPT_WP_SET_RANGE: |
381 set_wp_range = 1; | 388 set_wp_range = 1; |
382 break; | 389 break; |
383 case LONGOPT_WP_ENABLE: | 390 case LONGOPT_WP_ENABLE: |
384 set_wp_enable = 1; | 391 set_wp_enable = 1; |
385 break; | 392 break; |
386 case LONGOPT_WP_DISABLE: | 393 case LONGOPT_WP_DISABLE: |
387 set_wp_disable = 1; | 394 set_wp_disable = 1; |
388 break; | 395 break; |
| 396 case LONGOPT_IGNORE_FMAP: |
| 397 set_ignore_fmap = 1; |
| 398 break; |
389 default: | 399 default: |
390 cli_mfg_abort_usage(argv[0]); | 400 cli_mfg_abort_usage(argv[0]); |
391 break; | 401 break; |
392 } | 402 } |
393 } | 403 } |
394 | 404 |
395 /* FIXME: Print the actions flashrom will take. */ | 405 /* FIXME: Print the actions flashrom will take. */ |
396 | 406 |
397 if (list_supported) { | 407 if (list_supported) { |
398 print_supported(); | 408 print_supported(); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 | 606 |
597 msg_ginfo("%s\n", rc ? "FAILED" : "SUCCESS"); | 607 msg_ginfo("%s\n", rc ? "FAILED" : "SUCCESS"); |
598 cli_mfg_silent_exit: | 608 cli_mfg_silent_exit: |
599 programmer_shutdown(); /* must be done after chip_restore() */ | 609 programmer_shutdown(); /* must be done after chip_restore() */ |
600 cli_mfg_release_lock_exit: | 610 cli_mfg_release_lock_exit: |
601 #if USE_BIG_LOCK == 1 | 611 #if USE_BIG_LOCK == 1 |
602 release_big_lock(); | 612 release_big_lock(); |
603 #endif | 613 #endif |
604 return rc; | 614 return rc; |
605 } | 615 } |
OLD | NEW |