[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200330151536.871700-3-stefanb@linux.vnet.ibm.com>
Date: Mon, 30 Mar 2020 11:15:35 -0400
From: Stefan Berger <stefanb@...ux.vnet.ibm.com>
To: linux-integrity@...r.kernel.org, jarkko.sakkinen@...ux.intel.com,
linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
linux-security-module@...r.kernel.org
Cc: Stefan Berger <stefanb@...ux.ibm.com>
Subject: [PATCH v2 2/3] tpm: Rearrange ACPI log code to easier extend for TPM2 case
From: Stefan Berger <stefanb@...ux.ibm.com>
Rearrange the ACPI table based log code to allow for easier extension
for the TPM2 case.
Signed-off-by: Stefan Berger <stefanb@...ux.ibm.com>
---
drivers/char/tpm/eventlog/acpi.c | 39 ++++++++++++++++++++-------------------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/drivers/char/tpm/eventlog/acpi.c b/drivers/char/tpm/eventlog/acpi.c
index 63ada5e53f13..1ef2267c9378 100644
--- a/drivers/char/tpm/eventlog/acpi.c
+++ b/drivers/char/tpm/eventlog/acpi.c
@@ -50,9 +50,6 @@ int tpm_read_log_acpi(struct tpm_chip *chip)
u64 len, start;
struct tpm_bios_log *log;
- if (chip->flags & TPM_CHIP_FLAG_TPM2)
- return -ENODEV;
-
log = &chip->log;
/* Unfortuntely ACPI does not associate the event log with a specific
@@ -61,23 +58,27 @@ int tpm_read_log_acpi(struct tpm_chip *chip)
if (!chip->acpi_dev_handle)
return -ENODEV;
- /* Find TCPA entry in RSDT (ACPI_LOGICAL_ADDRESSING) */
- status = acpi_get_table(ACPI_SIG_TCPA, 1,
- (struct acpi_table_header **)&buff);
-
- if (ACPI_FAILURE(status))
+ if (chip->flags & TPM_CHIP_FLAG_TPM2) {
return -ENODEV;
-
- switch(buff->platform_class) {
- case BIOS_SERVER:
- len = buff->server.log_max_len;
- start = buff->server.log_start_addr;
- break;
- case BIOS_CLIENT:
- default:
- len = buff->client.log_max_len;
- start = buff->client.log_start_addr;
- break;
+ } else {
+ /* Find TCPA entry in RSDT (ACPI_LOGICAL_ADDRESSING) */
+ status = acpi_get_table(ACPI_SIG_TCPA, 1,
+ (struct acpi_table_header **)&buff);
+
+ if (ACPI_FAILURE(status))
+ return -ENODEV;
+
+ switch (buff->platform_class) {
+ case BIOS_SERVER:
+ len = buff->server.log_max_len;
+ start = buff->server.log_start_addr;
+ break;
+ case BIOS_CLIENT:
+ default:
+ len = buff->client.log_max_len;
+ start = buff->client.log_start_addr;
+ break;
+ }
}
if (!len) {
dev_warn(&chip->dev, "%s: TCPA log area empty\n", __func__);
--
2.14.5
Powered by blists - more mailing lists