]> xenbits.xensource.com Git - seabios.git/commitdiff
tpm: Move tpm_add_bootdevice() into callers
authorKevin O'Connor <kevin@koconnor.net>
Thu, 19 Nov 2015 22:43:27 +0000 (17:43 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Mon, 23 Nov 2015 00:23:11 +0000 (19:23 -0500)
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>
src/tcgbios.c

index 01fddcc3b1cb15d94896c3f19306b02913131c4b..d415714a4b639987b74c08b49100d3b4dd1ab8d9 100644 (file)
@@ -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;