2020-04-02 23:48:27 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2013-06-25 22:17:43 +02:00
|
|
|
|
2014-02-26 14:19:04 +01:00
|
|
|
#ifndef _RULES_H
|
|
|
|
#define _RULES_H
|
|
|
|
|
2021-03-25 13:10:31 +01:00
|
|
|
#if defined(__TEST__)
|
|
|
|
#define ENV_TEST 1
|
|
|
|
#else
|
|
|
|
#define ENV_TEST 0
|
|
|
|
#endif
|
|
|
|
|
2020-06-08 15:52:03 +02:00
|
|
|
#if defined(__TIMELESS__)
|
|
|
|
#define ENV_TIMELESS 1
|
|
|
|
#else
|
|
|
|
#define ENV_TIMELESS 0
|
|
|
|
#endif
|
|
|
|
|
2014-02-26 14:19:04 +01:00
|
|
|
/* Useful helpers to tell whether the code is executing in bootblock,
|
|
|
|
* romstage, ramstage or SMM.
|
|
|
|
*/
|
|
|
|
|
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>
2018-05-16 23:14:04 +02:00
|
|
|
#if defined(__DECOMPRESSOR__)
|
|
|
|
#define ENV_DECOMPRESSOR 1
|
|
|
|
#define ENV_BOOTBLOCK 0
|
|
|
|
#define ENV_ROMSTAGE 0
|
|
|
|
#define ENV_RAMSTAGE 0
|
|
|
|
#define ENV_SMM 0
|
2020-04-22 01:03:53 +02:00
|
|
|
#define ENV_SEPARATE_VERSTAGE 0
|
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>
2018-05-16 23:14:04 +02:00
|
|
|
#define ENV_RMODULE 0
|
|
|
|
#define ENV_POSTCAR 0
|
|
|
|
#define ENV_LIBAGESA 0
|
|
|
|
#define ENV_STRING "decompressor"
|
|
|
|
|
|
|
|
#elif defined(__BOOTBLOCK__)
|
|
|
|
#define ENV_DECOMPRESSOR 0
|
2014-02-26 14:19:04 +01:00
|
|
|
#define ENV_BOOTBLOCK 1
|
|
|
|
#define ENV_ROMSTAGE 0
|
|
|
|
#define ENV_RAMSTAGE 0
|
|
|
|
#define ENV_SMM 0
|
2020-04-22 01:03:53 +02:00
|
|
|
#define ENV_SEPARATE_VERSTAGE 0
|
2015-09-05 19:59:26 +02:00
|
|
|
#define ENV_RMODULE 0
|
2016-03-18 18:21:23 +01:00
|
|
|
#define ENV_POSTCAR 0
|
2017-03-02 12:01:58 +01:00
|
|
|
#define ENV_LIBAGESA 0
|
2015-11-19 17:48:47 +01:00
|
|
|
#define ENV_STRING "bootblock"
|
2014-02-26 14:19:04 +01:00
|
|
|
|
2015-04-28 22:43:31 +02:00
|
|
|
#elif defined(__ROMSTAGE__)
|
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>
2018-05-16 23:14:04 +02:00
|
|
|
#define ENV_DECOMPRESSOR 0
|
2014-02-26 14:19:04 +01:00
|
|
|
#define ENV_BOOTBLOCK 0
|
|
|
|
#define ENV_ROMSTAGE 1
|
|
|
|
#define ENV_RAMSTAGE 0
|
|
|
|
#define ENV_SMM 0
|
2020-04-22 01:03:53 +02:00
|
|
|
#define ENV_SEPARATE_VERSTAGE 0
|
2015-09-05 19:59:26 +02:00
|
|
|
#define ENV_RMODULE 0
|
2016-03-18 18:21:23 +01:00
|
|
|
#define ENV_POSTCAR 0
|
2017-03-02 12:01:58 +01:00
|
|
|
#define ENV_LIBAGESA 0
|
2015-11-19 17:48:47 +01:00
|
|
|
#define ENV_STRING "romstage"
|
2014-02-26 14:19:04 +01:00
|
|
|
|
|
|
|
#elif defined(__SMM__)
|
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>
2018-05-16 23:14:04 +02:00
|
|
|
#define ENV_DECOMPRESSOR 0
|
2014-02-26 14:19:04 +01:00
|
|
|
#define ENV_BOOTBLOCK 0
|
|
|
|
#define ENV_ROMSTAGE 0
|
|
|
|
#define ENV_RAMSTAGE 0
|
|
|
|
#define ENV_SMM 1
|
2020-04-22 01:03:53 +02:00
|
|
|
#define ENV_SEPARATE_VERSTAGE 0
|
2015-09-05 19:59:26 +02:00
|
|
|
#define ENV_RMODULE 0
|
2016-03-18 18:21:23 +01:00
|
|
|
#define ENV_POSTCAR 0
|
2017-03-02 12:01:58 +01:00
|
|
|
#define ENV_LIBAGESA 0
|
2015-11-19 17:48:47 +01:00
|
|
|
#define ENV_STRING "smm"
|
2015-04-28 22:26:23 +02:00
|
|
|
|
2020-04-22 01:03:53 +02:00
|
|
|
/*
|
|
|
|
* NOTE: "verstage" code may either run as a separate stage or linked into the
|
2020-11-09 21:13:27 +01:00
|
|
|
* bootblock/romstage, depending on the setting of the VBOOT_SEPARATE_VERSTAGE
|
|
|
|
* kconfig option. The ENV_SEPARATE_VERSTAGE macro will only return true for
|
|
|
|
* "verstage" code when CONFIG(VBOOT_SEPARATE_VERSTAGE) is true, otherwise that
|
|
|
|
* code will have ENV_BOOTBLOCK or ENV_ROMSTAGE set (depending on the
|
|
|
|
* "VBOOT_STARTS_IN_"... kconfig options).
|
2020-04-22 01:03:53 +02:00
|
|
|
*/
|
2015-04-28 22:26:23 +02:00
|
|
|
#elif defined(__VERSTAGE__)
|
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>
2018-05-16 23:14:04 +02:00
|
|
|
#define ENV_DECOMPRESSOR 0
|
2015-04-28 22:26:23 +02:00
|
|
|
#define ENV_BOOTBLOCK 0
|
|
|
|
#define ENV_ROMSTAGE 0
|
|
|
|
#define ENV_RAMSTAGE 0
|
|
|
|
#define ENV_SMM 0
|
2020-04-22 01:03:53 +02:00
|
|
|
#define ENV_SEPARATE_VERSTAGE 1
|
2015-09-05 19:59:26 +02:00
|
|
|
#define ENV_RMODULE 0
|
2016-03-18 18:21:23 +01:00
|
|
|
#define ENV_POSTCAR 0
|
2017-03-02 12:01:58 +01:00
|
|
|
#define ENV_LIBAGESA 0
|
2020-10-07 05:29:38 +02:00
|
|
|
#if CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK)
|
|
|
|
#define ENV_STRING "verstage-before-bootblock"
|
|
|
|
#else
|
2015-11-19 17:48:47 +01:00
|
|
|
#define ENV_STRING "verstage"
|
2020-10-07 05:29:38 +02:00
|
|
|
#endif
|
2014-08-27 00:39:51 +02:00
|
|
|
|
2015-09-04 23:28:15 +02:00
|
|
|
#elif defined(__RAMSTAGE__)
|
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>
2018-05-16 23:14:04 +02:00
|
|
|
#define ENV_DECOMPRESSOR 0
|
2014-02-26 14:19:04 +01:00
|
|
|
#define ENV_BOOTBLOCK 0
|
|
|
|
#define ENV_ROMSTAGE 0
|
|
|
|
#define ENV_RAMSTAGE 1
|
|
|
|
#define ENV_SMM 0
|
2020-04-22 01:03:53 +02:00
|
|
|
#define ENV_SEPARATE_VERSTAGE 0
|
2015-09-05 19:59:26 +02:00
|
|
|
#define ENV_RMODULE 0
|
2016-03-18 18:21:23 +01:00
|
|
|
#define ENV_POSTCAR 0
|
2017-03-02 12:01:58 +01:00
|
|
|
#define ENV_LIBAGESA 0
|
2015-11-19 17:48:47 +01:00
|
|
|
#define ENV_STRING "ramstage"
|
2015-09-05 19:59:26 +02:00
|
|
|
|
|
|
|
#elif defined(__RMODULE__)
|
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>
2018-05-16 23:14:04 +02:00
|
|
|
#define ENV_DECOMPRESSOR 0
|
2015-09-05 19:59:26 +02:00
|
|
|
#define ENV_BOOTBLOCK 0
|
|
|
|
#define ENV_ROMSTAGE 0
|
|
|
|
#define ENV_RAMSTAGE 0
|
|
|
|
#define ENV_SMM 0
|
2020-04-22 01:03:53 +02:00
|
|
|
#define ENV_SEPARATE_VERSTAGE 0
|
2015-09-05 19:59:26 +02:00
|
|
|
#define ENV_RMODULE 1
|
2016-03-18 18:21:23 +01:00
|
|
|
#define ENV_POSTCAR 0
|
2017-03-02 12:01:58 +01:00
|
|
|
#define ENV_LIBAGESA 0
|
2015-11-19 17:48:47 +01:00
|
|
|
#define ENV_STRING "rmodule"
|
2015-09-04 23:28:15 +02:00
|
|
|
|
2016-03-18 18:21:23 +01:00
|
|
|
#elif defined(__POSTCAR__)
|
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>
2018-05-16 23:14:04 +02:00
|
|
|
#define ENV_DECOMPRESSOR 0
|
2016-03-18 18:21:23 +01:00
|
|
|
#define ENV_BOOTBLOCK 0
|
|
|
|
#define ENV_ROMSTAGE 0
|
|
|
|
#define ENV_RAMSTAGE 0
|
|
|
|
#define ENV_SMM 0
|
2020-04-22 01:03:53 +02:00
|
|
|
#define ENV_SEPARATE_VERSTAGE 0
|
2016-03-18 18:21:23 +01:00
|
|
|
#define ENV_RMODULE 0
|
|
|
|
#define ENV_POSTCAR 1
|
2017-03-02 12:01:58 +01:00
|
|
|
#define ENV_LIBAGESA 0
|
2016-03-18 18:21:23 +01:00
|
|
|
#define ENV_STRING "postcar"
|
|
|
|
|
2017-03-02 12:01:58 +01:00
|
|
|
#elif defined(__LIBAGESA__)
|
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>
2018-05-16 23:14:04 +02:00
|
|
|
#define ENV_DECOMPRESSOR 0
|
2017-03-02 12:01:58 +01:00
|
|
|
#define ENV_BOOTBLOCK 0
|
|
|
|
#define ENV_ROMSTAGE 0
|
|
|
|
#define ENV_RAMSTAGE 0
|
|
|
|
#define ENV_SMM 0
|
2020-04-22 01:03:53 +02:00
|
|
|
#define ENV_SEPARATE_VERSTAGE 0
|
2017-03-02 12:01:58 +01:00
|
|
|
#define ENV_RMODULE 0
|
|
|
|
#define ENV_POSTCAR 0
|
|
|
|
#define ENV_LIBAGESA 1
|
|
|
|
#define ENV_STRING "libagesa"
|
|
|
|
|
2015-09-04 23:28:15 +02:00
|
|
|
#else
|
|
|
|
/*
|
|
|
|
* Default case of nothing set for random blob generation using
|
2017-03-02 12:01:58 +01:00
|
|
|
* create_class_compiler that isn't bound to a stage.
|
2015-09-04 23:28:15 +02:00
|
|
|
*/
|
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>
2018-05-16 23:14:04 +02:00
|
|
|
#define ENV_DECOMPRESSOR 0
|
2015-09-04 23:28:15 +02:00
|
|
|
#define ENV_BOOTBLOCK 0
|
|
|
|
#define ENV_ROMSTAGE 0
|
|
|
|
#define ENV_RAMSTAGE 0
|
|
|
|
#define ENV_SMM 0
|
2020-04-22 01:03:53 +02:00
|
|
|
#define ENV_SEPARATE_VERSTAGE 0
|
2015-09-05 19:59:26 +02:00
|
|
|
#define ENV_RMODULE 0
|
2016-03-18 18:21:23 +01:00
|
|
|
#define ENV_POSTCAR 0
|
2017-03-02 12:01:58 +01:00
|
|
|
#define ENV_LIBAGESA 0
|
2015-11-19 17:48:47 +01:00
|
|
|
#define ENV_STRING "UNKNOWN"
|
2014-02-26 14:19:04 +01:00
|
|
|
#endif
|
2013-06-25 22:17:43 +02:00
|
|
|
|
2015-11-13 22:28:41 +01:00
|
|
|
/* Define helpers about the current architecture, based on toolchain.inc. */
|
|
|
|
|
|
|
|
#if defined(__ARCH_arm__)
|
|
|
|
#define ENV_ARM 1
|
|
|
|
#define ENV_ARM64 0
|
|
|
|
#if __COREBOOT_ARM_ARCH__ == 4
|
|
|
|
#define ENV_ARMV4 1
|
|
|
|
#define ENV_ARMV7 0
|
|
|
|
#elif __COREBOOT_ARM_ARCH__ == 7
|
|
|
|
#define ENV_ARMV4 0
|
|
|
|
#define ENV_ARMV7 1
|
2016-09-08 19:13:59 +02:00
|
|
|
#if defined(__COREBOOT_ARM_V7_A__)
|
|
|
|
#define ENV_ARMV7_A 1
|
|
|
|
#define ENV_ARMV7_M 0
|
|
|
|
#define ENV_ARMV7_R 0
|
|
|
|
#elif defined(__COREBOOT_ARM_V7_M__)
|
|
|
|
#define ENV_ARMV7_A 0
|
|
|
|
#define ENV_ARMV7_M 1
|
|
|
|
#define ENV_ARMV7_R 0
|
|
|
|
#elif defined(__COREBOOT_ARM_V7_R__)
|
|
|
|
#define ENV_ARMV7_A 0
|
|
|
|
#define ENV_ARMV7_M 0
|
|
|
|
#define ENV_ARMV7_R 1
|
|
|
|
#endif
|
2015-11-13 22:28:41 +01:00
|
|
|
#else
|
|
|
|
#define ENV_ARMV4 0
|
|
|
|
#define ENV_ARMV7 0
|
|
|
|
#endif
|
|
|
|
#define ENV_ARMV8 0
|
|
|
|
#define ENV_RISCV 0
|
|
|
|
#define ENV_X86 0
|
|
|
|
#define ENV_X86_32 0
|
|
|
|
#define ENV_X86_64 0
|
|
|
|
|
|
|
|
#elif defined(__ARCH_arm64__)
|
|
|
|
#define ENV_ARM 0
|
|
|
|
#define ENV_ARM64 1
|
|
|
|
#define ENV_ARMV4 0
|
|
|
|
#define ENV_ARMV7 0
|
|
|
|
#if __COREBOOT_ARM_ARCH__ == 8
|
|
|
|
#define ENV_ARMV8 1
|
|
|
|
#else
|
|
|
|
#define ENV_ARMV8 0
|
|
|
|
#endif
|
|
|
|
#define ENV_RISCV 0
|
|
|
|
#define ENV_X86 0
|
|
|
|
#define ENV_X86_32 0
|
|
|
|
#define ENV_X86_64 0
|
|
|
|
|
|
|
|
#elif defined(__ARCH_riscv__)
|
|
|
|
#define ENV_ARM 0
|
|
|
|
#define ENV_ARM64 0
|
|
|
|
#define ENV_ARMV4 0
|
|
|
|
#define ENV_ARMV7 0
|
|
|
|
#define ENV_ARMV8 0
|
|
|
|
#define ENV_RISCV 1
|
|
|
|
#define ENV_X86 0
|
|
|
|
#define ENV_X86_32 0
|
|
|
|
#define ENV_X86_64 0
|
|
|
|
|
|
|
|
#elif defined(__ARCH_x86_32__)
|
|
|
|
#define ENV_ARM 0
|
|
|
|
#define ENV_ARM64 0
|
|
|
|
#define ENV_ARMV4 0
|
|
|
|
#define ENV_ARMV7 0
|
|
|
|
#define ENV_ARMV8 0
|
|
|
|
#define ENV_RISCV 0
|
|
|
|
#define ENV_X86 1
|
|
|
|
#define ENV_X86_32 1
|
|
|
|
#define ENV_X86_64 0
|
|
|
|
|
|
|
|
#elif defined(__ARCH_x86_64__)
|
|
|
|
#define ENV_ARM 0
|
|
|
|
#define ENV_ARM64 0
|
|
|
|
#define ENV_ARMV4 0
|
|
|
|
#define ENV_ARMV7 0
|
|
|
|
#define ENV_ARMV8 0
|
|
|
|
#define ENV_RISCV 0
|
|
|
|
#define ENV_X86 1
|
|
|
|
#define ENV_X86_32 0
|
|
|
|
#define ENV_X86_64 1
|
|
|
|
|
|
|
|
#else
|
|
|
|
#define ENV_ARM 0
|
|
|
|
#define ENV_ARM64 0
|
|
|
|
#define ENV_ARMV4 0
|
|
|
|
#define ENV_ARMV7 0
|
|
|
|
#define ENV_ARMV8 0
|
|
|
|
#define ENV_RISCV 0
|
|
|
|
#define ENV_X86 0
|
|
|
|
#define ENV_X86_32 0
|
|
|
|
#define ENV_X86_64 0
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2019-05-11 16:42:20 +02:00
|
|
|
#if CONFIG(RAMPAYLOAD)
|
|
|
|
/* ENV_PAYLOAD_LOADER is set to ENV_POSTCAR when CONFIG_RAMPAYLOAD is enabled */
|
|
|
|
#define ENV_PAYLOAD_LOADER ENV_POSTCAR
|
|
|
|
#else
|
2019-05-09 19:09:25 +02:00
|
|
|
/* ENV_PAYLOAD_LOADER is set when you are in a stage that loads the payload.
|
|
|
|
* For now, that is the ramstage. */
|
|
|
|
#define ENV_PAYLOAD_LOADER ENV_RAMSTAGE
|
2019-05-11 16:42:20 +02:00
|
|
|
#endif
|
2019-05-09 19:09:25 +02:00
|
|
|
|
2019-08-17 16:29:36 +02:00
|
|
|
#define ENV_ROMSTAGE_OR_BEFORE \
|
2019-09-14 13:59:38 +02:00
|
|
|
(ENV_DECOMPRESSOR || ENV_BOOTBLOCK || ENV_ROMSTAGE || \
|
2020-06-11 04:35:35 +02:00
|
|
|
(ENV_SEPARATE_VERSTAGE && !CONFIG(VBOOT_STARTS_IN_ROMSTAGE)))
|
2019-08-17 16:29:36 +02:00
|
|
|
|
2020-06-08 05:05:03 +02:00
|
|
|
#if ENV_X86
|
2019-08-17 16:29:36 +02:00
|
|
|
/* Indicates memory layout is determined with arch/x86/car.ld. */
|
2019-04-23 00:26:23 +02:00
|
|
|
#define ENV_CACHE_AS_RAM (ENV_ROMSTAGE_OR_BEFORE && !CONFIG(RESET_VECTOR_IN_RAM))
|
2019-08-21 06:15:38 +02:00
|
|
|
/* No .data sections with execute-in-place from ROM. */
|
2022-05-12 18:01:13 +02:00
|
|
|
#define ENV_HAS_DATA_SECTION !ENV_CACHE_AS_RAM
|
2019-08-21 06:15:38 +02:00
|
|
|
#else
|
|
|
|
/* Both .data and .bss, sometimes SRAM not DRAM. */
|
2022-05-12 18:01:13 +02:00
|
|
|
#define ENV_HAS_DATA_SECTION 1
|
2019-08-21 06:15:38 +02:00
|
|
|
#define ENV_CACHE_AS_RAM 0
|
|
|
|
#endif
|
|
|
|
|
2020-11-30 14:03:51 +01:00
|
|
|
/* Indicates if the stage uses the _bss region defined in arch/x86/car.ld */
|
|
|
|
#define ENV_SEPARATE_BSS (ENV_CACHE_AS_RAM && (ENV_BOOTBLOCK || !CONFIG(NO_XIP_EARLY_STAGES)))
|
|
|
|
|
2019-08-21 06:15:38 +02:00
|
|
|
/* Currently rmodules, ramstage and smm have heap. */
|
2022-05-12 18:01:13 +02:00
|
|
|
#define ENV_HAS_HEAP_SECTION (ENV_RMODULE || ENV_RAMSTAGE || ENV_SMM)
|
2019-08-21 06:15:38 +02:00
|
|
|
|
2020-07-24 02:27:58 +02:00
|
|
|
/* Set USER_SPACE in the makefile for the rare code that runs in userspace */
|
|
|
|
#if defined(__USER_SPACE__)
|
|
|
|
#define ENV_USER_SPACE 1
|
|
|
|
#else
|
|
|
|
#define ENV_USER_SPACE 0
|
|
|
|
#endif
|
|
|
|
|
2020-07-15 21:57:54 +02:00
|
|
|
/* Define the first stage to run */
|
|
|
|
#if CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK)
|
|
|
|
#define ENV_INITIAL_STAGE ENV_SEPARATE_VERSTAGE
|
|
|
|
#else
|
|
|
|
#define ENV_INITIAL_STAGE ENV_BOOTBLOCK
|
|
|
|
#endif
|
|
|
|
|
2022-03-31 06:40:10 +02:00
|
|
|
#define ENV_CREATES_CBMEM ENV_ROMSTAGE
|
|
|
|
#define ENV_HAS_CBMEM (ENV_ROMSTAGE | ENV_POSTCAR | ENV_RAMSTAGE)
|
2022-04-07 06:16:48 +02:00
|
|
|
#define ENV_RAMINIT ENV_ROMSTAGE
|
2022-03-31 06:40:10 +02:00
|
|
|
|
2021-11-10 02:10:58 +01:00
|
|
|
#if ENV_X86
|
2022-05-12 18:01:13 +02:00
|
|
|
#define ENV_HAS_SPINLOCKS !ENV_ROMSTAGE_OR_BEFORE
|
2021-11-10 02:10:58 +01:00
|
|
|
#elif ENV_RISCV
|
2022-05-12 18:01:13 +02:00
|
|
|
#define ENV_HAS_SPINLOCKS 1
|
2021-11-10 02:10:58 +01:00
|
|
|
#else
|
2022-05-12 18:01:13 +02:00
|
|
|
#define ENV_HAS_SPINLOCKS 0
|
2021-11-10 02:10:58 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* When set <arch/smp/spinlock.h> is included for the spinlock implementation. */
|
2022-05-12 18:01:13 +02:00
|
|
|
#define ENV_SUPPORTS_SMP (CONFIG(SMP) && ENV_HAS_SPINLOCKS)
|
2021-11-10 02:10:58 +01:00
|
|
|
|
2021-11-22 21:43:49 +01:00
|
|
|
#if ENV_X86 && CONFIG(COOP_MULTITASKING) && (ENV_RAMSTAGE || ENV_ROMSTAGE)
|
|
|
|
/* TODO: Enable in all x86 stages */
|
2022-05-12 18:01:13 +02:00
|
|
|
#define ENV_SUPPORTS_COOP 1
|
2021-11-22 21:43:49 +01:00
|
|
|
#else
|
2022-05-12 18:01:13 +02:00
|
|
|
#define ENV_SUPPORTS_COOP 0
|
2021-11-22 21:43:49 +01:00
|
|
|
#endif
|
|
|
|
|
2018-04-18 10:13:32 +02:00
|
|
|
/**
|
|
|
|
* For pre-DRAM stages and post-CAR always build with simple device model, ie.
|
|
|
|
* PCI, PNP and CPU functions operate without use of devicetree. The reason
|
|
|
|
* post-CAR utilizes __SIMPLE_DEVICE__ is for simplicity. Currently there's
|
|
|
|
* no known requirement that devicetree would be needed during that stage.
|
|
|
|
*
|
|
|
|
* For ramstage individual source file may define __SIMPLE_DEVICE__
|
|
|
|
* before including any header files to force that particular source
|
|
|
|
* be built with simple device model.
|
|
|
|
*/
|
|
|
|
|
2019-08-17 16:29:36 +02:00
|
|
|
#if !ENV_RAMSTAGE
|
2018-04-18 10:13:32 +02:00
|
|
|
#define __SIMPLE_DEVICE__
|
|
|
|
#endif
|
|
|
|
|
2014-02-26 14:19:04 +01:00
|
|
|
#endif /* _RULES_H */
|