Hi Zheng,
running flashrom on certain systems with SB700 family chipsets will
result in read and write corruption. I have added a corruption check to
latest flashrom, and it seems that the IMC will access flash even if
flashrom holds the BiosSemaphore (LPC bridge config space register 0x40,
bit 5).
Matthias Kretz owns a Supermicro H8DGT with this problem, but other
boards (including a MITAC development board) exhibit the same issue.
If we use flashrom to write, the SPI registers (especially FIFO counter
and FIFO) will lock up after some time, and we have not been successful
in getting the stuck board working again.
Is there a way to stop the IMC from the host or to stop all IMC flash
accesses (including read and instruction fetch)?
Regards,
Carl-Daniel
--
http://www.hailfinger.org/
Hi Daniel,
I follow your suggestion capture error messages from flashrom v0.9.2-runknown. We have probed SPI bus while that application is running, and have found that ROM shadow address 0xFFC00000 seems to be accessed. It may be the cause. Whatever, I have submitted the request of application modification to 3rd party, and expect that flashrom will be also improved in the future.
Could you not post our messages from mail to Patchwork Flashrom web site for commerce? I appreciate for your immediate assistance here.
Best Regards,
Hony
-----Original Message-----
From: Carl-Daniel Hailfinger [mailto:c-d.hailfinger.devel.2006@gmx.net]
Sent: Wednesday, August 18, 2010 11:42 PM
To: hony.chiang (江昆仲 - MIC)
Cc: victor.chen (陳文貴 - MIC); jerry.c (陳亭岳 - MIC); flashrom(a)flashrom.org
Subject: Re: [flashrom] Urgent: Flash part would be destroied by flashrom 0.9.2 once manager application is running.
Hi Hony,
can you please update flashrom to the latest version from svn and then run
flashrom -V -r test.rom
while the 3rd party application is running?
This should detect the corruption you were seeing. The corruption is no
fixed yet, but detecting it is a good first step.
Thanks!
Regards,
Carl-Daniel
--
http://www.hailfinger.org/
hony.chiang (江昆仲 - MIC) would like to recall the message, "[flashrom] Urgent: Flash part would be destroied by flashrom 0.9.2 once manager application is running.".
Hi Daniel,
I follow your suggestion capture error messages from flashrom v0.9.2-runknown. We have probed SPI bus while that application is running, and have found that ROM shadow address 0xFFEC0000 seems to be accessed. It may be the cause. Whatever, I have submitted the request of application modification to 3rd party, and expect that flashrom will be also improved in the future.
Could you not post our messages from mail to Patchwork Flashrom web site for commerce? I appreciate for your immediate assistance here.
Best Regards,
Hony
-----Original Message-----
From: Carl-Daniel Hailfinger [mailto:c-d.hailfinger.devel.2006@gmx.net]
Sent: Wednesday, August 18, 2010 11:42 PM
To: hony.chiang (江昆仲 - MIC)
Cc: victor.chen (陳文貴 - MIC); jerry.c (陳亭岳 - MIC); flashrom(a)flashrom.org
Subject: Re: [flashrom] Urgent: Flash part would be destroied by flashrom 0.9.2 once manager application is running.
Hi Hony,
can you please update flashrom to the latest version from svn and then run
flashrom -V -r test.rom
while the 3rd party application is running?
This should detect the corruption you were seeing. The corruption is no
fixed yet, but detecting it is a good first step.
Thanks!
Regards,
Carl-Daniel
--
http://www.hailfinger.org/
Try to request the BIOS semaphore on SB700 family southbridges.
This is a really gross hack and should _not_ enter the tree as is. It is
also potentially dangerous on SB600, and will slow down all flash
accesses a lot.
It is a really simple patch designed to test my assumptions about locking.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Index: flashrom-sb700_spi_imc_flash_arbitration/sb600spi.c
===================================================================
--- flashrom-sb700_spi_imc_flash_arbitration/sb600spi.c (Revision 1145)
+++ flashrom-sb700_spi_imc_flash_arbitration/sb600spi.c (Arbeitskopie)
@@ -42,6 +42,7 @@
*/
static uint8_t *sb600_spibar = NULL;
+static struct pci_dev *lpc_bridge = NULL;
int sb600_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len)
{
@@ -100,6 +101,71 @@
;
}
+static int request_flash_access(void)
+{
+ uint8_t tmp;
+ int i = 0;
+
+ tmp = pci_read_byte(lpc_bridge, 0x40);
+ if (tmp & (1 << 6)) {
+ msg_pspew("Waiting for SB600 IMC to release flash access.\n");
+ while (pci_read_byte(lpc_bridge, 0x40) & (1 << 6)) {
+ if (++i > 1024) {
+ msg_perr("SB600 IMC did not release flash.\n");
+ return 1;
+ }
+ }
+ msg_pspew("SB600 IMC released flash access after %i cycles.\n",
+ i);
+ i = 0;
+ }
+
+ if (tmp & (1 << 5)) {
+ /* Is this an error? */
+ msg_pdbg("Strange. SB600 flash access requested although it "
+ "was already granted.\n");
+ return 0;
+ }
+
+ /* Request BiosSemaphore. */
+ tmp = pci_read_byte(lpc_bridge, 0x40);
+ tmp |= 1 << 5;
+ pci_write_byte(lpc_bridge, 0x40, tmp);
+ while (!(pci_read_byte(lpc_bridge, 0x40) & (1 << 5))) {
+ if (++i > 1024) {
+ msg_perr("SB600 flash access was not granted.\n");
+ return 1;
+ }
+ }
+ tmp = pci_read_byte(lpc_bridge, 0x40);
+ if (tmp & (1 << 6)) {
+ msg_perr("Very strange. SB600 IMC has flash access although "
+ "we requested SB600 flash access.\n");
+ return 1;
+ }
+ msg_pspew("SB600 flash access granted after %i cycles.\n", i);
+ return 0;
+}
+
+static int release_flash_access(void)
+{
+ uint8_t tmp;
+
+ tmp = pci_read_byte(lpc_bridge, 0x40);
+ if (tmp & (1 << 6)) {
+ /* Is this an error? */
+ msg_pdbg("Strange. SB600 IMC already has flash access.\n");
+ }
+ if (!(tmp & (1 << 5))) {
+ /* Is this an error? */
+ msg_pdbg("Strange. SB600 already released flash access.\n");
+ }
+ tmp &= ~(1 << 5);
+ pci_write_byte(lpc_bridge, 0x40, tmp);
+
+ return 0;
+}
+
int sb600_spi_send_command(unsigned int writecnt, unsigned int readcnt,
const unsigned char *writearr, unsigned char *readarr)
{
@@ -126,6 +192,13 @@
return SPI_INVALID_LENGTH;
}
+ /* FIXME: Waiting for arbitration here is stupid. We need arbitration
+ * either at the start of a multicommand, or even at SB600 init.
+ * FIXME: Check if arbitration also is needed on SB600.
+ */
+ if (request_flash_access())
+ return SPI_PROGRAMMER_ERROR;
+
/* This is a workaround for a bug in SB600 and SB700. If we only send
* an opcode and no additional data/address, the SPI controller will
* read one byte too few from the chip. Basically, the last byte of
@@ -199,6 +272,7 @@
"flash chip.\n");
return SPI_PROGRAMMER_ERROR;
}
+ release_flash_access();
return 0;
}
@@ -212,6 +286,8 @@
"Reserved", "33", "22", "16.5"
};
+ lpc_bridge = dev;
+
/* Read SPI_BaseAddr */
tmp = pci_read_long(dev, 0xa0);
tmp &= 0xffffffe0; /* remove bits 4-0 (reserved) */
--
http://www.hailfinger.org/
Hi Sirs,
Nice to have your support. I get the serious problem on flashrom 0.9.2 on our server systems. We always have to run 3rd party manager application to call up flashrom for BIOS upgrade. However, flashrom would be failed on “Verifying flash” step because some of programmed data in flash part is different with ones in golden ROM image file on random offset addresses. This defect occurs on Red Hat 5 x64, SLES 10 x64 and SLES 11 x64. If I run flashrom tool manually without this 3rd application, it would always flash SPI part successfully. Due to the 3rd party application is confidential, it can not be provided to you for defect reproduction.
Q1: May I suspect that expected data that is written to mapped virtual memory space by flashrom is overwritten or interfered by other process from 3rd application before SPI host controller operates these data to SPI ROM?
Q2: May I suspect that expected data that is written to mapped virtual memory space by flashrom is not sync to physical memory space immediately when SPI host controller operates these data to SPI ROM?
Q3: In order to prevent other process to interfere /dev/mem, mapped virtual memory space or physical memory space that flashrom uses, would you have any idea or some slice codes to lock them during flashrom operation?
Q4: Would you have any idea to trace the root cause interfered flashrom?
Please advise me your professional comments. Thanks!!
Verbose message:
Programming flash
done.
COMPLETE.
Verifying flash... VERIFY FAILED at 0x00017ca4! Expected=0xff, Read=0x25, failed
byte count from 0x00000000-0x003fffff: 0x3a
Your flash chip is in an unknown state.
Get help on IRC at irc.freenode.net (channel #flashrom) or
mail flashrom(a)flashrom.org!
-------------------------------------------------------------------------------
DO NOT REBOOT OR POWEROFF!
Syntax:
./flashrom –w 24a.rom
Hardware configuration:
MB: AMD platform solution
South Bridge: AMD SP5100
Flash part: ST M25P32
NOS:
Reg Hat 5 X86_X64
SLES 10 X86_X64
SLES 11 X86_X64
Best Regards,
Hony Chiang