Philipp Deppenwiese has submitted this change. ( https://review.coreboot.org/c/coreboot/+/39103 )
Change subject: security/vboot: relocate and rename vboot_platform_is_resuming() ......................................................................
security/vboot: relocate and rename vboot_platform_is_resuming()
After measured boot is decoupled from verified boot in CB:35077, vboot_platform_is_resuming() is never vboot-specific, thus it is renamed to platform_is_resuming() and declared in bootmode.h.
Change-Id: I29b5b88af0576c34c10cfbd99659a5cdc0c75842 Signed-off-by: Bill XIE persmule@hardenedlinux.org Reviewed-on: https://review.coreboot.org/c/coreboot/+/39103 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Julius Werner jwerner@chromium.org --- M src/include/bootmode.h M src/security/vboot/vboot_common.h M src/security/vboot/vboot_logic.c M src/soc/amd/common/block/acpi/acpi.c M src/soc/intel/baytrail/pmutil.c M src/soc/intel/braswell/pmutil.c M src/soc/intel/broadwell/pmutil.c M src/soc/intel/common/block/pmc/pmclib.c M src/southbridge/intel/common/pmbase.c M src/vendorcode/eltan/security/verified_boot/vboot_check.c 10 files changed, 30 insertions(+), 25 deletions(-)
Approvals: build bot (Jenkins): Verified Julius Werner: Looks good to me, approved
diff --git a/src/include/bootmode.h b/src/include/bootmode.h index 258eba1..89e2c2c 100644 --- a/src/include/bootmode.h +++ b/src/include/bootmode.h @@ -29,4 +29,10 @@ int gfx_get_init_done(void); void gfx_set_init_done(int done);
+/* + * Determine if the platform is resuming from suspend. Returns 0 when + * not resuming, > 0 if resuming, and < 0 on error. + */ +int platform_is_resuming(void); + #endif /* __BOOTMODE_H__ */ diff --git a/src/security/vboot/vboot_common.h b/src/security/vboot/vboot_common.h index e922128..d825b82 100644 --- a/src/security/vboot/vboot_common.h +++ b/src/security/vboot/vboot_common.h @@ -48,12 +48,6 @@ */ int vboot_retrieve_hash(void *digest, size_t digest_size);
-/* - * Determine if the platform is resuming from suspend. Returns 0 when - * not resuming, > 0 if resuming, and < 0 on error. - */ -int vboot_platform_is_resuming(void); - /* ============================= VERSTAGE ================================== */ /* * Main logic for verified boot. verstage_main() is just the core vboot logic. diff --git a/src/security/vboot/vboot_logic.c b/src/security/vboot/vboot_logic.c index 80f7aaa..ab5b53d 100644 --- a/src/security/vboot/vboot_logic.c +++ b/src/security/vboot/vboot_logic.c @@ -113,7 +113,7 @@ if (!CONFIG(VBOOT_STARTS_IN_BOOTBLOCK)) return 0;
- is_resume = vboot_platform_is_resuming(); + is_resume = platform_is_resuming();
if (is_resume > 0) { uint8_t saved_hash[VBOOT_MAX_HASH_SIZE]; @@ -272,7 +272,7 @@ * does verification of memory init and thus must ensure it resumes with * the same slot that it booted from. */ if (CONFIG(RESUME_PATH_SAME_AS_BOOT) && - vboot_platform_is_resuming()) + platform_is_resuming()) ctx->flags |= VB2_CONTEXT_S3_RESUME;
/* Read secdata from TPM. Initialize TPM if secdata not found. We don't diff --git a/src/soc/amd/common/block/acpi/acpi.c b/src/soc/amd/common/block/acpi/acpi.c index 6f2f7c5..4d99f7b5 100644 --- a/src/soc/amd/common/block/acpi/acpi.c +++ b/src/soc/amd/common/block/acpi/acpi.c @@ -12,15 +12,17 @@ * GNU General Public License for more details. */
-#include <arch/acpi.h> -#include <cbmem.h> -#include <elog.h> -#include <console/console.h> -#include <soc/southbridge.h> #include <amdblocks/acpimmio.h> #include <amdblocks/acpi.h> +#include <arch/acpi.h> +#include <bootmode.h> +#include <cbmem.h> +#include <console/console.h> +#include <elog.h> #include <halt.h> #include <security/vboot/vboot_common.h> +#include <soc/southbridge.h> +#include <halt.h>
void poweroff(void) { @@ -136,7 +138,7 @@ return acpi_sleep_from_pm1(acpi_read16(MMIO_ACPI_PM1_CNT_BLK)); }
-int vboot_platform_is_resuming(void) +int platform_is_resuming(void) { if (!(acpi_read16(MMIO_ACPI_PM1_STS) & WAK_STS)) return 0; diff --git a/src/soc/intel/baytrail/pmutil.c b/src/soc/intel/baytrail/pmutil.c index 9e032ce..f0abcee 100644 --- a/src/soc/intel/baytrail/pmutil.c +++ b/src/soc/intel/baytrail/pmutil.c @@ -15,6 +15,7 @@ #include <stdint.h> #include <arch/acpi.h> #include <arch/io.h> +#include <bootmode.h> #include <device/device.h> #include <device/mmio.h> #include <device/pci.h> @@ -27,7 +28,6 @@ #include <soc/pci_devs.h> #include <soc/pmc.h> #include <security/vboot/vbnv.h> -#include <security/vboot/vboot_common.h>
#if defined(__SIMPLE_DEVICE__)
@@ -387,7 +387,7 @@ return rtc_failure(); }
-int vboot_platform_is_resuming(void) +int platform_is_resuming(void) { if (!(inw(ACPI_BASE_ADDRESS + PM1_STS) & WAK_STS)) return 0; diff --git a/src/soc/intel/braswell/pmutil.c b/src/soc/intel/braswell/pmutil.c index 9c5079f..016c45c 100644 --- a/src/soc/intel/braswell/pmutil.c +++ b/src/soc/intel/braswell/pmutil.c @@ -15,6 +15,7 @@ #include <arch/acpi.h> #include <arch/io.h> #include <assert.h> +#include <bootmode.h> #include <device/device.h> #include <device/mmio.h> #include <device/pci.h> @@ -26,7 +27,6 @@ #include <soc/pm.h> #include <stdint.h> #include <security/vboot/vbnv.h> -#include <security/vboot/vboot_common.h>
#if defined(__SIMPLE_DEVICE__)
@@ -380,7 +380,7 @@ return rtc_failure(); }
-int vboot_platform_is_resuming(void) +int platform_is_resuming(void) { if (!(inw(ACPI_BASE_ADDRESS + PM1_STS) & WAK_STS)) return 0; diff --git a/src/soc/intel/broadwell/pmutil.c b/src/soc/intel/broadwell/pmutil.c index 172d8cd..b170ff2 100644 --- a/src/soc/intel/broadwell/pmutil.c +++ b/src/soc/intel/broadwell/pmutil.c @@ -19,6 +19,7 @@
#include <arch/acpi.h> #include <arch/io.h> +#include <bootmode.h> #include <device/pci_ops.h> #include <device/device.h> #include <device/pci.h> @@ -30,7 +31,6 @@ #include <soc/pm.h> #include <soc/gpio.h> #include <security/vboot/vbnv.h> -#include <security/vboot/vboot_common.h>
/* Print status bits with descriptive names */ static void print_status_bits(u32 status, const char *bit_names[]) @@ -450,7 +450,7 @@ return sci_irq; }
-int vboot_platform_is_resuming(void) +int platform_is_resuming(void) { if (!(inw(ACPI_BASE_ADDRESS + PM1_STS) & WAK_STS)) return 0; diff --git a/src/soc/intel/common/block/pmc/pmclib.c b/src/soc/intel/common/block/pmc/pmclib.c index d03348a..47a4ed9 100644 --- a/src/soc/intel/common/block/pmc/pmclib.c +++ b/src/soc/intel/common/block/pmc/pmclib.c @@ -13,6 +13,7 @@ */
#include <arch/io.h> +#include <bootmode.h> #include <device/mmio.h> #include <cbmem.h> #include <console/console.h> @@ -21,11 +22,12 @@ #include <intelblocks/gpio.h> #include <intelblocks/tco.h> #include <option.h> +#include <pc80/mc146818rtc.h> +#include <security/vboot/vboot_common.h> #include <soc/pm.h> #include <stdint.h> #include <string.h> #include <timer.h> -#include <security/vboot/vboot_common.h>
static struct chipset_power_state power_state;
@@ -440,7 +442,7 @@ } #endif // CONFIG_PMC_GLOBAL_RESET_ENABLE_LOCK
-int vboot_platform_is_resuming(void) +int platform_is_resuming(void) { if (!(inw(ACPI_BASE_ADDRESS + PM1_STS) & WAK_STS)) return 0; diff --git a/src/southbridge/intel/common/pmbase.c b/src/southbridge/intel/common/pmbase.c index 5174ed7..2567b28 100644 --- a/src/southbridge/intel/common/pmbase.c +++ b/src/southbridge/intel/common/pmbase.c @@ -15,11 +15,11 @@ #include <stdint.h> #include <arch/acpi.h> #include <arch/io.h> +#include <bootmode.h> #include <device/pci_ops.h> #include <device/device.h> #include <device/pci.h> #include <assert.h> -#include <security/vboot/vboot_common.h>
#include "pmbase.h" #include "pmutil.h" @@ -94,7 +94,7 @@ return inb(lpc_get_pmbase() + addr); }
-int vboot_platform_is_resuming(void) +int platform_is_resuming(void) { u16 reg16 = read_pmbase16(PM1_STS);
diff --git a/src/vendorcode/eltan/security/verified_boot/vboot_check.c b/src/vendorcode/eltan/security/verified_boot/vboot_check.c index fd0d82b..63e4608 100644 --- a/src/vendorcode/eltan/security/verified_boot/vboot_check.c +++ b/src/vendorcode/eltan/security/verified_boot/vboot_check.c @@ -14,6 +14,7 @@
#include <boot_device.h> #include <bootmem.h> +#include <bootmode.h> #include <cbfs.h> #include <vboot_check.h> #include <vboot_common.h> @@ -290,7 +291,7 @@
if (CONFIG(VENDORCODE_ELTAN_MBOOT)) { printk(BIOS_DEBUG, "mb_measure returned 0x%x\n", - mb_measure(vboot_platform_is_resuming())); + mb_measure(platform_is_resuming())); }
printk(BIOS_SPEW, "%s: process early verify list\n", __func__);