[Skiboot] [PATCH v2 05/12] libstb: Register TPM chip for further use within TSS

Eric Richter erichte at linux.ibm.com
Mon Jan 20 13:36:53 AEDT 2020


From: "Mauro S. M. Rodrigues" <maurosr at linux.vnet.ibm.com>

TSS will know which device and transmit handler to use through this
registration.

Signed-off-by: Mauro S. M. Rodrigues <maurosr at linux.vnet.ibm.com>
Signed-off-by: Eric Richter <erichte at linux.ibm.com>
---
 libstb/drivers/tpm_i2c_nuvoton.c |  2 ++
 libstb/tpm_chip.h                | 19 +------------------
 2 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/libstb/drivers/tpm_i2c_nuvoton.c b/libstb/drivers/tpm_i2c_nuvoton.c
index 3679ddaf..44a61471 100644
--- a/libstb/drivers/tpm_i2c_nuvoton.c
+++ b/libstb/drivers/tpm_i2c_nuvoton.c
@@ -10,6 +10,7 @@
 #include "tpm_i2c_interface.h"
 #include "tpm_i2c_nuvoton.h"
 #include <opal-api.h>
+#include <tpm2.h>
 
 //#define DBG(fmt, ...) prlog(PR_DEBUG, fmt, ##__VA_ARGS__)
 #define DBG(fmt, ...)
@@ -593,6 +594,7 @@ void tpm_i2c_nuvoton_probe(void)
 			free(tpm_device);
 			continue;
 		}
+		tpm2_register(tpm_device, &tpm_i2c_nuvoton_driver);
 		bus = i2c_find_bus_by_id(tpm_device->bus_id);
 		assert(bus->check_quirk == NULL);
 		bus->check_quirk = nuvoton_tpm_quirk;
diff --git a/libstb/tpm_chip.h b/libstb/tpm_chip.h
index dede420f..b7d291e8 100644
--- a/libstb/tpm_chip.h
+++ b/libstb/tpm_chip.h
@@ -8,25 +8,8 @@
 
 #include "tss/tpmLogMgr.H"
 #include "tss/trustedTypes.H"
+#include <tpm2.h>
 
-struct tpm_dev {
-
-	/* TPM bus id */
-	int bus_id;
-
-	/* TPM address in the bus */
-	int i2c_addr;
-};
-
-struct tpm_driver {
-
-	/* Driver name */
-	const char* name;
-
-	/* Transmit the TPM command stored in buf to the tpm device */
-	int (*transmit)(struct tpm_dev *dev, uint8_t* buf, size_t cmdlen,
-			size_t *buflen);
-};
 
 struct tpm_chip {
 
-- 
2.21.0



More information about the Skiboot mailing list