Skip to contentSkip to conversation

TPM: STMicroelectronics u-boot driver I2C

PATCH New Mathias leblanc 2 participants 2 messages Mar 22, 2013 – May 11, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 TPM: STMicroelectronics u-boot driver I2C

From: admin01 <admin01@admin01-desktop.(none)>

* STMicroelectronics version 1.2.0, Copyright (C) 2013
* STMicroelectronics comes with ABSOLUTELY NO WARRANTY.
* This is free software, and you are welcome to redistribute it
* under certain conditions.

This is the driver for TPM chip from ST Microelectronics.

If you have a TPM security chip from STMicroelectronics working with an I2C, read the README file and add the correct defines regarding the tpm in the configuration file of your board.
This file is located in include/configs/your_board.h

The driver will be accessible from within uboot terminal.

---
 Makefile                       |    2 +-
 README                         |   12 +
 common/cmd_tpm.c               |  176 ++++++++++++
 drivers/tpm/Makefile           |    1 +
 drivers/tpm/compatibility.h    |   52 ++++
 drivers/tpm/tis_i2c.c          |  211 ++++++++++++++
 drivers/tpm/tpm.c              |  472 +++++++++++++++++++++++++++++++
 drivers/tpm/tpm.h              |  164 +++++++++++
 drivers/tpm/tpm_i2c_st.c       |  601 ++++++++++++++++++++++++++++++++++++++++
 include/configs/omap3_beagle.h |    8 +
 include/tpm.h                  |   16 +
 11 files changed, 1714 insertions(+), 1 deletions(-)
 create mode 100644 drivers/tpm/compatibility.h
 create mode 100644 drivers/tpm/tis_i2c.c
 create mode 100644 drivers/tpm/tpm.c
 create mode 100644 drivers/tpm/tpm.h
 create mode 100644 drivers/tpm/tpm_i2c_st.c
Makefile +1 -1
index 12763ce..ef954a4 100644
@@ -314,7 +314,7 @@ endif
 LIBS-y += drivers/rtc/librtc.o
 LIBS-y += drivers/serial/libserial.o
 LIBS-y += drivers/sound/libsound.o
-LIBS-$(CONFIG_GENERIC_LPC_TPM) += drivers/tpm/libtpm.o
+LIBS-$(CONFIG_TPM) += drivers/tpm/libtpm.o
 LIBS-y += drivers/twserial/libtws.o
 LIBS-y += drivers/usb/eth/libusb_eth.o
 LIBS-y += drivers/usb/gadget/libusb_gadget.o
README +12 -0
index 7f2506a..0e497d1 100644
@@ -1210,6 +1210,18 @@ The following options need to be configured:
 			to. Contemporary x86 systems usually map it at
 			0xfed40000.
 
+		CONFIG_ST_TPM_I2C
+		Define to compile the ST TPM I2C DRIVER.
+
+		CONFIG_TPM_I2C_BUS
+		Define the bus number of the board.
+
+		CONFIG_TPM_I2C_ADDR
+		Define the address of the TPM.
+
+		CONFIG_CMD_TPM
+		Define to use some TPM u-boot commands.
+
 - USB Support:
 		At the moment only the UHCI host controller is
 		supported (PIP405, MIP405, MPC5200); define
common/cmd_tpm.c +176 -0

182 lines not on this page · raw message

drivers/tpm/Makefile +1 -0
index be11c8b..802b54e 100644
@@ -24,6 +24,7 @@ include $(TOPDIR)/config.mk
 LIB := $(obj)libtpm.o
 
 COBJS-$(CONFIG_GENERIC_LPC_TPM) = generic_lpc_tpm.o
+COBJS-$(CONFIG_ST_TPM_I2C) = tis_i2c.o tpm.o tpm_i2c_st.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/tpm/compatibility.h new file +52 -0

52 lines not on this page · raw message

drivers/tpm/tis_i2c.c new file +211 -0

211 lines not on this page · raw message

drivers/tpm/tpm.c new file +472 -0

472 lines not on this page · raw message

drivers/tpm/tpm.h new file +164 -0

164 lines not on this page · raw message

drivers/tpm/tpm_i2c_st.c new file +601 -0

601 lines not on this page · raw message

include/configs/omap3_beagle.h +8 -0
index 48ce4c0..ef381f8 100644
@@ -111,6 +111,14 @@
 #define STATUS_LED_BOOT			STATUS_LED_BIT
 #define STATUS_LED_GREEN		STATUS_LED_BIT1
 
+/* TPM */
+#define CONFIG_CMD_TPM
+#define CONFIG_TPM
+#define CONFIG_ST_TPM_DEBUG
+#define CONFIG_ST_TPM_I2C
+#define CONFIG_TPM_I2C_BUS	1
+#define CONFIG_TPM_I2C_ADDR	0x13
+
 /* Enable Multi Bus support for I2C */
 #define CONFIG_I2C_MULTI_BUS		1
 
include/tpm.h +16 -0
index 6b21e9c..9074885 100644
@@ -68,4 +68,20 @@ int tis_close(void);
 int tis_sendrecv(const uint8_t *sendbuf, size_t send_size, uint8_t *recvbuf,
 			size_t *recv_len);
 
+/*
+ * tis_sendrecv_hash()
+ *
+ * Send the requested data to the TPM for hash in LOC 4
+ * and then try to get its response
+ *
+ * @sendbuf - buffer of the data to hash
+ * @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_hash(const uint8_t *sendbuf, size_t send_size, uint8_t *recvbuf,
+			size_t *recv_len);
 #endif /* _INCLUDE_TPM_H_ */
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 TPM: STMicroelectronics u-boot driver I2C

Hi Mathias,

Quoted 7 lines · Mathias leblanc

From: admin01 <admin01@admin01-desktop.(none)>

* STMicroelectronics version 1.2.0, Copyright (C) 2013
* STMicroelectronics comes with ABSOLUTELY NO WARRANTY.
* This is free software, and you are welcome to redistribute it
* under certain conditions.

Quoted 8 lines

This is the driver for TPM chip from ST Microelectronics.

If you have a TPM security chip from STMicroelectronics working with an I2C, read the README file and add the correct defines regarding the tpm in the configuration file of your board.
This file is located in include/configs/your_board.h

The driver will be accessible from within uboot terminal.

The TPM code in U-Boot has been updated, also there are some pending patches

Can you please rebase this patch on top of mainline plus the existing pending patches?

http://patchwork.ozlabs.org/patch/236211/
http://patchwork.ozlabs.org/patch/236212/
http://patchwork.ozlabs.org/patch/236214/
http://patchwork.ozlabs.org/patch/236215/
http://patchwork.ozlabs.org/patch/236213/

If it helps I have put them in branch 'tpm' of u-boot-x86.git.

Regards,
Simon