[flashrom] Re: Fail flashing

2021-03-24 Thread Mike Banon
Could you please verify that at least a part of the binary file got
flashed correctly? If yes, these reliability problems could be caused
by your setup - i.e. too long wires or the surrounding elements of the
BIOS chip are drawing too much current - causing a voltage drop on the
chip itself and the remaining is insufficient for the reliable
flashing (in this case I could recommend using the external power
supply for 3.3V line)

On Wed, Mar 24, 2021 at 9:50 AM G. Nalin  wrote:
>
> Hi all,
> I am trying to flash a WInbond w25q64bv BIOS chip of a Thinkpad L530. I am on 
> Ubuntu 20.04. Using a EEPROM  ch341a and I am not able to copy correctly the 
> content of the chip: diff and md5sum return all the time some errors. Trying 
> to erase the chip gives random errors like
>
> Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
> Found Winbond flash chip "W25Q64.V" (8192 kB, SPI) on ch341a_spi.
> Reading old flash chip contents... done.
> Erasing and writing flash chip... FAILED at 0x000b6000! Expected=0xff, 
> Found=0xae, failed byte count from 0x000b6000-0x000b6fff: 0x382
> ERASE FAILED!
>
> and so on. When I prompt the internal status I get:
>
> $sudo flashrom -V -p internal
>
> flashrom v1.2 on Linux 5.8.0-45-generic (x86_64)
> flashrom is free software, get the source code at https://flashrom.org
>
> flashrom was built with libpci 3.6.4, GCC 9.2.1 20200304, little endian
> Command line (3 args): flashrom -V -p internal
> Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
> Initializing internal programmer
> /sys/class/mtd/mtd0 does not exist
> No coreboot table found.
> Using Internal DMI decoder.
> DMI string chassis-type: "Notebook"
> Laptop detected via DMI.
> DMI string system-manufacturer: "LENOVO"
> DMI string system-product-name: "20AWS01V01"
> DMI string system-version: "ThinkPad T440p"
> DMI string baseboard-manufacturer: "LENOVO"
> DMI string baseboard-product-name: "20AWS01V01"
> DMI string baseboard-version: "0B98401 PRO"
> W836xx enter config mode worked or we were already in config mode. W836xx 
> leave config mode had no effect.
> Active config mode, unknown reg 0x20 ID: 00.
> Found chipset "Intel QM87" with PCI ID 8086:8c4f.
> This chipset is marked as untested. If you are using an up-to-date version
> of flashrom *and* were (not) able to successfully update your firmware with 
> it,
> then please email a report to flashrom@flashrom.org including a verbose (-V) 
> log.
> Thank you!
> Enabling flash write... Root Complex Register Block address = 0xfed1c000
> GCS = 0xc21: BIOS Interface Lock-Down: enabled, Boot BIOS Straps: 0x3 (SPI)
> Top Swap: not enabled
> 0x7fff/0x7fff FWH IDSEL: 0x0
> 0x7fff/0x7fff FWH IDSEL: 0x0
> 0x7fff/0x7fff FWH IDSEL: 0x1
> 0x7fff/0x7fff FWH IDSEL: 0x1
> 0x7fff/0x7fff FWH IDSEL: 0x2
> 0x7fff/0x7fff FWH IDSEL: 0x2
> 0x7fff/0x7fff FWH IDSEL: 0x3
> 0x7fff/0x7fff FWH IDSEL: 0x3
> 0x7fff/0x7fff FWH IDSEL: 0x4
> 0x7fff/0x7fff FWH IDSEL: 0x5
> 0x7fff/0x7fff FWH IDSEL: 0x6
> 0x7fff/0x7fff FWH IDSEL: 0x7
> 0x7fff/0x7fff FWH decode enabled
> 0x7fff/0x7fff FWH decode enabled
> 0x7fff/0x7fff FWH decode enabled
> 0x7fff/0x7fff FWH decode enabled
> 0x7fff/0x7fff FWH decode enabled
> 0x7fff/0x7fff FWH decode enabled
> 0x7fff/0x7fff FWH decode enabled
> 0x7fff/0x7fff FWH decode enabled
> 0x7fff/0x7fff FWH decode enabled
> 0x7fff/0x7fff FWH decode enabled
> 0x7fff/0x7fff FWH decode enabled
> 0x7fff/0x7fff FWH decode enabled
> Maximum FWH chip size: 0x10 bytes
> SPI Read Configuration: prefetching enabled, caching enabled,
> BIOS_CNTL = 0x2b: BIOS Lock Enable: enabled, BIOS Write Enable: enabled
> Warning: BIOS region SMM protection is enabled!
> Warning: Setting Bios Control at 0xdc from 0x2a to 0x09 failed.
> New value is 0x2b.
> SPIBAR = 0x7f0d5db92000 + 0x3800
> 0x04: 0xe008 (HSFS)
> HSFS: FDONE=0, FCERR=0, AEL=0, BERASE=1, SCIP=0, FDOPSS=1, FDV=1, FLOCKDN=1
> SPI Configuration is locked down.
> Reading OPCODES... done
> 0x06: 0x (HSFC)
> HSFC: FGO=0, FCYCLE=0, FDBC=0, SME=0
> 0x50: 0x4a4b (FRAP)
> BMWAG 0x00, BMRAG 0x00, BRWA 0x4a, BRRA 0x4b
> 0x54: 0x FREG0: Flash Descriptor region (0x-0x0fff) is 
> read-only.
> 0x58: 0x0bff0500 FREG1: BIOS region (0x0050-0x00bf) is read-write.
> 0x5C: 0x04ff0003 FREG2: Management Engine region (0x3000-0x004f) is 
> locked.
> 0x60: 0x00020001 FREG3: Gigabit Ethernet region (0x1000-0x2fff) is 
> read-write.
> Not all flash regions are freely accessible by flashrom. This is most likely
> due to an active ME. Please see https://flashrom.org/ME for details.
> 0x74: 0x8aaf0800 PR0: Warning: 0x0080-0x00aa is read-only.
> 0x78: 0x8ab00ab0 PR1: Warning: 0x00ab-0x00ab0fff is read-only.
> 0x7C: 0x8adf0ab1 PR2: Warning: 0x00ab1000-0x00ad is read-only.
> 0x80: 

