diff mbox series

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

Message ID 20200120023700.5373-6-erichte@linux.ibm.com
State Superseded
Headers show
Series Add initial secure variable storage and backend drivers | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch
snowpatch_ozlabs/apply_patch warning Failed to apply on branch master (d75e82dbfbb9443efeb3f9a5921ac23605aab469)

Commit Message

Eric Richter Jan. 20, 2020, 2:36 a.m. UTC
From: "Mauro S. M. Rodrigues" <maurosr@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@linux.vnet.ibm.com>
Signed-off-by: Eric Richter <erichte@linux.ibm.com>
---
 libstb/drivers/tpm_i2c_nuvoton.c |  2 ++
 libstb/tpm_chip.h                | 19 +------------------
 2 files changed, 3 insertions(+), 18 deletions(-)

Comments

Stefan Berger Jan. 22, 2020, 9:01 p.m. UTC | #1
On 1/19/20 9:36 PM, Eric Richter wrote:
> From: "Mauro S. M. Rodrigues" <maurosr@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@linux.vnet.ibm.com>
> Signed-off-by: Eric Richter <erichte@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);
> -};


Wasn't this just added in 3/12 ?


>   
>   struct tpm_chip {
>
diff mbox series

Patch

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 {