diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-01-10 10:53:24 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-11-27 15:04:48 -0500 |
commit | 9ec57de1db32fc75d2acd740d4a3bf47cdf023e6 (patch) | |
tree | fe5355b64af835df28d932d404c61770e7d4f17c /src/tcgbios.c | |
parent | 0166993d3c47c0c9a69175b5c24166e74f9d5b07 (diff) | |
download | seabios-hppa-9ec57de1db32fc75d2acd740d4a3bf47cdf023e6.zip seabios-hppa-9ec57de1db32fc75d2acd740d4a3bf47cdf023e6.tar.gz seabios-hppa-9ec57de1db32fc75d2acd740d4a3bf47cdf023e6.tar.bz2 |
acpi: Generalize find_fadt() and find_tcpa_by_rsdp() into find_acpi_table()
The find_fadt() and find_tcpa_by_rsdp() functions are very similar.
Create a new find_acpi_table() function and replace the two functions
with this new function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/tcgbios.c')
-rw-r--r-- | src/tcgbios.c | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/src/tcgbios.c b/src/tcgbios.c index 5c40d62..5475535 100644 --- a/src/tcgbios.c +++ b/src/tcgbios.c @@ -71,42 +71,10 @@ struct { u8 * log_area_last_entry; } tpm_state VARLOW; -static struct tcpa_descriptor_rev2 * -find_tcpa_by_rsdp(struct rsdp_descriptor *rsdp) -{ - if (!rsdp) { - dprintf(DEBUG_tcg, - "TCGBIOS: RSDP was NOT found! -- Disabling interface.\n"); - return NULL; - } - struct rsdt_descriptor *rsdt = (void*)rsdp->rsdt_physical_address; - if (!rsdt) - return NULL; - - u32 length = rsdt->length; - u16 off = offsetof(struct rsdt_descriptor, entry); - u32 ctr = 0; - while ((off + sizeof(rsdt->entry[0])) <= length) { - /* try all pointers to structures */ - struct tcpa_descriptor_rev2 *tcpa = (void*)rsdt->entry[ctr]; - - /* valid TCPA ACPI table ? */ - if (tcpa->signature == TCPA_SIGNATURE - && checksum(tcpa, tcpa->length) == 0) - return tcpa; - - off += sizeof(rsdt->entry[0]); - ctr++; - } - - dprintf(DEBUG_tcg, "TCGBIOS: TCPA ACPI was NOT found!\n"); - return NULL; -} - static int tpm_tcpa_probe(void) { - struct tcpa_descriptor_rev2 *tcpa = find_tcpa_by_rsdp(RsdpAddr); + struct tcpa_descriptor_rev2 *tcpa = find_acpi_table(TCPA_SIGNATURE); if (!tcpa) return -1; |