Convert CONFIG_SAMSUNG_ONENAND to Kconfig
[platform/kernel/u-boot.git] / include / tpm-v2.h
index 949a13c..e79c90b 100644 (file)
@@ -75,7 +75,7 @@ struct udevice;
 /*
  * event types, cf.
  * "TCG PC Client Platform Firmware Profile Specification", Family "2.0"
- * rev 1.04, June 3, 2019
+ * Level 00 Version 1.05 Revision 23, May 7, 2021
  */
 #define EV_EFI_EVENT_BASE                      ((u32)0x80000000)
 #define EV_EFI_VARIABLE_DRIVER_CONFIG          ((u32)0x80000001)
@@ -87,8 +87,24 @@ struct udevice;
 #define EV_EFI_ACTION                          ((u32)0x80000007)
 #define EV_EFI_PLATFORM_FIRMWARE_BLOB          ((u32)0x80000008)
 #define EV_EFI_HANDOFF_TABLES                  ((u32)0x80000009)
+#define EV_EFI_PLATFORM_FIRMWARE_BLOB2         ((u32)0x8000000A)
+#define EV_EFI_HANDOFF_TABLES2                 ((u32)0x8000000B)
+#define EV_EFI_VARIABLE_BOOT2                  ((u32)0x8000000C)
 #define EV_EFI_HCRTM_EVENT                     ((u32)0x80000010)
 #define EV_EFI_VARIABLE_AUTHORITY              ((u32)0x800000E0)