[flashrom] Fail flashing

2021-03-24 Thread G. Nalin
Hi all,
I am trying to flash a WInbond w25q64bv BIOS chip of a Thinkpad L530. I am on 
Ubuntu 20.04. Using a EEPROM  ch341a and I am not able to copy correctly the 
content of the chip: diff and md5sum return all the time some errors. Trying to 
erase the chip gives random errors like

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found Winbond flash chip "W25Q64.V" (8192 kB, SPI) on ch341a_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... FAILED at 0x000b6000! Expected=0xff, 
Found=0xae, failed byte count from 0x000b6000-0x000b6fff: 0x382
ERASE FAILED!

and so on. When I prompt the internal status I get:

$sudo flashrom -V -p internal

flashrom v1.2 on Linux 5.8.0-45-generic (x86_64)
flashrom is free software, get the source code at https://flashrom.org

flashrom was built with libpci 3.6.4, GCC 9.2.1 20200304, little endian
Command line (3 args): flashrom -V -p internal
Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Initializing internal programmer
/sys/class/mtd/mtd0 does not exist
No coreboot table found.
Using Internal DMI decoder.
DMI string chassis-type: "Notebook"
Laptop detected via DMI.
DMI string system-manufacturer: "LENOVO"
DMI string system-product-name: "20AWS01V01"
DMI string system-version: "ThinkPad T440p"
DMI string baseboard-manufacturer: "LENOVO"
DMI string baseboard-product-name: "20AWS01V01"
DMI string baseboard-version: "0B98401 PRO"
W836xx enter config mode worked or we were already in config mode. W836xx leave 
config mode had no effect.
Active config mode, unknown reg 0x20 ID: 00.
Found chipset "Intel QM87" with PCI ID 8086:8c4f.
This chipset is marked as untested. If you are using an up-to-date version
of flashrom *and* were (not) able to successfully update your firmware with it,
then please email a report to flashrom@flashrom.org including a verbose (-V) 
log.
Thank you!
Enabling flash write... Root Complex Register Block address = 0xfed1c000
GCS = 0xc21: BIOS Interface Lock-Down: enabled, Boot BIOS Straps: 0x3 (SPI)
Top Swap: not enabled
0x7fff/0x7fff FWH IDSEL: 0x0
0x7fff/0x7fff FWH IDSEL: 0x0
0x7fff/0x7fff FWH IDSEL: 0x1
0x7fff/0x7fff FWH IDSEL: 0x1
0x7fff/0x7fff FWH IDSEL: 0x2
0x7fff/0x7fff FWH IDSEL: 0x2
0x7fff/0x7fff FWH IDSEL: 0x3
0x7fff/0x7fff FWH IDSEL: 0x3
0x7fff/0x7fff FWH IDSEL: 0x4
0x7fff/0x7fff FWH IDSEL: 0x5
0x7fff/0x7fff FWH IDSEL: 0x6
0x7fff/0x7fff FWH IDSEL: 0x7
0x7fff/0x7fff FWH decode enabled
0x7fff/0x7fff FWH decode enabled
0x7fff/0x7fff FWH decode enabled
0x7fff/0x7fff FWH decode enabled
0x7fff/0x7fff FWH decode enabled
0x7fff/0x7fff FWH decode enabled
0x7fff/0x7fff FWH decode enabled
0x7fff/0x7fff FWH decode enabled
0x7fff/0x7fff FWH decode enabled
0x7fff/0x7fff FWH decode enabled
0x7fff/0x7fff FWH decode enabled
0x7fff/0x7fff FWH decode enabled
Maximum FWH chip size: 0x10 bytes
SPI Read Configuration: prefetching enabled, caching enabled,
BIOS_CNTL = 0x2b: BIOS Lock Enable: enabled, BIOS Write Enable: enabled
Warning: BIOS region SMM protection is enabled!
Warning: Setting Bios Control at 0xdc from 0x2a to 0x09 failed.
New value is 0x2b.
SPIBAR = 0x7f0d5db92000 + 0x3800
0x04: 0xe008 (HSFS)
HSFS: FDONE=0, FCERR=0, AEL=0, BERASE=1, SCIP=0, FDOPSS=1, FDV=1, FLOCKDN=1
SPI Configuration is locked down.
Reading OPCODES... done
0x06: 0x (HSFC)
HSFC: FGO=0, FCYCLE=0, FDBC=0, SME=0
0x50: 0x4a4b (FRAP)
BMWAG 0x00, BMRAG 0x00, BRWA 0x4a, BRRA 0x4b
0x54: 0x FREG0: Flash Descriptor region (0x-0x0fff) is 
read-only.
0x58: 0x0bff0500 FREG1: BIOS region (0x0050-0x00bf) is read-write.
0x5C: 0x04ff0003 FREG2: Management Engine region (0x3000-0x004f) is 
locked.
0x60: 0x00020001 FREG3: Gigabit Ethernet region (0x1000-0x2fff) is 
read-write.
Not all flash regions are freely accessible by flashrom. This is most likely
due to an active ME. Please see https://flashrom.org/ME for details.
0x74: 0x8aaf0800 PR0: Warning: 0x0080-0x00aa is read-only.
0x78: 0x8ab00ab0 PR1: Warning: 0x00ab-0x00ab0fff is read-only.
0x7C: 0x8adf0ab1 PR2: Warning: 0x00ab1000-0x00ad is read-only.
0x80: 0x8bff0b40 PR3: Warning: 0x00b4-0x00bf is read-only.
At least some flash regions are read protected. You have to use a flash
layout and include only accessible regions. For write operations, you'll
additionally need the --noverify-all switch. See manpage for more details.
0x90: 0xc0 (SSFS)
SSFS: SCIP=0, FDONE=0, FCERR=0, AEL=0
0x91: 0xf94000 (SSFC)
SSFC: SCGO=0, ACS=0, SPOP=0, COP=0, DBC=0, SME=0, SCF=1
0x94: 0x0606 (PREOP)
0x96: 0x3f90 (OPTYPE)
0x98: 0x03003505 (OPMENU)
0x9c: 0x9f20d802 (OPMENU+4)
0xa0: 0x (BBAR)
0xc4: 0x80802025 (LVSCC)
LVSCC: BES=0x1, WG=1, WSR=0, WEWS=0, EO=0x20, VCL=1
0xc8: 0x8000 (UVSCC)
UVSCC: BES=0x0, WG=0, WSR=0, WEWS=0,