Tcg2PhysicalPresenceLib.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /** @file
  2. This library is intended to be used by BDS modules.
  3. This library will execute TPM2 request.
  4. Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.<BR>
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #ifndef _TCG2_PHYSICAL_PRESENCE_LIB_H_
  8. #define _TCG2_PHYSICAL_PRESENCE_LIB_H_
  9. #include <IndustryStandard/Tpm20.h>
  10. #include <IndustryStandard/TcgPhysicalPresence.h>
  11. #include <Protocol/Tcg2Protocol.h>
  12. //
  13. // UEFI TCG2 library definition bit of the BIOS TPM Management Flags
  14. //
  15. // BIT0 is reserved
  16. #define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CLEAR BIT1
  17. // BIT2 is reserved
  18. #define TCG2_LIB_PP_FLAG_RESET_TRACK BIT3
  19. #define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_TURN_ON BIT4
  20. #define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_TURN_OFF BIT5
  21. #define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_EPS BIT6
  22. #define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_PCRS BIT7
  23. //
  24. // UEFI TCG2 library definition bit of the BIOS Information Flags
  25. //
  26. #define TCG2_BIOS_INFORMATION_FLAG_HIERARCHY_CONTROL_STORAGE_DISABLE BIT8
  27. #define TCG2_BIOS_INFORMATION_FLAG_HIERARCHY_CONTROL_ENDORSEMENT_DISABLE BIT9
  28. //
  29. // UEFI TCG2 library definition bit of the BIOS Storage Management Flags
  30. //
  31. #define TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_ENABLE_BLOCK_SID BIT16
  32. #define TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_DISABLE_BLOCK_SID BIT17
  33. #define TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_ENABLE_BLOCK_SID BIT18
  34. /**
  35. Check and execute the pending TPM request.
  36. The TPM request may come from OS or BIOS. This API will display request information and wait
  37. for user confirmation if TPM request exists. The TPM request will be sent to TPM device after
  38. the TPM request is confirmed, and one or more reset may be required to make TPM request to
  39. take effect.
  40. This API should be invoked after console in and console out are all ready as they are required
  41. to display request information and get user input to confirm the request.
  42. @param PlatformAuth platform auth value. NULL means no platform auth change.
  43. **/
  44. VOID
  45. EFIAPI
  46. Tcg2PhysicalPresenceLibProcessRequest (
  47. IN TPM2B_AUTH *PlatformAuth OPTIONAL
  48. );
  49. /**
  50. Check if the pending TPM request needs user input to confirm.
  51. The TPM request may come from OS. This API will check if TPM request exists and need user
  52. input to confirmation.
  53. @retval TRUE TPM needs input to confirm user physical presence.
  54. @retval FALSE TPM doesn't need input to confirm user physical presence.
  55. **/
  56. BOOLEAN
  57. EFIAPI
  58. Tcg2PhysicalPresenceLibNeedUserConfirm (
  59. VOID
  60. );
  61. /**
  62. Return TPM2 ManagementFlags set by PP interface.
  63. @retval ManagementFlags TPM2 Management Flags.
  64. **/
  65. UINT32
  66. EFIAPI
  67. Tcg2PhysicalPresenceLibGetManagementFlags (
  68. VOID
  69. );
  70. /**
  71. The handler for TPM physical presence function:
  72. Return TPM Operation Response to OS Environment.
  73. This API should be invoked in OS runtime phase to interface with ACPI method.
  74. @param[out] MostRecentRequest Most recent operation request.
  75. @param[out] Response Response to the most recent operation request.
  76. @return Return Code for Return TPM Operation Response to OS Environment.
  77. **/
  78. UINT32
  79. EFIAPI
  80. Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction (
  81. OUT UINT32 *MostRecentRequest,
  82. OUT UINT32 *Response
  83. );
  84. /**
  85. The handler for TPM physical presence function:
  86. Submit TPM Operation Request to Pre-OS Environment and
  87. Submit TPM Operation Request to Pre-OS Environment 2.
  88. This API should be invoked in OS runtime phase to interface with ACPI method.
  89. Caution: This function may receive untrusted input.
  90. @param[in, out] Pointer to OperationRequest TPM physical presence operation request.
  91. @param[in, out] Pointer to RequestParameter TPM physical presence operation request parameter.
  92. @return Return Code for Submit TPM Operation Request to Pre-OS Environment and
  93. Submit TPM Operation Request to Pre-OS Environment 2.
  94. **/
  95. UINT32
  96. Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx (
  97. IN OUT UINT32 *OperationRequest,
  98. IN OUT UINT32 *RequestParameter
  99. );
  100. /**
  101. The handler for TPM physical presence function:
  102. Submit TPM Operation Request to Pre-OS Environment and
  103. Submit TPM Operation Request to Pre-OS Environment 2.
  104. This API should be invoked in OS runtime phase to interface with ACPI method.
  105. Caution: This function may receive untrusted input.
  106. @param[in] OperationRequest TPM physical presence operation request.
  107. @param[in] RequestParameter TPM physical presence operation request parameter.
  108. @return Return Code for Submit TPM Operation Request to Pre-OS Environment and
  109. Submit TPM Operation Request to Pre-OS Environment 2.
  110. **/
  111. UINT32
  112. EFIAPI
  113. Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction (
  114. IN UINT32 OperationRequest,
  115. IN UINT32 RequestParameter
  116. );
  117. /**
  118. The handler for TPM physical presence function:
  119. Get User Confirmation Status for Operation.
  120. This API should be invoked in OS runtime phase to interface with ACPI method.
  121. Caution: This function may receive untrusted input.
  122. @param[in] OperationRequest TPM physical presence operation request.
  123. @return Return Code for Get User Confirmation Status for Operation.
  124. **/
  125. UINT32
  126. EFIAPI
  127. Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (
  128. IN UINT32 OperationRequest
  129. );
  130. #endif