Am 30.05.2014 05:15 schrieb Stefan Tauner:
> Add headers and columns (i.e. print device entries in a table-like manner).
> Also, add and use test_state_to_text() to support the new test states.
>
> Signed-off-by: Stefan Tauner <stefan.tauner(a)alumni.tuwien.ac.at>
Thanks!
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Regards,
Carl-Daniel
--
http://www.hailfinger.org/
Found this bitrotting away on my disk. Rebased from r1645, last time all
snippets compiled was r1539. If you kill the cli_classic.c hunk, it
should compile. That hunk was in the patch to make sure the msg_gspew()
calls in selfcheck() aren't no-ops by default. Hm. This seems to be a
bug still in HEAD.
Not for direct merge, there are other random changes in there as well.
Stefan, you already wrote a patch doing a board enable array selfcheck,
and AFAICS yours checks some more bits.
AFAICS the most interesting point in this patch are the verbose
messages/comments.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Index: flashrom-boardenable_selfcheck/cli_classic.c
===================================================================
--- flashrom-boardenable_selfcheck/cli_classic.c (Revision 1806)
+++ flashrom-boardenable_selfcheck/cli_classic.c (Arbeitskopie)
@@ -139,8 +139,10 @@
print_version();
print_banner();
+ verbose = 2;
if (selfcheck())
exit(1);
+ verbose = 0;
setbuf(stdout, NULL);
/* FIXME: Delay all operation_specified checks until after command
Index: flashrom-boardenable_selfcheck/flashrom.c
===================================================================
--- flashrom-boardenable_selfcheck/flashrom.c (Revision 1806)
+++ flashrom-boardenable_selfcheck/flashrom.c (Arbeitskopie)
@@ -1303,6 +1303,10 @@
eraser.eraseblocks[i].size;
}
/* Empty eraseblock definition with erase function. */
+ /* FIXME: This message will never trigger because spew and debug
+ * messages are not printed at this stage before debug variable
+ * initialization.
+ */
if (!done && eraser.block_erase)
msg_gspew("Strange: Empty eraseblock definition with "
"non-empty erase function. Not an error.\n");
@@ -1768,7 +1772,11 @@
ret = 1;
}
}
+ ret = 1;
}
+ if (selfcheck_boardenables()) {
+ msg_gerr("Board enable self check failed!\n");
+ }
/* TODO: implement similar sanity checks for other arrays where deemed necessary. */
return ret;
Index: flashrom-boardenable_selfcheck/programmer.h
===================================================================
--- flashrom-boardenable_selfcheck/programmer.h (Revision 1806)
+++ flashrom-boardenable_selfcheck/programmer.h (Arbeitskopie)
@@ -263,6 +263,7 @@
uint8_t sio_read(uint16_t port, uint8_t reg);
void sio_write(uint16_t port, uint8_t reg, uint8_t data);
void sio_mask(uint16_t port, uint8_t reg, uint8_t data, uint8_t mask);
+int selfcheck_boardenables(void);
void board_handle_before_superio(void);
void board_handle_before_laptop(void);
int board_flash_enable(const char *vendor, const char *model, const char *cb_vendor, const char *cb_model);
Index: flashrom-boardenable_selfcheck/board_enable.c
===================================================================
--- flashrom-boardenable_selfcheck/board_enable.c (Revision 1806)
+++ flashrom-boardenable_selfcheck/board_enable.c (Arbeitskopie)
@@ -2532,9 +2532,72 @@
return NULL;
}
+int selfcheck_boardenables(void)
+{
+ struct board_pciid_enable *board = board_pciid_enables;
+ int ret = 0;
+ int i = 0;
+
+ for (; board->vendor_name; board++) {
+ if (!board->first_vendor) {
+ /* This would only be valid for boards which don't have
+ * any onboard PCI devices at all.
+ */
+ msg_gerr("Zero first vendor in position %i "
+ "of the board enable table\n", i);
+ ret = 1;
+ }
+ if (!board->first_device) {
+ /* This would only be valid for boards which don't have
+ * any onboard PCI devices at all.
+ */
+ msg_gerr("Zero first device in position %i "
+ "of the board enable table\n", i);
+ ret = 1;
+ }
+ if (!board->board_name) {
+ /* A nameless board in the list is a maintenance
+ * nightmare.
+ */
+ msg_gerr("Missing board name in position %i "
+ "of the board enable table\n", i);
+ ret = 1;
+ }
+ if (!board->first_card_vendor && !board->dmi_pattern) {
+ msg_gerr("Zero first subsystem vendor and no DMI "
+ "pattern in position %i of the board enable "
+ "table\n", i);
+ ret = 1;
+ }
+ if (!board->first_card_device && !board->dmi_pattern) {
+ msg_gerr("Zero first subsystem device and no DMI "
+ "pattern in position %i of the board enable "
+ "table\n", i);
+ ret = 1;
+ }
+ if (!board->first_card_vendor && board->dmi_pattern) {
+ /* Such boards are usually really old. No error. */
+ msg_gspew("Zero first subsystem vendor but with DMI pattern in position %i "
+ "of the board enable table\n", i);
+ }
+ if (!board->first_card_device && board->dmi_pattern) {
+ /* Such boards are usually really old. No error. */
+ msg_gspew("Zero first subsystem device but with DMI pattern in position %i "
+ "of the board enable table\n", i);
+ }
+
+ i++;
+ }
+
+ return ret;
+}
+
/*
* Match boards on PCI IDs and subsystem IDs.
* Second set of IDs can be either main+subsystem IDs, main IDs or no IDs.
+ *
+ * Logic of this function: First PCI dev has to match ven/dev/subven/subdev.
+ * The second PCI dev is completely optional (bad idea).
*/
const static struct board_match *board_match_pci_ids(enum board_match_phase phase)
{
--
http://www.hailfinger.org/
From: Stefan Tauner <stefan.tauner(a)student.tuwien.ac.at>
Without this...
Erasing and writing flash chip... ERASE FAILED at 0x00001000! Expected=0xff, Read=0xb4, failed byte count from 0x00000000-0x0000ffff: 0xef09
ERASE FAILED!
Reading current flash chip contents... done.
<loooooong break while the next eraser and writing is tried>
Erase/write done.
Verifying flash... VERIFIED.
Even if there is not a long temporal pause, it is very confusing for
the user to first see a failed erase, followed by a read, a done
message and eventually the verification message.
This patch inserts "Looking for another erase function." where there is
just a silent break above.
Signed-off-by: Stefan Tauner <stefan.tauner(a)alumni.tuwien.ac.at>
---
flashrom.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/flashrom.c b/flashrom.c
index 98101b7..4438dc6 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1470,9 +1470,9 @@ int erase_and_write_flash(struct flashctx *flash, uint8_t *oldcontents, uint8_t
for (k = 0; k < NUM_ERASEFUNCTIONS; k++) {
if (k != 0)
- msg_cdbg("Looking for another erase function.\n");
+ msg_cinfo("Looking for another erase function.\n");
if (!usable_erasefunctions) {
- msg_cdbg("No usable erase functions left.\n");
+ msg_cinfo("No usable erase functions left.\n");
break;
}
msg_cdbg("Trying erase function %i... ", k);
--
Kind regards, Stefan Tauner