Re: [PATCH V3 1/2] driver: add PPI support in tpm driver

2012-08-15 Thread Kent Yoder
On Thu, Jul 12, 2012 at 09:45:29AM -0500, Kent Yoder wrote:
> On Thu, Jul 12, 2012 at 02:38:56AM +, Zhang, Xiaoyan wrote:
> > Hi Kent,
> > 
> > Thanks for your comment on the patch. But there's some confusion on my side.
> > You mentioned not to change the tpm driver name. But the driver is linked 
> > from tpm.c and tpm_ppi.c, so I should change the original tpm.c file name, 
> > right? Is it acceptable to change tpm.c to tpm_common.c or tpm_utils.c or 
> > else?
> 
>   I think you can just add tpm_ppi.c like this:
> 
> diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile
> index beac52f6..96b9222 100644
> --- a/drivers/char/tpm/Makefile
> +++ b/drivers/char/tpm/Makefile
> @@ -4,7 +4,7 @@
>  obj-$(CONFIG_TCG_TPM) += tpm.o
>  ifdef CONFIG_ACPI
> obj-$(CONFIG_TCG_TPM) += tpm_bios.o
> -   tpm_bios-objs += tpm_eventlog.o tpm_acpi.o
> +   tpm_bios-objs += tpm_eventlog.o tpm_acpi.o tpm_ppi.o
>  endif
>  obj-$(CONFIG_TCG_TIS) += tpm_tis.o
>  obj-$(CONFIG_TCG_TIS_I2C_INFINEON) += tpm_i2c_infineon.o

Hi Xiaoyan,

  Can you please resubmit the PPI patches applying on top of this tree?

  git://github.com:shpedoikal/linux.git v3.6-rc1-tpmdd-staging

Thanks,
Kent

> 
> Kent
> 
> > 
> > Thanks,
> > Xiaoyan
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3 1/2] driver: add PPI support in tpm driver

2012-08-15 Thread Kent Yoder
On Thu, Jul 12, 2012 at 09:45:29AM -0500, Kent Yoder wrote:
 On Thu, Jul 12, 2012 at 02:38:56AM +, Zhang, Xiaoyan wrote:
  Hi Kent,
  
  Thanks for your comment on the patch. But there's some confusion on my side.
  You mentioned not to change the tpm driver name. But the driver is linked 
  from tpm.c and tpm_ppi.c, so I should change the original tpm.c file name, 
  right? Is it acceptable to change tpm.c to tpm_common.c or tpm_utils.c or 
  else?
 
   I think you can just add tpm_ppi.c like this:
 
 diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile
 index beac52f6..96b9222 100644
 --- a/drivers/char/tpm/Makefile
 +++ b/drivers/char/tpm/Makefile
 @@ -4,7 +4,7 @@
  obj-$(CONFIG_TCG_TPM) += tpm.o
  ifdef CONFIG_ACPI
 obj-$(CONFIG_TCG_TPM) += tpm_bios.o
 -   tpm_bios-objs += tpm_eventlog.o tpm_acpi.o
 +   tpm_bios-objs += tpm_eventlog.o tpm_acpi.o tpm_ppi.o
  endif
  obj-$(CONFIG_TCG_TIS) += tpm_tis.o
  obj-$(CONFIG_TCG_TIS_I2C_INFINEON) += tpm_i2c_infineon.o

Hi Xiaoyan,

  Can you please resubmit the PPI patches applying on top of this tree?

  git://github.com:shpedoikal/linux.git v3.6-rc1-tpmdd-staging

Thanks,
Kent

 
 Kent
 
  
  Thanks,
  Xiaoyan
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
 

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3 1/2] driver: add PPI support in tpm driver

2012-07-12 Thread Kent Yoder
On Thu, Jul 12, 2012 at 02:38:56AM +, Zhang, Xiaoyan wrote:
> Hi Kent,
> 
> Thanks for your comment on the patch. But there's some confusion on my side.
> You mentioned not to change the tpm driver name. But the driver is linked 
> from tpm.c and tpm_ppi.c, so I should change the original tpm.c file name, 
> right? Is it acceptable to change tpm.c to tpm_common.c or tpm_utils.c or 
> else?

  I think you can just add tpm_ppi.c like this:

diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile
index beac52f6..96b9222 100644
--- a/drivers/char/tpm/Makefile
+++ b/drivers/char/tpm/Makefile
@@ -4,7 +4,7 @@
 obj-$(CONFIG_TCG_TPM) += tpm.o
 ifdef CONFIG_ACPI
obj-$(CONFIG_TCG_TPM) += tpm_bios.o
-   tpm_bios-objs += tpm_eventlog.o tpm_acpi.o
+   tpm_bios-objs += tpm_eventlog.o tpm_acpi.o tpm_ppi.o
 endif
 obj-$(CONFIG_TCG_TIS) += tpm_tis.o
 obj-$(CONFIG_TCG_TIS_I2C_INFINEON) += tpm_i2c_infineon.o

Kent

> 
> Thanks,
> Xiaoyan

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3 1/2] driver: add PPI support in tpm driver

2012-07-12 Thread Kent Yoder
On Thu, Jul 12, 2012 at 02:38:56AM +, Zhang, Xiaoyan wrote:
 Hi Kent,
 
 Thanks for your comment on the patch. But there's some confusion on my side.
 You mentioned not to change the tpm driver name. But the driver is linked 
 from tpm.c and tpm_ppi.c, so I should change the original tpm.c file name, 
 right? Is it acceptable to change tpm.c to tpm_common.c or tpm_utils.c or 
 else?

  I think you can just add tpm_ppi.c like this:

diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile
index beac52f6..96b9222 100644
--- a/drivers/char/tpm/Makefile
+++ b/drivers/char/tpm/Makefile
@@ -4,7 +4,7 @@
 obj-$(CONFIG_TCG_TPM) += tpm.o
 ifdef CONFIG_ACPI
obj-$(CONFIG_TCG_TPM) += tpm_bios.o
-   tpm_bios-objs += tpm_eventlog.o tpm_acpi.o
+   tpm_bios-objs += tpm_eventlog.o tpm_acpi.o tpm_ppi.o
 endif
 obj-$(CONFIG_TCG_TIS) += tpm_tis.o
 obj-$(CONFIG_TCG_TIS_I2C_INFINEON) += tpm_i2c_infineon.o

Kent

 
 Thanks,
 Xiaoyan

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH V3 1/2] driver: add PPI support in tpm driver

2012-07-11 Thread Zhang, Xiaoyan
Hi Kent,

Thanks for your comment on the patch. But there's some confusion on my side.
You mentioned not to change the tpm driver name. But the driver is linked from 
tpm.c and tpm_ppi.c, so I should change the original tpm.c file name, right? Is 
it acceptable to change tpm.c to tpm_common.c or tpm_utils.c or else?

Thanks,
Xiaoyan


-Original Message-
From: Kent Yoder [mailto:k...@linux.vnet.ibm.com] 
Sent: Wednesday, July 11, 2012 11:25 PM
To: Zhang, Xiaoyan
Cc: linux-kernel@vger.kernel.org; Cihula, Joseph; Wei, Gang; 
tpmdd-de...@lists.sourceforge.net; deb...@linux.vnet.ibm.com; 
sra...@linux.vnet.ibm.com; m.selho...@sirrix.com; shpedoi...@gmail.com; 
linux-security-mod...@vger.kernel.org; james.l.mor...@oracle.com; 
h...@zytor.com; linux-...@vger.kernel.org
Subject: Re: [PATCH V3 1/2] driver: add PPI support in tpm driver

Hi Xiaoyan,

