dasharo-issues icon indicating copy to clipboard operation
dasharo-issues copied to clipboard

Trouble with flashrom writing on MSI Z790-P - initial deployment

Open bdelgado1995 opened this issue 2 years ago • 9 comments

Dasharo version 7e06_v0.9.0

Dasharo variant MSI Pro Z790-P Wifi DDR4

Question text

This is a question about initial deployment.

On a MSI Pro Z790-P Wifi DDR4 board with the original vendor firmware (E7E06IMS.150 (3/23/2023)) and the Dasharo fork of flashrom, I'm working on the initial deployment following the instructions here, it says to do: sudo flashrom -p internal -r dump.rom.

This syntax is resulting in the transaction error between offset message below.

sudo flashrom -p internal -r dump.rom
flashrom v1.2-1033-g24b8fcf-dirty on Linux 6.2.0-33-generic (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Cannot open file stream for /dev/mtd0
No DMI table found.
Found chipset "Intel Z790".
Enabling flash write... SPI Configuration is locked down.
FREG0: Flash Descriptor region (0x00000000-0x00000fff) is read-only.
FREG1: BIOS region (0x01000000-0x01ffffff) is read-write.
FREG2: Management Engine region (0x00001000-0x003d8fff) is read-only.
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.
At least some flash regions are write protected. For write operations,
you should use a flash layout and include only writable regions. See
manpage for more details.
Enabling hardware sequencing because some important opcode is locked.
OK.
Found Programmer flash chip "Opaque flash chip" (32768 kB, Programmer-specific) on internal.
Reading flash... Transaction error between offset 0x003d9000 and 0x003d903f (= 0x003d9000 + 63)!
Read operation failed!
FAILED.

However, using sudo flashrom -p internal -r bios_back.bin --ifd -i bios does work though. Perhaps the docs need an update here? These result show:

sudo flashrom -p internal -r bios_back.bin --ifd -i bios
flashrom v1.2-1033-g24b8fcf-dirty on Linux 6.2.0-33-generic (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Cannot open file stream for /dev/mtd0
No DMI table found.
Found chipset "Intel Z790".
Enabling flash write... SPI Configuration is locked down.
FREG0: Flash Descriptor region (0x00000000-0x00000fff) is read-only.
FREG1: BIOS region (0x01000000-0x01ffffff) is read-write.
FREG2: Management Engine region (0x00001000-0x003d8fff) is read-only.
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.
At least some flash regions are write protected. For write operations,
you should use a flash layout and include only writable regions. See
manpage for more details.
Enabling hardware sequencing because some important opcode is locked.
OK.
Found Programmer flash chip "Opaque flash chip" (32768 kB, Programmer-specific) on internal.
Reading ich descriptor... done.
Using region: "bios".
Reading flash... done.

The vendor firmware was read ok:

-rw-r--r-- 1 root root 33554432 Sep 30 14:28 bios_back.bin

Now trying to write provides this error:

sudo flashrom -p internal -w msi_ms7e06_v0.9.0-dirty_ddr4.rom --ifd -i bios
flashrom v1.2-1033-g24b8fcf-dirty on Linux 6.2.0-33-generic (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Cannot open file stream for /dev/mtd0
No DMI table found.
Found chipset "Intel Z790".
Enabling flash write... SPI Configuration is locked down.
FREG0: Flash Descriptor region (0x00000000-0x00000fff) is read-only.
FREG1: BIOS region (0x01000000-0x01ffffff) is read-write.
FREG2: Management Engine region (0x00001000-0x003d8fff) is read-only.
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.
At least some flash regions are write protected. For write operations,
you should use a flash layout and include only writable regions. See
manpage for more details.
Enabling hardware sequencing because some important opcode is locked.
OK.
Found Programmer flash chip "Opaque flash chip" (32768 kB, Programmer-specific) on internal.
Reading ich descriptor... done.
Using region: "bios".
Reading old flash chip contents... Transaction error between offset 0x003d9000 and 0x003d903f (= 0x003d9000 + 63)!
FAILED.

It looks like this error is related to the ME. Is there a configuration change or alternate flashrom write syntax that I should be using? Thanks for any tips!

bdelgado1995 avatar Sep 30 '23 21:09 bdelgado1995

@bdelgado1995 I got this from @miczyg1 over the Dasharo Primer Support channel (BTW, you should have access to it since, IIRC, you are a Dasharo Entry Subscription subscriber). We typically reply on matrix much faster.

MSI started to lock the descriptor out of a sudden. There is a hole between ME and BIOS regions which is not accessible when descriptor is locked. One has to specify all readable regions when reading or writing and add an -N flag flashrom -p internal -r bios_back.bin --ifd -i fd -i me -i bios -N

So, apparently, for Z790-P, our documentation would need to be updated.

Please note there is also a bug with some stepping of RPL-S, so please ensure you will not face it yourself.

pietrushnic avatar Oct 01 '23 11:10 pietrushnic

Thanks. I tried this alternate syntax but unfortunately the update didn't proceed correctly. Looks like a problem in this region:

Transaction error between offset 0x00002000 and 0x00001fff

I can keep the board on. Can also discuss on Matrix if that's better.

sudo flashrom -p internal -w msi_ms7e06_v0.9.0-dirty_ddr4.rom --ifd -i fd -i me -i bios -N
flashrom v1.2-1033-g24b8fcf-dirty on Linux 6.2.0-33-generic (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Cannot open file stream for /dev/mtd0
No DMI table found.
Found chipset "Intel Z790".
Enabling flash write... SPI Configuration is locked down.
FREG0: Flash Descriptor region (0x00000000-0x00000fff) is read-only.
FREG1: BIOS region (0x01000000-0x01ffffff) is read-write.
FREG2: Management Engine region (0x00001000-0x003d8fff) is read-only.
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.
At least some flash regions are write protected. For write operations,
you should use a flash layout and include only writable regions. See
manpage for more details.
Enabling hardware sequencing because some important opcode is locked.
OK.
Found Programmer flash chip "Opaque flash chip" (32768 kB, Programmer-specific) on internal.
Reading ich descriptor... done.
Using regions: "bios", "me", "fd".
Reading old flash chip contents... done.
Erasing and writing flash chip... Transaction error between offset 0x00002000 and 0x00001fff (= 0x00002000 + -1)!
Reading current flash chip contents... done. Looking for another erase function.
Looking for another erase function.
Looking for another erase function.
Looking for another erase function.
Looking for another erase function.
Looking for another erase function.
Looking for another erase function.
No usable erase functions left.
FAILED!
Uh oh. Erase/write failed. 
Your flash chip is in an unknown state.
Get help on IRC (see https://www.flashrom.org/Contact) or mail
[email protected] with the subject "FAILED: <your board name>"!-------------------------------------------------------------------------------
DO NOT REBOOT OR POWEROFF!

bdelgado1995 avatar Oct 02 '23 02:10 bdelgado1995

@bdelgado1995 the ME and flash descriptor region is locked. Not sure which version of ME you are running, but it may or may not work well with Raptor Lake CPUs.

flashrom -p internal -w msi_ms7e06_v0.9.0-dirty_ddr4.rom --ifd -i bios -N

Should not report errors.

miczyg1 avatar Oct 02 '23 07:10 miczyg1

Not sure which version of ME you are running, but it may or may not work well with Raptor Lake CPUs.

Why would ME from MSI's bios for Z790-P have issues with Raptor Lake CPUs?

SergiiDmytruk avatar Oct 02 '23 11:10 SergiiDmytruk

Not sure which version of ME you are running, but it may or may not work well with Raptor Lake CPUs.

Why would ME from MSI's bios for Z790-P have issues with Raptor Lake CPUs?

Why would not? Depending on the MSI firmware version installed it may have an early version of ME, which had poor RPL support. I heard a lot about it on Matrix

miczyg1 avatar Oct 02 '23 12:10 miczyg1

Not sure which version of ME you are running, but it may or may not work well with Raptor Lake CPUs.

Why would ME from MSI's bios for Z790-P have issues with Raptor Lake CPUs?

Why would not? Depending on the MSI firmware version installed it may have an early version of ME, which had poor RPL support. I heard a lot about it on Matrix

Note than I was the guy that mentioned this, but it applies to Z690-A only. Z790-P has Raptor Lake support out of the box so I suppose than it should also use an era-accurate ME version with official Raptor Lake support. It was updating Z690 boards BIOSes without updating the ME that could cause issues with Raptor Lake like not detecting NVMe SSDs or GPUs because the PCIe Ports weren't initialized, but I don't recall hearing about that with Z790 boards. I suppose that it should be easy to check what ME version does MSI first release BIOS for the Z790-P includes to discard than this scenario is even possible.

About the Processor issue, it affects all of the 13th gen "Raptor Lakes" that are Alder Lake C0/H0 dies, so everything from 13000 to 13600 EXCEPT 13600K (13600K and above are all Raptor Lake B0). If you have one of those, 0.9.0 will not POST so you need a fixed Dasharo RC image. The good thing is that if you already flashed or something, MSI FlashBIOS works so you can either go back to MSI or flash Dasharo RC image if you bricked. Actually, if you already have successfully backuped manually MSI BIOS, I even recommend to use FlashBIOS because it is the closest thing to a "just works" feature. With flashrom, the recently locked ME descriptor also means that you have to flash twice, a first time with Dasharo, which unlocks the ME descriptor, then Dasharo again so that it can finally write over that previously locked part. FlashBIOS is as good as external reprogramming since it skips all that. Yeah, instructions have to be significantly updated to account for locked ME descriptor shenanigans.

zirblazer avatar Oct 02 '23 13:10 zirblazer

first time with Dasharo, which unlocks the ME descriptor, then Dasharo again so that it can finally write over that previously locked part. FlashBIOS is as good as external reprogramming since it skips all that.

We can't unlock the descriptor by flashing it. For Z690 you need to flash the BIOS region to v1.1.2 to enable FlashBIOS support and then use FlashBIOS to update descriptor and ME. This is totally different case

miczyg1 avatar Oct 02 '23 13:10 miczyg1

My "workaround" for

Found Programmer flash chip "Opaque flash chip" (32768 kB, Programmer-specific) on internal.
Reading flash... Transaction error between offset 0x003d9000 and 0x003d903f (= 0x003d9000 + 63)!
Read operation failed!
FAILED.

on MSI PRO Z790-P WIFI (MS-7E06) was to dump the stock MSI flash contents with CH341a (connected with wires to JTPM1 header, flashrom running on another computer; PSU connected to MSI board was disconnected from mains). I flashed Dasharo with Flash BIOS Button. This is 100% working solution, albeit it requires additional hardware and some basic electronics knowledge.

desowin avatar Feb 20 '24 20:02 desowin

Revert back to firmware v10 and it should work from stock.

mdrobnak avatar May 16 '24 19:05 mdrobnak