Re: [U-Boot] [PATCH v3 3/4] dm: tpm: Remove every compilation switch for TPM driver model

2015-10-04 Thread Simon Glass
Hi Christophe,

On 3 October 2015 at 15:27, Simon Glass  wrote:
> On 20 September 2015 at 21:00, Christophe Ricard
>  wrote:
>> As every TPM drivers support UCLASS_TPM, we can only rely on DM_TPM
>> functions.
>>
>> This simplify a bit the code.
>>
>> Signed-off-by: Christophe Ricard 
>> Reviewed-by: Tom Rini 
>> ---
>>
>> Changes in v3: None
>>
>>  common/cmd_tpm.c   | 13 +
>>  drivers/tpm/tpm_tis_infineon.c |  1 -
>>  include/tis.h  | 60 
>> --
>>  include/tpm.h  |  6 -
>>  lib/tpm.c  | 20 +++---
>>  5 files changed, 4 insertions(+), 96 deletions(-)
>>  delete mode 100644 include/tis.h
>
> Acked-by: Simon Glass 

I get errors with this patch:

04: dm: tpm: Remove every compilation switch for TPM driver model
   x86:  +   coreboot-x86 chromebook_link chromebox_panther
-build/../common/cmd_tpm.c:504: undefined reference to `tis_sendrecv'
-build/../lib/tpm.c:253: undefined reference to `tis_sendrecv'
-build/../lib/tpm.c:276: undefined reference to `tis_init'
-build/../lib/tpm.c:280: undefined reference to `tis_open'
+common/built-in.o: In function `get_tpm':
+build/../common/cmd_tpm.c:450: undefined reference to `uclass_first_device'
+common/built-in.o: In function `do_tpm_info':
+build/../common/cmd_tpm.c:469: undefined reference to `tpm_get_desc'
+build/../common/cmd_tpm.c:498: undefined reference to `tpm_xfer'
+build/../lib/tpm.c:245: undefined reference to `uclass_first_device'
+build/../lib/tpm.c:248: undefined reference to `tpm_xfer'
+build/../lib/tpm.c:264: undefined reference to `uclass_first_device'
+build/../lib/tpm.c:267: undefined reference to `tpm_open'
+../drivers/tpm/tpm_tis_lpc.c:19:17: fatal error: tis.h: No such file
or directory
+ #include 
+compilation terminated.
+make[3]: *** [drivers/tpm/tpm_tis_lpc.o] Error 1
+make[2]: *** [drivers/tpm] Error 2
+make[1]: *** [drivers] Error 2

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 3/4] dm: tpm: Remove every compilation switch for TPM driver model

2015-10-03 Thread Simon Glass
On 20 September 2015 at 21:00, Christophe Ricard
 wrote:
> As every TPM drivers support UCLASS_TPM, we can only rely on DM_TPM
> functions.
>
> This simplify a bit the code.
>
> Signed-off-by: Christophe Ricard 
> Reviewed-by: Tom Rini 
> ---
>
> Changes in v3: None
>
>  common/cmd_tpm.c   | 13 +
>  drivers/tpm/tpm_tis_infineon.c |  1 -
>  include/tis.h  | 60 
> --
>  include/tpm.h  |  6 -
>  lib/tpm.c  | 20 +++---
>  5 files changed, 4 insertions(+), 96 deletions(-)
>  delete mode 100644 include/tis.h

Acked-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 3/4] dm: tpm: Remove every compilation switch for TPM driver model

2015-09-20 Thread Christophe Ricard
As every TPM drivers support UCLASS_TPM, we can only rely on DM_TPM
functions.

This simplify a bit the code.

Signed-off-by: Christophe Ricard 
Reviewed-by: Tom Rini 
---

Changes in v3: None

 common/cmd_tpm.c   | 13 +
 drivers/tpm/tpm_tis_infineon.c |  1 -
 include/tis.h  | 60 --
 include/tpm.h  |  6 -
 lib/tpm.c  | 20 +++---
 5 files changed, 4 insertions(+), 96 deletions(-)
 delete mode 100644 include/tis.h

diff --git a/common/cmd_tpm.c b/common/cmd_tpm.c
index 97501cc..add6bfb 100644
--- a/common/cmd_tpm.c
+++ b/common/cmd_tpm.c
@@ -443,7 +443,6 @@ TPM_COMMAND_NO_ARG(tpm_force_clear)
 TPM_COMMAND_NO_ARG(tpm_physical_enable)
 TPM_COMMAND_NO_ARG(tpm_physical_disable)
 
-#ifdef CONFIG_DM_TPM
 static int get_tpm(struct udevice **devp)
 {
int rc;
@@ -476,11 +475,11 @@ static int do_tpm_info(cmd_tbl_t *cmdtp, int flag, int 
argc,
 
return 0;
 }
-#endif
 
 static int do_tpm_raw_transfer(cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[])
 {
+   struct udevice *dev;
void *command;
uint8_t response[1024];
size_t count, response_length = sizeof(response);
@@ -492,17 +491,11 @@ static int do_tpm_raw_transfer(cmd_tbl_t *cmdtp, int flag,
return CMD_RET_FAILURE;
}
 
-#ifdef CONFIG_DM_TPM
-   struct udevice *dev;
-
rc = get_tpm(&dev);
if (rc)
return rc;
 
rc = tpm_xfer(dev, command, count, response, &response_length);
-#else
-   rc = tis_sendrecv(command, count, response, &response_length);
-#endif
free(command);
if (!rc) {
puts("tpm response:\n");
@@ -657,9 +650,7 @@ TPM_COMMAND_NO_ARG(tpm_end_oiap)
U_BOOT_CMD_MKENT(cmd, 0, 1, do_tpm_ ## cmd, "", "")
 
 static cmd_tbl_t tpm_commands[] = {
-#ifdef CONFIG_DM_TPM
U_BOOT_CMD_MKENT(info, 0, 1, do_tpm_info, "", ""),
-#endif
U_BOOT_CMD_MKENT(init, 0, 1,
do_tpm_init, "", ""),
U_BOOT_CMD_MKENT(startup, 0, 1,
@@ -730,9 +721,7 @@ U_BOOT_CMD(tpm, CONFIG_SYS_MAXARGS, 1, do_tpm,
 "cmd args...\n"
 "- Issue TPM command  with arguments .\n"
 "Admin Startup and State Commands:\n"
-#ifdef CONFIG_DM_TPM
 "  info - Show information about the TPM\n"
-#endif
 "  init\n"
 "- Put TPM into a state where it waits for 'startup' command.\n"
 "  startup mode\n"
diff --git a/drivers/tpm/tpm_tis_infineon.c b/drivers/tpm/tpm_tis_infineon.c
index 88eb786..f57c328 100644
--- a/drivers/tpm/tpm_tis_infineon.c
+++ b/drivers/tpm/tpm_tis_infineon.c
@@ -24,7 +24,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/include/tis.h b/include/tis.h
deleted file mode 100644
index 1985d9e..000
--- a/include/tis.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2011 The Chromium OS Authors.
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-#ifndef __TIS_H
-#define __TIS_H
-
-#ifndef CONFIG_DM_TPM
-
-#include 
-
-/* Low-level interface to access TPM */
-
-/*
- * tis_init()
- *
- * Initialize the TPM device. Returns 0 on success or -1 on
- * failure (in case device probing did not succeed).
- */
-int tis_init(void);
-
-/*
- * tis_open()
- *
- * Requests access to locality 0 for the caller. After all commands have been
- * completed the caller is supposed to call tis_close().
- *
- * Returns 0 on success, -1 on failure.
- */
-int tis_open(void);
-
-/*
- * tis_close()
- *
- * terminate the currect session with the TPM by releasing the locked
- * locality. Returns 0 on success of -1 on failure (in case lock
- * removal did not succeed).
- */
-int tis_close(void);
-
-/*
- * tis_sendrecv()
- *
- * Send the requested data to the TPM and then try to get its response
- *
- * @sendbuf - buffer of the data to send
- * @send_size size of the data to send
- * @recvbuf - memory to save the response to
- * @recv_len - pointer to the size of the response buffer
- *
- * Returns 0 on success (and places the number of response bytes at recv_len)
- * or -1 on failure.
- */
-int tis_sendrecv(const uint8_t *sendbuf, size_t send_size, uint8_t *recvbuf,
-   size_t *recv_len);
-#endif
-
-#endif /* __TIS_H */
diff --git a/include/tpm.h b/include/tpm.h
index 086b672..9a6585d 100644
--- a/include/tpm.h
+++ b/include/tpm.h
@@ -8,8 +8,6 @@
 #ifndef __TPM_H
 #define __TPM_H
 
-#include 
-
 /*
  * Here is a partial implementation of TPM commands.  Please consult TCG Main
  * Specification for definitions of TPM commands.
@@ -196,8 +194,6 @@ struct tpm_permanent_flags {
u8  disable_full_da_logic_info;
 } __packed;
 
-#ifdef CONFIG_DM_TPM
-
 /* Max buffer size supported by our tpm */
 #define TPM_DEV_BUFSIZE1260
 
@@ -375,8 +371,6 @@ int tpm_get_desc(struct udevice *dev, char *buf, int size);
 int tpm_xfer(struct udevice *dev, const uint8_t *sendbuf, size_t send_size,
 uint8_t *rec