Fix ICH SPI reprogram_opcode_on_the_fly return code.
Helpful for SFDP debugging.

Signed-off-by: Carl-Daniel Hailfinger <[email protected]>

Index: flashrom-sfdp_read_dummy_reduce_param_chunksize/ichspi.c
===================================================================
--- flashrom-ichspi_invalid_length_consistent/ichspi.c  (Revision 1528)
+++ flashrom-ichspi_invalid_length_consistent/ichspi.c  (Arbeitskopie)
@@ -416,7 +416,10 @@
                msg_pdbg ("on-the-fly OPCODE (0x%02X) re-programmed, 
op-pos=%d\n", opcode, oppos);
                return oppos;
        }
-       return -1;
+       /* This case only happens if the writecnt/readcnt combination is
+        * impossible to achieve on ICH SPI.
+        */
+       return SPI_INVALID_LENGTH;
 }
 
 static int find_opcode(OPCODES *op, uint8_t opcode)
@@ -1001,7 +1004,11 @@
        if (opcode_index == -1) {
                if (!ichspi_lock)
                        opcode_index = reprogram_opcode_on_the_fly(cmd, 
writecnt, readcnt);
-               if (opcode_index == -1) {
+               if (opcode_index == SPI_INVALID_LENGTH) {
+                       msg_pdbg("OPCODE 0x%02x has unsupported length, will "
+                                "not execute.\n", cmd);
+                       return SPI_INVALID_LENGTH;
+               } else if (opcode_index == -1) {
                        msg_pdbg("Invalid OPCODE 0x%02x, will not execute.\n",
                                 cmd);
                        return SPI_INVALID_OPCODE;


-- 
http://www.hailfinger.org/


_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to