[SeaBIOS] [PATCH 2/2] tcg: Use seabios setup()/prepboot() calling convention for tcg
Kevin O'Connor
kevin at koconnor.net
Wed Jun 10 17:11:47 CEST 2015
Rename tcg externally called functions to more closely match other
subsystems.
Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
src/post.c | 12 ++++++------
src/tcgbios.c | 34 ++++++++++++++--------------------
src/tcgbios.h | 6 +++---
3 files changed, 23 insertions(+), 29 deletions(-)
diff --git a/src/post.c b/src/post.c
index ff2cb6c..6157b50 100644
--- a/src/post.c
+++ b/src/post.c
@@ -174,11 +174,17 @@ platform_hardware_setup(void)
// Platform specific setup
qemu_platform_setup();
coreboot_platform_setup();
+
+ // Initialize TPM
+ tpm_setup();
}
void
prepareboot(void)
{
+ // Change TPM phys. presence state befor leaving BIOS
+ tpm_prepboot();
+
// Run BCVs
bcv_prepboot();
@@ -222,9 +228,6 @@ maininit(void)
if (threads_during_optionroms())
device_hardware_setup();
- // Initialize TPM
- tpm_start();
-
// Run vga option rom
vgarom_setup();
@@ -241,9 +244,6 @@ maininit(void)
interactive_bootmenu();
wait_threads();
- // Change TPM phys. presence state befor leaving BIOS
- tpm_leave_bios();
-
// Prepare for boot.
prepareboot();
diff --git a/src/tcgbios.c b/src/tcgbios.c
index 0d57462..6f9e0aa 100644
--- a/src/tcgbios.c
+++ b/src/tcgbios.c
@@ -503,31 +503,31 @@ err_exit:
}
-u32
-tpm_start(void)
+void
+tpm_setup(void)
{
if (!CONFIG_TCGBIOS)
- return 0;
+ return;
tpm_acpi_init();
if (runningOnXen())
- return 0;
+ return;
- return tpm_startup();
+ tpm_startup();
}
-u32
-tpm_leave_bios(void)
+void
+tpm_prepboot(void)
{
u32 rc;
u32 returnCode;
if (!CONFIG_TCGBIOS)
- return 0;
+ return;
if (!has_working_tpm())
- return TCG_GENERAL_ERROR;
+ return;
rc = build_and_send_cmd(0, TPM_ORD_PhysicalPresence,
PhysicalPresence_CMD_ENABLE,
@@ -551,15 +551,12 @@ tpm_leave_bios(void)
if (rc)
goto err_exit;
- return 0;
+ return;
err_exit:
dprintf(DEBUG_tcg, "TCGBIOS: TPM malfunctioning (line %d).\n", __LINE__);
tpm_state.tpm_working = 0;
- if (rc)
- return rc;
- return TCG_TCG_COMMAND_ERROR;
}
static int
@@ -1451,17 +1448,17 @@ tpm_add_cdrom_catalog(const u8 *addr, u32 length)
return tpm_ipl(IPL_EL_TORITO_2, addr, length);
}
-u32
+void
tpm_s3_resume(void)
{
u32 rc;
u32 returnCode;
if (!CONFIG_TCGBIOS)
- return 0;
+ return;
if (!has_working_tpm())
- return TCG_GENERAL_ERROR;
+ return;
dprintf(DEBUG_tcg, "TCGBIOS: Resuming with TPM_Startup(ST_STATE)\n");
@@ -1475,13 +1472,10 @@ tpm_s3_resume(void)
if (rc || returnCode)
goto err_exit;
- return 0;
+ return;
err_exit:
dprintf(DEBUG_tcg, "TCGBIOS: TPM malfunctioning (line %d).\n", __LINE__);
tpm_state.tpm_working = 0;
- if (rc)
- return rc;
- return TCG_TCG_COMMAND_ERROR;
}
diff --git a/src/tcgbios.h b/src/tcgbios.h
index 2d5c45d..8d25aa5 100644
--- a/src/tcgbios.h
+++ b/src/tcgbios.h
@@ -23,9 +23,9 @@ enum ipltype {
struct bregs;
void tpm_interrupt_handler32(struct bregs *regs);
-u32 tpm_start(void);
-u32 tpm_leave_bios(void);
-u32 tpm_s3_resume(void);
+void tpm_setup(void);
+void tpm_prepboot(void);
+void tpm_s3_resume(void);
u32 tpm_add_bcv(u32 bootdrv, const u8 *addr, u32 length);
u32 tpm_add_cdrom(u32 bootdrv, const u8 *addr, u32 length);
u32 tpm_add_cdrom_catalog(const u8 *addr, u32 length);
--
1.9.3
More information about the SeaBIOS
mailing list