From: Stefan Berger stefanb@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@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