[SeaBIOS] [PATCH 2/3] tpm: Introduce a cache variable for TCPA table pointer

Stefan Berger stefanb at us.ibm.com
Fri Nov 20 19:32:31 CET 2015


From: Stefan Berger <stefanb at linux.vnet.ibm.com>

Introduce a cache variable for the TCPA ACPI table pointer
to avoid having to search for it every time it is needed.

Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
---
 src/tcgbios.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/tcgbios.c b/src/tcgbios.c
index cd5e2cf..cb741f0 100644
--- a/src/tcgbios.c
+++ b/src/tcgbios.c
@@ -90,6 +90,7 @@ typedef struct {
     u8            tpm_working:1;
     u8            if_shutdown:1;
     u8            tpm_driver_to_use:4;
+    struct tcpa_descriptor_rev2 *tcpa;
 } tpm_state_t;
 
 
@@ -195,6 +196,10 @@ find_tcpa_by_rsdp(struct rsdp_descriptor *rsdp)
         ctr++;
     }
 
+    /* cache it */
+    if (tcpa)
+        tpm_state.tcpa = tcpa;
+
     return tcpa;
 }
 
@@ -205,6 +210,9 @@ find_tcpa_table(void)
     struct tcpa_descriptor_rev2 *tcpa = NULL;
     struct rsdp_descriptor *rsdp = RsdpAddr;
 
+    if (tpm_state.tcpa)
+        return tpm_state.tcpa;
+
     if (rsdp)
         tcpa = find_tcpa_by_rsdp(rsdp);
     else
-- 
2.4.3




More information about the SeaBIOS mailing list