[coreboot-gerrit] Patch set updated for coreboot: Partly revert "lzma: Port size-checking ulzman() version to coreboot"

Paul Menzel (paulepanter@users.sourceforge.net) gerrit at coreboot.org
Wed Feb 24 00:27:32 CET 2016


Paul Menzel (paulepanter at users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13773

-gerrit

commit 0b871f477ab52eed2ef4fa2057e56f4e1be267c6
Author: Paul Menzel <paulepanter at users.sourceforge.net>
Date:   Wed Feb 24 00:03:27 2016 +0100

    Partly revert "lzma: Port size-checking ulzman() version to coreboot"
    
    This partly reverts a25b5d257dbfbff808b19bf8c48565435e6bef9d.
    
    Revert the change in `src/lib/lzmadecode.c` as it increases the boot
    time to ramstage by 150 ms on the ASRock E350M1.
    
    There seems to be some special case with the flash ROM access. Until
    this has been figured out, revert the change.
    
    Change-Id: Icc480c41cda77526256ba1761b29a24def48400e
    Signed-off-by: Paul Menzel <paulepanter at users.sourceforge.net>
---
 src/lib/lzmadecode.c |  7 ++-----
 src/lib/selfboot.c   | 24 ++++--------------------
 2 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/src/lib/lzmadecode.c b/src/lib/lzmadecode.c
index fbf1596..ada7226 100644
--- a/src/lib/lzmadecode.c
+++ b/src/lib/lzmadecode.c
@@ -29,12 +29,9 @@
 #define kBitModelTotal (1 << kNumBitModelTotalBits)
 #define kNumMoveBits 5
 
-/* Use 32-bit reads whenever possible to avoid bad flash performance. Fall back
- * to byte reads for last 4 bytes since RC_TEST returns an error when BufferLim
- * is *reached* (not surpassed!), meaning we can't allow that to happen while
- * there are still bytes to decode from the algorithm's point of view. */
+/* Use 32-bit reads whenever possible to avoid bad flash performance.  */
 #define RC_READ_BYTE (look_ahead_ptr < 4 ? look_ahead.raw[look_ahead_ptr++] \
-		      : ((((uintptr_t) Buffer & 3) || ((SizeT) (BufferLim - Buffer) <= 4)) ? (*Buffer++) \
+		      : ((((uintptr_t) Buffer & 3) || ((SizeT) (BufferLim - Buffer) < 4)) ? (*Buffer++) \
 	   : ((look_ahead.dw = *(UInt32 *)Buffer), (Buffer += 4), (look_ahead_ptr = 1), look_ahead.raw[0])))
 
 #define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \
diff --git a/src/lib/selfboot.c b/src/lib/selfboot.c
index 7d3e2dd..60cda6a 100644
--- a/src/lib/selfboot.c
+++ b/src/lib/selfboot.c
@@ -14,7 +14,6 @@
  * GNU General Public License for more details.
  */
 
-#include <commonlib/compression.h>
 #include <console/console.h>
 #include <cpu/cpu.h>
 #include <endian.h>
@@ -26,7 +25,6 @@
 #include <lib.h>
 #include <bootmem.h>
 #include <program_loading.h>
-#include <timestamp.h>
 
 static const unsigned long lb_start = (unsigned long)&_program;
 static const unsigned long lb_end = (unsigned long)&_eprogram;
@@ -116,9 +114,6 @@ static int relocate_segment(unsigned long buffer, struct segment *seg)
 	if (!overlaps_coreboot(seg))
 		return 0;
 
-	if (!arch_supports_bounce_buffer())
-		die ("bounce buffer not supported");
-
 	start = seg->s_dstaddr;
 	middle = start + seg->s_filesz;
 	end = start + seg->s_memsz;
@@ -383,23 +378,12 @@ static int load_self_segments(
 		/* Copy data from the initial buffer */
 		if (ptr->s_filesz) {
 			unsigned char *middle, *end;
-			size_t len = ptr->s_filesz;
-			size_t memsz = ptr->s_memsz;
+			size_t len;
+			len = ptr->s_filesz;
 			switch(ptr->compression) {
 				case CBFS_COMPRESS_LZMA: {
 					printk(BIOS_DEBUG, "using LZMA\n");
-					timestamp_add_now(TS_START_ULZMA);
-					len = ulzman(src, len, dest, memsz);
-					timestamp_add_now(TS_END_ULZMA);
-					if (!len) /* Decompression Error. */
-						return 0;
-					break;
-				}
-				case CBFS_COMPRESS_LZ4: {
-					printk(BIOS_DEBUG, "using LZ4\n");
-					timestamp_add_now(TS_START_ULZ4F);
-					len = ulz4fn(src, len, dest, memsz);
-					timestamp_add_now(TS_END_ULZ4F);
+					len = ulzma(src, dest);
 					if (!len) /* Decompression Error. */
 						return 0;
 					break;
@@ -413,7 +397,7 @@ static int load_self_segments(
 					printk(BIOS_INFO,  "CBFS:  Unknown compression type %d\n", ptr->compression);
 					return -1;
 			}
-			end = dest + memsz;
+			end = dest + ptr->s_memsz;
 			middle = dest + len;
 			printk(BIOS_SPEW, "[ 0x%08lx, %08lx, 0x%08lx) <- %08lx\n",
 				(unsigned long)dest,



More information about the coreboot-gerrit mailing list