On Thu, Jun 21, 2012 at 06:54:51AM +, Zhang, Xiaoyan wrote:
> From: Xiaoyan Zhang 
> 
> The Physical Presence Interface enables the OS and the BIOS to 
> cooperate and provides a simple and straightforward platform user 
> experience for administering the TPM without sacrificing security.
> 
> V2: separate the patch out in a separate source file, add #ifdef 
> CONFIG_ACPI so it compiles out on ppc, and use standard error instead 
> of ACPI error as return code of show/store fns.
> 
> V3: move #ifdef CONFIG_ACPI from .c file to .h file
> 
> Signed-off-by: Xiaoyan Zhang 
> ---
>  drivers/char/tpm/Makefile  |4 +-
>  drivers/char/tpm/tpm.c |5 +
>  drivers/char/tpm/tpm.h |8 +
>  drivers/char/tpm/tpm_ppi.c |  461 
> 
>  4 files changed, 477 insertions(+), 1 deletions(-)  create mode 
> 100644 drivers/char/tpm/tpm_ppi.c
> 
> diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile 
> index ea3a1e0..132ad95 100644
> --- a/drivers/char/tpm/Makefile
> +++ b/drivers/char/tpm/Makefile
> @@ -1,8 +1,10 @@
>  #
>  # Makefile for the kernel tpm device drivers.
>  #
> -obj-$(CONFIG_TCG_TPM) += tpm.o
> +obj-$(CONFIG_TCG_TPM) += tpm_main.o
> +tpm_main-y += tpm.o
>  ifdef CONFIG_ACPI
> + tpm_main-y += tpm_ppi.o
>   obj-$(CONFIG_TCG_TPM) += tpm_bios.o

  This will change the name of the tpm driver, which I really don't want to do. 
Can you apply on top of [1] and resubmit?  I've added the following patch which 
modularizes the event logging code and has a couple Makefile changes too. This 
is needed for a future driver on PPC, but it should make adding your file 
obvious. Note that the patch below applies on top of Infineon's I2C driver 
patches.

[1] git://github.com/shpedoikal/linux.git tpmdd-next

Thanks,
Kent

tpm: modularize event log collection

Break ACPI-specific pieces of the event log handling into their own file and 
create tpm_eventlog.[ch] to store common event log handling code.
This will be required to integrate future event log sources on platforms 
without ACPI tables.

Signed-off-by: Kent Yoder 
---
 drivers/char/tpm/Makefile   |1 +
 drivers/char/tpm/tpm.c  |1 +
 drivers/char/tpm/tpm_acpi.c |  104 
 drivers/char/tpm/tpm_bios.c |  556 ---
 drivers/char/tpm/tpm_eventlog.c |  419 +
 drivers/char/tpm/tpm_eventlog.h |   71 +
 6 files changed, 596 insertions(+), 556 deletions(-)  create mode 100644 
drivers/char/tpm/tpm_acpi.c  delete mode 100644 drivers/char/tpm/tpm_bios.c  
create mode 100644 drivers/char/tpm/tpm_eventlog.c  create mode 100644 
drivers/char/tpm/tpm_eventlog.h

diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile index 
a9c3afc..beac52f6 100644
--- a/drivers/char/tpm/Makefile
+++ b/drivers/char/tpm/Makefile
@@ -4,6 +4,7 @@
 obj-$(CONFIG_TCG_TPM) += tpm.o
 ifdef CONFIG_ACPI
obj-$(CONFIG_TCG_TPM) += tpm_bios.o
+   tpm_bios-objs += tpm_eventlog.o tpm_acpi.o
 endif
 obj-$(CONFIG_TCG_TIS) += tpm_tis.o
 obj-$(CONFIG_TCG_TIS_I2C_INFINEON) += tpm_i2c_infineon.o diff --git 
a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index d39b1f6..beb98c3 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -30,6 +30,7 @@
 #include 
 
 #include "tpm.h"