+#define EV_EFI_SPDM_FIRMWARE_BLOB              ((u32)0x800000E1)
+#define EV_EFI_SPDM_FIRMWARE_CONFIG            ((u32)0x800000E2)
+
+#define EFI_CALLING_EFI_APPLICATION         \
+       "Calling EFI Application from Boot Option"
+#define EFI_RETURNING_FROM_EFI_APPLICATION  \
+       "Returning from EFI Application from Boot Option"
+#define EFI_EXIT_BOOT_SERVICES_INVOCATION   \
+       "Exit Boot Services Invocation"
+#define EFI_EXIT_BOOT_SERVICES_FAILED       \
+       "Exit Boot Services Returned with Failure"
+#define EFI_EXIT_BOOT_SERVICES_SUCCEEDED    \
+       "Exit Boot Services Returned with Success"
 
 /* TPMS_TAGGED_PROPERTY Structure */
 struct tpms_tagged_property {
@@ -380,6 +396,7 @@ enum {
        TPM_STS_DATA_EXPECT             = 1 << 3,
        TPM_STS_SELF_TEST_DONE          = 1 << 2,
        TPM_STS_RESPONSE_RETRY          = 1 << 1,
+       TPM_STS_READ_ZERO               = 0x23
 };
 
 enum {
@@ -408,7 +425,7 @@ enum {
  * @dev                TPM device
  * @mode       TPM startup mode
  *
- * @return code of the operation
+ * Return: code of the operation
  */
 u32 tpm2_startup(struct udevice *dev, enum tpm2_startup_types mode);
 
@@ -418,7 +435,7 @@ u32 tpm2_startup(struct udevice *dev, enum tpm2_startup_types mode);
  * @dev                TPM device
  * @full_test  Asking to perform all tests or only the untested ones
  *
- * @return code of the operation
+ * Return: code of the operation
  */
 u32 tpm2_self_test(struct udevice *dev, enum tpm2_yes_no full_test);
 
@@ -430,7 +447,7 @@ u32 tpm2_self_test(struct udevice *dev, enum tpm2_yes_no full_test);
  * @pw         Password
  * @pw_sz      Length of the password
  *
- * @return code of the operation
+ * Return: code of the operation
  */
 u32 tpm2_clear(struct udevice *dev, u32 handle, const char *pw,
               const ssize_t pw_sz);
@@ -446,7 +463,7 @@ u32 tpm2_clear(struct udevice *dev, u32 handle, const char *pw,
  * @nv_attributes      TPM_NV_ATTRIBUTES of the area
  * @nv_policy          policy to use
  * @nv_policy_size     size of the policy
- * @return return code of the operation
+ * Return: return code of the operation
  */
 u32 tpm2_nv_define_space(struct udevice *dev, u32 space_index,
                         size_t space_size, u32 nv_attributes,
@@ -461,7 +478,7 @@ u32 tpm2_nv_define_space(struct udevice *dev, u32 space_index,
  * @digest     Value representing the event to be recorded
  * @digest_len  len of the hash
  *
- * @return code of the operation
+ * Return: code of the operation
  */
 u32 tpm2_pcr_extend(struct udevice *dev, u32 index, u32 algorithm,
                    const u8 *digest, u32 digest_len);
@@ -473,7 +490,7 @@ u32 tpm2_pcr_extend(struct udevice *dev, u32 index, u32 algorithm,
  * @index      Index of data to read
  * @data       Place to put data
  * @count      Number of bytes of data
- * @return code of the operation
+ * Return: code of the operation
  */
 u32 tpm2_nv_read_value(struct udevice *dev, u32 index, void *data, u32 count);
 
@@ -484,7 +501,7 @@ u32 tpm2_nv_read_value(struct udevice *dev, u32 index, void *data, u32 count);
  * @index      Index of data to write
  * @data       Data to write
  * @count      Number of bytes of data
- * @return code of the operation
+ * Return: code of the operation
  */
 u32 tpm2_nv_write_value(struct udevice *dev, u32 index, const void *data,
                        u32 count);
@@ -495,13 +512,16 @@ u32 tpm2_nv_write_value(struct udevice *dev, u32 index, const void *data,
  * @dev                TPM device
  * @idx                Index of the PCR
  * @idx_min_sz Minimum size in bytes of the pcrSelect array
+ * @algorithm  Algorithm used, defined in 'enum tpm2_algorithms'
  * @data       Output buffer for contents of the named PCR
+ * @digest_len  len of the data
  * @updates    Optional out parameter: number of updates for this PCR
  *
- * @return code of the operation
+ * Return: code of the operation
  */
 u32 tpm2_pcr_read(struct udevice *dev, u32 idx, unsigned int idx_min_sz,
-                 void *data, unsigned int *updates);
+                 u16 algorithm, void *data, u32 digest_len,
+                 unsigned int *updates);
 
 /**
  * Issue a TPM2_GetCapability command.  This implementation is limited
@@ -513,7 +533,7 @@ u32 tpm2_pcr_read(struct udevice *dev, u32 idx, unsigned int idx_min_sz,
  * @buf                Output buffer for capability information
  * @prop_count Size of output buffer
  *
- * @return code of the operation
+ * Return: code of the operation
  */
 u32 tpm2_get_capability(struct udevice *dev, u32 capability, u32 property,
                        void *buf, size_t prop_count);
@@ -525,7 +545,7 @@ u32 tpm2_get_capability(struct udevice *dev, u32 capability, u32 property,
  * @pw         Password
  * @pw_sz      Length of the password
  *
- * @return code of the operation
+ * Return: code of the operation
  */
 u32 tpm2_dam_reset(struct udevice *dev, const char *pw, const ssize_t pw_sz);
 
@@ -539,7 +559,7 @@ u32 tpm2_dam_reset(struct udevice *dev, const char *pw, const ssize_t pw_sz);
  * @recovery_time Time before decrementation of the failure count
  * @lockout_recovery Time to wait after a lockout
  *
- * @return code of the operation
+ * Return: code of the operation
  */
 u32 tpm2_dam_parameters(struct udevice *dev, const char *pw,
                        const ssize_t pw_sz, unsigned int max_tries,
@@ -556,7 +576,7 @@ u32 tpm2_dam_parameters(struct udevice *dev, const char *pw,
  * @oldpw      Old password
  * @oldpw_sz   Length of the old password
  *
- * @return code of the operation
+ * Return: code of the operation
  */
 int tpm2_change_auth(struct udevice *dev, u32 handle, const char *newpw,
                     const ssize_t newpw_sz, const char *oldpw,
@@ -571,7 +591,7 @@ int tpm2_change_auth(struct udevice *dev, u32 handle, const char *newpw,
  * @index      Index of the PCR
  * @digest     New key to access the PCR
  *
- * @return code of the operation
+ * Return: code of the operation
  */
 u32 tpm2_pcr_setauthpolicy(struct udevice *dev, const char *pw,
                           const ssize_t pw_sz, u32 index, const char *key);
@@ -586,7 +606,7 @@ u32 tpm2_pcr_setauthpolicy(struct udevice *dev, const char *pw,
  * @digest     New key to access the PCR
  * @key_sz     Length of the new key
  *
- * @return code of the operation
+ * Return: code of the operation
  */
 u32 tpm2_pcr_setauthvalue(struct udevice *dev, const char *pw,
                          const ssize_t pw_sz, u32 index, const char *key,
@@ -599,7 +619,7 @@ u32 tpm2_pcr_setauthvalue(struct udevice *dev, const char *pw,
  * @param data         output buffer for the random bytes
  * @param count                size of output buffer
  *
- * @return return code of the operation
+ * Return: return code of the operation
  */
 u32 tpm2_get_random(struct udevice *dev, void *data, u32 count);
 
@@ -610,7 +630,7 @@ u32 tpm2_get_random(struct udevice *dev, void *data, u32 count);
  *
  * @dev                TPM device
  * @index      Index of data to lock
- * @return code of the operation
+ * Return: code of the operation
  */
 u32 tpm2_write_lock(struct udevice *dev, u32 index);
 
@@ -621,8 +641,21 @@ u32 tpm2_write_lock(struct udevice *dev, u32 index);
  * before calling the kernel.
  *
  * @dev                TPM device
- * @return code of the operation
+ * Return: code of the operation
  */
 u32 tpm2_disable_platform_hierarchy(struct udevice *dev);
 
+/**
+ * submit user specified data to the TPM and get response
+ *
+ * @dev                TPM device
+ * @sendbuf:   Buffer of the data to send
+ * @recvbuf:   Buffer to save the response to
+ * @recv_size: Pointer to the size of the response buffer
+ *
+ * Return: code of the operation
+ */
+u32 tpm2_submit_command(struct udevice *dev, const u8 *sendbuf,
+                       u8 *recvbuf, size_t *recv_size);
+
 #endif /* __TPM_V2_H */