[coreboot] [patch] flashrom: resending my patch about SPI/LPC conflicts

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Mon May 18 14:40:30 CEST 2009

On 02.02.2009 05:12, Bao, Zheng wrote:
> Signed-off-by: Zheng Bao <zheng.bao at amd.com>
> This patch is about flashrom running on dbm690t. It was sent several
> months ago and hasn't got any response yet. Now it deals with 3
> problems.
> 1. Fix the bug that the flashrom would hang if there is not SPI chip. A
> timeout detection was added.
> 2. We only access LPC ROM if we boot via LPC ROM. And only SPI ROM if we
> boot via SPI ROM. Doing crossly is not allowed. Anybody has better idea?
> 3. When we read/write SPI, we use memory read/write instead of sending
> SPI command.

I have simplified the SPI read memcpy() patch a bit. What do you think?

There is one possible problem with the patch: How will it interact with
ROM region read protection (PCI config reg 0x50, 0x54, 0x58, 0x5C of the
LPC bridge)? Does that protection only affect LPC or does it affect SPI
as well? If it affects SPI, we have to check for read protection before
using memcpy().

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>

Index: flashrom-sb600_spi_read_memcpy/sb600spi.c
--- flashrom-sb600_spi_read_memcpy/sb600spi.c	(Revision 531)
+++ flashrom-sb600_spi_read_memcpy/sb600spi.c	(Arbeitskopie)
@@ -41,14 +41,11 @@
 int sb600_spi_read(struct flashchip *flash, uint8_t *buf)
-	int rc = 0, i;
 	int total_size = flash->total_size * 1024;
-	int page_size = 8;
-	for (i = 0; i < total_size / page_size; i++)
-		spi_nbyte_read(i * page_size, (void *)(buf + i * page_size),
-			       page_size);
-	return rc;
+	memcpy(buf, (void *)flash->virtual_memory, total_size);
+	return 0;
 uint8_t sb600_read_status_register(void)


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: flashrom_sb600_spi_read_memcpy.diff
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20090518/661f4b85/attachment.ksh>

More information about the coreboot mailing list