summaryrefslogtreecommitdiffstats
path: root/src/include/bootblock_common.h
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2018-05-16 14:14:04 -0700
committerJulius Werner <jwerner@chromium.org>2018-05-22 02:44:14 +0000
commit99f4683adf3203d11c164b15a5455e778709a3e0 (patch)
tree077268ffcfa2df08671633ff0e0501e9626fda22 /src/include/bootblock_common.h
parent9123449734f43922fe39cdb08c3d60f02f0eb3ed (diff)
downloadcoreboot-99f4683adf3203d11c164b15a5455e778709a3e0.tar.gz
coreboot-99f4683adf3203d11c164b15a5455e778709a3e0.tar.bz2
coreboot-99f4683adf3203d11c164b15a5455e778709a3e0.zip
Introduce bootblock self-decompression
Masked ROMs are the silent killers of boot speed on devices without memory-mapped SPI flash. They often contain awfully slow SPI drivers (presumably bit-banged) that take hundreds of milliseconds to load our bootblock, and every extra kilobyte of bootblock size has a hugely disproportionate impact on boot speed. The coreboot timestamps can never show that component, but it impacts our users all the same. This patch tries to alleviate that issue a bit by allowing us to compress the bootblock with LZ4, which can cut its size down to nearly half. Of course, masked ROMs usually don't come with decompression algorithms built in, so we need to introduce a little decompression stub that can decompress the rest of the bootblock. This is done by creating a new "decompressor" stage which runs before the bootblock, but includes the compressed bootblock code in its data section. It needs to be as small as possible to get a real benefit from this approach, which means no device drivers, no console output, no exception handling, etc. Besides the decompression algorithm itself we only include the timer driver so that we can measure the boot speed impact of decompression. On ARM and ARM64 systems, we also need to give SoC code a chance to initialize the MMU, since running decompression without MMU is prohibitively slow on these architectures. This feature is implemented for ARM and ARM64 architectures for now, although most of it is architecture-independent and it should be relatively simple to port to other platforms where a masked ROM loads the bootblock into SRAM. It is also supposed to be a clean starting point from which later optimizations can hopefully cut down the decompression stub size (currently ~4K on RK3399) a bit more. NOTE: Bootblock compression is not for everyone. Possible side effects include trying to run LZ4 on CPUs that come out of reset extremely underclocked or enabling this too early in SoC bring-up and getting frustrated trying to find issues in an undebuggable environment. Ask your SoC vendor if bootblock compression is right for you. Change-Id: I0dc1cad9ae7508892e477739e743cd1afb5945e8 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/26340 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/include/bootblock_common.h')
-rw-r--r--src/include/bootblock_common.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/include/bootblock_common.h b/src/include/bootblock_common.h
index fa67098111aa..0f6c5e467fde 100644
--- a/src/include/bootblock_common.h
+++ b/src/include/bootblock_common.h
@@ -26,6 +26,7 @@
* The 'early' variants are called prior to console initialization. Also, the
* SoC functions are called prior to the mainboard fucntions.
*/
+void decompressor_soc_init(void);
void bootblock_mainboard_early_init(void);
void bootblock_mainboard_init(void);
void bootblock_soc_early_init(void);
@@ -47,4 +48,11 @@ asmlinkage void bootblock_c_entry(uint64_t base_timestamp);
asmlinkage void bootblock_main_with_timestamp(uint64_t base_timestamp,
struct timestamp_entry *timestamps, size_t num_timestamps);
+/* This is the argument structure passed from decompressor to bootblock. */
+struct bootblock_arg {
+ uint64_t base_timestamp;
+ uint32_t num_timestamps;
+ struct timestamp_entry timestamps[];
+};
+
#endif /* __BOOTBLOCK_COMMON_H */