summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBill XIE <persmule@hardenedlinux.org>2020-02-24 23:08:35 +0800
committerPhilipp Deppenwiese <zaolin.daisuki@gmail.com>2020-03-31 10:38:07 +0000
commit516c0a53384188f00b5df139b0840567dc8b8298 (patch)
tree787842ee7a72df3211f3497eb2a2ec370b7c8c13 /src
parentbad08c2c29210530e584436a562a1c03a68eb693 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/include/bootmode.h6
-rw-r--r--src/security/vboot/vboot_common.h6
-rw-r--r--src/security/vboot/vboot_logic.c4
-rw-r--r--src/soc/amd/common/block/acpi/acpi.c12
-rw-r--r--src/soc/intel/baytrail/pmutil.c4
-rw-r--r--src/soc/intel/braswell/pmutil.c4
-rw-r--r--src/soc/intel/broadwell/pmutil.c4
-rw-r--r--src/soc/intel/common/block/pmc/pmclib.c6
-rw-r--r--src/southbridge/intel/common/pmbase.c4
-rw-r--r--src/vendorcode/eltan/security/verified_boot/vboot_check.c3
10 files changed, 29 insertions, 24 deletions
diff --git a/src/include/bootmode.h b/src/include/bootmode.h
index 258eba1660..89e2c2cc8a 100644
--- a/src/include/bootmode.h
+++ b/src/include/bootmode.h
@@ -29,4 +29,10 @@ int display_init_required(void);
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 e9221288ad..d825b82f29 100644
--- a/src/security/vboot/vboot_common.h
+++ b/src/security/vboot/vboot_common.h
@@ -48,12 +48,6 @@ int vboot_save_hash(void *digest, size_t digest_size);
*/
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 80f7aaa86b..ab5b53dc5f 100644
--- a/src/security/vboot/vboot_logic.c
+++ b/src/security/vboot/vboot_logic.c
@@ -113,7 +113,7 @@ static int handle_digest_result(void *slot_hash, size_t slot_hash_sz)
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 @@ void verstage_main(void)
* 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 6f2f7c5ad7..4d99f7b535 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 <amdblocks/acpimmio.h>
+#include <amdblocks/acpi.h>
#include <arch/acpi.h>
+#include <bootmode.h>
#include <cbmem.h>
-#include <elog.h>
#include <console/console.h>
-#include <soc/southbridge.h>
-#include <amdblocks/acpimmio.h>
-#include <amdblocks/acpi.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 @@ int acpi_get_sleep_type(void)
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 9e032cebfb..f0abcee7d8 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 @@ int vbnv_cmos_failed(void)
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 9c5079f8ed..016c45cccc 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 @@ int vbnv_cmos_failed(void)
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 172d8cda20..b170ff27d7 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 @@ int acpi_sci_irq(void)
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 d03348adec..47a4ed9f78 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 @@ void pmc_global_reset_enable(bool enable)
}
#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 5174ed7cfa..2567b287c1 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 @@ u8 read_pmbase8(const u8 addr)
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 fd0d82b3f7..63e4608553 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 @@ void verified_boot_early_check(void)
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__);