summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/configs/coreboot.h1
-rw-r--r--include/configs/exynos5250-dt.h7
-rw-r--r--include/fdtdec.h1
-rw-r--r--include/mmc.h22
-rw-r--r--include/mtd/cfi_flash.h41
-rw-r--r--include/tis.h73
-rw-r--r--include/tpm.h197
7 files changed, 281 insertions, 61 deletions
diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h
index a4aa8f7..5bacc77 100644
--- a/include/configs/coreboot.h
+++ b/include/configs/coreboot.h
@@ -41,6 +41,7 @@
#define CONFIG_INTEL_CORE_ARCH /* Sandy bridge and ivy bridge chipsets. */
#define CONFIG_ZBOOT_32
#define CONFIG_PHYSMEM
+#define CONFIG_SYS_EARLY_PCI_INIT
#define CONFIG_LMB
#define CONFIG_OF_LIBFDT
diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
index 4514e7a..8a82892 100644
--- a/include/configs/exynos5250-dt.h
+++ b/include/configs/exynos5250-dt.h
@@ -139,6 +139,13 @@
#define EXYNOS_USB_SECONDARY_BOOT 0xfeed0002
#define EXYNOS_IRAM_SECONDARY_BASE 0x02020018
+/* TPM */
+#define CONFIG_TPM
+#define CONFIG_CMD_TPM
+#define CONFIG_INFINEON_TPM_I2C
+#define CONFIG_INFINEON_TPM_I2C_BUS 3
+#define CONFIG_INFINEON_TPM_I2C_ADDR 0x20
+
/* MMC SPL */
#define CONFIG_SPL
#define COPY_BL2_FNPTR_ADDR 0x02020030
diff --git a/include/fdtdec.h b/include/fdtdec.h
index 844991e..4e8032b 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -92,6 +92,7 @@ enum fdt_compat_id {
COMPAT_MAXIM_MAX77686_PMIC, /* MAX77686 PMIC */
COMPAT_GENERIC_SPI_FLASH, /* Generic SPI Flash chip */
COMPAT_MAXIM_98095_CODEC, /* MAX98095 Codec */
+ COMPAT_INFINEON_SLB9635_TPM, /* Infineon SLB9635 TPM */
COMPAT_COUNT,
};
diff --git a/include/mmc.h b/include/mmc.h
index de6d497..f0d4820 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -30,16 +30,22 @@
#include <linux/compiler.h>
#define SD_VERSION_SD 0x20000
-#define SD_VERSION_2 (SD_VERSION_SD | 0x20)
-#define SD_VERSION_1_0 (SD_VERSION_SD | 0x10)
-#define SD_VERSION_1_10 (SD_VERSION_SD | 0x1a)
+#define SD_VERSION_3 (SD_VERSION_SD | 0x300)
+#define SD_VERSION_2 (SD_VERSION_SD | 0x200)
+#define SD_VERSION_1_0 (SD_VERSION_SD | 0x100)
+#define SD_VERSION_1_10 (SD_VERSION_SD | 0x10a)
#define MMC_VERSION_MMC 0x10000
#define MMC_VERSION_UNKNOWN (MMC_VERSION_MMC)
-#define MMC_VERSION_1_2 (MMC_VERSION_MMC | 0x12)
-#define MMC_VERSION_1_4 (MMC_VERSION_MMC | 0x14)
-#define MMC_VERSION_2_2 (MMC_VERSION_MMC | 0x22)
-#define MMC_VERSION_3 (MMC_VERSION_MMC | 0x30)
-#define MMC_VERSION_4 (MMC_VERSION_MMC | 0x40)
+#define MMC_VERSION_1_2 (MMC_VERSION_MMC | 0x102)
+#define MMC_VERSION_1_4 (MMC_VERSION_MMC | 0x104)
+#define MMC_VERSION_2_2 (MMC_VERSION_MMC | 0x202)
+#define MMC_VERSION_3 (MMC_VERSION_MMC | 0x300)
+#define MMC_VERSION_4 (MMC_VERSION_MMC | 0x400)
+#define MMC_VERSION_4_1 (MMC_VERSION_MMC | 0x401)
+#define MMC_VERSION_4_2 (MMC_VERSION_MMC | 0x402)
+#define MMC_VERSION_4_3 (MMC_VERSION_MMC | 0x403)
+#define MMC_VERSION_4_41 (MMC_VERSION_MMC | 0x429)
+#define MMC_VERSION_4_5 (MMC_VERSION_MMC | 0x405)
#define MMC_MODE_HS 0x001
#define MMC_MODE_HS_52MHz 0x010
diff --git a/include/mtd/cfi_flash.h b/include/mtd/cfi_flash.h
index 9bd76eb..966b5e0 100644
--- a/include/mtd/cfi_flash.h
+++ b/include/mtd/cfi_flash.h
@@ -78,30 +78,29 @@
#define FLASH_CONTINUATION_CODE 0x7F
#define FLASH_OFFSET_MANUFACTURER_ID 0x00
-#define FLASH_OFFSET_DEVICE_ID 0x02
-#define FLASH_OFFSET_DEVICE_ID2 0x1C
-#define FLASH_OFFSET_DEVICE_ID3 0x1E
-#define FLASH_OFFSET_CFI 0xAA
-
+#define FLASH_OFFSET_DEVICE_ID 0x01
+#define FLASH_OFFSET_DEVICE_ID2 0x0E
+#define FLASH_OFFSET_DEVICE_ID3 0x0F
+#define FLASH_OFFSET_CFI 0x55
#define FLASH_OFFSET_CFI_ALT 0x555
-#define FLASH_OFFSET_CFI_RESP 0x20
-#define FLASH_OFFSET_PRIMARY_VENDOR 0x26
+#define FLASH_OFFSET_CFI_RESP 0x10
+#define FLASH_OFFSET_PRIMARY_VENDOR 0x13
/* extended query table primary address */
-#define FLASH_OFFSET_EXT_QUERY_T_P_ADDR 0x2A
+#define FLASH_OFFSET_EXT_QUERY_T_P_ADDR 0x15
#define FLASH_OFFSET_WTOUT 0x1F
-#define FLASH_OFFSET_WBTOUT 0x40
-#define FLASH_OFFSET_ETOUT 0x4A
-#define FLASH_OFFSET_CETOUT 0x44
-#define FLASH_OFFSET_WMAX_TOUT 0x46
-#define FLASH_OFFSET_WBMAX_TOUT 0x48
-#define FLASH_OFFSET_EMAX_TOUT 0x4A
-#define FLASH_OFFSET_CEMAX_TOUT 0x4C
-#define FLASH_OFFSET_SIZE 0x4E
-#define FLASH_OFFSET_INTERFACE 0x50
-#define FLASH_OFFSET_BUFFER_SIZE 0x54
-#define FLASH_OFFSET_NUM_ERASE_REGIONS 0x58
-#define FLASH_OFFSET_ERASE_REGIONS 0x5A
-#define FLASH_OFFSET_PROTECT 0x04
+#define FLASH_OFFSET_WBTOUT 0x20
+#define FLASH_OFFSET_ETOUT 0x21
+#define FLASH_OFFSET_CETOUT 0x22
+#define FLASH_OFFSET_WMAX_TOUT 0x23
+#define FLASH_OFFSET_WBMAX_TOUT 0x24
+#define FLASH_OFFSET_EMAX_TOUT 0x25
+#define FLASH_OFFSET_CEMAX_TOUT 0x26
+#define FLASH_OFFSET_SIZE 0x27
+#define FLASH_OFFSET_INTERFACE 0x28
+#define FLASH_OFFSET_BUFFER_SIZE 0x2A
+#define FLASH_OFFSET_NUM_ERASE_REGIONS 0x2C
+#define FLASH_OFFSET_ERASE_REGIONS 0x2D
+#define FLASH_OFFSET_PROTECT 0x02
#define FLASH_OFFSET_USER_PROTECTION 0x85
#define FLASH_OFFSET_INTEL_PROTECTION 0x81
diff --git a/include/tis.h b/include/tis.h
new file mode 100644
index 0000000..89e5730
--- /dev/null
+++ b/include/tis.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __TIS_H
+#define __TIS_H
+
+#include <common.h>
+
+/* 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 /* __TIS_H */
diff --git a/include/tpm.h b/include/tpm.h
index 6b21e9c..7219b73 100644
--- a/include/tpm.h
+++ b/include/tpm.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 The Chromium OS Authors.
+ * Copyright (c) 2013 The Chromium OS Authors.
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -20,52 +20,185 @@
* MA 02111-1307 USA
*/
-#ifndef _INCLUDE_TPM_H_
-#define _INCLUDE_TPM_H_
+#ifndef __TPM_H
+#define __TPM_H
-#include <common.h>
+#include <tis.h>
/*
- * tis_init()
+ * Here is a partial implementation of TPM commands. Please consult TCG Main
+ * Specification for definitions of TPM commands.
+ */
+
+enum tpm_startup_type {
+ TPM_ST_CLEAR = 0x0001,
+ TPM_ST_STATE = 0x0002,
+ TPM_ST_DEACTIVATED = 0x0003,
+};
+
+enum tpm_physical_presence {
+ TPM_PHYSICAL_PRESENCE_HW_DISABLE = 0x0200,
+ TPM_PHYSICAL_PRESENCE_CMD_DISABLE = 0x0100,
+ TPM_PHYSICAL_PRESENCE_LIFETIME_LOCK = 0x0080,
+ TPM_PHYSICAL_PRESENCE_HW_ENABLE = 0x0040,
+ TPM_PHYSICAL_PRESENCE_CMD_ENABLE = 0x0020,
+ TPM_PHYSICAL_PRESENCE_NOTPRESENT = 0x0010,
+ TPM_PHYSICAL_PRESENCE_PRESENT = 0x0008,
+ TPM_PHYSICAL_PRESENCE_LOCK = 0x0004,
+};
+
+enum tpm_nv_index {
+ TPM_NV_INDEX_LOCK = 0xffffffff,
+ TPM_NV_INDEX_0 = 0x00000000,
+ TPM_NV_INDEX_DIR = 0x10000001,
+};
+
+/**
+ * Initialize TPM device. It must be called before any TPM commands.
*
- * Initialize the TPM device. Returns 0 on success or -1 on
- * failure (in case device probing did not succeed).
+ * @return 0 on success, non-0 on error.
*/
-int tis_init(void);
+uint32_t tpm_init(void);
-/*
- * tis_open()
+/**
+ * Issue a TPM_Startup command.
*
- * Requests access to locality 0 for the caller. After all commands have been
- * completed the caller is supposed to call tis_close().
+ * @param mode TPM startup mode
+ * @return return code of the operation
+ */
+uint32_t tpm_startup(enum tpm_startup_type mode);
+
+/**
+ * Issue a TPM_SelfTestFull command.
*
- * Returns 0 on success, -1 on failure.
+ * @return return code of the operation
*/
-int tis_open(void);
+uint32_t tpm_self_test_full(void);
-/*
- * tis_close()
+/**
+ * Issue a TPM_ContinueSelfTest command.
*
- * 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).
+ * @return return code of the operation
*/
-int tis_close(void);
+uint32_t tpm_continue_self_test(void);
-/*
- * tis_sendrecv()
+/**
+ * Issue a TPM_NV_DefineSpace command. The implementation is limited
+ * to specify TPM_NV_ATTRIBUTES and size of the area. The area index
+ * could be one of the special value listed in enum tpm_nv_index.
*
- * Send the requested data to the TPM and then try to get its response
+ * @param index index of the area
+ * @param perm TPM_NV_ATTRIBUTES of the area
+ * @param size size of the area
+ * @return return code of the operation
+ */
+uint32_t tpm_nv_define_space(uint32_t index, uint32_t perm, uint32_t size);
+
+/**
+ * Issue a TPM_NV_ReadValue command. This implementation is limited
+ * to read the area from offset 0. The area index could be one of
+ * the special value listed in enum tpm_nv_index.
+ *
+ * @param index index of the area
+ * @param data output buffer of the area contents
+ * @param count size of output buffer
+ * @return return code of the operation
+ */
+uint32_t tpm_nv_read_value(uint32_t index, void *data, uint32_t count);
+
+/**
+ * Issue a TPM_NV_WriteValue command. This implementation is limited
+ * to write the area from offset 0. The area index could be one of
+ * the special value listed in enum tpm_nv_index.
+ *
+ * @param index index of the area
+ * @param data input buffer to be wrote to the area
+ * @param length length of data bytes of input buffer
+ * @return return code of the operation
+ */
+uint32_t tpm_nv_write_value(uint32_t index, const void *data, uint32_t length);
+
+/**
+ * Issue a TPM_Extend command.
+ *
+ * @param index index of the PCR
+ * @param in_digest 160-bit value representing the event to be
+ * recorded
+ * @param out_digest 160-bit PCR value after execution of the
+ * command
+ * @return return code of the operation
+ */
+uint32_t tpm_extend(uint32_t index, const void *in_digest, void *out_digest);
+
+/**
+ * Issue a TPM_PCRRead command.
*
- * @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
+ * @param index index of the PCR
+ * @param data output buffer for contents of the named PCR
+ * @param count size of output buffer
+ * @return return code of the operation
+ */
+uint32_t tpm_pcr_read(uint32_t index, void *data, size_t count);
+
+/**
+ * Issue a TSC_PhysicalPresence command. TPM physical presence flag
+ * is bit-wise OR'ed of flags listed in enum tpm_physical_presence.
+ *
+ * @param presence TPM physical presence flag
+ * @return return code of the operation
+ */
+uint32_t tpm_tsc_physical_presence(uint16_t presence);
+
+/**
+ * Issue a TPM_ReadPubek command.
+ *
+ * @param data output buffer for the public endorsement key
+ * @param count size of ouput buffer
+ * @return return code of the operation
+ */
+uint32_t tpm_read_pubek(void *data, size_t count);
+
+/**
+ * Issue a TPM_ForceClear command.
+ *
+ * @return return code of the operation
+ */
+uint32_t tpm_force_clear(void);
+
+/**
+ * Issue a TPM_PhysicalEnable command.
+ *
+ * @return return code of the operation
+ */
+uint32_t tpm_physical_enable(void);
+
+/**
+ * Issue a TPM_PhysicalDisable command.
+ *
+ * @return return code of the operation
+ */
+uint32_t tpm_physical_disable(void);
+
+/**
+ * Issue a TPM_PhysicalSetDeactivated command.
+ *
+ * @param state boolean state of the deactivated flag
+ * @return return code of the operation
+ */
+uint32_t tpm_physical_set_deactivated(uint8_t state);
+
+/**
+ * Issue a TPM_GetCapability command. This implementation is limited
+ * to query sub_cap index that is 4-byte wide.
*
- * Returns 0 on success (and places the number of response bytes at recv_len)
- * or -1 on failure.
+ * @param cap_area partition of capabilities
+ * @param sub_cap further definition of capability, which is
+ * limited to be 4-byte wide
+ * @param cap output buffer for capability information
+ * @param count size of ouput buffer
+ * @return return code of the operation
*/
-int tis_sendrecv(const uint8_t *sendbuf, size_t send_size, uint8_t *recvbuf,
- size_t *recv_len);
+uint32_t tpm_get_capability(uint32_t cap_area, uint32_t sub_cap,
+ void *cap, size_t count);
-#endif /* _INCLUDE_TPM_H_ */
+#endif /* __TPM_H */