aboutsummaryrefslogtreecommitdiff
path: root/src/tcgbios.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2015-11-19 17:43:27 -0500
committerKevin O'Connor <kevin@koconnor.net>2015-11-22 19:23:11 -0500
commit8bd4a08daecf286b5e99c6fb5ff286b1ce2f7cca (patch)
treef3b3e755431a15a5fdbb4905a1b3ddf9b5857b33 /src/tcgbios.c
parenta617542063071da7de3908b85df5ca8b4a4378fd (diff)
downloadseabios-hppa-8bd4a08daecf286b5e99c6fb5ff286b1ce2f7cca.zip
seabios-hppa-8bd4a08daecf286b5e99c6fb5ff286b1ce2f7cca.tar.gz
seabios-hppa-8bd4a08daecf286b5e99c6fb5ff286b1ce2f7cca.tar.bz2
tpm: Move tpm_add_bootdevice() into callers
The switch statement in tpm_add_bootdevice() corresponds with its call sites - just perform the appropriate action in each caller. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/tcgbios.c')
-rw-r--r--src/tcgbios.c51
1 files changed, 7 insertions, 44 deletions
diff --git a/src/tcgbios.c b/src/tcgbios.c
index 01fddcc..d415714 100644
--- a/src/tcgbios.c
+++ b/src/tcgbios.c
@@ -861,46 +861,6 @@ tpm_option_rom(const void *addr, u32 len)
(u8 *)&pcctes, sizeof(pcctes));
}
-/*
- * Add a measurement regarding the boot device (CDRom, Floppy, HDD) to
- * the list of measurements.
- */
-static u32
-tpm_add_bootdevice(u32 bootcd, u32 bootdrv)
-{
- const char *string;
-
- if (!CONFIG_TCGBIOS)
- return 0;
-
- if (!has_working_tpm())
- return TCG_GENERAL_ERROR;
-
- switch (bootcd) {
- case 0:
- switch (bootdrv) {
- case 0:
- string = "Booting BCV device 00h (Floppy)";
- break;
-
- case 0x80:
- string = "Booting BCV device 80h (HDD)";
- break;
-
- default:
- string = "Booting unknown device";
- break;
- }
-
- break;
-
- default:
- string = "Booting from CD ROM device";
- }
-
- return tpm_add_action(4, string);
-}
-
u32
tpm_add_bcv(u32 bootdrv, const u8 *addr, u32 length)
{
@@ -910,13 +870,16 @@ tpm_add_bcv(u32 bootdrv, const u8 *addr, u32 length)
if (!has_working_tpm())
return TCG_GENERAL_ERROR;
- u32 rc = tpm_add_bootdevice(0, bootdrv);
+ const char *string = "Booting BCV device 00h (Floppy)";
+ if (bootdrv == 0x80)
+ string = "Booting BCV device 80h (HDD)";
+ u32 rc = tpm_add_action(4, string);
if (rc)
return rc;
/* specs: see section 'Hard Disk Device or Hard Disk-Like Devices' */
/* equivalent to: dd if=/dev/hda ibs=1 count=440 | sha1sum */
- const char *string = "MBR";
+ string = "MBR";
rc = tpm_add_measurement_to_log(4, EV_IPL,
string, strlen(string),
addr, 0x1b8);
@@ -939,7 +902,7 @@ tpm_add_cdrom(u32 bootdrv, const u8 *addr, u32 length)
if (!has_working_tpm())
return TCG_GENERAL_ERROR;
- u32 rc = tpm_add_bootdevice(1, bootdrv);
+ u32 rc = tpm_add_action(4, "Booting from CD ROM device");
if (rc)
return rc;
@@ -959,7 +922,7 @@ tpm_add_cdrom_catalog(const u8 *addr, u32 length)
if (!has_working_tpm())
return TCG_GENERAL_ERROR;
- u32 rc = tpm_add_bootdevice(1, 0);
+ u32 rc = tpm_add_action(4, "Booting from CD ROM device");
if (rc)
return rc;