From newforest333 at hotmail.ca Fri Jun 1 04:00:28 2012 From: newforest333 at hotmail.ca (Bicks Factory) Date: Thu, 31 May 2012 22:00:28 -0400 Subject: [flashrom] external programmer In-Reply-To: <201205311154.q4VBs8mU008036@mail2.student.tuwien.ac.at> References: , <201205311154.q4VBs8mU008036@mail2.student.tuwien.ac.at> Message-ID: Okay so I am making progress.......I ran flashrom without connecting or specifing the programmer and this is the result. trevtsx06 at TestBedUbuntu:~$ sudo flashrom -V flashrom v0.9.5.2-r1517 on Linux 3.2.0-24-generic-pae (i686), built with libpci 3.1.8, GCC 4.6.3, little endian flashrom is free software, get the source code at http://www.flashrom.org Calibrating delay loop... OS timer resolution is 1 usecs, 2400M loops per second, 10 myus = 10 us, 100 myus = 100 us, 1000 myus = 1000 us, 10000 myus = 10001 us, 4 myus = 4 us, OK. Initializing internal programmer No coreboot table found. DMI string system-manufacturer: "MSI" DMI string system-product-name: "MS-7592" DMI string system-version: "1.0" DMI string baseboard-manufacturer: "MSI" DMI string baseboard-product-name: "G41M4 (MS-7592)" DMI string baseboard-version: "1.0" DMI string chassis-type: "Desktop" Found chipset "Intel ICH7/ICH7R" with PCI ID 8086:27b8. Enabling flash write... 0xfff80000/0xffb80000 FWH IDSEL: 0x0 0xfff00000/0xffb00000 FWH IDSEL: 0x0 0xffe80000/0xffa80000 FWH IDSEL: 0x1 0xffe00000/0xffa00000 FWH IDSEL: 0x1 0xffd80000/0xff980000 FWH IDSEL: 0x2 0xffd00000/0xff900000 FWH IDSEL: 0x2 0xffc80000/0xff880000 FWH IDSEL: 0x3 0xffc00000/0xff800000 FWH IDSEL: 0x3 0xff700000/0xff300000 FWH IDSEL: 0x4 0xff600000/0xff200000 FWH IDSEL: 0x5 0xff500000/0xff100000 FWH IDSEL: 0x6 0xff400000/0xff000000 FWH IDSEL: 0x7 0xfff80000/0xffb80000 FWH decode enabled 0xfff00000/0xffb00000 FWH decode enabled 0xffe80000/0xffa80000 FWH decode disabled 0xffe00000/0xffa00000 FWH decode disabled 0xffd80000/0xff980000 FWH decode disabled 0xffd00000/0xff900000 FWH decode disabled 0xffc80000/0xff880000 FWH decode disabled 0xffc00000/0xff800000 FWH decode disabled 0xff700000/0xff300000 FWH decode disabled 0xff600000/0xff200000 FWH decode disabled 0xff500000/0xff100000 FWH decode disabled 0xff400000/0xff000000 FWH decode disabled Maximum FWH chip size: 0x100000 bytes BIOS Lock Enable: disabled, BIOS Write Enable: disabled, BIOS_CNTL is 0x0 Root Complex Register Block address = 0xfed1c000 GCS = 0x465: BIOS Interface Lock-Down: enabled, Boot BIOS Straps: 0x1 (SPI) Top Swap : not enabled SPIBAR = 0xfed1c000 + 0x3020 0x00: 0x0004 (SPIS) 0x02: 0x4140 (SPIC) 0x04: 0x00000000 (SPIA) 0x08: 0xc21413c2 (SPID0) 0x0c: 0xffffffff (SPID0+4) 0x10: 0xffffffff (SPID1) 0x14: 0xffffffff (SPID1+4) 0x18: 0x00000000 (SPID2) 0x1c: 0x00000000 (SPID2+4) 0x20: 0x00000000 (SPID3) 0x24: 0x00000000 (SPID3+4) 0x28: 0x00000000 (SPID4) 0x2c: 0x00000000 (SPID4+4) 0x30: 0x00000000 (SPID5) 0x34: 0x00000000 (SPID5+4) 0x38: 0x00000000 (SPID6) 0x3c: 0x00000000 (SPID6+4) 0x40: 0x00000000 (SPID7) 0x44: 0x00000000 (SPID7+4) 0x50: 0x00000000 (BBAR) 0x54: 0x0006 (PREOP) 0x56: 0x543b (OPTYPE) 0x58: 0x05200302 (OPMENU) 0x5c: 0x0006019f (OPMENU+4) 0x60: 0x00000000 (PBR0) 0x64: 0x00000000 (PBR1) 0x68: 0x00000000 (PBR2) Programming OPCODES... program_opcodes: preop=5006 optype=463b opmenu=05d80302c79f0190 done SPI Read Configuration: prefetching disabled, caching enabled, OK. The following protocols are supported: SPI. Probing for AMIC A25L05PT, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L05PU, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L10PT, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L10PU, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L20PT, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L20PU, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L40PT, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L40PU, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L80P, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L16PT, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L16PU, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L512, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L010, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L020, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L040, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L080, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L016, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L032, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25LQ032, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DF021, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DF041A, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DF081, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DF081A, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DF161, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DF321, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DF321A, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DF641(A), 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DQ161, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25F512B, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25FS010, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25FS040, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT26DF041, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT26DF081A, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT26DF161, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT26DF161A, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT26F004, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45CS1282, 16896 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45DB011D, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45DB021D, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45DB041D, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45DB081D, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45DB161D, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45DB321C, 4224 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45DB321D, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45DB642D, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for EMST F25L008A, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B05, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B05T, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B10, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B10T, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B20, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B20T, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B40, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B40T, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B80, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B80T, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B16T, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B32, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B32T, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B64, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B64T, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25F05, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25F10, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25F20, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25F40, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25F80, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25F16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25F32, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25Q40, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25Q80(A), 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25Q16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25Q32(A/B), 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25Q64, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25Q128, 16384 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25QH16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L512, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L1005, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L2005, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L4005, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L8005, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Chip status register is 00 Chip status register: Status Register Write Disable (SRWD) is not set Chip status register: Bit 6 is not set Chip status register: Bit 5 / Block Protect 3 (BP3) is not set Chip status register: Bit 4 / Block Protect 2 (BP2) is not set Chip status register: Bit 3 / Block Protect 1 (BP1) is not set Chip status register: Bit 2 / Block Protect 0 (BP0) is not set Chip status register: Write Enable Latch (WEL) is not set Chip status register: Write In Progress (WIP/BUSY) is not set Found Macronix flash chip "MX25L8005" (1024 kB, SPI) at physical address 0xfff00000. Probing for Macronix MX25L1605, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L1635D, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L1635E, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L3205, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L3235D, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L6405, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L12805, 16384 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Numonyx M25PE10, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Numonyx M25PE20, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Numonyx M25PE40, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Numonyx M25PE80, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Numonyx M25PE16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for PMC Pm25LV010, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for PMC Pm25LV016B, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for PMC Pm25LV020, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for PMC Pm25LV040, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for PMC Pm25LV080B, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for PMC Pm25LV512, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Sanyo LF25FW203A, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Spansion S25FL004A, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Spansion S25FL008A, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Spansion S25FL016A, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Spansion S25FL032A, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Spansion S25FL064A, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for SST SST25LF040A, 512 kB: program_opcodes: preop=5006 optype=462b opmenu=05ab0302c79f0190 on-the-fly OPCODE (0xAB) re-programmed, op-pos=2 probe_spi_res2: id1 0x13, id2 0x13 Probing for SST SST25LF080A, 1024 kB: probe_spi_res2: id1 0x13, id2 0x13 Probing for SST SST25VF010, 128 kB: probe_spi_rems: id1 0xc2, id2 0x13 Probing for SST SST25VF016B, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for SST SST25VF032B, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for SST SST25VF064C, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for SST SST25VF040, 512 kB: probe_spi_rems: id1 0xc2, id2 0x13 Probing for SST SST25VF040B, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for SST SST25VF040B.REMS, 512 kB: probe_spi_rems: id1 0xc2, id2 0x13 Probing for SST SST25VF080B, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P05-A, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P05, 64 kB: Ignoring RES in favour of RDID. Probing for ST M25P10-A, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P10, 128 kB: Ignoring RES in favour of RDID. Probing for ST M25P20, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P40, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P40-old, 512 kB: Ignoring RES in favour of RDID. Probing for ST M25P80, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P32, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P64, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P128, 16384 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25PX16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25PX32, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25PX64, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25Q80, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25Q16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25Q32, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25Q64, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25Q128, 16384 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25X10, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25X20, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25X40, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25X80, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25X16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25X32, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25X64, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Unknown SFDP-capable chip, 0 kB: program_opcodes: preop=5006 optype=462b opmenu=055a0302c79f0190 on-the-fly OPCODE (0x5A) re-programmed, op-pos=2 No SFDP signature found. Probing for AMIC unknown AMIC SPI chip, 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel unknown Atmel SPI chip, 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon unknown Eon SPI chip, 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix unknown Macronix SPI chip, 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for PMC unknown PMC SPI chip, 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for SST unknown SST SPI chip, 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST unknown ST SPI chip, 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Sanyo unknown Sanyo SPI chip, 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Generic unknown SPI chip (RDID), 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Generic unknown SPI chip (REMS), 0 kB: probe_spi_rems: id1 0xc2, id2 0x13 Found Macronix flash chip "MX25L8005" (1024 kB, SPI). No operations were specified. Restoring MMIO space at 0xb7777070 Restoring MMIO space at 0xb777707c Restoring MMIO space at 0xb7777078 Restoring MMIO space at 0xb7777076 Restoring MMIO space at 0xb7777074 Restoring PCI config space for 00:1f:0 reg 0xdc I ran flashrom with the programmer plugged into usb but not to the board being flashed. Ran with -V and this is what I got. trevtsx06 at TestBedUbuntu:~$ sudo flashrom -p ft2232_spi:type=tumpa -V flashrom v0.9.5.2-r1517 on Linux 3.2.0-24-generic-pae (i686), built with libpci 3.1.8, GCC 4.6.3, little endian flashrom is free software, get the source code at http://www.flashrom.org Calibrating delay loop... OS timer resolution is 1 usecs, 2399M loops per second, 10 myus = 10 us, 100 myus = 100 us, 1000 myus = 1000 us, 10000 myus = 10004 us, 4 myus = 4 us, OK. Initializing ft2232_spi programmer Using device type TIAO USB Multi-Protocol Adapter interface A Disable divide-by-5 front stage Set clock divisor MPSSE clock: 60.000000 MHz divisor: 3 SPI clock: 10.000000 MHz No loopback of TDI/DO TDO/DI Set data bits The following protocols are supported: SPI. Probing for AMIC A25L05PT, 64 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25L05PU, 64 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25L10PT, 128 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25L10PU, 128 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25L20PT, 256 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25L20PU, 256 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25L40PT, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25L40PU, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25L80P, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25L16PT, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25L16PU, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25L512, 64 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25L010, 128 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25L020, 256 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25L040, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25L080, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25L016, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25L032, 4096 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for AMIC A25LQ032, 4096 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT25DF021, 256 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT25DF041A, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT25DF081, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT25DF081A, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT25DF161, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT25DF321, 4096 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT25DF321A, 4096 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT25DF641(A), 8192 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT25DQ161, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT25F512B, 64 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT25FS010, 128 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT25FS040, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT26DF041, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT26DF081A, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT26DF161, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT26DF161A, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT26F004, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT45CS1282, 16896 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT45DB011D, 128 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT45DB021D, 256 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT45DB041D, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT45DB081D, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT45DB161D, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT45DB321C, 4224 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT45DB321D, 4096 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel AT45DB642D, 8192 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for EMST F25L008A, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25B05, 64 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25B05T, 64 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25B10, 128 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25B10T, 128 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25B20, 256 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25B20T, 256 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25B40, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25B40T, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25B80, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25B80T, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25B16, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25B16T, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25B32, 4096 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25B32T, 4096 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25B64, 8192 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25B64T, 8192 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25F05, 64 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25F10, 128 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25F20, 256 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25F40, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25F80, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25F16, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25F32, 4096 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25Q40, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25Q80(A), 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25Q16, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25Q32(A/B), 4096 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25Q64, 8192 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25Q128, 16384 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon EN25QH16, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Macronix MX25L512, 64 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Macronix MX25L1005, 128 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Macronix MX25L2005, 256 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Macronix MX25L4005, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Macronix MX25L8005, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Macronix MX25L1605, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Macronix MX25L1635D, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Macronix MX25L1635E, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Macronix MX25L3205, 4096 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Macronix MX25L3235D, 4096 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Macronix MX25L6405, 8192 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Macronix MX25L12805, 16384 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Numonyx M25PE10, 128 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Numonyx M25PE20, 256 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Numonyx M25PE40, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Numonyx M25PE80, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Numonyx M25PE16, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for PMC Pm25LV010, 128 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for PMC Pm25LV016B, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for PMC Pm25LV020, 256 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for PMC Pm25LV040, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for PMC Pm25LV080B, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for PMC Pm25LV512, 64 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Sanyo LF25FW203A, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Spansion S25FL004A, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Spansion S25FL008A, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Spansion S25FL016A, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Spansion S25FL032A, 4096 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Spansion S25FL064A, 8192 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for SST SST25LF040A, 512 kB: probe_spi_res2: id1 0xff, id2 0xff Probing for SST SST25LF080A, 1024 kB: probe_spi_res2: id1 0xff, id2 0xff Probing for SST SST25VF010, 128 kB: probe_spi_rems: id1 0xff, id2 0xff Probing for SST SST25VF016B, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for SST SST25VF032B, 4096 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for SST SST25VF064C, 8192 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for SST SST25VF040, 512 kB: probe_spi_rems: id1 0xff, id2 0xff Probing for SST SST25VF040B, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for SST SST25VF040B.REMS, 512 kB: probe_spi_rems: id1 0xff, id2 0xff Probing for SST SST25VF080B, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for ST M25P05-A, 64 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for ST M25P05, 64 kB: probe_spi_res1: id 0xff Probing for ST M25P10-A, 128 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for ST M25P10, 128 kB: probe_spi_res1: id 0xff Probing for ST M25P20, 256 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for ST M25P40, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for ST M25P40-old, 512 kB: probe_spi_res1: id 0xff Probing for ST M25P80, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for ST M25P16, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for ST M25P32, 4096 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for ST M25P64, 8192 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for ST M25P128, 16384 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for ST M25PX16, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for ST M25PX32, 4096 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for ST M25PX64, 8192 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Winbond W25Q80, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Winbond W25Q16, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Winbond W25Q32, 4096 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Winbond W25Q64, 8192 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Winbond W25Q128, 16384 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Winbond W25X10, 128 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Winbond W25X20, 256 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Winbond W25X40, 512 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Winbond W25X80, 1024 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Winbond W25X16, 2048 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Winbond W25X32, 4096 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Winbond W25X64, 8192 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Unknown SFDP-capable chip, 0 kB: No SFDP signature found. Probing for AMIC unknown AMIC SPI chip, 0 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Atmel unknown Atmel SPI chip, 0 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Eon unknown Eon SPI chip, 0 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Macronix unknown Macronix SPI chip, 0 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for PMC unknown PMC SPI chip, 0 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for SST unknown SST SPI chip, 0 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for ST unknown ST SPI chip, 0 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Sanyo unknown Sanyo SPI chip, 0 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Generic unknown SPI chip (RDID), 0 kB: RDID byte 0 parity violation. probe_spi_rdid_generic: id1 0xff, id2 0xffff Probing for Generic unknown SPI chip (REMS), 0 kB: probe_spi_rems: id1 0xff, id2 0xff No EEPROM/flash device found. Note: flashrom can never write if the flash chip isn't found automatically. Okay so next I plugged into board being flashed and the result. trevtsx06 at TestBedUbuntu:~$ sudo flashrom -p ft2232_spi:type=tumpa -V flashrom v0.9.5.2-r1517 on Linux 3.2.0-24-generic-pae (i686), built with libpci 3.1.8, GCC 4.6.3, little endian flashrom is free software, get the source code at http://www.flashrom.org Calibrating delay loop... OS timer resolution is 1 usecs, 2400M loops per second, 10 myus = 10 us, 100 myus = 100 us, 1000 myus = 1000 us, 10000 myus = 10002 us, 4 myus = 4 us, OK. Initializing ft2232_spi programmer Using device type TIAO USB Multi-Protocol Adapter interface A Disable divide-by-5 front stage Set clock divisor MPSSE clock: 60.000000 MHz divisor: 3 SPI clock: 10.000000 MHz No loopback of TDI/DO TDO/DI Set data bits The following protocols are supported: SPI. Probing for AMIC A25L05PT, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L05PU, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L10PT, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L10PU, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L20PT, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L20PU, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L40PT, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L40PU, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L80P, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L16PT, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L16PU, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L512, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L010, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L020, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L040, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L080, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L016, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25L032, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for AMIC A25LQ032, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DF021, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DF041A, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DF081, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DF081A, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DF161, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DF321, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DF321A, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DF641(A), 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25DQ161, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25F512B, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25FS010, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT25FS040, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT26DF041, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT26DF081A, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT26DF161, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT26DF161A, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT26F004, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45CS1282, 16896 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45DB011D, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45DB021D, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45DB041D, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45DB081D, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45DB161D, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45DB321C, 4224 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45DB321D, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel AT45DB642D, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for EMST F25L008A, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B05, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B05T, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B10, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B10T, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B20, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B20T, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B40, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B40T, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B80, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B80T, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B16T, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B32, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B32T, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B64, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25B64T, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25F05, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25F10, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25F20, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25F40, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25F80, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25F16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25F32, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25Q40, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25Q80(A), 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25Q16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25Q32(A/B), 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25Q64, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25Q128, 16384 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon EN25QH16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L512, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L1005, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L2005, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L4005, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L8005, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Chip status register is 00 Chip status register: Status Register Write Disable (SRWD) is not set Chip status register: Bit 6 is not set Chip status register: Bit 5 / Block Protect 3 (BP3) is not set Chip status register: Bit 4 / Block Protect 2 (BP2) is not set Chip status register: Bit 3 / Block Protect 1 (BP1) is not set Chip status register: Bit 2 / Block Protect 0 (BP0) is not set Chip status register: Write Enable Latch (WEL) is not set Chip status register: Write In Progress (WIP/BUSY) is not set Found Macronix flash chip "MX25L8005" (1024 kB, SPI) on ft2232_spi. Probing for Macronix MX25L1605, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L1635D, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L1635E, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L3205, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L3235D, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L6405, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix MX25L12805, 16384 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Numonyx M25PE10, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Numonyx M25PE20, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Numonyx M25PE40, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Numonyx M25PE80, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Numonyx M25PE16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for PMC Pm25LV010, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for PMC Pm25LV016B, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for PMC Pm25LV020, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for PMC Pm25LV040, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for PMC Pm25LV080B, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for PMC Pm25LV512, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Sanyo LF25FW203A, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Spansion S25FL004A, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Spansion S25FL008A, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Spansion S25FL016A, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Spansion S25FL032A, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Spansion S25FL064A, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for SST SST25LF040A, 512 kB: probe_spi_res2: id1 0x13, id2 0x13 Probing for SST SST25LF080A, 1024 kB: probe_spi_res2: id1 0x13, id2 0x13 Probing for SST SST25VF010, 128 kB: probe_spi_rems: id1 0xc2, id2 0x13 Probing for SST SST25VF016B, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for SST SST25VF032B, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for SST SST25VF064C, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for SST SST25VF040, 512 kB: probe_spi_rems: id1 0xc2, id2 0x13 Probing for SST SST25VF040B, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for SST SST25VF040B.REMS, 512 kB: probe_spi_rems: id1 0xc2, id2 0x13 Probing for SST SST25VF080B, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P05-A, 64 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P05, 64 kB: Ignoring RES in favour of RDID. Probing for ST M25P10-A, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P10, 128 kB: Ignoring RES in favour of RDID. Probing for ST M25P20, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P40, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P40-old, 512 kB: Ignoring RES in favour of RDID. Probing for ST M25P80, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P32, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P64, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25P128, 16384 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25PX16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25PX32, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST M25PX64, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25Q80, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25Q16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25Q32, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25Q64, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25Q128, 16384 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25X10, 128 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25X20, 256 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25X40, 512 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25X80, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25X16, 2048 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25X32, 4096 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Winbond W25X64, 8192 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Unknown SFDP-capable chip, 0 kB: No SFDP signature found. Probing for AMIC unknown AMIC SPI chip, 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Atmel unknown Atmel SPI chip, 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Eon unknown Eon SPI chip, 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Macronix unknown Macronix SPI chip, 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for PMC unknown PMC SPI chip, 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for SST unknown SST SPI chip, 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for ST unknown ST SPI chip, 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Sanyo unknown Sanyo SPI chip, 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Generic unknown SPI chip (RDID), 0 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Probing for Generic unknown SPI chip (REMS), 0 kB: probe_spi_rems: id1 0xc2, id2 0x13 Found Macronix flash chip "MX25L8005" (1024 kB, SPI). No operations were specified. So it seems to find a flash chip. Unfortunately this is the flash chip of the board being flashed from. The chip it is supposed to see is. SST SST25VF080B, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 Just a little more info. I picked up a used motherboard off of Kijiji, an Asus P5b Deluxe brought it home didnt work. Unfortunately I cant get a hold of the seller. Googled seems to be a bad bios flash from windows. Tried the parallel port to spi method, my cable was no good, got different chip readings from flashrom everytime. I got the pinouts of the spi headers from the site that showed the parallel port to spi method and from the TIAO wiki which is the tumpa maker. > Date: Thu, 31 May 2012 13:54:08 +0200 > From: stefan.tauner at student.tuwien.ac.at > To: newforest333 at hotmail.ca > CC: flashrom at flashrom.org > Subject: Re: [flashrom] external programmer > > On Thu, 31 May 2012 07:27:03 -0400 > Bicks Factory wrote: > > > Hey thanks for taking time to help out. So I went and got a copy of debian os to try. I installed it but had too many problems with network cards not being detected and getting root privlages etc. That was a waste of a cd. So I went to ubuntu 12.04. Installed on hard drive and couldnt get flashrom to install at all. Changed the server location were ubuntu was looking for flashrom from CAN site to default server. Worked. So now I have ubuntu installed with flashrom. I checked and libftdi is installed aswell. Unfortunately I get the same problem. Cant detect/see my external programmer. I am hoping someone that has got this thing to work can add some usefull instructions on how they got this to work. > > Thanks again. > > I hope Im responding in the right manner. Not sure if this is going to a personal email or if this is going to the mailing list. > > can you please send us the complete output of flashrom you get (please > ensure that there is at least one -V parameter in your command line so > that we see useful debug information). > the output of lsusb would also be interesting. > > i can only think of three possible problems: > your flashrom version is too old (unlikely with ubuntu 12.04), or the > programmer has different IDs than flashrom expects, or there is a > communication problem that flashrom/libftdi does not diagnose correctly. > > > Stefan Tauner wrote: > > > > On Thu, 24 May 2012 22:04:50 -0400 > > Bicks Factory wrote: > > > > > > > > > > > Trying to use an external programmer, specifically the > > > TIAO/DIYGADGET USB Multi-Protocol Adapter (TUMPA). > > > Running from a live cd of parted magic. Using flashrom v0.9.5.2-r1515. > > > Run command: flashrom -p ft2232_spi:type=tumpa > > > get back: unknown programmer ft2232_spi:type=tumpa. > > > Motherboard is a MSI G41M-F. > > > Flashrom can see the flash chip on the board. Intel ich7 > > > Not really used to using command prompt or linux. > > > I'm assuming I'm missing some usb drivers. > > > > > > > > > Any help would be greatly appreciated. > > > > hello! > > > > that's not your fault (and admittedly the error message could be a bit > > better). the problem seems to be that flashrom was compiled without > > support for the ft2232_spi programmer in parted magic to safe space. > > so you need to get another live cd or build flashrom yourself (not > > really recommended when you dont know linux and the command line :) > > > > i am not aware of any live cd that ships a full build of flashrom (i > > was not aware yet, that they actually strip them down. it is not the > > default to do so, so they did it on consciously). > > the livecds of the bigger distributions such as ubuntu should be able > > to install packages after boot, which is necessary because flashrom is > > not added to the cds themselves and they should be the complete version. > > this requires either internet access after boot or some manual > > preparation though... > > hth > > > -- > Kind regards/Mit freundlichen Gr??en, Stefan Tauner -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan.tauner at student.tuwien.ac.at Fri Jun 1 10:40:43 2012 From: stefan.tauner at student.tuwien.ac.at (Stefan Tauner) Date: Fri, 1 Jun 2012 10:40:43 +0200 Subject: [flashrom] external programmer In-Reply-To: References: <201205311154.q4VBs8mU008036@mail2.student.tuwien.ac.at> Message-ID: <201206010840.q518ehqf026348@mail2.student.tuwien.ac.at> On Thu, 31 May 2012 22:00:28 -0400 Bicks Factory wrote: > Found Macronix flash chip "MX25L8005" (1024 kB, SPI). > No operations were specified. > > > So it seems to find a flash chip. Unfortunately this is the flash chip of the board being flashed from. The chip it is supposed to see is. > SST SST25VF080B, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 how did you come to the conclusion that the chip is a SST SST25VF080B and not a Macronix MX25L8005? -- Kind regards/Mit freundlichen Gr??en, Stefan Tauner From newforest333 at hotmail.ca Fri Jun 1 20:38:53 2012 From: newforest333 at hotmail.ca (Bicks Factory) Date: Fri, 1 Jun 2012 14:38:53 -0400 Subject: [flashrom] external programmer Message-ID: http://wildbagger.com/wordpress/tag/p5b/ This is the website that explains my problem and why it should be a sst chip.? Stefan Tauner wrote: On Thu, 31 May 2012 22:00:28 -0400 Bicks Factory wrote: > Found Macronix flash chip "MX25L8005" (1024 kB, SPI). > No operations were specified. > > > So it seems to find a flash chip. Unfortunately this is the flash chip of the board being flashed from. The chip it is supposed to see is. > SST SST25VF080B, 1024 kB: probe_spi_rdid_generic: id1 0xc2, id2 0x2014 how did you come to the conclusion that the chip is a SST SST25VF080B and not a Macronix MX25L8005? -- Kind regards/Mit freundlichen Gr??en, Stefan Tauner -------------- next part -------------- An HTML attachment was scrubbed... URL: From niso at kth.se Fri Jun 1 21:31:17 2012 From: niso at kth.se (=?UTF-8?q?Niklas=20S=C3=B6derlund?=) Date: Fri, 1 Jun 2012 21:31:17 +0200 Subject: [flashrom] [PATCH] remove exit calls from sp_opensocket Message-ID: <1338579077-7193-1-git-send-email-niso@kth.se> Replace with return statements and adopt the only upstream caller which in turn all plumbing is place for Signed-off-by: Niklas S?derlund --- serprog.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/serprog.c b/serprog.c index d06fb0b..02996ea 100644 --- a/serprog.c +++ b/serprog.c @@ -110,20 +110,25 @@ static int sp_opensocket(char *ip, unsigned int port) int sock; msg_pdbg(MSGHEADER "IP %s port %d\n", ip, port); sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); - if (sock < 0) - sp_die("Error: serprog cannot open socket"); + if (sock < 0) { + msg_perr("Error: serprog cannot open socket: %s\n", strerror(errno)); + return -1; + } hostPtr = gethostbyname(ip); if (NULL == hostPtr) { hostPtr = gethostbyaddr(ip, strlen(ip), AF_INET); - if (NULL == hostPtr) - sp_die("Error: cannot resolve"); + if (NULL == hostPtr) { + msg_perr("Error: cannot resolve: %s\n", strerror(errno)); + return -1; + } } sp.si.sin_family = AF_INET; sp.si.sin_port = htons(port); (void)memcpy(&sp.si.sin_addr, hostPtr->h_addr, hostPtr->h_length); if (connect(sock, &sp.s, sizeof(sp.si)) < 0) { close(sock); - sp_die("Error: serprog cannot connect"); + msg_perr("Error: serprog cannot connect: %s\n", strerror(errno)); + return -1; } /* We are latency limited, and sometimes do write-write-read * * (write-n) - so enable TCP_NODELAY. */ @@ -398,6 +403,10 @@ int serprog_init(void) } if (strlen(device)) { sp_fd = sp_opensocket(device, atoi(baudport)); + if (sp_fd < 0) { + free(device); + return 1; + } have_device++; } } -- 1.7.10.3 From niso at kth.se Fri Jun 1 22:39:58 2012 From: niso at kth.se (=?UTF-8?q?Niklas=20S=C3=B6derlund?=) Date: Fri, 1 Jun 2012 22:39:58 +0200 Subject: [flashrom] [PATCH] remove exit calls from sp_sync_read_timeout and sp_synchronize Message-ID: <1338583198-12930-1-git-send-email-niso@kth.se> Add return values to sp_synchronize so we can signal a failure to the only upstream caller, which is prepared to propagate a failure. The addition of a return code to signal a failure from the read syscall in sp_sync_read_timeout is a bit of a stretch and might look strange. But the only caller is in the loop in sp_synchronize and any sequential call to read will result in the same error and end result. But please take a extra look on this to make sure we don't miss any corner case. The alternative would be to differentiate between a read failure over fast detection of a EAGAIN. The end result would in my opinion only make the code harder to read. The cost is that upon read failure the user might be spammed up to 10 times with the same error message before flashrom dies. Signed-off-by: Niklas S?derlund --- serprog.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/serprog.c b/serprog.c index 02996ea..f03d332 100644 --- a/serprog.c +++ b/serprog.c @@ -145,8 +145,10 @@ static int sp_sync_read_timeout(int loops) rv = read(sp_fd, &c, 1); if (rv == 1) return c; - if ((rv == -1) && (errno != EAGAIN)) - sp_die("read"); + if ((rv == -1) && (errno != EAGAIN)) { + msg_perr("read: %s\n", strerror(errno)); + return -1; + } usleep(10 * 1000); /* 10ms units */ } return -1; @@ -158,7 +160,7 @@ static int sp_sync_read_timeout(int loops) * blocking read - TODO: add an alarm() timer for the rest of the app on * * serial operations, though not such a big issue as the first thing to * * do is synchronize (eg. check that device is alive). */ -static void sp_synchronize(void) +static int sp_synchronize(void) { int i; int flags = fcntl(sp_fd, F_GETFL); @@ -169,8 +171,10 @@ static void sp_synchronize(void) * the device serial parser to get to a sane state, unless if it * * is waiting for a real long write-n. */ memset(buf, S_CMD_NOP, 8); - if (write(sp_fd, buf, 8) != 8) - sp_die("flush write"); + if (write(sp_fd, buf, 8) != 8) { + msg_perr("flush write: %s\n", strerror(errno)); + return 1; + } /* A second should be enough to get all the answers to the buffer */ usleep(1000 * 1000); sp_flush_incoming(); @@ -181,9 +185,11 @@ static void sp_synchronize(void) * attempt, ~1s if immediate success. */ for (i = 0; i < 8; i++) { int n; - unsigned char c = S_CMD_SYNCNOP; - if (write(sp_fd, &c, 1) != 1) - sp_die("sync write"); + int c = S_CMD_SYNCNOP; + if (write(sp_fd, &c, 1) != 1) { + msg_perr("sync write: %s\n", strerror(errno)); + return 1; + } msg_pdbg("."); fflush(stdout); for (n = 0; n < 10; n++) { @@ -194,8 +200,10 @@ static void sp_synchronize(void) if (c != S_ACK) continue; c = S_CMD_SYNCNOP; - if (write(sp_fd, &c, 1) != 1) - sp_die("sync write"); + if (write(sp_fd, &c, 1) != 1) { + msg_perr("sync write: %s\n", strerror(errno)); + return 1; + } c = sp_sync_read_timeout(50); if (c != S_NAK) break; /* fail */ @@ -206,12 +214,12 @@ static void sp_synchronize(void) flags &= ~O_NONBLOCK; fcntl(sp_fd, F_SETFL, flags); msg_pdbg("\n"); - return; + return 0; } } msg_perr("Error: cannot synchronize protocol " "- check communications and reset device?\n"); - exit(1); + return 1; } static int sp_check_commandavail(uint8_t command) @@ -432,7 +440,8 @@ int serprog_init(void) sp_check_avail_automatic = 0; - sp_synchronize(); + if (sp_synchronize()) + return 1; msg_pdbg(MSGHEADER "Synchronized\n"); -- 1.7.10.3 From juraj at lutter.sk Fri Jun 1 22:10:06 2012 From: juraj at lutter.sk (Juraj Lutter) Date: Fri, 01 Jun 2012 22:10:06 +0200 Subject: [flashrom] output of flashrom -Vr Message-ID: <4FC9219E.2040400@lutter.sk> otis at zed ~/code/flashrom-1.0 $ sudo ./flashrom -Vr xx flashrom v0.9.5.2-r1538 on Linux 3.2.0-2-amd64 (x86_64), built with libpci 3.1.8, GCC 4.6.3, little endian flashrom is free software, get the source code at http://www.flashrom.org Command line (2 args): ./flashrom -Vr xx Calibrating delay loop... OS timer resolution is 1 usecs, 1415M loops per second, 10 myus = 10 us, 100 myus = 117 us, 1000 myus = 973 us, 10000 myus = 9945 us, 4 myus = 8 us, OK. Initializing internal programmer No coreboot table found. DMI string system-manufacturer: "Hewlett-Packard" DMI string system-product-name: "HP Z400 Workstation" DMI string system-version: " " DMI string baseboard-manufacturer: "Hewlett-Packard" DMI string baseboard-product-name: "0AE4h" DMI string baseboard-version: "Not Specified" DMI string chassis-type: "Mini Tower" Found chipset "Intel ICH10R" with PCI ID 8086:3a16. Enabling flash write... 0xfff80000/0xffb80000 FWH IDSEL: 0x0 0xfff00000/0xffb00000 FWH IDSEL: 0x0 0xffe80000/0xffa80000 FWH IDSEL: 0x1 0xffe00000/0xffa00000 FWH IDSEL: 0x1 0xffd80000/0xff980000 FWH IDSEL: 0x2 0xffd00000/0xff900000 FWH IDSEL: 0x2 0xffc80000/0xff880000 FWH IDSEL: 0x3 0xffc00000/0xff800000 FWH IDSEL: 0x3 0xff700000/0xff300000 FWH IDSEL: 0x4 0xff600000/0xff200000 FWH IDSEL: 0x5 0xff500000/0xff100000 FWH IDSEL: 0x6 0xff400000/0xff000000 FWH IDSEL: 0x7 0xfff80000/0xffb80000 FWH decode enabled 0xfff00000/0xffb00000 FWH decode enabled 0xffe80000/0xffa80000 FWH decode enabled 0xffe00000/0xffa00000 FWH decode enabled 0xffd80000/0xff980000 FWH decode disabled 0xffd00000/0xff900000 FWH decode disabled 0xffc80000/0xff880000 FWH decode disabled 0xffc00000/0xff800000 FWH decode disabled 0xff700000/0xff300000 FWH decode disabled 0xff600000/0xff200000 FWH decode disabled 0xff500000/0xff100000 FWH decode disabled 0xff400000/0xff000000 FWH decode disabled Maximum FWH chip size: 0x100000 bytes BIOS Lock Enable: enabled, BIOS Write Enable: disabled, BIOS_CNTL is 0x2 WARNING: Setting 0xdc from 0x2 to 0x3 on ICH10R failed. New value is 0x2. Root Complex Register Block address = 0xfed1c000 GCS = 0x464: BIOS Interface Lock-Down: disabled, Boot BIOS Straps: 0x1 (SPI) Top Swap : not enabled SPIBAR = 0xfed1c000 + 0x3800 0x04: 0xa008 (HSFS) HSFS: FDONE=0, FCERR=0, AEL=0, BERASE=1, SCIP=0, FDOPSS=1, FDV=0, FLOCKDN=1 WARNING: SPI Configuration Lockdown activated. Reading OPCODES... done 0x08: 0x001fffc0 (FADDR) 0x74: 0x81ff01f0 PR0: WARNING: 0x001f0000-0x001fffff is read-only. Please send a verbose log to flashrom at flashrom.org if this board is not listed on http://flashrom.org/Supported_hardware#Supported_mainboards yet. Writes have been disabled. You can enforce write support with the ich_spi_force programmer option, but it will most likely harm your hardware! If you force flashrom you will get no support if something breaks. 0x90: 0x04 (SSFS) SSFS: SCIP=0, FDONE=1, FCERR=0, AEL=0 0x91: 0x007f40 (SSFC) SSFC: SCGO=0, ACS=0, SPOP=0, COP=4, DBC=63, SME=0, SCF=0 0x94: 0x0606 (PREOP) 0x96: 0xb6f0 (OPTYPE) 0x98: 0x0220059f (OPMENU) 0x9C: 0x03020103 (OPMENU+4) 0xA0: 0x00000000 (BBAR) SPI Read Configuration: prefetching disabled, caching enabled, PROBLEMS, continuing anyway The following protocols are supported: FWH, SPI. Probing for AMIC A25L05PT, 64 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25L05PU, 64 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25L10PT, 128 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25L10PU, 128 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25L20PT, 256 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25L20PU, 256 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25L40PT, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25L40PU, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25L80P, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25L16PT, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25L16PU, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25L512, 64 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25L010, 128 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25L020, 256 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25L040, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25L080, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25L016, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25L032, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for AMIC A25LQ032, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT25DF021, 256 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT25DF041A, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT25DF081, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT25DF081A, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT25DF161, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT25DF321, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT25DF321A, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT25DF641(A), 8192 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT25DQ161, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT25F512B, 64 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT25FS010, 128 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT25FS040, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT26DF041, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT26DF081A, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT26DF161, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Chip status register is 10 Found Atmel flash chip "AT26DF161" (2048 kB, SPI) at physical address 0xffe00000. Chip status register is 10 Chip status register: Sector Protection Register Lock (SRPL) is not set Chip status register: Bit 6 is not set Chip status register: Erase/Program Error (EPE) is not set Chip status register: WP# pin (WPP) is not asserted Chip status register: Software Protection Status (SWP): no sectors are protected Chip status register: Write Enable Latch (WEL) is not set Chip status register: Write In Progress (WIP/BUSY) is not set Probing for Atmel AT26DF161A, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT26F004, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT45CS1282, 16896 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT45DB011D, 128 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT45DB021D, 256 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT45DB041D, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT45DB081D, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT45DB161D, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT45DB321C, 4224 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT45DB321D, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel AT45DB642D, 8192 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for EMST F25L008A, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25B05, 64 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25B05T, 64 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25B10, 128 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25B10T, 128 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25B20, 256 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25B20T, 256 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25B40, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25B40T, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25B80, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25B80T, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25B16, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25B16T, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25B32, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25B32T, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25B64, 8192 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25B64T, 8192 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25F05, 64 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25F10, 128 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25F20, 256 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25F40, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25F80, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25F16, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25F32, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25Q40, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25Q80(A), 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25Q16, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25Q32(A/B), 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25Q64, 8192 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25Q128, 16384 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25QH16, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon EN25QH32, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for GigaDevice GD25Q20, 256 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for GigaDevice GD25Q40, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for GigaDevice GD25Q80, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for GigaDevice GD25Q16, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for GigaDevice GD25Q32, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for GigaDevice GD25Q64, 8192 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for GigaDevice GD25Q128, 16384 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Macronix MX25L512, 64 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Macronix MX25L1005, 128 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Macronix MX25L2005, 256 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Macronix MX25L4005, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Macronix MX25L8005, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Macronix MX25L1605, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Macronix MX25L1635D, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Macronix MX25L1635E, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Macronix MX25L3205, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Macronix MX25L3235D, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Macronix MX25L6405, 8192 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Macronix MX25L12805, 16384 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Numonyx M25PE10, 128 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Numonyx M25PE20, 256 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Numonyx M25PE40, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Numonyx M25PE80, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Numonyx M25PE16, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Numonyx N25Q064, 8192 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for PMC Pm25LV010, 128 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for PMC Pm25LV016B, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for PMC Pm25LV020, 256 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for PMC Pm25LV040, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for PMC Pm25LV080B, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for PMC Pm25LV512, 64 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Sanyo LF25FW203A, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Spansion S25FL004A, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Spansion S25FL008A, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Spansion S25FL016A, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Spansion S25FL032A, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Spansion S25FL064A, 8192 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for SST SST25LF040A, 512 kB: Invalid OPCODE 0xab, will not execute. Probing for SST SST25LF080A, 1024 kB: Invalid OPCODE 0xab, will not execute. Probing for SST SST25VF010, 128 kB: Invalid OPCODE 0x90, will not execute. Probing for SST SST25VF016B, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for SST SST25VF032B, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for SST SST25VF064C, 8192 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for SST SST25VF040, 512 kB: Invalid OPCODE 0x90, will not execute. Probing for SST SST25VF040B, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for SST SST25VF040B.REMS, 512 kB: Invalid OPCODE 0x90, will not execute. Probing for SST SST25VF080B, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for ST M25P05-A, 64 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for ST M25P05, 64 kB: Ignoring RES in favour of RDID. Probing for ST M25P10-A, 128 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for ST M25P10, 128 kB: Ignoring RES in favour of RDID. Probing for ST M25P20, 256 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for ST M25P40, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for ST M25P40-old, 512 kB: Ignoring RES in favour of RDID. Probing for ST M25P80, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for ST M25P16, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for ST M25P32, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for ST M25P64, 8192 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for ST M25P128, 16384 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for ST M25PX16, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for ST M25PX32, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for ST M25PX64, 8192 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Winbond W25Q80, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Winbond W25Q16, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Winbond W25Q32, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Winbond W25Q64, 8192 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Winbond W25Q128, 16384 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Winbond W25X10, 128 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Winbond W25X20, 256 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Winbond W25X40, 512 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Winbond W25X80, 1024 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Winbond W25X16, 2048 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Winbond W25X32, 4096 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Winbond W25X64, 8192 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Unknown SFDP-capable chip, 0 kB: Invalid OPCODE 0x5a, will not execute. Receiving SFDP signature failed. Probing for AMIC unknown AMIC SPI chip, 0 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Atmel unknown Atmel SPI chip, 0 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Eon unknown Eon SPI chip, 0 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Macronix unknown Macronix SPI chip, 0 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for PMC unknown PMC SPI chip, 0 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for SST unknown SST SPI chip, 0 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for ST unknown ST SPI chip, 0 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Sanyo unknown Sanyo SPI chip, 0 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Generic unknown SPI chip (RDID), 0 kB: probe_spi_rdid_generic: id1 0x1f, id2 0x4600 Probing for Generic unknown SPI chip (REMS), 0 kB: Invalid OPCODE 0x90, will not execute. Probing for Atmel AT49LH002, 256 kB: probe_82802ab: id1 0x22, id2 0x2f, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for Intel 82802AB, 512 kB: probe_82802ab: id1 0x18, id2 0xf1, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for Intel 82802AC, 1024 kB: probe_82802ab: id1 0xff, id2 0xff, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for PMC Pm49FL002, 256 kB: probe_jedec_common: id1 0x22, id2 0x2f, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for PMC Pm49FL004, 512 kB: probe_jedec_common: id1 0x18, id2 0xf1, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for Sharp LHF00L04, 1024 kB: probe_82802ab: id1 0xff, id2 0xff, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for SST SST49LF002A/B, 256 kB: probe_jedec_common: id1 0x22, id2 0x2f, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for SST SST49LF003A/B, 384 kB: probe_jedec_common: id1 0x78, id2 0xfc, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for SST SST49LF004A/B, 512 kB: probe_jedec_common: id1 0x18, id2 0xf1, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for SST SST49LF004C, 512 kB: probe_82802ab: id1 0x18, id2 0xf1, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for SST SST49LF008A, 1024 kB: probe_jedec_common: id1 0xff, id2 0xff, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for SST SST49LF008C, 1024 kB: probe_82802ab: id1 0xff, id2 0xff, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for SST SST49LF016C, 2048 kB: Chip size 2048 kB is bigger than supported size 1024 kB of chipset/board/programmer for FWH interface, probe/read/erase/write may fail. probe_82802ab: id1 0xff, id2 0xff, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for ST M50FLW040A, 512 kB: probe_82802ab: id1 0x18, id2 0xf1, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for ST M50FLW040B, 512 kB: probe_82802ab: id1 0x18, id2 0xf1, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for ST M50FLW080A, 1024 kB: probe_82802ab: id1 0xff, id2 0xff, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for ST M50FLW080B, 1024 kB: probe_82802ab: id1 0xff, id2 0xff, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for ST M50FW002, 256 kB: probe_82802ab: id1 0x22, id2 0x2f, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for ST M50FW016, 2048 kB: Chip size 2048 kB is bigger than supported size 1024 kB of chipset/board/programmer for FWH interface, probe/read/erase/write may fail. probe_82802ab: id1 0xff, id2 0xff, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for ST M50FW040, 512 kB: probe_82802ab: id1 0x18, id2 0xf1, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for ST M50FW080, 1024 kB: probe_82802ab: id1 0xff, id2 0xff, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for Winbond W39V040FA, 512 kB: probe_jedec_common: id1 0x18, id2 0xf1, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for Winbond W39V040FB, 512 kB: probe_jedec_common: id1 0x18, id2 0xf1, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for Winbond W39V040FC, 512 kB: probe_jedec_common: id1 0x18, id2 0xf1, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for Winbond W49V002FA, 256 kB: probe_jedec_common: id1 0x22, id2 0x2f, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for Winbond W39V080FA, 1024 kB: probe_jedec_common: id1 0xff, id2 0xff, id1 parity violation, id1 is normal flash content, id2 is normal flash content Probing for Winbond W39V080FA (dual mode), 512 kB: probe_jedec_common: id1 0x18, id2 0xf1, id1 parity violation, id1 is normal flash content, id2 is normal flash content Found Atmel flash chip "AT26DF161" (2048 kB, SPI). === This flash part has status UNTESTED for operations: PROBE READ ERASE WRITE The test status of this chip may have been updated in the latest development version of flashrom. If you are running the latest development version, please email a report to flashrom at flashrom.org if any of the above operations work correctly for you with this flash part. Please include the flashrom output with the additional -V option for all operations you tested (-V, -Vr, -VE, -Vw), and mention which mainboard or programmer you tested. Please mention your board in the subject line. Thanks for your help! Some block protection in effect, disabling Block protection could not be disabled! Reading flash... done. Restoring MMIO space at 0x7f80c933b8a0 Restoring PCI config space for 00:1f:0 reg 0xdc -- Juraj Lutter | /\ ASCII Ribbon Campaign otis (at) wilbury (dot) sk | \/ - NO HTML/RTF in e-mail http://www.wilbury.sk/ | /\ - NO Word docs in e-mail JID: otis (at) jabber (dot) vx (dot) sk !07/11 PDP a ni deppart m'I !pleH From c-d.hailfinger.devel.2006 at gmx.net Sat Jun 2 15:29:05 2012 From: c-d.hailfinger.devel.2006 at gmx.net (Carl-Daniel Hailfinger) Date: Sat, 02 Jun 2012 15:29:05 +0200 Subject: [flashrom] [PATCH] Add logfile support to flashrom In-Reply-To: <201205172259.q4HMx8Op015734@mail2.student.tuwien.ac.at> References: <4DF12DDE.9000401@gmx.net> <20110611142151.GE6443@greenwood> <4DF38206.20903@home.nl> <4DF53AAF.6000700@gmx.net> <4DF53D2B.7090006@home.nl> <4DF69FA1.6070705@gmx.net> <201106171328.p5HDSU4l017284@mail2.student.tuwien.ac.at> <201106191244.p5JCiSbM005768@mail2.student.tuwien.ac.at> <4E3092B5.9020307@gmx.net> <4F03A676.1040006@gmx.net> <201202092013.q19KDFpe031614@mail2.student.tuwien.ac.at> <4FA1C4E2.5040500@gmx.net> <4FAA6E14.8010901@gmx.net> <201205091354.q49DsfCB026816@mail2.student.tuwien.ac.at> <4FAAF447.80807@gmx.net> <4FB34898.5070306@gmx.net> <201205172259.q4HMx8Op015734@mail2.student.tuwien.ac.at> Message-ID: <4FCA1521.8050806@gmx.net> Am 18.05.2012 00:59 schrieb Stefan Tauner: > On Wed, 16 May 2012 08:26:32 +0200 > Carl-Daniel Hailfinger wrote: > >> Am 10.05.2012 00:48 schrieb Carl-Daniel Hailfinger: >>> Am 09.05.2012 15:54 schrieb Stefan Tauner: >>>> On Wed, 09 May 2012 15:16:04 +0200 Carl-Daniel Hailfinger wrote: >>>> we use both - WARNING and Warning - throughout the code. is that >>>> intended? if so what's the policy? if not then we should fix it. i >>>> think (without looking at any specific case) that WARNING is warranted >>>> because it sticks out more (especially in verbose outputs). as long as >>>> we dont want to play with bold or colored text... :) >>> WARNING >>> >>> The point about "Warning" vs. "WARNING" is intricately linked to whether >>> you believe there should be one or two levels of warnings ("retrying a >>> different erase command" vs "your EC is stuck, and we just erased its >>> firmware"). Even a really serious warning is not an error because >>> flashrom may be theoretically able to fix this while it is still running. >>> That's largely nitpicking, though. I have no really strong feelings >>> about this. >> Besides that, we need msg_*warn in addition to msg_*err. > and msg_*warn2: if you really want to distinguish between WARNING and > Warning, this should be done explicitly and with some policy similar to > how the rest of the verbosity scheme works. > >> Anyway, here is a new log file patch. It should work, and I hope I >> killed most/all of the controversial points. >> Well, except the programmer_shutdown changes which might be unnecessary >> with the new code flow introduced in the msg_* cleanup. >> The print_version() change is in this patch because it's a behavioural >> change needed for reasonable log file writing. > what changes exactly? > the verbosity changes in print_sysinfo are useless regarding the log > file support: stdout/err and log file are equal with and without those > changes. they should have been in the previous cleanup patch imho. > >> Signed-off-by: Carl-Daniel Hailfinger >> >> Index: flashrom-logfile/flash.h >> =================================================================== >> --- flashrom-logfile/flash.h (Revision 1536) >> +++ flashrom-logfile/flash.h (Arbeitskopie) >> [?] >> /* cli_output.c */ >> +#ifndef STANDALONE >> +int open_logfile(const char * const filename); >> +int close_logfile(void); >> +void start_logging(void); >> +#endif > hm... while logging is not useful inside coreboot, it certainly is > somewhat useful in code using libflashrom... > side note: the name STANDALONE sucks. > >> Index: flashrom-logfile/cli_output.c >> =================================================================== >> --- flashrom-logfile/cli_output.c (Revision 1536) >> +++ flashrom-logfile/cli_output.c (Arbeitskopie) >> @@ -2,6 +2,7 @@ >> * This file is part of the flashrom project. >> * >> * Copyright (C) 2009 Sean Nelson >> + * Copyright (C) 2011 Carl-Daniel Hailfinger >> * >> * This program is free software; you can redistribute it and/or modify >> * it under the terms of the GNU General Public License as published by >> @@ -20,8 +21,53 @@ >> >> #include >> #include >> +#include >> +#include >> #include "flash.h" >> >> +static FILE *logfile = NULL; >> + >> +#ifndef STANDALONE >> +int close_logfile(void) >> +{ >> + if (logfile && fclose(logfile)) { >> + /* fclose returned an error. Stop writing to be safe. */ >> + logfile = NULL; >> + msg_perr("Closing the log file returned error %s\n", >> + strerror(errno)); > new line limit > >> + return 1; >> + } >> + logfile = NULL; >> + return 0; >> +} >> + >> +int open_logfile(const char * const filename) >> +{ >> + if (!filename) { >> + msg_gerr("No filename specified.\n"); >> + return 1; >> + } >> + if ((logfile = fopen(filename, "w")) == NULL) { >> + perror(filename); >> + return 1; >> + } >> + return 0; >> +} >> + >> +void start_logging(void) >> +{ >> + enum msglevel oldverbose_screen = verbose_screen; >> + enum msglevel oldverbose_logfile = verbose_logfile; >> + >> + /* Shut up the console > temporarily. */ >> + verbose_screen = MSG_ERROR; >> + verbose_logfile = MSG_DEBUG; >> + print_version(); >> + verbose_screen = oldverbose_screen; >> + verbose_logfile = oldverbose_logfile; >> +} >> +#endif /* STANDALONE */ > actually it is !STANDALONE... that comment is worse than none imho. > >> /* Please note that level is the verbosity, not the importance of the message. */ >> int print(enum msglevel level, const char *fmt, ...) >> { >> @@ -32,7 +78,7 @@ >> if (level == MSG_ERROR) >> output_type = stderr; >> >> - if (level <= verbose) { >> + if (level <= verbose_screen) { >> va_start(ap, fmt); >> ret = vfprintf(output_type, fmt, ap); >> va_end(ap); >> @@ -42,5 +88,12 @@ >> if (level != MSG_SPEW) >> fflush(output_type); >> } >> + if ((level <= verbose_logfile) && logfile) { >> + va_start(ap, fmt); >> + ret = vfprintf(logfile, fmt, ap); >> + va_end(ap); >> + if (level != MSG_SPEW) >> + fflush(logfile); >> + } >> return ret; >> } >> Index: flashrom-logfile/cli_classic.c >> =================================================================== >> --- flashrom-logfile/cli_classic.c (Revision 1536) >> +++ flashrom-logfile/cli_classic.c (Arbeitskopie) >> @@ -106,7 +106,7 @@ >> "-z|" >> #endif >> "-E|-r |-w |-v ]\n" >> - " [-c ] [-l ]\n" >> + " [-c ] [-l ] [-o ]\n" >> " [-i ] [-p [:]]\n\n"); >> >> printf("Please note that the command line interface for flashrom has " >> @@ -135,6 +135,7 @@ >> "\n" >> " -i | --image only flash image " >> "from flash layout\n" >> + " -o | --output log to file \n" >> " -L | --list-supported print supported devices\n" >> #if CONFIG_PRINT_WIKI == 1 >> " -z | --list-supported-wiki print supported devices " >> @@ -189,7 +190,7 @@ >> enum programmer prog = PROGRAMMER_INVALID; >> int ret = 0; >> >> - static const char optstring[] = "r:Rw:v:nVEfc:l:i:p:Lzh"; >> + static const char optstring[] = "r:Rw:v:nVEfc:l:i:p:Lzho:"; >> static const struct option long_options[] = { >> {"read", 1, NULL, 'r'}, >> {"write", 1, NULL, 'w'}, >> @@ -206,11 +207,13 @@ >> {"programmer", 1, NULL, 'p'}, >> {"help", 0, NULL, 'h'}, >> {"version", 0, NULL, 'R'}, >> + {"output", 1, NULL, 'o'}, >> {NULL, 0, NULL, 0}, >> }; >> >> char *filename = NULL; >> char *layoutfile = NULL; >> + char *log_name = NULL; > the variable names for the different filenames are not very consistent. > > image_file > layout_file > log_file > >> char *tempstr = NULL; >> char *pparam = NULL; >> >> @@ -272,7 +275,8 @@ >> chip_to_probe = strdup(optarg); >> break; >> case 'V': >> - verbose++; >> + verbose_screen++; >> + verbose_logfile++; >> break; >> case 'E': >> if (++operation_specified > 1) { >> @@ -378,6 +382,19 @@ >> cli_classic_usage(argv[0]); >> exit(0); >> break; >> + case 'o': >> +#ifdef STANDALONE >> + fprintf(stderr, "Log file not supported in standalone " >> + "mode. Aborting.\n"); > new line limit > >> + cli_classic_abort_usage(); >> +#else /* STANDALONE */ >> + log_name = strdup(optarg); >> + if (log_name[0] == '\0') { >> + fprintf(stderr, "No log filename specified.\n"); >> + cli_classic_abort_usage(); >> + } >> +#endif /* STANDALONE */ >> + break; >> default: >> cli_classic_abort_usage(); >> break; >> @@ -396,6 +413,13 @@ >> cli_classic_abort_usage(); >> } >> >> +#ifndef STANDALONE >> + if (log_name && check_filename(log_name, "log")) >> + cli_classic_abort_usage(); >> + if (log_name && open_logfile(log_name)) >> + return 1; >> +#endif /* !STANDALONE */ >> + >> #if CONFIG_PRINT_WIKI == 1 >> if (list_supported_wiki) { >> print_supported_wiki(); >> @@ -410,6 +434,10 @@ >> goto out; >> } >> >> +#ifndef STANDALONE >> + start_logging(); >> +#endif /* STANDALONE */ >> + >> msg_gdbg("Command line (%i args):", argc - 1); >> for (i = 0; i < argc; i++) { >> msg_gdbg(" %s", argv[i]); >> @@ -546,11 +574,12 @@ >> */ >> programmer_delay(100000); >> ret |= doit(fill_flash, force, filename, read_it, write_it, erase_it, verify_it); >> - /* Note: doit() already calls programmer_shutdown(). */ >> - goto out; >> >> out_shutdown: >> programmer_shutdown(); >> out: >> +#ifndef STANDALONE >> + ret |= close_logfile(); >> +#endif >> return ret; >> } >> Index: flashrom-logfile/flashrom.c >> =================================================================== >> --- flashrom-logfile/flashrom.c (Revision 1536) >> +++ flashrom-logfile/flashrom.c (Arbeitskopie) >> @@ -40,7 +40,8 @@ >> >> const char flashrom_version[] = FLASHROM_VERSION; >> char *chip_to_probe = NULL; >> -int verbose = MSG_INFO; >> +int verbose_screen = MSG_INFO; >> +int verbose_logfile = MSG_DEBUG; >> >> static enum programmer programmer = PROGRAMMER_INVALID; >> >> @@ -1493,35 +1494,35 @@ >> #else >> msg_ginfo(" on unknown machine"); >> #endif >> - msg_ginfo(", built with"); >> + msg_gdbg(", built with"); >> #if NEED_PCI == 1 >> #ifdef PCILIB_VERSION >> - msg_ginfo(" libpci %s,", PCILIB_VERSION); >> + msg_gdbg(" libpci %s,", PCILIB_VERSION); >> #else >> - msg_ginfo(" unknown PCI library,"); >> + msg_gdbg(" unknown PCI library,"); >> #endif >> #endif >> #ifdef __clang__ >> - msg_ginfo(" LLVM Clang"); >> + msg_gdbg(" LLVM Clang"); >> #ifdef __clang_version__ >> - msg_ginfo(" %s,", __clang_version__); >> + msg_gdbg(" %s,", __clang_version__); >> #else >> - msg_ginfo(" unknown version (before r102686),"); >> + msg_gdbg(" unknown version (before r102686),"); >> #endif >> #elif defined(__GNUC__) >> - msg_ginfo(" GCC"); >> + msg_gdbg(" GCC"); >> #ifdef __VERSION__ >> - msg_ginfo(" %s,", __VERSION__); >> + msg_gdbg(" %s,", __VERSION__); >> #else >> - msg_ginfo(" unknown version,"); >> + msg_gdbg(" unknown version,"); >> #endif >> #else >> - msg_ginfo(" unknown compiler,"); >> + msg_gdbg(" unknown compiler,"); >> #endif >> #if defined (__FLASHROM_LITTLE_ENDIAN__) >> - msg_ginfo(" little endian"); >> + msg_gdbg(" little endian"); >> #else >> - msg_ginfo(" big endian"); >> + msg_gdbg(" big endian"); >> #endif >> msg_ginfo("\n"); >> } >> @@ -1840,6 +1841,5 @@ >> free(oldcontents); >> free(newcontents); >> out_nofree: >> - programmer_shutdown(); >> return ret; >> } >> >> > TODO: > - minimum verbosity handling > > apart from that it would have been ack-able i think. looks very nice, > small, clean and sane. thanks! > pity we took so long. > NB: i have not thoroughly tested it yet. New version. IIRC the only remaining problem is the name of the variable storing the log file name. Signed-off-by: Carl-Daniel Hailfinger Index: flashrom-logfile/flash.h =================================================================== --- flashrom-logfile/flash.h (Revision 1539) +++ flashrom-logfile/flash.h (Arbeitskopie) @@ -228,7 +228,8 @@ write_gran_1byte, write_gran_256bytes, }; -extern int verbose; +extern int verbose_screen; +extern int verbose_logfile; extern const char flashrom_version[]; extern char *chip_to_probe; void map_flash_registers(struct flashctx *flash); @@ -244,6 +245,7 @@ int need_erase(uint8_t *have, uint8_t *want, unsigned int len, enum write_granularity gran); char *strcat_realloc(char *dest, const char *src); void print_version(void); +void print_buildinfo(void); void print_banner(void); void list_programmers_linebreak(int startcol, int cols, int paren); int selfcheck(void); @@ -268,6 +270,11 @@ #define ERROR_FLASHROM_LIMIT -201 /* cli_output.c */ +#ifndef STANDALONE +int open_logfile(const char * const filename); +int close_logfile(void); +void start_logging(void); +#endif enum msglevel { MSG_ERROR = 0, MSG_INFO = 1, Index: flashrom-logfile/cli_output.c =================================================================== --- flashrom-logfile/cli_output.c (Revision 1539) +++ flashrom-logfile/cli_output.c (Arbeitskopie) @@ -2,6 +2,7 @@ * This file is part of the flashrom project. * * Copyright (C) 2009 Sean Nelson + * Copyright (C) 2011 Carl-Daniel Hailfinger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,8 +21,49 @@ #include #include +#include +#include #include "flash.h" +static FILE *logfile = NULL; + +#ifndef STANDALONE +int close_logfile(void) +{ + if (logfile && fclose(logfile)) { + /* fclose returned an error. Stop writing to be safe. */ + logfile = NULL; + msg_perr("Closing the log file returned error %s\n", strerror(errno)); + return 1; + } + logfile = NULL; + return 0; +} + +int open_logfile(const char * const filename) +{ + if (!filename) { + msg_gerr("No filename specified.\n"); + return 1; + } + if ((logfile = fopen(filename, "w")) == NULL) { + perror(filename); + return 1; + } + return 0; +} + +void start_logging(void) +{ + enum msglevel oldverbose_screen = verbose_screen; + + /* Shut up the console. */ + verbose_screen = MSG_ERROR; + print_version(); + verbose_screen = oldverbose_screen; +} +#endif /* !STANDALONE */ + /* Please note that level is the verbosity, not the importance of the message. */ int print(enum msglevel level, const char *fmt, ...) { @@ -32,7 +74,7 @@ if (level == MSG_ERROR) output_type = stderr; - if (level <= verbose) { + if (level <= verbose_screen) { va_start(ap, fmt); ret = vfprintf(output_type, fmt, ap); va_end(ap); @@ -42,5 +84,12 @@ if (level != MSG_SPEW) fflush(output_type); } + if ((level <= verbose_logfile) && logfile) { + va_start(ap, fmt); + ret = vfprintf(logfile, fmt, ap); + va_end(ap); + if (level != MSG_SPEW) + fflush(logfile); + } return ret; } Index: flashrom-logfile/cli_classic.c =================================================================== --- flashrom-logfile/cli_classic.c (Revision 1539) +++ flashrom-logfile/cli_classic.c (Arbeitskopie) @@ -106,7 +106,7 @@ "-z|" #endif "-E|-r |-w |-v ]\n" - " [-c ] [-l ]\n" + " [-c ] [-l ] [-o ]\n" " [-i ] [-p [:]]\n\n"); printf("Please note that the command line interface for flashrom has " @@ -135,6 +135,7 @@ "\n" " -i | --image only flash image " "from flash layout\n" + " -o | --output log to file \n" " -L | --list-supported print supported devices\n" #if CONFIG_PRINT_WIKI == 1 " -z | --list-supported-wiki print supported devices " @@ -189,7 +190,7 @@ enum programmer prog = PROGRAMMER_INVALID; int ret = 0; - static const char optstring[] = "r:Rw:v:nVEfc:l:i:p:Lzh"; + static const char optstring[] = "r:Rw:v:nVEfc:l:i:p:Lzho:"; static const struct option long_options[] = { {"read", 1, NULL, 'r'}, {"write", 1, NULL, 'w'}, @@ -206,11 +207,13 @@ {"programmer", 1, NULL, 'p'}, {"help", 0, NULL, 'h'}, {"version", 0, NULL, 'R'}, + {"output", 1, NULL, 'o'}, {NULL, 0, NULL, 0}, }; char *filename = NULL; char *layoutfile = NULL; + char *logfile = NULL; char *tempstr = NULL; char *pparam = NULL; @@ -272,7 +275,9 @@ chip_to_probe = strdup(optarg); break; case 'V': - verbose++; + verbose_screen++; + if (verbose_screen > MSG_DEBUG2) + verbose_logfile = verbose_screen; break; case 'E': if (++operation_specified > 1) { @@ -378,6 +383,18 @@ cli_classic_usage(argv[0]); exit(0); break; + case 'o': +#ifdef STANDALONE + fprintf(stderr, "Log file not supported in standalone mode. Aborting.\n"); + cli_classic_abort_usage(); +#else /* STANDALONE */ + logfile = strdup(optarg); + if (logfile[0] == '\0') { + fprintf(stderr, "No log filename specified.\n"); + cli_classic_abort_usage(); + } +#endif /* STANDALONE */ + break; default: cli_classic_abort_usage(); break; @@ -396,6 +413,13 @@ cli_classic_abort_usage(); } +#ifndef STANDALONE + if (logfile && check_filename(logfile, "log")) + cli_classic_abort_usage(); + if (logfile && open_logfile(logfile)) + return 1; +#endif /* !STANDALONE */ + #if CONFIG_PRINT_WIKI == 1 if (list_supported_wiki) { print_supported_wiki(); @@ -410,6 +434,11 @@ goto out; } +#ifndef STANDALONE + start_logging(); +#endif /* !STANDALONE */ + + print_buildinfo(); msg_gdbg("Command line (%i args):", argc - 1); for (i = 0; i < argc; i++) { msg_gdbg(" %s", argv[i]); @@ -552,5 +581,8 @@ out_shutdown: programmer_shutdown(); out: +#ifndef STANDALONE + ret |= close_logfile(); +#endif /* !STANDALONE */ return ret; } Index: flashrom-logfile/flashrom.c =================================================================== --- flashrom-logfile/flashrom.c (Revision 1539) +++ flashrom-logfile/flashrom.c (Arbeitskopie) @@ -40,7 +40,8 @@ const char flashrom_version[] = FLASHROM_VERSION; char *chip_to_probe = NULL; -int verbose = MSG_INFO; +int verbose_screen = MSG_INFO; +int verbose_logfile = MSG_DEBUG2; static enum programmer programmer = PROGRAMMER_INVALID; @@ -1493,35 +1494,39 @@ #else msg_ginfo(" on unknown machine"); #endif - msg_ginfo(", built with"); +} + +void print_buildinfo(void) +{ + msg_gdbg("flashrom was built with"); #if NEED_PCI == 1 #ifdef PCILIB_VERSION - msg_ginfo(" libpci %s,", PCILIB_VERSION); + msg_gdbg(" libpci %s,", PCILIB_VERSION); #else - msg_ginfo(" unknown PCI library,"); + msg_gdbg(" unknown PCI library,"); #endif #endif #ifdef __clang__ - msg_ginfo(" LLVM Clang"); + msg_gdbg(" LLVM Clang"); #ifdef __clang_version__ - msg_ginfo(" %s,", __clang_version__); + msg_gdbg(" %s,", __clang_version__); #else - msg_ginfo(" unknown version (before r102686),"); + msg_gdbg(" unknown version (before r102686),"); #endif #elif defined(__GNUC__) - msg_ginfo(" GCC"); + msg_gdbg(" GCC"); #ifdef __VERSION__ - msg_ginfo(" %s,", __VERSION__); + msg_gdbg(" %s,", __VERSION__); #else - msg_ginfo(" unknown version,"); + msg_gdbg(" unknown version,"); #endif #else - msg_ginfo(" unknown compiler,"); + msg_gdbg(" unknown compiler,"); #endif #if defined (__FLASHROM_LITTLE_ENDIAN__) - msg_ginfo(" little endian"); + msg_gdbg(" little endian"); #else - msg_ginfo(" big endian"); + msg_gdbg(" big endian"); #endif msg_ginfo("\n"); } @@ -1530,6 +1535,7 @@ { msg_ginfo("flashrom v%s", flashrom_version); print_sysinfo(); + msg_ginfo("\n"); } void print_banner(void) -- http://www.hailfinger.org/ From c-d.hailfinger.devel.2006 at gmx.net Sun Jun 3 02:29:19 2012 From: c-d.hailfinger.devel.2006 at gmx.net (Carl-Daniel Hailfinger) Date: Sun, 03 Jun 2012 02:29:19 +0200 Subject: [flashrom] [PATCH] Add logfile support to flashrom In-Reply-To: <4FCA1521.8050806@gmx.net> References: <4DF12DDE.9000401@gmx.net> <20110611142151.GE6443@greenwood> <4DF38206.20903@home.nl> <4DF53AAF.6000700@gmx.net> <4DF53D2B.7090006@home.nl> <4DF69FA1.6070705@gmx.net> <201106171328.p5HDSU4l017284@mail2.student.tuwien.ac.at> <201106191244.p5JCiSbM005768@mail2.student.tuwien.ac.at> <4E3092B5.9020307@gmx.net> <4F03A676.1040006@gmx.net> <201202092013.q19KDFpe031614@mail2.student.tuwien.ac.at> <4FA1C4E2.5040500@gmx.net> <4FAA6E14.8010901@gmx.net> <201205091354.q49DsfCB026816@mail2.student.tuwien.ac.at> <4FAAF447.80807@gmx.net> <4FB34898.5070306@gmx.net> <201205172259.q4HMx8Op015734@mail2.student.tuwien.ac.at> <4FCA1521.8050806@gmx.net> Message-ID: <4FCAAFDF.20805@gmx.net> New version, all review comments addressed. Note: The log file is opened with mode "w", not "wb", and that means DOS/Windows/Mac users can open the log file with a text editor and the line breaks just work. It will require a bit more work on our side if the file is uploaded unmodified, though. Usage: flashrom --output logfile.txt Logfile output has at least dbg2 verbosity or screen verbosity, whichever is greater. Signed-off-by: Carl-Daniel Hailfinger Index: flashrom-logfile/flash.h =================================================================== --- flashrom-logfile/flash.h (Revision 1539) +++ flashrom-logfile/flash.h (Arbeitskopie) @@ -228,7 +228,8 @@ write_gran_1byte, write_gran_256bytes, }; -extern int verbose; +extern int verbose_screen; +extern int verbose_logfile; extern const char flashrom_version[]; extern char *chip_to_probe; void map_flash_registers(struct flashctx *flash); @@ -244,6 +245,7 @@ int need_erase(uint8_t *have, uint8_t *want, unsigned int len, enum write_granularity gran); char *strcat_realloc(char *dest, const char *src); void print_version(void); +void print_buildinfo(void); void print_banner(void); void list_programmers_linebreak(int startcol, int cols, int paren); int selfcheck(void); @@ -268,6 +270,11 @@ #define ERROR_FLASHROM_LIMIT -201 /* cli_output.c */ +#ifndef STANDALONE +int open_logfile(const char * const filename); +int close_logfile(void); +void start_logging(void); +#endif enum msglevel { MSG_ERROR = 0, MSG_INFO = 1, Index: flashrom-logfile/cli_output.c =================================================================== --- flashrom-logfile/cli_output.c (Revision 1539) +++ flashrom-logfile/cli_output.c (Arbeitskopie) @@ -2,6 +2,7 @@ * This file is part of the flashrom project. * * Copyright (C) 2009 Sean Nelson + * Copyright (C) 2011 Carl-Daniel Hailfinger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,8 +21,52 @@ #include #include +#include +#include #include "flash.h" +#ifndef STANDALONE +static FILE *logfile = NULL; + +int close_logfile(void) +{ + if (!logfile) + return 0; + /* No need to call fflush() explicitly, fclose() already does that. */ + if (fclose(logfile)) { + /* fclose returned an error. Stop writing to be safe. */ + logfile = NULL; + msg_perr("Closing the log file returned error %s\n", strerror(errno)); + return 1; + } + logfile = NULL; + return 0; +} + +int open_logfile(const char * const filename) +{ + if (!filename) { + msg_gerr("No filename specified.\n"); + return 1; + } + if ((logfile = fopen(filename, "w")) == NULL) { + perror(filename); + return 1; + } + return 0; +} + +void start_logging(void) +{ + enum msglevel oldverbose_screen = verbose_screen; + + /* Shut up the console. */ + verbose_screen = MSG_ERROR; + print_version(); + verbose_screen = oldverbose_screen; +} +#endif /* !STANDALONE */ + /* Please note that level is the verbosity, not the importance of the message. */ int print(enum msglevel level, const char *fmt, ...) { @@ -32,7 +77,7 @@ if (level == MSG_ERROR) output_type = stderr; - if (level <= verbose) { + if (level <= verbose_screen) { va_start(ap, fmt); ret = vfprintf(output_type, fmt, ap); va_end(ap); @@ -42,5 +87,14 @@ if (level != MSG_SPEW) fflush(output_type); } +#ifndef STANDALONE + if ((level <= verbose_logfile) && logfile) { + va_start(ap, fmt); + ret = vfprintf(logfile, fmt, ap); + va_end(ap); + if (level != MSG_SPEW) + fflush(logfile); + } +#endif /* !STANDALONE */ return ret; } Index: flashrom-logfile/cli_classic.c =================================================================== --- flashrom-logfile/cli_classic.c (Revision 1539) +++ flashrom-logfile/cli_classic.c (Arbeitskopie) @@ -106,7 +106,7 @@ "-z|" #endif "-E|-r |-w |-v ]\n" - " [-c ] [-l ]\n" + " [-c ] [-l ] [-o ]\n" " [-i ] [-p [:]]\n\n"); printf("Please note that the command line interface for flashrom has " @@ -135,6 +135,7 @@ "\n" " -i | --image only flash image " "from flash layout\n" + " -o | --output log to file \n" " -L | --list-supported print supported devices\n" #if CONFIG_PRINT_WIKI == 1 " -z | --list-supported-wiki print supported devices " @@ -189,7 +190,7 @@ enum programmer prog = PROGRAMMER_INVALID; int ret = 0; - static const char optstring[] = "r:Rw:v:nVEfc:l:i:p:Lzh"; + static const char optstring[] = "r:Rw:v:nVEfc:l:i:p:Lzho:"; static const struct option long_options[] = { {"read", 1, NULL, 'r'}, {"write", 1, NULL, 'w'}, @@ -206,11 +207,13 @@ {"programmer", 1, NULL, 'p'}, {"help", 0, NULL, 'h'}, {"version", 0, NULL, 'R'}, + {"output", 1, NULL, 'o'}, {NULL, 0, NULL, 0}, }; char *filename = NULL; char *layoutfile = NULL; + char *logfile = NULL; char *tempstr = NULL; char *pparam = NULL; @@ -272,7 +275,9 @@ chip_to_probe = strdup(optarg); break; case 'V': - verbose++; + verbose_screen++; + if (verbose_screen > MSG_DEBUG2) + verbose_logfile = verbose_screen; break; case 'E': if (++operation_specified > 1) { @@ -378,6 +383,18 @@ cli_classic_usage(argv[0]); exit(0); break; + case 'o': +#ifdef STANDALONE + fprintf(stderr, "Log file not supported in standalone mode. Aborting.\n"); + cli_classic_abort_usage(); +#else /* STANDALONE */ + logfile = strdup(optarg); + if (logfile[0] == '\0') { + fprintf(stderr, "No log filename specified.\n"); + cli_classic_abort_usage(); + } +#endif /* STANDALONE */ + break; default: cli_classic_abort_usage(); break; @@ -396,6 +413,13 @@ cli_classic_abort_usage(); } +#ifndef STANDALONE + if (logfile && check_filename(logfile, "log")) + cli_classic_abort_usage(); + if (logfile && open_logfile(logfile)) + return 1; +#endif /* !STANDALONE */ + #if CONFIG_PRINT_WIKI == 1 if (list_supported_wiki) { print_supported_wiki(); @@ -410,6 +434,11 @@ goto out; } +#ifndef STANDALONE + start_logging(); +#endif /* !STANDALONE */ + + print_buildinfo(); msg_gdbg("Command line (%i args):", argc - 1); for (i = 0; i < argc; i++) { msg_gdbg(" %s", argv[i]); @@ -552,5 +581,8 @@ out_shutdown: programmer_shutdown(); out: +#ifndef STANDALONE + ret |= close_logfile(); +#endif /* !STANDALONE */ return ret; } Index: flashrom-logfile/flashrom.c =================================================================== --- flashrom-logfile/flashrom.c (Revision 1539) +++ flashrom-logfile/flashrom.c (Arbeitskopie) @@ -40,7 +40,8 @@ const char flashrom_version[] = FLASHROM_VERSION; char *chip_to_probe = NULL; -int verbose = MSG_INFO; +int verbose_screen = MSG_INFO; +int verbose_logfile = MSG_DEBUG2; static enum programmer programmer = PROGRAMMER_INVALID; @@ -1493,35 +1494,39 @@ #else msg_ginfo(" on unknown machine"); #endif - msg_ginfo(", built with"); +} + +void print_buildinfo(void) +{ + msg_gdbg("flashrom was built with"); #if NEED_PCI == 1 #ifdef PCILIB_VERSION - msg_ginfo(" libpci %s,", PCILIB_VERSION); + msg_gdbg(" libpci %s,", PCILIB_VERSION); #else - msg_ginfo(" unknown PCI library,"); + msg_gdbg(" unknown PCI library,"); #endif #endif #ifdef __clang__ - msg_ginfo(" LLVM Clang"); + msg_gdbg(" LLVM Clang"); #ifdef __clang_version__ - msg_ginfo(" %s,", __clang_version__); + msg_gdbg(" %s,", __clang_version__); #else - msg_ginfo(" unknown version (before r102686),"); + msg_gdbg(" unknown version (before r102686),"); #endif #elif defined(__GNUC__) - msg_ginfo(" GCC"); + msg_gdbg(" GCC"); #ifdef __VERSION__ - msg_ginfo(" %s,", __VERSION__); + msg_gdbg(" %s,", __VERSION__); #else - msg_ginfo(" unknown version,"); + msg_gdbg(" unknown version,"); #endif #else - msg_ginfo(" unknown compiler,"); + msg_gdbg(" unknown compiler,"); #endif #if defined (__FLASHROM_LITTLE_ENDIAN__) - msg_ginfo(" little endian"); + msg_gdbg(" little endian"); #else - msg_ginfo(" big endian"); + msg_gdbg(" big endian"); #endif msg_ginfo("\n"); } @@ -1530,6 +1535,7 @@ { msg_ginfo("flashrom v%s", flashrom_version); print_sysinfo(); + msg_ginfo("\n"); } void print_banner(void) -- http://www.hailfinger.org/ From c-d.hailfinger.devel.2006 at gmx.net Sun Jun 3 16:51:18 2012 From: c-d.hailfinger.devel.2006 at gmx.net (Carl-Daniel Hailfinger) Date: Sun, 03 Jun 2012 16:51:18 +0200 Subject: [flashrom] [PATCH] Return code for spi_read_status_register Message-ID: <4FCB79E6.2030608@gmx.net> spi_read_status_register now returns success/failure and stores the status register value via call-by-reference. That way, status register reading failure (only possible if the programmer couldn't run RDSR) can be detected and acted upon in the future. Signed-off-by: Carl-Daniel Hailfinger Index: flashrom-spi_rdsr_errorcheck/it87spi.c =================================================================== --- flashrom-spi_rdsr_errorcheck/it87spi.c (Revision 1539) +++ flashrom-spi_rdsr_errorcheck/it87spi.c (Arbeitskopie) @@ -321,6 +321,7 @@ { unsigned int i; int result; + uint8_t status; chipaddr bios = flash->virtual_memory; result = spi_write_enable(flash); @@ -335,7 +336,7 @@ /* Wait until the Write-In-Progress bit is cleared. * This usually takes 1-10 ms, so wait in 1 ms steps. */ - while (spi_read_status_register(flash) & SPI_SR_WIP) + while (spi_read_status_register(flash, &status), status & SPI_SR_WIP) programmer_delay(1000); return 0; } Index: flashrom-spi_rdsr_errorcheck/a25.c =================================================================== --- flashrom-spi_rdsr_errorcheck/a25.c (Revision 1539) +++ flashrom-spi_rdsr_errorcheck/a25.c (Arbeitskopie) @@ -33,7 +33,7 @@ { uint8_t status; - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); msg_cdbg("Chip status register is %02x\n", status); spi_prettyprint_status_register_amic_a25_srwd(status); @@ -49,7 +49,7 @@ { uint8_t status; - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); msg_cdbg("Chip status register is %02x\n", status); spi_prettyprint_status_register_amic_a25_srwd(status); @@ -64,7 +64,7 @@ { uint8_t status; - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); msg_cdbg("Chip status register is %02x\n", status); spi_prettyprint_status_register_amic_a25_srwd(status); @@ -82,7 +82,7 @@ { uint8_t status; - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); msg_cdbg("Chip status register is %02x\n", status); spi_prettyprint_status_register_amic_a25_srwd(status); Index: flashrom-spi_rdsr_errorcheck/at25.c =================================================================== --- flashrom-spi_rdsr_errorcheck/at25.c (Revision 1539) +++ flashrom-spi_rdsr_errorcheck/at25.c (Arbeitskopie) @@ -61,7 +61,7 @@ { uint8_t status; - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); msg_cdbg("Chip status register is %02x\n", status); spi_prettyprint_status_register_atmel_at25_srpl(status); @@ -84,7 +84,7 @@ { uint8_t status; - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); msg_cdbg("Chip status register is %02x\n", status); spi_prettyprint_status_register_atmel_at25_srpl(status); @@ -103,7 +103,7 @@ { uint8_t status; - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); msg_cdbg("Chip status register is %02x\n", status); msg_cdbg("Chip status register: Status Register Write Protect (WPEN) " @@ -127,7 +127,7 @@ { uint8_t status; - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); msg_cdbg("Chip status register is %02x\n", status); msg_cdbg("Chip status register: Status Register Write Protect (WPEN) " @@ -151,7 +151,7 @@ { uint8_t status; - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); msg_cdbg("Chip status register is %02x\n", status); spi_prettyprint_status_register_atmel_at25_srpl(status); @@ -168,7 +168,7 @@ uint8_t status; int result; - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); /* If block protection is disabled, stop here. */ if ((status & (3 << 2)) == 0) return 0; @@ -195,7 +195,7 @@ msg_cerr("spi_write_status_register failed\n"); return result; } - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); if ((status & (3 << 2)) != 0) { msg_cerr("Block protection could not be disabled!\n"); return 1; @@ -223,7 +223,7 @@ uint8_t status; int result; - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); /* If block protection is disabled, stop here. */ if ((status & 0x6c) == 0) return 0; @@ -244,7 +244,7 @@ msg_cerr("spi_write_status_register failed\n"); return result; } - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); if ((status & 0x6c) != 0) { msg_cerr("Block protection could not be disabled!\n"); return 1; @@ -257,7 +257,7 @@ uint8_t status; int result; - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); /* If block protection is disabled, stop here. */ if ((status & 0x7c) == 0) return 0; @@ -278,7 +278,7 @@ msg_cerr("spi_write_status_register failed\n"); return result; } - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); if ((status & 0x7c) != 0) { msg_cerr("Block protection could not be disabled!\n"); return 1; Index: flashrom-spi_rdsr_errorcheck/spi25.c =================================================================== --- flashrom-spi_rdsr_errorcheck/spi25.c (Revision 1539) +++ flashrom-spi_rdsr_errorcheck/spi25.c (Arbeitskopie) @@ -301,7 +301,7 @@ return 1; } -uint8_t spi_read_status_register(struct flashctx *flash) +int spi_read_status_register(struct flashctx *flash, uint8_t *status) { static const unsigned char cmd[JEDEC_RDSR_OUTSIZE] = { JEDEC_RDSR }; /* FIXME: No workarounds for driver/hardware bugs in generic code. */ @@ -311,10 +311,14 @@ /* Read Status Register */ ret = spi_send_command(flash, sizeof(cmd), sizeof(readarr), cmd, readarr); - if (ret) + if (ret) { msg_cerr("RDSR failed!\n"); + *status = 0xff; + return ret; + } - return readarr[0]; + *status = readarr[0]; + return 0; } /* Prettyprint the status register. Common definitions. */ @@ -418,7 +422,7 @@ { uint8_t status; - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); msg_cdbg("Chip status register is %02x\n", status); switch (flash->manufacture_id) { case ST_ID: @@ -451,6 +455,7 @@ int spi_chip_erase_60(struct flashctx *flash) { int result; + uint8_t status; struct spi_command cmds[] = { { .writecnt = JEDEC_WREN_OUTSIZE, @@ -479,7 +484,7 @@ * This usually takes 1-85 s, so wait in 1 s steps. */ /* FIXME: We assume spi_read_status_register will never fail. */ - while (spi_read_status_register(flash) & SPI_SR_WIP) + while (spi_read_status_register(flash, &status), status & SPI_SR_WIP) programmer_delay(1000 * 1000); /* FIXME: Check the status register for errors. */ return 0; @@ -488,6 +493,7 @@ int spi_chip_erase_c7(struct flashctx *flash) { int result; + uint8_t status; struct spi_command cmds[] = { { .writecnt = JEDEC_WREN_OUTSIZE, @@ -515,7 +521,7 @@ * This usually takes 1-85 s, so wait in 1 s steps. */ /* FIXME: We assume spi_read_status_register will never fail. */ - while (spi_read_status_register(flash) & SPI_SR_WIP) + while (spi_read_status_register(flash, &status), status & SPI_SR_WIP) programmer_delay(1000 * 1000); /* FIXME: Check the status register for errors. */ return 0; @@ -525,6 +531,7 @@ unsigned int blocklen) { int result; + uint8_t status; struct spi_command cmds[] = { { .writecnt = JEDEC_WREN_OUTSIZE, @@ -557,7 +564,7 @@ /* Wait until the Write-In-Progress bit is cleared. * This usually takes 100-4000 ms, so wait in 100 ms steps. */ - while (spi_read_status_register(flash) & SPI_SR_WIP) + while (spi_read_status_register(flash, &status), status & SPI_SR_WIP) programmer_delay(100 * 1000); /* FIXME: Check the status register for errors. */ return 0; @@ -572,6 +579,7 @@ unsigned int blocklen) { int result; + uint8_t status; struct spi_command cmds[] = { { .writecnt = JEDEC_WREN_OUTSIZE, @@ -604,7 +612,7 @@ /* Wait until the Write-In-Progress bit is cleared. * This usually takes 100-4000 ms, so wait in 100 ms steps. */ - while (spi_read_status_register(flash) & SPI_SR_WIP) + while (spi_read_status_register(flash, &status), status & SPI_SR_WIP) programmer_delay(100 * 1000); /* FIXME: Check the status register for errors. */ return 0; @@ -617,6 +625,7 @@ unsigned int blocklen) { int result; + uint8_t status; struct spi_command cmds[] = { { .writecnt = JEDEC_WREN_OUTSIZE, @@ -649,7 +658,7 @@ /* Wait until the Write-In-Progress bit is cleared. * This usually takes 100-4000 ms, so wait in 100 ms steps. */ - while (spi_read_status_register(flash) & SPI_SR_WIP) + while (spi_read_status_register(flash, &status), status & SPI_SR_WIP) programmer_delay(100 * 1000); /* FIXME: Check the status register for errors. */ return 0; @@ -660,6 +669,7 @@ unsigned int blocklen) { int result; + uint8_t status; struct spi_command cmds[] = { { .writecnt = JEDEC_WREN_OUTSIZE, @@ -692,7 +702,7 @@ /* Wait until the Write-In-Progress bit is cleared. * This usually takes 15-800 ms, so wait in 10 ms steps. */ - while (spi_read_status_register(flash) & SPI_SR_WIP) + while (spi_read_status_register(flash, &status), status & SPI_SR_WIP) programmer_delay(10 * 1000); /* FIXME: Check the status register for errors. */ return 0; @@ -764,7 +774,8 @@ * This is according the SST25VF016 datasheet, who knows it is more * generic that this... */ -static int spi_write_status_register_flag(struct flashctx *flash, int status, const unsigned char enable_opcode) +static int spi_write_status_register_flag(struct flashctx *flash, uint8_t status, + const unsigned char enable_opcode) { int result; int i = 0; @@ -781,7 +792,7 @@ .readarr = NULL, }, { .writecnt = JEDEC_WRSR_OUTSIZE, - .writearr = (const unsigned char[]){ JEDEC_WRSR, (unsigned char) status }, + .writearr = (const unsigned char[]){ JEDEC_WRSR, status }, .readcnt = 0, .readarr = NULL, }, { @@ -805,7 +816,7 @@ * 100 ms, then wait in 10 ms steps until a total of 5 s have elapsed. */ programmer_delay(100 * 1000); - while (spi_read_status_register(flash) & SPI_SR_WIP) { + while (spi_read_status_register(flash, &status), status & SPI_SR_WIP) { if (++i > 490) { msg_cerr("Error: WIP bit after WRSR never cleared\n"); return TIMEOUT_ERROR; @@ -925,7 +936,7 @@ uint8_t status; int result; - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); /* If block protection is disabled, stop here. */ if ((status & 0x3c) == 0) return 0; @@ -936,7 +947,7 @@ msg_cerr("spi_write_status_register failed\n"); return result; } - status = spi_read_status_register(flash); + spi_read_status_register(flash, &status); if ((status & 0x3c) != 0) { msg_cerr("Block protection could not be disabled!\n"); return 1; @@ -1007,6 +1018,7 @@ unsigned int len, unsigned int chunksize) { int rc = 0; + uint8_t status; unsigned int i, j, starthere, lenhere, towrite; /* FIXME: page_size is the wrong variable. We need max_writechunk_size * in struct flashctx to do this properly. All chips using @@ -1035,7 +1047,7 @@ rc = spi_nbyte_program(flash, starthere + j, buf + starthere - start + j, towrite); if (rc) break; - while (spi_read_status_register(flash) & SPI_SR_WIP) + while (spi_read_status_register(flash, &status), status & SPI_SR_WIP) programmer_delay(10); } if (rc) @@ -1056,13 +1068,14 @@ unsigned int len) { unsigned int i; + uint8_t status; int result = 0; for (i = start; i < start + len; i++) { result = spi_byte_program(flash, i, buf[i - start]); if (result) return 1; - while (spi_read_status_register(flash) & SPI_SR_WIP) + while (spi_read_status_register(flash, &status), status & SPI_SR_WIP) programmer_delay(10); } @@ -1074,6 +1087,7 @@ { uint32_t pos = start; int result; + uint8_t status; unsigned char cmd[JEDEC_AAI_WORD_PROGRAM_CONT_OUTSIZE] = { JEDEC_AAI_WORD_PROGRAM, }; @@ -1157,7 +1171,7 @@ */ return result; } - while (spi_read_status_register(flash) & SPI_SR_WIP) + while (spi_read_status_register(flash, &status), status & SPI_SR_WIP) programmer_delay(10); /* We already wrote 2 bytes in the multicommand step. */ @@ -1169,7 +1183,7 @@ cmd[2] = buf[pos++ - start]; spi_send_command(flash, JEDEC_AAI_WORD_PROGRAM_CONT_OUTSIZE, 0, cmd, NULL); - while (spi_read_status_register(flash) & SPI_SR_WIP) + while (spi_read_status_register(flash, &status), status & SPI_SR_WIP) programmer_delay(10); } Index: flashrom-spi_rdsr_errorcheck/chipdrivers.h =================================================================== --- flashrom-spi_rdsr_errorcheck/chipdrivers.h (Revision 1539) +++ flashrom-spi_rdsr_errorcheck/chipdrivers.h (Arbeitskopie) @@ -45,7 +45,7 @@ int spi_chip_write_1(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); int spi_chip_write_256(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); int spi_chip_read(struct flashctx *flash, uint8_t *buf, unsigned int start, int unsigned len); -uint8_t spi_read_status_register(struct flashctx *flash); +int spi_read_status_register(struct flashctx *flash, uint8_t *status); int spi_write_status_register(struct flashctx *flash, int status); void spi_prettyprint_status_register_bit(uint8_t status, int bit); void spi_prettyprint_status_register_bp3210(uint8_t status, int bp); -- http://www.hailfinger.org/ From c-d.hailfinger.devel.2006 at gmx.net Mon Jun 4 14:26:15 2012 From: c-d.hailfinger.devel.2006 at gmx.net (Carl-Daniel Hailfinger) Date: Mon, 04 Jun 2012 14:26:15 +0200 Subject: [flashrom] [PATCH] Automatic programmer driver writer Message-ID: <4FCCA967.5040000@gmx.net> Run ./build_new_driver.sh and recompile. You have a new driver, and it's linked in at the appropriate places. Patch needs work for anything which is not a bitbang SPI driver. Signed-off-by: Carl-Daniel Hailfinger Index: flashrom-programmer_template/build_new_driver.sh =================================================================== --- flashrom-programmer_template/build_new_driver.sh (Revision 0) +++ flashrom-programmer_template/build_new_driver.sh (Revision 0) @@ -0,0 +1,232 @@ +#!/bin/bash +# flashrom programmer driver skeleton builder. +# Copyright 2012 Carl-Daniel Hailfinger +# Licensed under the GNU GPL v2 + +# Fill in all info in the block below, and don't touch anything else. +PROGRAMMERNAME=ezo +PROGRAMMERDESCR="EZo+Willem Programmer" +PROGRAMMERMANUF="EZo and Willem" +PROGRAMMERURL="http://www.$PROGRAMMERNAMEflash.com/" +AUTHORNAME="Carl-Daniel Hailfinger" +# Does the programmer need a map/unmap function? +HAVE_MAP=no +# Does the programmer have its own delay function? +HAVE_DELAY=no +# Does the programmer need some sort of direct hardware access? +NEED_PCI=yes +# Does the programmer need some sort of serial port access? +NEED_SERIAL=no +# Does the programmer use Parallel/LPC/FWH functionality? +NEED_PARLPCFWH=no +# Does the programmer use the bitbanging SPI infrastructure? +NEED_BITBANG_SPI=yes + +# No user serviceable parts below. +if test $HAVE_MAP = yes; then MAPNAME=$PROGRAMMERNAME; else MAPNAME=fallback; fi +if test $HAVE_DELAY = yes; then DELAYNAME=$PROGRAMMERNAME; else DELAYNAME=internal; fi +PROGRAMMERNAMECAPS=$(echo -n $PROGRAMMERNAME|tr "[[:lower:]]" "[[:upper:]]") +CONFIGNAME=CONFIG_$PROGRAMMERNAMECAPS +ENUMNAME=PROGRAMMER_$PROGRAMMERNAMECAPS +BITBANG_SPI_ENUMNAME=BITBANG_SPI_MASTER_$PROGRAMMERNAMECAPS +if test $NEED_PCI = yes; then NEEDS="NEED_PCI := yes\n"; fi +if test $NEED_SERIAL = yes; then NEEDS+="NEED_SERIAL := yes\n"; fi + +sed "s-^//PLACEHOLDER_NEWPROG_PROGRAMMER_ARRAY-\ +#if $CONFIGNAME == 1\n\ + {\n\ + .name = \"${PROGRAMMERNAME}\",\n\ + .init = ${PROGRAMMERNAME}_init,\n\ + .map_flash_region = ${MAPNAME}_map,\n\ + .unmap_flash_region = ${MAPNAME}_unmap,\n\ + .delay = ${DELAYNAME}_delay,\n\ + },\n\ +#endif\n\ +\n\0-" flashrom.c >flashrom.c.mine + +sed -e "s/^#PLACEHOLDER_NEWPROG_DEFAULTCONFIG/\ +# Enable $PROGRAMMERDESCR for now.\n\ +$CONFIGNAME ?= yes\n\ +\n\0/" \ +-e "s/^#PLACEHOLDER_NEWPROG_COMPILERULE/\ +ifeq (\$($CONFIGNAME), yes)\n\ +FEATURE_CFLAGS += -D'$CONFIGNAME=1'\n\ +PROGRAMMER_OBJS += $PROGRAMMERNAME.o\n\ +${NEEDS}\ +endif\n\ +\n\0/" Makefile >Makefile.mine1 + +if test $NEED_BITBANG_SPI = yes; then +sed -e "s/^#PLACEHOLDER_NEWPROG_BITBANGSPICONFIG1/\ +ifeq (\$($CONFIGNAME), yes)\n\ +override CONFIG_BITBANG_SPI = yes\n\ +else\n\ +\0/" \ +-e "s/^#PLACEHOLDER_NEWPROG_BITBANGSPICONFIG2/\ +\0\n\ +endif/;" Makefile.mine1 >Makefile.mine +rm Makefile.mine1 +else +mv Makefile.mine1 Makefile.mine +fi + +sed -e "s-^//PLACEHOLDER_NEWPROG_PROGRAMMER_ENUM-\ +#if $CONFIGNAME == 1\n\ + $ENUMNAME,\n\ +#endif\n\ +\0-" \ +-e "s-//PLACEHOLDER_NEWPROG_PUBLICFUNCTIONS-\ +/* $PROGRAMMERNAME.c */\n\ +#if $CONFIGNAME == 1\n\ +int ${PROGRAMMERNAME}_init(void);\n\ +#endif\n\ +\n\0-" programmer.h >programmer.h.mine1 + +if test $NEED_BITBANG_SPI = yes; then +sed -e "s-^//PLACEHOLDER_NEWPROG_PROGRAMMER_BITBANG_ENUM-\ +#if $CONFIGNAME == 1\n\ + $BITBANG_SPI_ENUMNAME,\n\ +#endif\n\ +\0-" \ +-e "s-//PLACEHOLDER_NEWPROG_SELECT_SPI_BITBANG\$-\ +|| $CONFIGNAME == 1 \0-" programmer.h.mine1 >programmer.h.mine +rm programmer.h.mine1 +else +mv programmer.h.mine1 programmer.h.mine +fi + +sed -e "s-PLACEHOLDER_NEWPROG_CHECK_PROGRAMMERCOUNT-\ +$CONFIGNAME+\0-" \ +-e "s-^//PLACEHOLDER_NEWPROG_PROGRAMMER_ENUMDEFAULT-\ +#if $CONFIGNAME == 1\n\ + $ENUMNAME\n\ +#endif\n\ +\0-" cli_classic.c >cli_classic.c.mine + +cat >$PROGRAMMERNAME.c <>$PROGRAMMERNAME.c <>$PROGRAMMERNAME.c <>$PROGRAMMERNAME.c <>$PROGRAMMERNAME.c <>$PROGRAMMERNAME.c < 1 +#if CONFIG_NIC3COM+CONFIG_NICREALTEK+CONFIG_NICNATSEMI+CONFIG_GFXNVIDIA+CONFIG_DRKAISER+CONFIG_SATASII+CONFIG_ATAHPT+CONFIG_FT2232_SPI+CONFIG_SERPROG+CONFIG_BUSPIRATE_SPI+CONFIG_DEDIPROG+CONFIG_RAYER_SPI+CONFIG_NICINTEL+CONFIG_NICINTEL_SPI+CONFIG_OGP_SPI+CONFIG_SATAMV+PLACEHOLDER_NEWPROG_CHECK_PROGRAMMERCOUNT > 1 #error Please enable either CONFIG_DUMMY or CONFIG_INTERNAL or disable support for all programmers except one. #endif static enum programmer default_programmer = @@ -96,6 +96,7 @@ #if CONFIG_LINUX_SPI == 1 PROGRAMMER_LINUX_SPI #endif +//PLACEHOLDER_NEWPROG_PROGRAMMER_ENUMDEFAULT ; #endif Index: flashrom-programmer_template/flashrom.c =================================================================== --- flashrom-programmer_template/flashrom.c (Revision 1539) +++ flashrom-programmer_template/flashrom.c (Arbeitskopie) @@ -261,6 +261,7 @@ }, #endif +//PLACEHOLDER_NEWPROG_PROGRAMMER_ARRAY {}, /* This entry corresponds to PROGRAMMER_INVALID. */ }; Index: flashrom-programmer_template/programmer.h =================================================================== --- flashrom-programmer_template/programmer.h (Revision 1539) +++ flashrom-programmer_template/programmer.h (Arbeitskopie) @@ -87,6 +87,7 @@ #if CONFIG_LINUX_SPI == 1 PROGRAMMER_LINUX_SPI, #endif +//PLACEHOLDER_NEWPROG_PROGRAMMER_ENUM PROGRAMMER_INVALID /* This must always be the last entry. */ }; @@ -127,6 +128,7 @@ #if CONFIG_OGP_SPI == 1 BITBANG_SPI_MASTER_OGP, #endif +//PLACEHOLDER_NEWPROG_PROGRAMMER_BITBANG_ENUM }; struct bitbang_spi_master { @@ -461,6 +463,8 @@ int dediprog_init(void); #endif +//PLACEHOLDER_NEWPROG_PUBLICFUNCTIONS + /* flashrom.c */ struct decode_sizes { uint32_t parallel; @@ -505,7 +509,7 @@ #if CONFIG_DEDIPROG == 1 SPI_CONTROLLER_DEDIPROG, #endif -#if CONFIG_OGP_SPI == 1 || CONFIG_NICINTEL_SPI == 1 || CONFIG_RAYER_SPI == 1 || CONFIG_PONY_SPI == 1 || (CONFIG_INTERNAL == 1 && (defined(__i386__) || defined(__x86_64__))) +#if CONFIG_OGP_SPI == 1 || CONFIG_NICINTEL_SPI == 1 || CONFIG_RAYER_SPI == 1 || CONFIG_PONY_SPI == 1 || (CONFIG_INTERNAL == 1 && (defined(__i386__) || defined(__x86_64__))) //PLACEHOLDER_NEWPROG_SELECT_SPI_BITBANG SPI_CONTROLLER_BITBANG, #endif #if CONFIG_LINUX_SPI == 1 -- http://www.hailfinger.org/ From c-d.hailfinger.devel.2006 at gmx.net Mon Jun 4 19:49:31 2012 From: c-d.hailfinger.devel.2006 at gmx.net (Carl-Daniel Hailfinger) Date: Mon, 04 Jun 2012 19:49:31 +0200 Subject: [flashrom] [PATCH] Automatic programmer driver writer In-Reply-To: <4FCCA967.5040000@gmx.net> References: <4FCCA967.5040000@gmx.net> Message-ID: <4FCCF52B.4070500@gmx.net> Am 04.06.2012 14:26 schrieb Carl-Daniel Hailfinger: > Run ./build_new_driver.sh and recompile. You have a new driver, and it's > linked in at the appropriate places. Patch needs work for anything which > is not a bitbang SPI driver. Added a man page template and print/print_wiki stuff. Signed-off-by: Carl-Daniel Hailfinger Index: flashrom-programmer_template/build_new_driver.sh =================================================================== --- flashrom-programmer_template/build_new_driver.sh (Revision 0) +++ flashrom-programmer_template/build_new_driver.sh (Revision 0) @@ -0,0 +1,262 @@ +#!/bin/bash +# flashrom programmer driver skeleton builder. +# Copyright 2012 Carl-Daniel Hailfinger +# Licensed under the GNU GPL v2 + +# Fill in all info in the block below, and don't touch anything else. +PROGRAMMERNAME=ezo +PROGRAMMERDESCR="EZo+Willem Programmer" +PROGRAMMERMANUF="EZo and Willem" +PROGRAMMERURL="http://www.ezoflash.com/" +AUTHORNAME="Carl-Daniel Hailfinger" +# Does the programmer need a map/unmap function? +HAVE_MAP=no +# Does the programmer have its own delay function? +HAVE_DELAY=no +# Does the programmer need some sort of direct hardware access? +NEED_PCI=yes +# Does the programmer need some sort of serial port access? +NEED_SERIAL=no +# Does the programmer use Parallel/LPC/FWH functionality? +NEED_PARLPCFWH=no +# Does the programmer use the bitbanging SPI infrastructure? +NEED_BITBANG_SPI=yes + +# No user serviceable parts below. +if test $HAVE_MAP = yes; then MAPNAME=$PROGRAMMERNAME; else MAPNAME=fallback; fi +if test $HAVE_DELAY = yes; then DELAYNAME=$PROGRAMMERNAME; else DELAYNAME=internal; fi +PROGRAMMERNAMECAPS=$(echo -n $PROGRAMMERNAME|tr "[[:lower:]]" "[[:upper:]]") +CONFIGNAME=CONFIG_$PROGRAMMERNAMECAPS +ENUMNAME=PROGRAMMER_$PROGRAMMERNAMECAPS +BITBANG_SPI_ENUMNAME=BITBANG_SPI_MASTER_$PROGRAMMERNAMECAPS +if test $NEED_PCI = yes; then NEEDS="NEED_PCI := yes\n"; fi +if test $NEED_SERIAL = yes; then NEEDS+="NEED_SERIAL := yes\n"; fi + +sed "s-^//PLACEHOLDER_NEWPROG_PROGRAMMER_ARRAY-\ +#if ${CONFIGNAME} == 1\n\ + {\n\ + .name = \"${PROGRAMMERNAME}\",\n\ + .init = ${PROGRAMMERNAME}_init,\n\ + .map_flash_region = ${MAPNAME}_map,\n\ + .unmap_flash_region = ${MAPNAME}_unmap,\n\ + .delay = ${DELAYNAME}_delay,\n\ + },\n\ +#endif\n\ +\n\0-" flashrom.c >flashrom.c.mine + +sed -e "s/^#PLACEHOLDER_NEWPROG_DEFAULTCONFIG/\ +# Enable ${PROGRAMMERDESCR} for now.\n\ +${CONFIGNAME} ?= yes\n\ +\n\0/" \ +-e "s/^#PLACEHOLDER_NEWPROG_COMPILERULE/\ +ifeq (\$(${CONFIGNAME}), yes)\n\ +FEATURE_CFLAGS += -D'${CONFIGNAME}=1'\n\ +PROGRAMMER_OBJS += ${PROGRAMMERNAME}.o\n\ +${NEEDS}\ +endif\n\ +\n\0/" Makefile >Makefile.mine1 + +if test $NEED_BITBANG_SPI = yes; then +sed -e "s/^#PLACEHOLDER_NEWPROG_BITBANGSPICONFIG1/\ +ifeq (\$(${CONFIGNAME}), yes)\n\ +override CONFIG_BITBANG_SPI = yes\n\ +else\n\ +\0/" \ +-e "s/^#PLACEHOLDER_NEWPROG_BITBANGSPICONFIG2/\ +\0\n\ +endif/;" Makefile.mine1 >Makefile.mine +rm Makefile.mine1 +else +mv Makefile.mine1 Makefile.mine +fi + +sed -e "s-^//PLACEHOLDER_NEWPROG_PROGRAMMER_ENUM-\ +#if ${CONFIGNAME} == 1\n\ + ${ENUMNAME},\n\ +#endif\n\ +\0-" \ +-e "s-//PLACEHOLDER_NEWPROG_PUBLICFUNCTIONS-\ +/* ${PROGRAMMERNAME}.c */\n\ +#if ${CONFIGNAME} == 1\n\ +int ${PROGRAMMERNAME}_init(void);\n\ +#endif\n\ +\n\0-" programmer.h >programmer.h.mine1 + +if test $NEED_BITBANG_SPI = yes; then +sed -e "s-^//PLACEHOLDER_NEWPROG_PROGRAMMER_BITBANG_ENUM-\ +#if ${CONFIGNAME} == 1\n\ + ${BITBANG_SPI_ENUMNAME},\n\ +#endif\n\ +\0-" \ +-e "s-//PLACEHOLDER_NEWPROG_SELECT_SPI_BITBANG\$-\ +|| ${CONFIGNAME} == 1 \0-" programmer.h.mine1 >programmer.h.mine +rm programmer.h.mine1 +else +mv programmer.h.mine1 programmer.h.mine +fi + +sed -e "s-PLACEHOLDER_NEWPROG_CHECK_PROGRAMMERCOUNT-\ +${CONFIGNAME}+\0-" \ +-e "s-^//PLACEHOLDER_NEWPROG_PROGRAMMER_ENUMDEFAULT-\ +#if ${CONFIGNAME} == 1\n\ + ${ENUMNAME}\n\ +#endif\n\ +\0-" cli_classic.c >cli_classic.c.mine + +sed -e "s-^//PLACEHOLDER_NEWPROG_PROGRAMMER_PRINT-\ +#if ${CONFIGNAME} == 1\n\ + msg_ginfo(\"\\\nSupported devices for the %s programmer:\\\n\",\n\ + programmer_table[${ENUMNAME}].name)\;\n\ + /* Print the supported devices here. */\n\ +#endif\n\ +\0-" print.c >print.c.mine + +sed -e "s-//PLACEHOLDER_NEWPROG_PROGRAMMER_PRINT-\ +#if ${CONFIGNAME} == 1\n\ + /* Print the supported devices here. */\n\ +#endif\n\ +\0-" print_wiki.c >print_wiki.c.mine + +cat >$PROGRAMMERNAME.c <>$PROGRAMMERNAME.c <>$PROGRAMMERNAME.c <