11CHAR16 mTcgStorageName[] = L
"TCG_CONFIGURATION";
14 TCG_CONFIG_PRIVATE_DATA_SIGNATURE,
32 TCG_CONFIG_FORM_SET_GUID
36 END_ENTIRE_DEVICE_PATH_SUBTYPE,
38 (UINT8)(END_DEVICE_PATH_LENGTH),
39 (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
59 OUT BOOLEAN *TpmEnable OPTIONAL,
60 OUT BOOLEAN *TpmActivate OPTIONAL
69 ASSERT (TcgProtocol !=
NULL);
74 if ((TpmEnable !=
NULL) || (TpmActivate !=
NULL)) {
76 *(UINT16 *)&CmdBuf[0] =
SwapBytes16 (TPM_TAG_RQU_COMMAND);
78 *(UINT32 *)&CmdBuf[6] =
SwapBytes32 (TPM_ORD_GetCapability);
80 *(UINT32 *)&CmdBuf[10] =
SwapBytes32 (TPM_CAP_FLAG);
81 *(UINT32 *)&CmdBuf[14] =
SwapBytes32 (
sizeof (TPM_CAP_FLAG_PERMANENT));
82 *(UINT32 *)&CmdBuf[18] =
SwapBytes32 (TPM_CAP_FLAG_PERMANENT);
84 Status = TcgProtocol->PassThroughToTpm (
92 if (EFI_ERROR (Status) || (TpmRsp->tag !=
SwapBytes16 (TPM_TAG_RSP_COMMAND)) || (TpmRsp->returnCode != 0)) {
93 return EFI_DEVICE_ERROR;
98 if (TpmEnable !=
NULL) {
99 *TpmEnable = (BOOLEAN) !TpmPermanentFlags->disable;
102 if (TpmActivate !=
NULL) {
103 *TpmActivate = (BOOLEAN) !TpmPermanentFlags->deactivated;
141 OUT EFI_STRING *Progress,
142 OUT EFI_STRING *Results
147 EFI_STRING ConfigRequestHdr;
148 EFI_STRING ConfigRequest;
149 BOOLEAN AllocatedRequest;
154 if ((Progress ==
NULL) || (Results ==
NULL)) {
155 return EFI_INVALID_PARAMETER;
160 return EFI_NOT_FOUND;
163 ConfigRequestHdr =
NULL;
164 ConfigRequest =
NULL;
165 AllocatedRequest =
FALSE;
168 PrivateData = TCG_CONFIG_PRIVATE_DATA_FROM_THIS (This);
173 PrivateData->Configuration->TpmOperation = PHYSICAL_PRESENCE_NO_ACTION;
178 if (PrivateData->TcgProtocol !=
NULL) {
179 Status =
GetTpmState (PrivateData->TcgProtocol, &TpmEnable, &TpmActivate);
180 if (EFI_ERROR (Status)) {
184 PrivateData->Configuration->TpmEnable = TpmEnable;
185 PrivateData->Configuration->TpmActivate = TpmActivate;
188 ConfigRequest = Request;
195 ConfigRequestHdr =
HiiConstructConfigHdr (&gTcgConfigFormSetGuid, mTcgStorageName, PrivateData->DriverHandle);
196 Size = (
StrLen (ConfigRequestHdr) + 32 + 1) *
sizeof (CHAR16);
198 ASSERT (ConfigRequest !=
NULL);
199 AllocatedRequest =
TRUE;
207 (UINT8 *)PrivateData->Configuration,
215 if (AllocatedRequest) {
222 if (Request ==
NULL) {
224 }
else if (
StrStr (Request, L
"OFFSET") ==
NULL) {
225 *Progress = Request +
StrLen (Request);
253 IN CONST EFI_STRING Configuration,
254 OUT EFI_STRING *Progress
261 if ((Configuration ==
NULL) || (Progress ==
NULL)) {
262 return EFI_INVALID_PARAMETER;
265 *Progress = Configuration;
267 return EFI_NOT_FOUND;
277 (UINT8 *)&TcgConfiguration,
281 if (EFI_ERROR (Status)) {
310 Status =
gRT->GetVariable (
311 PHYSICAL_PRESENCE_VARIABLE,
312 &gEfiPhysicalPresenceGuid,
317 if (EFI_ERROR (Status)) {
322 Status =
gRT->SetVariable (
323 PHYSICAL_PRESENCE_VARIABLE,
324 &gEfiPhysicalPresenceGuid,
329 if (EFI_ERROR (Status)) {
362 IN EFI_BROWSER_ACTION Action,
363 IN EFI_QUESTION_ID QuestionId,
366 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
372 if ((This ==
NULL) || (Value ==
NULL) || (ActionRequest ==
NULL)) {
373 return EFI_INVALID_PARAMETER;
376 if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {
377 if (QuestionId == KEY_TPM_ACTION) {
378 PrivateData = TCG_CONFIG_PRIVATE_DATA_FROM_THIS (This);
383 PrivateData->Configuration->TpmEnable ? L
"Enabled" : L
"Disabled",
384 PrivateData->Configuration->TpmActivate ? L
"Activated" : L
"Deactivated"
392 if ((Action != EFI_BROWSER_ACTION_CHANGED) || (QuestionId != KEY_TPM_ACTION)) {
393 return EFI_UNSUPPORTED;
397 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
423 ConfigAccess = &PrivateData->ConfigAccess;
424 Status =
gBS->InstallMultipleProtocolInterfaces (
426 &gEfiDevicePathProtocolGuid,
427 &mTcgHiiVendorDevicePath,
428 &gEfiHiiConfigAccessProtocolGuid,
432 if (EFI_ERROR (Status)) {
436 PrivateData->DriverHandle = DriverHandle;
442 &gTcgConfigFormSetGuid,
448 if (HiiHandle ==
NULL) {
449 gBS->UninstallMultipleProtocolInterfaces (
451 &gEfiDevicePathProtocolGuid,
452 &mTcgHiiVendorDevicePath,
453 &gEfiHiiConfigAccessProtocolGuid,
458 return EFI_OUT_OF_RESOURCES;
461 PrivateData->HiiHandle = HiiHandle;
480 if (PrivateData->HiiHandle !=
NULL) {
482 PrivateData->HiiHandle =
NULL;
488 if (PrivateData->DriverHandle !=
NULL) {
489 gBS->UninstallMultipleProtocolInterfaces (
490 PrivateData->DriverHandle,
491 &gEfiDevicePathProtocolGuid,
492 &mTcgHiiVendorDevicePath,
493 &gEfiHiiConfigAccessProtocolGuid,
494 &PrivateData->ConfigAccess,
497 PrivateData->DriverHandle =
NULL;
500 if (PrivateData->Configuration !=
NULL) {
501 FreePool (PrivateData->Configuration);
UINT16 EFIAPI SwapBytes16(IN UINT16 Value)
UINT32 EFIAPI SwapBytes32(IN UINT32 Value)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
#define HARDWARE_DEVICE_PATH
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STRING EFIAPI HiiConstructConfigHdr(IN CONST EFI_GUID *Guid OPTIONAL, IN CONST CHAR16 *Name OPTIONAL, IN EFI_HANDLE DriverHandle)
EFI_HII_HANDLE EFIAPI HiiAddPackages(IN CONST EFI_GUID *PackageListGuid, IN EFI_HANDLE DeviceHandle OPTIONAL,...)
BOOLEAN EFIAPI HiiIsConfigHdrMatch(IN CONST EFI_STRING ConfigHdr, IN CONST EFI_GUID *Guid OPTIONAL, IN CONST CHAR16 *Name OPTIONAL)
EFI_STRING_ID EFIAPI HiiSetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId OPTIONAL, IN CONST EFI_STRING String, IN CONST CHAR8 *SupportedLanguages OPTIONAL)
VOID EFIAPI HiiRemovePackages(IN EFI_HII_HANDLE HiiHandle)
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
EFI_RUNTIME_SERVICES * gRT
EFI_STATUS EFIAPI TcgCallback(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN EFI_BROWSER_ACTION Action, IN EFI_QUESTION_ID QuestionId, IN UINT8 Type, IN EFI_IFR_TYPE_VALUE *Value, OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest)
EFI_STATUS SavePpRequest(IN UINT8 PpRequest)
EFI_STATUS EFIAPI TcgExtractConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results)
EFI_STATUS InstallTcgConfigForm(IN OUT TCG_CONFIG_PRIVATE_DATA *PrivateData)
VOID UninstallTcgConfigForm(IN OUT TCG_CONFIG_PRIVATE_DATA *PrivateData)
EFI_STATUS EFIAPI TcgRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
EFI_STATUS GetTpmState(IN EFI_TCG_PROTOCOL *TcgProtocol, OUT BOOLEAN *TpmEnable OPTIONAL, OUT BOOLEAN *TpmActivate OPTIONAL)
struct tdTPM_RQU_COMMAND_HDR TPM_RQU_COMMAND_HDR
EFI_HII_CONFIG_ROUTING_PROTOCOL * gHiiConfigRouting
#define EFI_VARIABLE_NON_VOLATILE
UINT8 PPRequest
Physical Presence request command.