+#include "tpm_eventlog.h"
 
 enum tpm_const {
TPM_MINOR = 224,/* officially assigned */
diff --git a/drivers/char/tpm/tpm_acpi.c b/drivers/char/tpm/tpm_acpi.c new file 
mode 100644 index 000..a1bb5a18
--- /dev/null
+++ b/drivers/char/tpm/tpm_acpi.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2005 IBM Corporation
+ *
+ * Authors:
+ * Seiji Munetoh 
+ * Stefan Berger 
+ * Reiner Sailer 
+ * Kylene Hall 
+ *
+ * Maintained by: 
+ *
+ * Access to the eventlog extended by the TCG BIOS of PC platform
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public Lice

Re: [PATCH V3 1/2] driver: add PPI support in tpm driver

2012-07-11 Thread Kent Yoder
Hi Xiaoyan,

On Thu, Jun 21, 2012 at 06:54:51AM +, Zhang, Xiaoyan wrote:
> From: Xiaoyan Zhang 
> 
> The Physical Presence Interface enables the OS and the BIOS to cooperate
> and provides a simple and straightforward platform user experience for
> administering the TPM without sacrificing security.
> 
> V2: separate the patch out in a separate source file, add #ifdef CONFIG_ACPI
> so it compiles out on ppc, and use standard error instead of ACPI error as
> return code of show/store fns.
> 
> V3: move #ifdef CONFIG_ACPI from .c file to .h file
> 
> Signed-off-by: Xiaoyan Zhang 
> ---
>  drivers/char/tpm/Makefile  |4 +-
>  drivers/char/tpm/tpm.c |5 +
>  drivers/char/tpm/tpm.h |8 +
>  drivers/char/tpm/tpm_ppi.c |  461 
> 
>  4 files changed, 477 insertions(+), 1 deletions(-)
>  create mode 100644 drivers/char/tpm/tpm_ppi.c
> 
> diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile
> index ea3a1e0..132ad95 100644
> --- a/drivers/char/tpm/Makefile
> +++ b/drivers/char/tpm/Makefile
> @@ -1,8 +1,10 @@
>  #
>  # Makefile for the kernel tpm device drivers.
>  #
> -obj-$(CONFIG_TCG_TPM) += tpm.o
> +obj-$(CONFIG_TCG_TPM) += tpm_main.o
> +tpm_main-y += tpm.o
>  ifdef CONFIG_ACPI
> + tpm_main-y += tpm_ppi.o
>   obj-$(CONFIG_TCG_TPM) += tpm_bios.o

  This will change the name of the tpm driver, which I really don't want
to do. Can you apply on top of [1] and resubmit?  I've added the
following patch which modularizes the event logging code and has a
couple Makefile changes too. This is needed for a future driver on PPC,
but it should make adding your file obvious. Note that the patch below
applies on top of Infineon's I2C driver patches.

[1] git://github.com/shpedoikal/linux.git tpmdd-next

Thanks,
Kent

tpm: modularize event log collection

Break ACPI-specific pieces of the event log handling into their own file
and create tpm_eventlog.[ch] to store common event log handling code.
This will be required to integrate future event log sources on platforms
without ACPI tables.

Signed-off-by: Kent Yoder 
---
 drivers/char/tpm/Makefile   |1 +
 drivers/char/tpm/tpm.c  |1 +
 drivers/char/tpm/tpm_acpi.c |  104 
 drivers/char/tpm/tpm_bios.c |  556 ---
 drivers/char/tpm/tpm_eventlog.c |  419 +
 drivers/char/tpm/tpm_eventlog.h |   71 +
 6 files changed, 596 insertions(+), 556 deletions(-)
 create mode 100644 drivers/char/tpm/tpm_acpi.c
 delete mode 100644 drivers/char/tpm/tpm_bios.c
 create mode 100644 drivers/char/tpm/tpm_eventlog.c
 create mode 100644 drivers/char/tpm/tpm_eventlog.h

diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile
index a9c3afc..beac52f6 100644
--- a/drivers/char/tpm/Makefile
+++ b/drivers/char/tpm/Makefile
@@ -4,6 +4,7 @@
 obj-$(CONFIG_TCG_TPM) += tpm.o
 ifdef CONFIG_ACPI
obj-$(CONFIG_TCG_TPM) += tpm_bios.o
+   tpm_bios-objs += tpm_eventlog.o tpm_acpi.o
 endif
 obj-$(CONFIG_TCG_TIS) += tpm_tis.o
 obj-$(CONFIG_TCG_TIS_I2C_INFINEON) += tpm_i2c_infineon.o
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index d39b1f6..beb98c3 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -30,6 +30,7 @@
 #include 
 
 #include "tpm.h"
+#include "tpm_eventlog.h"
 
 enum tpm_const {
TPM_MINOR = 224,/* officially assigned */
diff --git a/drivers/char/tpm/tpm_acpi.c b/drivers/char/tpm/tpm_acpi.c
new file mode 100644
index 000..a1bb5a18
--- /dev/null
+++ b/drivers/char/tpm/tpm_acpi.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2005 IBM Corporation
+ *
+ * Authors:
+ * Seiji Munetoh 
+ * Stefan Berger 
+ * Reiner Sailer 
+ * Kylene Hall 
+ *
+ * Maintained by: 
+ *
+ * Access to the eventlog extended by the TCG BIOS of PC platform
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "tpm.h"
+#include "tpm_eventlog.h"
+
+struct acpi_tcpa {
+   struct acpi_table_header hdr;
+   u16 platform_class;
+   union {
+   struct client_hdr {
+   u32 log_max_len __attribute__ ((packed));
+   u64 log_start_addr __attribute__ ((packed));
+   } client;
+   struct server_hdr {
+   u16 reserved;
+   u64 log_max_len __attribute__ ((packed));
+   u64 log_start_addr __attribute__ ((packed));
+   } server;
+   };
+};
+
+/* read binary bios log */
+int read_log(struct tpm_bios_log *log)
+{
+   struct acpi_tcpa *buff;
+   acpi_status status;
+   struct acpi_table_header *virt;
+   u64 len, start;
+
+   

Re: [PATCH V3 1/2] driver: add PPI support in tpm driver

2012-07-11 Thread Kent Yoder
Hi Xiaoyan,

On Thu, Jun 21, 2012 at 06:54:51AM +, Zhang, Xiaoyan wrote:
 From: Xiaoyan Zhang xiaoyan.zh...@intel.com
 
 The Physical Presence Interface enables the OS and the BIOS to cooperate
 and provides a simple and straightforward platform user experience for
 administering the TPM without sacrificing security.
 
 V2: separate the patch out in a separate source file, add #ifdef CONFIG_ACPI
 so it compiles out on ppc, and use standard error instead of ACPI error as
 return code of show/store fns.
 
 V3: move #ifdef CONFIG_ACPI from .c file to .h file
 
 Signed-off-by: Xiaoyan Zhang xiaoyan.zh...@intel.com
 ---
  drivers/char/tpm/Makefile  |4 +-
  drivers/char/tpm/tpm.c |5 +
  drivers/char/tpm/tpm.h |8 +
  drivers/char/tpm/tpm_ppi.c |  461 
 
  4 files changed, 477 insertions(+), 1 deletions(-)
  create mode 100644 drivers/char/tpm/tpm_ppi.c
 
 diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile
 index ea3a1e0..132ad95 100644
 --- a/drivers/char/tpm/Makefile
 +++ b/drivers/char/tpm/Makefile
 @@ -1,8 +1,10 @@
  #
  # Makefile for the kernel tpm device drivers.
  #
 -obj-$(CONFIG_TCG_TPM) += tpm.o
 +obj-$(CONFIG_TCG_TPM) += tpm_main.o
 +tpm_main-y += tpm.o
  ifdef CONFIG_ACPI
 + tpm_main-y += tpm_ppi.o
   obj-$(CONFIG_TCG_TPM) += tpm_bios.o

  This will change the name of the tpm driver, which I really don't want
to do. Can you apply on top of [1] and resubmit?  I've added the
following patch which modularizes the event logging code and has a
couple Makefile changes too. This is needed for a future driver on PPC,
but it should make adding your file obvious. Note that the patch below
applies on top of Infineon's I2C driver patches.

[1] git://github.com/shpedoikal/linux.git tpmdd-next

Thanks,
Kent

tpm: modularize event log collection

Break ACPI-specific pieces of the event log handling into their own file
and create tpm_eventlog.[ch] to store common event log handling code.
This will be required to integrate future event log sources on platforms
without ACPI tables.

Signed-off-by: Kent Yoder k...@linux.vnet.ibm.com
---
 drivers/char/tpm/Makefile   |1 +
 drivers/char/tpm/tpm.c  |1 +
 drivers/char/tpm/tpm_acpi.c |  104 
 drivers/char/tpm/tpm_bios.c |  556 ---
 drivers/char/tpm/tpm_eventlog.c |  419 +
 drivers/char/tpm/tpm_eventlog.h |   71 +
 6 files changed, 596 insertions(+), 556 deletions(-)
 create mode 100644 drivers/char/tpm/tpm_acpi.c
 delete mode 100644 drivers/char/tpm/tpm_bios.c
 create mode 100644 drivers/char/tpm/tpm_eventlog.c
 create mode 100644 drivers/char/tpm/tpm_eventlog.h

diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile
index a9c3afc..beac52f6 100644
--- a/drivers/char/tpm/Makefile
+++ b/drivers/char/tpm/Makefile
@@ -4,6 +4,7 @@
 obj-$(CONFIG_TCG_TPM) += tpm.o
 ifdef CONFIG_ACPI
obj-$(CONFIG_TCG_TPM) += tpm_bios.o
+   tpm_bios-objs += tpm_eventlog.o tpm_acpi.o
 endif
 obj-$(CONFIG_TCG_TIS) += tpm_tis.o
 obj-$(CONFIG_TCG_TIS_I2C_INFINEON) += tpm_i2c_infineon.o
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index d39b1f6..beb98c3 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -30,6 +30,7 @@
 #include linux/freezer.h
 
 #include tpm.h
+#include tpm_eventlog.h
 
 enum tpm_const {
TPM_MINOR = 224,/* officially assigned */
diff --git a/drivers/char/tpm/tpm_acpi.c b/drivers/char/tpm/tpm_acpi.c
new file mode 100644
index 000..a1bb5a18
--- /dev/null
+++ b/drivers/char/tpm/tpm_acpi.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2005 IBM Corporation
+ *
+ * Authors:
+ * Seiji Munetoh mune...@jp.ibm.com
+ * Stefan Berger stef...@us.ibm.com
+ * Reiner Sailer sai...@watson.ibm.com
+ * Kylene Hall kjh...@us.ibm.com
+ *
+ * Maintained by: tpmdd-de...@lists.sourceforge.net
+ *
+ * Access to the eventlog extended by the TCG BIOS of PC platform
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ */
+
+#include linux/seq_file.h
+#include linux/fs.h
+#include linux/security.h
+#include linux/module.h
+#include linux/slab.h
+#include acpi/acpi.h
+
+#include tpm.h
+#include tpm_eventlog.h
+
+struct acpi_tcpa {
+   struct acpi_table_header hdr;
+   u16 platform_class;
+   union {
+   struct client_hdr {
+   u32 log_max_len __attribute__ ((packed));
+   u64 log_start_addr __attribute__ ((packed));
+   } client;
+   struct server_hdr {
+   u16 reserved;
+   u64 log_max_len __attribute__ ((packed));
+   u64 log_start_addr __attribute__ ((packed));
+   } 

RE: [PATCH V3 1/2] driver: add PPI support in tpm driver

2012-07-11 Thread Zhang, Xiaoyan
Hi Kent,

Thanks for your comment on the patch. But there's some confusion on my side.
You mentioned not to change the tpm driver name. But the driver is linked from 
tpm.c and tpm_ppi.c, so I should change the original tpm.c file name, right? Is 
it acceptable to change tpm.c to tpm_common.c or tpm_utils.c or else?

Thanks,
Xiaoyan


-Original Message-
From: Kent Yoder [mailto:k...@linux.vnet.ibm.com] 
Sent: Wednesday, July 11, 2012 11:25 PM
To: Zhang, Xiaoyan
Cc: linux-kernel@vger.kernel.org; Cihula, Joseph; Wei, Gang; 
tpmdd-de...@lists.sourceforge.net; deb...@linux.vnet.ibm.com; 
sra...@linux.vnet.ibm.com; m.selho...@sirrix.com; shpedoi...@gmail.com; 
linux-security-mod...@vger.kernel.org; james.l.mor...@oracle.com; 
h...@zytor.com; linux-...@vger.kernel.org
Subject: Re: [PATCH V3 1/2] driver: add PPI support in tpm driver

Hi Xiaoyan,

On Thu, Jun 21, 2012 at 06:54:51AM +, Zhang, Xiaoyan wrote:
 From: Xiaoyan Zhang xiaoyan.zh...@intel.com
 
 The Physical Presence Interface enables the OS and the BIOS to 
 cooperate and provides a simple and straightforward platform user 
 experience for administering the TPM without sacrificing security.
 
 V2: separate the patch out in a separate source file, add #ifdef 
 CONFIG_ACPI so it compiles out on ppc, and use standard error instead 
 of ACPI error as return code of show/store fns.
 
 V3: move #ifdef CONFIG_ACPI from .c file to .h file
 
 Signed-off-by: Xiaoyan Zhang xiaoyan.zh...@intel.com
 ---
  drivers/char/tpm/Makefile  |4 +-
  drivers/char/tpm/tpm.c |5 +
  drivers/char/tpm/tpm.h |8 +
  drivers/char/tpm/tpm_ppi.c |  461 
 
  4 files changed, 477 insertions(+), 1 deletions(-)  create mode 
 100644 drivers/char/tpm/tpm_ppi.c
 
 diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile 
 index ea3a1e0..132ad95 100644
 --- a/drivers/char/tpm/Makefile
 +++ b/drivers/char/tpm/Makefile
 @@ -1,8 +1,10 @@
  #
  # Makefile for the kernel tpm device drivers.
  #
 -obj-$(CONFIG_TCG_TPM) += tpm.o
 +obj-$(CONFIG_TCG_TPM) += tpm_main.o
 +tpm_main-y += tpm.o
  ifdef CONFIG_ACPI
 + tpm_main-y += tpm_ppi.o
   obj-$(CONFIG_TCG_TPM) += tpm_bios.o

  This will change the name of the tpm driver, which I really don't want to do. 
Can you apply on top of [1] and resubmit?  I've added the following patch which 
modularizes the event logging code and has a couple Makefile changes too. This 
is needed for a future driver on PPC, but it should make adding your file 
obvious. Note that the patch below applies on top of Infineon's I2C driver 
patches.

[1] git://github.com/shpedoikal/linux.git tpmdd-next

Thanks,
Kent

tpm: modularize event log collection

Break ACPI-specific pieces of the event log handling into their own file and 
create tpm_eventlog.[ch] to store common event log handling code.
This will be required to integrate future event log sources on platforms 
without ACPI tables.

Signed-off-by: Kent Yoder k...@linux.vnet.ibm.com
---
 drivers/char/tpm/Makefile   |1 +
 drivers/char/tpm/tpm.c  |1 +
 drivers/char/tpm/tpm_acpi.c |  104 
 drivers/char/tpm/tpm_bios.c |  556 ---
 drivers/char/tpm/tpm_eventlog.c |  419 +
 drivers/char/tpm/tpm_eventlog.h |   71 +
 6 files changed, 596 insertions(+), 556 deletions(-)  create mode 100644 
drivers/char/tpm/tpm_acpi.c  delete mode 100644 drivers/char/tpm/tpm_bios.c  
create mode 100644 drivers/char/tpm/tpm_eventlog.c  create mode 100644 
drivers/char/tpm/tpm_eventlog.h

diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile index 
a9c3afc..beac52f6 100644
--- a/drivers/char/tpm/Makefile
+++ b/drivers/char/tpm/Makefile
@@ -4,6 +4,7 @@
 obj-$(CONFIG_TCG_TPM) += tpm.o
 ifdef CONFIG_ACPI
obj-$(CONFIG_TCG_TPM) += tpm_bios.o
+   tpm_bios-objs += tpm_eventlog.o tpm_acpi.o
 endif
 obj-$(CONFIG_TCG_TIS) += tpm_tis.o
 obj-$(CONFIG_TCG_TIS_I2C_INFINEON) += tpm_i2c_infineon.o diff --git 
a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index d39b1f6..beb98c3 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -30,6 +30,7 @@
 #include linux/freezer.h
 
 #include tpm.h
+#include tpm_eventlog.h
 
 enum tpm_const {
TPM_MINOR = 224,/* officially assigned */
diff --git a/drivers/char/tpm/tpm_acpi.c b/drivers/char/tpm/tpm_acpi.c new file 
mode 100644 index 000..a1bb5a18
--- /dev/null
+++ b/drivers/char/tpm/tpm_acpi.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2005 IBM Corporation
+ *
+ * Authors:
+ * Seiji Munetoh mune...@jp.ibm.com
+ * Stefan Berger stef...@us.ibm.com
+ * Reiner Sailer sai...@watson.ibm.com
+ * Kylene Hall kjh...@us.ibm.com
+ *
+ * Maintained by: tpmdd-de...@lists.sourceforge.net
+ *
+ * Access to the eventlog extended by the TCG BIOS of PC platform
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General