1 /** @file 2 Implement TPM1.2 Ownership related command. 3 4 Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved. <BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 13 **/ 14 15 #include <PiPei.h> 16 #include <Library/BaseMemoryLib.h> 17 #include <Library/BaseLib.h> 18 #include <Library/Tpm12DeviceLib.h> 19 20 /** 21 Send ForceClear command to TPM1.2. 22 23 @retval EFI_SUCCESS Operation completed successfully. 24 @retval EFI_DEVICE_ERROR Unexpected device behavior. 25 **/ 26 EFI_STATUS 27 EFIAPI Tpm12ForceClear(VOID)28Tpm12ForceClear ( 29 VOID 30 ) 31 { 32 EFI_STATUS Status; 33 TPM_RQU_COMMAND_HDR Command; 34 TPM_RSP_COMMAND_HDR Response; 35 UINT32 Length; 36 37 // 38 // send Tpm command TPM_ORD_ForceClear 39 // 40 Command.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND); 41 Command.paramSize = SwapBytes32 (sizeof (Command)); 42 Command.ordinal = SwapBytes32 (TPM_ORD_ForceClear); 43 Length = sizeof (Response); 44 45 Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response); 46 if (EFI_ERROR (Status)) { 47 return Status; 48 } 49 switch (SwapBytes32 (Response.returnCode)) { 50 case TPM_SUCCESS: 51 return EFI_SUCCESS; 52 default: 53 return EFI_DEVICE_ERROR; 54 } 55 }