attached.

ron
Here is the proposed patch to cbfstool that sets unwritten space (on creation) to flash-friendly 
values. It does not work :-) But it sure speeds up the flash writing process! And it also shows a 
need to have flashrom not erase already-erased FLASH -- that's slow!

In testing, my kontron fails to work correctly if this code is in place. Something in our code is depending on 
zeros in flash! 

Kind of interesting. 

Not signed off, of course. It is a suggestion at this point. 

Note that uninitialized_flash_value is a global that can, if we ever need it, be set by 
an argument in main. It's clear that we may need it to be for testing :-)

At the same time, "erased" value has been "1" on every EEPROM or FLASH I've used for some time now. Making 
this a settable value may not be that useful and could cause trouble. 

Here are my last messages: 
v_esp=ffdfffd8
cpu_reset = 00000000
Clearing initial memory region: No cache as ram now - src=fffd8000
dst=00100000
Uncompressing image to RAM.
image length = 0004674c
Jumping to image.

ron
Index: util/cbfstool/util.c
===================================================================
--- util/cbfstool/util.c	(revision 1668)
+++ util/cbfstool/util.c	(working copy)
@@ -25,6 +25,13 @@
 #include <sys/mman.h>
 #include "cbfstool.h"
 
+int uninitialized_flash_value = 0xff;
+
+void flashinit(void *ptr, size_t len)
+{
+	memset(ptr, uninitialized_flash_value, len);
+}
+
 int get_size(const char *size)
 {
 	char *next;
@@ -203,6 +210,9 @@
 		return -1;
 	}
 
+	/* mmap'ed pages are by default zero-filled. Fix that. */
+	flashinit(rom->ptr, romsize);
+
 	/* This is a pointer to the header for easy access */
 	rom->header = (struct cbfs_header *)
 	    ROM_PTR(rom, rom->size - 16 - bootblocksize - sizeof(struct cbfs_header));
Index: util/cbfstool/cbfstool.h
===================================================================
--- util/cbfstool/cbfstool.h	(revision 1668)
+++ util/cbfstool/cbfstool.h	(working copy)
@@ -56,6 +56,7 @@
 /* Function prototypes */
 
 /* util.c */
+void flashinit(void *ptr, size_t len);
 int open_rom(struct rom *rom, const char *filename);
 int create_rom(struct rom *rom, const unsigned char *filename, int size,
 	       const char *bootblockname, int bootblocksize,
-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to