Handle programmer init errors and abort. If the programmer didn't
initialize correctly, it is pointless to continue.

Fix standalone IT87* SPI init to set flashbus to NONE if no IT87* SPI
communication is possible.
Print the I/O port detected by the IT87* SPI code.

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

Index: flashrom-programmer_init_errorcheck_it87spi_initfix/it87spi.c
===================================================================
--- flashrom-programmer_init_errorcheck_it87spi_initfix/it87spi.c       
(Revision 632)
+++ flashrom-programmer_init_errorcheck_it87spi_initfix/it87spi.c       
(Arbeitskopie)
@@ -83,11 +83,12 @@
                        tmp |= 1 << 4;
                        sio_write(port, 0x24, tmp);
                }
-               printf("serial flash pin %i\n", (tmp & 1 << 5) ? 87 : 29);
+               printf("Serial flash pin %i\n", (tmp & 1 << 5) ? 87 : 29);
                /* LDN 0x7, reg 0x64/0x65 */
                sio_write(port, 0x07, 0x7);
                flashport = sio_read(port, 0x64) << 8;
                flashport |= sio_read(port, 0x65);
+               printf("Serial flash port 0x%04x\n", flashport);
        }
        exit_conf_mode_ite(port);
        return flashport;
@@ -113,8 +114,11 @@
 
        get_io_perms();
        ret = it87spi_common_init();
-       if (!ret)
+       if (!ret) {
                buses_supported = CHIP_BUSTYPE_SPI;
+       } else {
+               buses_supported = CHIP_BUSTYPE_NONE;
+       }
        return ret;
 }
 
Index: flashrom-programmer_init_errorcheck_it87spi_initfix/flashrom.c
===================================================================
--- flashrom-programmer_init_errorcheck_it87spi_initfix/flashrom.c      
(Revision 632)
+++ flashrom-programmer_init_errorcheck_it87spi_initfix/flashrom.c      
(Arbeitskopie)
@@ -692,7 +692,10 @@
        if (optind < argc)
                filename = argv[optind++];
 
-       ret = programmer_init();
+       if (programmer_init()) {
+               fprintf(stderr, "Error: Programmer initialization failed.\n");
+               exit(1);
+       }
 
        myusec_calibrate_delay();
 


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

Index: flashrom-programmer_init_errorcheck_it87spi_initfix/it87spi.c
===================================================================
--- flashrom-programmer_init_errorcheck_it87spi_initfix/it87spi.c       
(Revision 632)
+++ flashrom-programmer_init_errorcheck_it87spi_initfix/it87spi.c       
(Arbeitskopie)
@@ -83,11 +83,12 @@
                        tmp |= 1 << 4;
                        sio_write(port, 0x24, tmp);
                }
-               printf("serial flash pin %i\n", (tmp & 1 << 5) ? 87 : 29);
+               printf("Serial flash pin %i\n", (tmp & 1 << 5) ? 87 : 29);
                /* LDN 0x7, reg 0x64/0x65 */
                sio_write(port, 0x07, 0x7);
                flashport = sio_read(port, 0x64) << 8;
                flashport |= sio_read(port, 0x65);
+               printf("Serial flash port 0x%04x\n", flashport);
        }
        exit_conf_mode_ite(port);
        return flashport;
@@ -113,8 +114,11 @@
 
        get_io_perms();
        ret = it87spi_common_init();
-       if (!ret)
+       if (!ret) {
                buses_supported = CHIP_BUSTYPE_SPI;
+       } else {
+               buses_supported = CHIP_BUSTYPE_NONE;
+       }
        return ret;
 }
 
Index: flashrom-programmer_init_errorcheck_it87spi_initfix/flashrom.c
===================================================================
--- flashrom-programmer_init_errorcheck_it87spi_initfix/flashrom.c      
(Revision 632)
+++ flashrom-programmer_init_errorcheck_it87spi_initfix/flashrom.c      
(Arbeitskopie)
@@ -692,7 +692,10 @@
        if (optind < argc)
                filename = argv[optind++];
 
-       ret = programmer_init();
+       if (programmer_init()) {
+               fprintf(stderr, "Error: Programmer initialization failed.\n");
+               exit(1);
+       }
 
        myusec_calibrate_delay();
 
-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to