On 02.02.2009 05:12, Bao, Zheng wrote:
Signed-off-by: Zheng Bao zheng.bao@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.
- 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@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)