lib/selfboot.c: Fix indentation and drop one newline

Change-Id: Ica4254297f5d05e75f852d7e9a9e7bb833dfcea7
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50397
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Angel Pons 2021-02-08 18:45:21 +01:00 committed by Patrick Georgi
parent 56a676e5d0
commit 6f4dc8f7a4
1 changed files with 54 additions and 55 deletions

View File

@ -53,67 +53,66 @@ static int load_one_segment(uint8_t *dest,
uint32_t compression, uint32_t compression,
int flags) int flags)
{ {
unsigned char *middle, *end; unsigned char *middle, *end;
printk(BIOS_DEBUG, "Loading Segment: addr: %p memsz: 0x%016zx filesz: 0x%016zx\n", printk(BIOS_DEBUG, "Loading Segment: addr: %p memsz: 0x%016zx filesz: 0x%016zx\n",
dest, memsz, len); dest, memsz, len);
/* Compute the boundaries of the segment */ /* Compute the boundaries of the segment */
end = dest + memsz; end = dest + memsz;
/* Copy data from the initial buffer */ /* Copy data from the initial buffer */
switch (compression) { switch (compression) {
case CBFS_COMPRESS_LZMA: { case CBFS_COMPRESS_LZMA: {
printk(BIOS_DEBUG, "using LZMA\n"); printk(BIOS_DEBUG, "using LZMA\n");
timestamp_add_now(TS_START_ULZMA); timestamp_add_now(TS_START_ULZMA);
len = ulzman(src, len, dest, memsz); len = ulzman(src, len, dest, memsz);
timestamp_add_now(TS_END_ULZMA); timestamp_add_now(TS_END_ULZMA);
if (!len) /* Decompression Error. */ 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);
if (!len) /* Decompression Error. */
return 0;
break;
}
case CBFS_COMPRESS_NONE: {
printk(BIOS_DEBUG, "it's not compressed!\n");
memcpy(dest, src, len);
break;
}
default:
printk(BIOS_INFO, "CBFS: Unknown compression type %d\n", compression);
return 0; return 0;
} break;
/* Calculate middle after any changes to len. */ }
middle = dest + len; case CBFS_COMPRESS_LZ4: {
printk(BIOS_SPEW, "[ 0x%08lx, %08lx, 0x%08lx) <- %08lx\n", printk(BIOS_DEBUG, "using LZ4\n");
(unsigned long)dest, timestamp_add_now(TS_START_ULZ4F);
len = ulz4fn(src, len, dest, memsz);
timestamp_add_now(TS_END_ULZ4F);
if (!len) /* Decompression Error. */
return 0;
break;
}
case CBFS_COMPRESS_NONE: {
printk(BIOS_DEBUG, "it's not compressed!\n");
memcpy(dest, src, len);
break;
}
default:
printk(BIOS_INFO, "CBFS: Unknown compression type %d\n", compression);
return 0;
}
/* Calculate middle after any changes to len. */
middle = dest + len;
printk(BIOS_SPEW, "[ 0x%08lx, %08lx, 0x%08lx) <- %08lx\n",
(unsigned long)dest,
(unsigned long)middle,
(unsigned long)end,
(unsigned long)src);
/* Zero the extra bytes between middle & end */
if (middle < end) {
printk(BIOS_DEBUG,
"Clearing Segment: addr: 0x%016lx memsz: 0x%016lx\n",
(unsigned long)middle, (unsigned long)middle,
(unsigned long)end, (unsigned long)(end - middle));
(unsigned long)src);
/* Zero the extra bytes between middle & end */ /* Zero the extra bytes */
if (middle < end) { memset(middle, 0, end - middle);
printk(BIOS_DEBUG, }
"Clearing Segment: addr: 0x%016lx memsz: 0x%016lx\n",
(unsigned long)middle,
(unsigned long)(end - middle));
/* Zero the extra bytes */
memset(middle, 0, end - middle);
}
/*
* Each architecture can perform additional operations
* on the loaded segment
*/
prog_segment_loaded((uintptr_t)dest, memsz, flags);
/*
* Each architecture can perform additional operations
* on the loaded segment
*/
prog_segment_loaded((uintptr_t)dest, memsz, flags);
return 1; return 1;
} }