VirtualBox

Ignore:
Timestamp:
Oct 28, 2015 8:17:18 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
103761
Message:

EFI/Firmware: 'svn merge /vendor/edk2/UDK2010.SR1 /vendor/edk2/current .', reverting and removing files+dirs listed in ReadMe.vbox, resolving conflicts with help from ../UDK2014.SP1/. This is a raw untested merge.

Location:
trunk/src/VBox/Devices/EFI/Firmware
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware

  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.c

    r48674 r58459  
    55  will clear MOR_CLEAR_MEMORY_BIT bit if it is set.
    66
    7 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
     7Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
    88This program and the accompanying materials
    99are licensed and made available under the terms and conditions of the BSD License
     
    1717
    1818#include "TcgMor.h"
     19
     20UINT8    mMorControl;
     21
     22/**
     23  Ready to Boot Event notification handler.
     24
     25  Sequence of OS boot events is measured in this event notification handler.
     26
     27  @param[in]  Event     Event whose notification function is being invoked
     28  @param[in]  Context   Pointer to the notification function's context
     29
     30**/
     31VOID
     32EFIAPI
     33OnReadyToBoot (
     34  IN      EFI_EVENT                 Event,
     35  IN      VOID                      *Context
     36  )
     37{
     38  EFI_STATUS  Status;
     39  UINTN       DataSize;
     40 
     41  if (MOR_CLEAR_MEMORY_VALUE (mMorControl) == 0x0) {
     42    //
     43    // MorControl is expected, directly return to avoid unnecessary variable operation
     44    //
     45    return ;
     46  }
     47  //
     48  // Clear MOR_CLEAR_MEMORY_BIT
     49  //
     50  DEBUG ((EFI_D_INFO, "TcgMor: Clear MorClearMemory bit\n"));
     51  mMorControl &= 0xFE; 
     52
     53  DataSize = sizeof (mMorControl);
     54  Status   = gRT->SetVariable (
     55               MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
     56               &gEfiMemoryOverwriteControlDataGuid,
     57               EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
     58               DataSize,
     59               &mMorControl
     60               );
     61  if (EFI_ERROR (Status)) {
     62    DEBUG ((EFI_D_ERROR, "TcgMor: Clear MOR_CLEAR_MEMORY_BIT failure, Status = %r\n"));
     63  }
     64}
     65
    1966
    2067/**
     
    3582{
    3683  EFI_STATUS  Status;
    37   UINT8       MorControl;
    3884  UINTN       DataSize;
     85  EFI_EVENT   Event;
    3986
    4087  ///
     
    4289  ///
    4390
    44   DataSize = sizeof (MorControl);
     91  DataSize = sizeof (mMorControl);
    4592  Status = gRT->GetVariable (
    4693                  MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
     
    4895                  NULL,
    4996                  &DataSize,
    50                   &MorControl
     97                  &mMorControl
    5198                  );
    5299  if (EFI_ERROR (Status)) {
     
    54101    // Set default value to 0
    55102    //
    56     MorControl = 0;
     103    mMorControl = 0;
     104    Status = gRT->SetVariable (
     105                    MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
     106                    &gEfiMemoryOverwriteControlDataGuid,
     107                    EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
     108                    DataSize,
     109                    &mMorControl
     110                    );
     111    DEBUG ((EFI_D_INFO, "TcgMor: Create MOR variable! Status = %r\n", Status));
    57112  } else {
    58     if (MOR_CLEAR_MEMORY_VALUE (MorControl) == 0x0) {
    59       //
    60       // MorControl is expected, directly return to avoid unnecessary variable operation
    61       //
    62       return EFI_SUCCESS;
    63     }
    64113    //
    65     // Clear MOR_CLEAR_MEMORY_BIT
     114    // Create a Ready To Boot Event and Clear the MorControl bit in the call back function.
    66115    //
    67     DEBUG ((EFI_D_INFO, "TcgMor: Clear MorClearMemory bit\n"));
    68     MorControl &= 0xFE;
    69   }
     116    DEBUG ((EFI_D_INFO, "TcgMor: Create ReadyToBoot Event for MorControl Bit cleanning!\n"));
     117    Status = EfiCreateEventReadyToBootEx (
     118               TPL_CALLBACK,
     119               OnReadyToBoot,
     120               NULL,
     121               &Event
     122               );
     123  }   
    70124 
    71   Status = gRT->SetVariable (
    72                   MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
    73                   &gEfiMemoryOverwriteControlDataGuid,
    74                   EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
    75                   DataSize,
    76                   &MorControl
    77                   );
    78   ASSERT_EFI_ERROR (Status);
    79125  return Status;
    80126}
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.h

    r48674 r58459  
    22  The header file for TcgMor.
    33
    4 Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
     4Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
    55This program and the accompanying materials
    66are licensed and made available under the terms and conditions of the BSD License
     
    2323#include <Library/UefiRuntimeServicesTableLib.h>
    2424#include <Library/DebugLib.h>
     25#include <Library/UefiLib.h>
    2526
    2627#endif
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.inf

    r48674 r58459  
    11## @file
    2 Component description file for Memory Overwrite Control driver.
     2Initilizes MemoryOverwriteRequestControl variable
    33#
    4 # Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
     4#  This module will clear MOR_CLEAR_MEMORY_BIT bit if it is set.
     5#
     6# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
    57# This program and the accompanying materials
    68# are licensed and made available under the terms and conditions of the BSD License
     
    1517  INF_VERSION                    = 0x00010005
    1618  BASE_NAME                      = TcgMor
     19  MODULE_UNI_FILE                = TcgMor.uni
    1720  FILE_GUID                      = AD416CE3-A483-45b1-94C2-4B4E4D575562
    1821  MODULE_TYPE                    = DXE_DRIVER
     
    4043  ReportStatusCodeLib
    4144  DebugLib
     45  UefiLib
    4246
    4347[Guids]
    44   gEfiMemoryOverwriteControlDataGuid            # GUID ALWAYS_CONSUMED
     48  ## SOMETIMES_CONSUMES      ## Variable:L"MemoryOverwriteRequestControl"
     49  ## PRODUCES                ## Variable:L"MemoryOverwriteRequestControl"
     50  gEfiMemoryOverwriteControlDataGuid
    4551
    4652[Depex]
    4753  gEfiVariableArchProtocolGuid AND
    4854  gEfiVariableWriteArchProtocolGuid AND
    49   gEfiTcgProtocolGuid
     55  ( gEfiTcgProtocolGuid OR gEfiTrEEProtocolGuid )
    5056
     57[UserExtensions.TianoCore."ExtraFiles"]
     58  TcgMorExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/PhysicalPresencePei/PhysicalPresencePei.inf

    r48674 r58459  
    11## @file
    2 Component description file for physical presence PEI module.
     2Produces a PPI to indicate whether to lock TPM in PEI phase
    33#
    4 # Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
     4#  This module produces PEI_LOCK_PHYSICAL_PRESENCE_PPI to indicate whether
     5#  TPM physical presence needs to be locked. It can be replaced by a
     6#  platform specific module.
     7#
     8# Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
    59# This program and the accompanying materials
    610# are licensed and made available under the terms and conditions of the BSD License
     
    1620  INF_VERSION                    = 0x00010005
    1721  BASE_NAME                      = PhysicalPresencePei
     22  MODULE_UNI_FILE                = PhysicalPresencePei.uni
    1823  FILE_GUID                      = 4FE772E8-FE3E-4086-B638-8C493C490488
    1924  MODULE_TYPE                    = PEIM
     
    4146
    4247[Ppis]
    43   gPeiLockPhysicalPresencePpiGuid
    44   gEfiPeiReadOnlyVariable2PpiGuid
     48  gPeiLockPhysicalPresencePpiGuid                       ## PRODUCES
     49  gEfiPeiReadOnlyVariable2PpiGuid                       ## CONSUMES
    4550
    4651[Guids]
    47   gEfiPhysicalPresenceGuid
     52  gEfiPhysicalPresenceGuid                              ## SOMETIMES_CONSUMES    ## Variable:L"PhysicalPresence"
    4853
    4954[Pcd]
    50   gEfiSecurityPkgTokenSpaceGuid.PcdTpmPhysicalPresence
     55  gEfiSecurityPkgTokenSpaceGuid.PcdTpmPhysicalPresence  ## SOMETIMES_CONSUMES
    5156
    5257[Depex]
     
    5459  gEfiPeiReadOnlyVariable2PpiGuid AND
    5560  gPeiTpmInitializedPpiGuid
     61
     62[UserExtensions.TianoCore."ExtraFiles"]
     63  PhysicalPresencePeiExtra.uni
     64 
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfig.vfr

    r48674 r58459  
    22  VFR file used by the TCG configuration component.
    33
    4 Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
     4Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
    55This program and the accompanying materials
    66are licensed and made available under the terms and conditions of the BSD License
     
    4545    endif;
    4646
    47     suppressif TRUE;
    48       checkbox varid   = TCG_CONFIGURATION.OriginalHideTpm,
    49               prompt   = STRING_TOKEN(STR_NULL),
    50               help     = STRING_TOKEN(STR_NULL),
    51       endcheckbox;
    52     endif;
    53 
    5447    text
    5548      help   = STRING_TOKEN(STR_TPM_STATE_HELP),
     
    5952    subtitle text = STRING_TOKEN(STR_NULL);
    6053
    61     label LABEL_TCG_CONFIGURATION_HIDETPM;
    62 
    63     checkbox varid = TCG_CONFIGURATION.HideTpm,
    64           questionid  = KEY_HIDE_TPM,
    65           prompt      = STRING_TOKEN(STR_HIDE_TPM_PROMPT),
    66           help        = STRING_TOKEN(STR_HIDE_TPM_HELP),
    67           flags       = RESET_REQUIRED,
    68     endcheckbox;
    69 
    70     label LABEL_END;
    71 
    72     grayoutif ideqval TCG_CONFIGURATION.OriginalHideTpm == 1;
    7354    oneof varid  = TCG_CONFIGURATION.TpmOperation,
    7455          questionid = KEY_TPM_ACTION,
     
    10384    subtitle text = STRING_TOKEN(STR_NULL);
    10485
    105     checkbox varid = TCG_CONFIGURATION.MorState,
    106           questionid = KEY_TPM_MOR_ENABLE,
    107           prompt = STRING_TOKEN(STR_MOR_PROMPT),
    108           help   = STRING_TOKEN(STR_MOR_HELP),
    109     endcheckbox;
    110     endif;
    111 
    11286  endform;
    11387
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigDriver.c

    r48674 r58459  
    22  The module entry point for Tcg configuration module.
    33
    4 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
     4Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
    55This program and the accompanying materials
    66are licensed and made available under the terms and conditions of the BSD License
     
    1414
    1515#include "TcgConfigImpl.h"
     16#include <Guid/TpmInstance.h>
    1617
    1718/**
     
    3738  TCG_CONFIG_PRIVATE_DATA   *PrivateData;
    3839  EFI_TCG_PROTOCOL          *TcgProtocol;
     40
     41  if (!CompareGuid (PcdGetPtr(PcdTpmInstanceGuid), &gEfiTpmDeviceInstanceTpm12Guid)){
     42    DEBUG ((EFI_D_ERROR, "No TPM12 instance required!\n"));
     43    return EFI_UNSUPPORTED;
     44  }
    3945
    4046  Status = TisPcRequestUseTpm ((TIS_TPM_HANDLE) (UINTN) TPM_BASE_ADDRESS);
     
    7076 
    7177  PrivateData->TcgProtocol = TcgProtocol;
    72   PrivateData->HideTpm     = (BOOLEAN) (PcdGetBool (PcdHideTpmSupport) && PcdGetBool (PcdHideTpm));
    7378 
    7479  //
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigDxe.inf

    r48674 r58459  
    11## @file
    2 #  Component name for Tcg configuration module.
     2#  Provides the capability to update TPM state setup browser
     3#  By this module, user may enable/disable/activate/deactivate/clear TPM, etc.
    34#
    4 # Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
     5# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
    56# This program and the accompanying materials
    67# are licensed and made available under the terms and conditions of the BSD License
     
    1516  INF_VERSION                    = 0x00010005
    1617  BASE_NAME                      = TcgConfigDxe
     18  MODULE_UNI_FILE                = TcgConfigDxe.uni
    1719  FILE_GUID                      = 1FA4DAFE-FA5D-4d75-BEA6-5863862C520A
    1820  MODULE_TYPE                    = DXE_DRIVER
     
    5456
    5557[Guids]
     58  ## SOMETIMES_PRODUCES ## Variable:L"PhysicalPresence"
     59  ## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresence"
    5660  gEfiPhysicalPresenceGuid
    57   gEfiIfrTianoGuid
     61 
     62  gEfiIfrTianoGuid                                    ## SOMETIMES_PRODUCES  ## GUID       # HII opcode
     63  ## PRODUCES            ## HII
     64  ## CONSUMES            ## HII
    5865  gTcgConfigFormSetGuid
     66  gEfiTpmDeviceInstanceTpm12Guid                      ## CONSUMES     ## GUID       # TPM device identifier
    5967
    6068[Protocols]
    61   gEfiHiiConfigAccessProtocolGuid               ## PRODUCES
    62   gEfiHiiConfigRoutingProtocolGuid              ## CONSUMES
    63   gEfiTcgProtocolGuid                           ## CONSUMES
    64 
    65 [FixedPcd]
    66   gEfiSecurityPkgTokenSpaceGuid.PcdHideTpmSupport
     69  gEfiHiiConfigAccessProtocolGuid                     ## PRODUCES
     70  gEfiDevicePathProtocolGuid                          ## PRODUCES
     71  gEfiTcgProtocolGuid                                 ## CONSUMES
    6772
    6873[Pcd]
    69   gEfiSecurityPkgTokenSpaceGuid.PcdMorEnable
    70   gEfiSecurityPkgTokenSpaceGuid.PcdHideTpm
     74  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid    ## CONSUMES
    7175
    7276[Depex]
     
    7579  gEfiVariableArchProtocolGuid      AND
    7680  gEfiVariableWriteArchProtocolGuid
     81 
     82[UserExtensions.TianoCore."ExtraFiles"]
     83  TcgConfigDxeExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigImpl.c

    r48674 r58459  
    22  HII Config Access protocol implementation of TCG configuration module.
    33
    4 Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
     4Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
    55This program and the accompanying materials
    66are licensed and made available under the terms and conditions of the BSD License
     
    182182  ZeroMem (&Configuration, sizeof (TCG_CONFIGURATION));
    183183
    184   Configuration.MorState        = PcdGetBool (PcdMorEnable);
    185184  Configuration.TpmOperation    = PHYSICAL_PRESENCE_ENABLE;
    186   Configuration.HideTpm         = (BOOLEAN) (PcdGetBool (PcdHideTpmSupport) && PcdGetBool (PcdHideTpm));
    187   //
    188   // Read the original value of HideTpm from PrivateData which won't be changed by Setup in this boot.
    189   //
    190   Configuration.OriginalHideTpm = PrivateData->HideTpm;
    191185
    192186  //
     
    308302    return Status;
    309303  }
    310 
    311   PcdSetBool (PcdMorEnable,  TcgConfiguration.MorState);
    312   PcdSetBool (PcdHideTpm,    TcgConfiguration.HideTpm);
    313304
    314305  return EFI_SUCCESS;
     
    428419  EFI_HII_HANDLE                  HiiHandle;
    429420  EFI_HANDLE                      DriverHandle;
    430   VOID                            *StartOpCodeHandle;
    431   VOID                            *EndOpCodeHandle;
    432   EFI_IFR_GUID_LABEL              *StartLabel;
    433   EFI_IFR_GUID_LABEL              *EndLabel;
    434 
    435421  EFI_HII_CONFIG_ACCESS_PROTOCOL  *ConfigAccess;
    436422
     
    476462  PrivateData->HiiHandle = HiiHandle;
    477463
    478   //
    479   // Remove the Hide TPM question from the IFR
    480   //
    481   if (!PcdGetBool (PcdHideTpmSupport)) {
    482     //
    483     // Allocate space for creation of UpdateData Buffer
    484     //
    485     StartOpCodeHandle = HiiAllocateOpCodeHandle ();
    486     ASSERT (StartOpCodeHandle != NULL);
    487 
    488     EndOpCodeHandle = HiiAllocateOpCodeHandle ();
    489     ASSERT (EndOpCodeHandle != NULL);
    490 
    491     //
    492     // Create Hii Extend Label OpCode as the start opcode
    493     //
    494     StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
    495     StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
    496     StartLabel->Number       = LABEL_TCG_CONFIGURATION_HIDETPM;
    497 
    498     //
    499     // Create Hii Extend Label OpCode as the end opcode
    500     //
    501     EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
    502     EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
    503     EndLabel->Number       = LABEL_END;
    504    
    505     HiiUpdateForm (HiiHandle, NULL, TCG_CONFIGURATION_FORM_ID, StartOpCodeHandle, EndOpCodeHandle);
    506 
    507     HiiFreeOpCodeHandle (StartOpCodeHandle);
    508     HiiFreeOpCodeHandle (EndOpCodeHandle);
    509   }
    510 
    511464  return EFI_SUCCESS; 
    512465}
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigImpl.h

    r48674 r58459  
    33  configuration module.
    44
    5 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
     5Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
    66This program and the accompanying materials
    77are licensed and made available under the terms and conditions of the BSD License
     
    6363
    6464  EFI_TCG_PROTOCOL                  *TcgProtocol;
    65 
    66   BOOLEAN                           HideTpm;
    6765} TCG_CONFIG_PRIVATE_DATA;
    6866
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigNvData.h

    r48674 r58459  
    22  Header file for NV data structure definition.
    33
    4 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
     4Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
    55This program and the accompanying materials
    66are licensed and made available under the terms and conditions of the BSD License
     
    2323#define TCG_CONFIGURATION_FORM_ID      0x0001
    2424
    25 #define KEY_HIDE_TPM                   0x2000
    26 #define KEY_TPM_ACTION                 0x3000
    27 #define KEY_TPM_MOR_ENABLE             0x4000
     25#define KEY_TPM_ACTION                         0x3000
    2826
    29 #define LABEL_TCG_CONFIGURATION_HIDETPM  0x0001
    30 #define LABEL_END                        0xffff
     27#define LABEL_TCG_CONFIGURATION_TPM_OPERATION  0x0001
     28#define LABEL_END                              0xffff
    3129
    3230//
     
    3432//
    3533typedef struct {
    36   BOOLEAN HideTpm;
    37   BOOLEAN OriginalHideTpm;
    38   BOOLEAN MorState;
    3934  UINT8   TpmOperation;
    4035  BOOLEAN TpmEnable;
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgDxe/TcgDxe.c

    r48674 r58459  
    11/** @file 
    22  This module implements TCG EFI Protocol.
    3  
    4 Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
     3 
     4Caution: This module requires additional review when modified.
     5This driver will have external input - TcgDxePassThroughToTpm
     6This external input must be validated carefully to avoid security issue like
     7buffer overflow, integer overflow.
     8
     9TcgDxePassThroughToTpm() will receive untrusted input and do basic validation.
     10
     11Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
    512This program and the accompanying materials
    613are licensed and made available under the terms and conditions of the BSD License
     
    1825#include <IndustryStandard/PeImage.h>
    1926#include <IndustryStandard/SmBios.h>
     27#include <IndustryStandard/TcpaAcpi.h>
    2028
    2129#include <Guid/GlobalVariable.h>
     
    2432#include <Guid/TcgEventHob.h>
    2533#include <Guid/EventGroup.h>
     34#include <Guid/EventExitBootServiceFailed.h>
     35#include <Guid/TpmInstance.h>
     36
    2637#include <Protocol/DevicePath.h>
    2738#include <Protocol/TcgService.h>
    2839#include <Protocol/AcpiTable.h>
     40#include <Protocol/MpService.h>
    2941
    3042#include <Library/DebugLib.h>
     
    4052#include <Library/PcdLib.h>
    4153#include <Library/UefiLib.h>
     54#include <Library/ReportStatusCodeLib.h>
    4255
    4356#include "TpmComm.h"
    4457
    4558#define  EFI_TCG_LOG_AREA_SIZE        0x10000
    46 
    47 #pragma pack (1)
    48 
    49 typedef struct _EFI_TCG_CLIENT_ACPI_TABLE {
    50   EFI_ACPI_DESCRIPTION_HEADER       Header;
    51   UINT16                            PlatformClass;
    52   UINT32                            Laml;
    53   EFI_PHYSICAL_ADDRESS              Lasa;
    54 } EFI_TCG_CLIENT_ACPI_TABLE;
    55 
    56 typedef struct _EFI_TCG_SERVER_ACPI_TABLE {
    57   EFI_ACPI_DESCRIPTION_HEADER             Header;
    58   UINT16                                  PlatformClass;
    59   UINT16                                  Reserved0;
    60   UINT64                                  Laml;
    61   EFI_PHYSICAL_ADDRESS                    Lasa;
    62   UINT16                                  SpecRev;
    63   UINT8                                   DeviceFlags;
    64   UINT8                                   InterruptFlags;
    65   UINT8                                   Gpe;
    66   UINT8                                   Reserved1[3];
    67   UINT32                                  GlobalSysInt;
    68   EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE  BaseAddress;
    69   UINT32                                  Reserved2;
    70   EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE  ConfigAddress;
    71   UINT8                                   PciSegNum;
    72   UINT8                                   PciBusNum;
    73   UINT8                                   PciDevNum;
    74   UINT8                                   PciFuncNum;
    75 } EFI_TCG_SERVER_ACPI_TABLE;
    76 
    77 #pragma pack ()
    7859
    7960#define TCG_DXE_DATA_FROM_THIS(this)  \
     
    152133
    153134/**
     135  Get All processors EFI_CPU_LOCATION in system. LocationBuf is allocated inside the function
     136  Caller is responsible to free LocationBuf.
     137
     138  @param[out] LocationBuf          Returns Processor Location Buffer.
     139  @param[out] Num                  Returns processor number.
     140
     141  @retval EFI_SUCCESS              Operation completed successfully.
     142  @retval EFI_UNSUPPORTED       MpService protocol not found.
     143
     144**/
     145EFI_STATUS
     146GetProcessorsCpuLocation (
     147    OUT  EFI_CPU_PHYSICAL_LOCATION   **LocationBuf,
     148    OUT  UINTN                       *Num
     149  )
     150{
     151  EFI_STATUS                        Status;
     152  EFI_MP_SERVICES_PROTOCOL          *MpProtocol;
     153  UINTN                             ProcessorNum;
     154  UINTN                             EnabledProcessorNum;
     155  EFI_PROCESSOR_INFORMATION         ProcessorInfo;
     156  EFI_CPU_PHYSICAL_LOCATION         *ProcessorLocBuf;
     157  UINTN                             Index;
     158
     159  Status = gBS->LocateProtocol (&gEfiMpServiceProtocolGuid, NULL, (VOID **) &MpProtocol);
     160  if (EFI_ERROR (Status)) {
     161    //
     162    // MP protocol is not installed
     163    //
     164    return EFI_UNSUPPORTED;
     165  }
     166
     167  Status = MpProtocol->GetNumberOfProcessors(
     168                         MpProtocol,
     169                         &ProcessorNum,
     170                         &EnabledProcessorNum
     171                         );
     172  if (EFI_ERROR(Status)){
     173    return Status;
     174  }
     175
     176  Status = gBS->AllocatePool(
     177                  EfiBootServicesData,
     178                  sizeof(EFI_CPU_PHYSICAL_LOCATION) * ProcessorNum,
     179                  (VOID **) &ProcessorLocBuf
     180                  );
     181  if (EFI_ERROR(Status)){
     182    return Status;
     183  }
     184
     185  //
     186  // Get each processor Location info
     187  //
     188  for (Index = 0; Index < ProcessorNum; Index++) {
     189    Status = MpProtocol->GetProcessorInfo(
     190                           MpProtocol,
     191                           Index,
     192                           &ProcessorInfo
     193                           );
     194    if (EFI_ERROR(Status)){
     195      FreePool(ProcessorLocBuf);
     196      return Status;
     197    }
     198
     199    //
     200    // Get all Processor Location info & measure
     201    //
     202    CopyMem(
     203      &ProcessorLocBuf[Index],
     204      &ProcessorInfo.Location,
     205      sizeof(EFI_CPU_PHYSICAL_LOCATION)
     206      );
     207  }
     208
     209  *LocationBuf = ProcessorLocBuf;
     210  *Num = ProcessorNum;
     211
     212  return Status;
     213}
     214
     215/**
    154216  This service provides EFI protocol capability information, state information
    155217  about the TPM, and Event Log state information.
     
    204266
    205267  if (EventLogLastEntry != NULL) {
    206     if (TcgData->BsCap.TPMDeactivatedFlag) {
     268    if (TcgData->BsCap.TPMDeactivatedFlag || (!TcgData->BsCap.TPMPresentFlag)) {
    207269      *EventLogLastEntry = (EFI_PHYSICAL_ADDRESS)(UINTN)0;
    208270    } else {
     
    262324      }
    263325      *HashedDataLen = sizeof (TPM_DIGEST);
     326
     327          if (*HashedDataResult == NULL) {
     328                *HashedDataResult = AllocatePool ((UINTN) *HashedDataLen);
     329          }
    264330
    265331      return TpmCommHashAll (
     
    341407  TCG_DXE_DATA  *TcgData;
    342408
     409  if (TCGLogData == NULL){
     410    return EFI_INVALID_PARAMETER;
     411  }
     412
    343413  TcgData = TCG_DXE_DATA_FROM_THIS (This);
    344414 
    345   if (TcgData->BsCap.TPMDeactivatedFlag) {
     415  if (TcgData->BsCap.TPMDeactivatedFlag || (!TcgData->BsCap.TPMPresentFlag)) {
    346416    return EFI_DEVICE_ERROR;
    347417  }
     
    379449{
    380450  TCG_DXE_DATA                      *TcgData;
     451
     452  if (TpmInputParameterBlock == NULL ||
     453      TpmOutputParameterBlock == NULL ||
     454      TpmInputParameterBlockSize == 0 ||
     455      TpmOutputParameterBlockSize == 0) {
     456    return EFI_INVALID_PARAMETER;
     457  }
    381458
    382459  TcgData = TCG_DXE_DATA_FROM_THIS (This);
     
    420497  EFI_STATUS                        Status;
    421498
    422   if (HashDataLen > 0) {
     499  if (!TcgData->BsCap.TPMPresentFlag) {
     500    return EFI_DEVICE_ERROR;
     501  }
     502
     503  if (HashDataLen > 0 || HashData != NULL) {
    423504    Status = TpmCommHashAll (
    424505               HashData,
     
    426507               &NewEventHdr->Digest
    427508               );
    428     ASSERT_EFI_ERROR (Status);
     509    if (EFI_ERROR(Status)) {
     510      DEBUG ((DEBUG_ERROR, "TpmCommHashAll Failed. %x\n", Status));
     511      goto Done;
     512    }
    429513  }
    430514
     
    437521  if (!EFI_ERROR (Status)) {
    438522    Status = TcgDxeLogEventI (TcgData, NewEventHdr, NewEventData);
     523  }
     524
     525Done:
     526  if ((Status == EFI_DEVICE_ERROR) || (Status == EFI_TIMEOUT)) {
     527    DEBUG ((EFI_D_ERROR, "TcgDxeHashLogExtendEventI - %r. Disable TPM.\n", Status));
     528    TcgData->BsCap.TPMPresentFlag = FALSE;
     529    REPORT_STATUS_CODE (
     530      EFI_ERROR_CODE | EFI_ERROR_MINOR,
     531      (PcdGet32 (PcdStatusCodeSubClassTpmDevice) | EFI_P_EC_INTERFACE_ERROR)
     532      );
     533    Status = EFI_DEVICE_ERROR;
    439534  }
    440535
     
    479574{
    480575  TCG_DXE_DATA  *TcgData;
     576  EFI_STATUS    Status;
     577
     578  if (TCGLogData == NULL || EventLogLastEntry == NULL){
     579    return EFI_INVALID_PARAMETER;
     580  }
    481581
    482582  TcgData = TCG_DXE_DATA_FROM_THIS (This);
    483583 
    484   if (TcgData->BsCap.TPMDeactivatedFlag) {
     584  if (TcgData->BsCap.TPMDeactivatedFlag || (!TcgData->BsCap.TPMPresentFlag)) {
    485585    return EFI_DEVICE_ERROR;
    486586  }
     
    489589    return EFI_UNSUPPORTED;
    490590  }
    491 
    492   return TcgDxeHashLogExtendEventI (
    493            TcgData,
    494            (UINT8 *) (UINTN) HashData,
    495            HashDataLen,
    496            (TCG_PCR_EVENT_HDR*)TCGLogData,
    497            TCGLogData->Event
    498            );
     591 
     592  if (HashData == 0 && HashDataLen > 0) {
     593    return EFI_INVALID_PARAMETER;
     594  }
     595
     596  Status = TcgDxeHashLogExtendEventI (
     597             TcgData,
     598             (UINT8 *) (UINTN) HashData,
     599             HashDataLen,
     600             (TCG_PCR_EVENT_HDR*)TCGLogData,
     601             TCGLogData->Event
     602             );
     603
     604  if (!EFI_ERROR(Status)){
     605    *EventLogLastEntry = (EFI_PHYSICAL_ADDRESS)(UINTN) TcgData->LastEvent;
     606  }
     607
     608  return Status;
    499609}
    500610
     
    642752  TCG_PCR_EVENT_HDR                 TcgEvent;
    643753  EFI_HANDOFF_TABLE_POINTERS        HandoffTables;
    644 
     754  UINTN                             ProcessorNum;
     755  EFI_CPU_PHYSICAL_LOCATION         *ProcessorLocBuf;
     756
     757  ProcessorLocBuf = NULL;
     758
     759  //
     760  // Measure SMBIOS with EV_EFI_HANDOFF_TABLES to PCR[1]
     761  //
    645762  Status = EfiGetSystemConfigurationTable (
    646763             &gEfiSmbiosTableGuid,
     
    648765             );
    649766
    650   if (!EFI_ERROR (Status)) {
    651     ASSERT (SmbiosTable != NULL);
    652 
     767  if (!EFI_ERROR (Status) && SmbiosTable != NULL) {
    653768    TcgEvent.PCRIndex  = 1;
    654769    TcgEvent.EventType = EV_EFI_HANDOFF_TABLES;
     
    669784               (UINT8*)&HandoffTables
    670785               );
     786  }
     787
     788  if (PcdGet8 (PcdTpmPlatformClass) == TCG_PLATFORM_TYPE_SERVER) {
     789    //
     790    // Tcg Server spec.
     791    // Measure each processor EFI_CPU_PHYSICAL_LOCATION with EV_TABLE_OF_DEVICES to PCR[1]
     792    //
     793    Status = GetProcessorsCpuLocation(&ProcessorLocBuf, &ProcessorNum);
     794
     795    if (!EFI_ERROR(Status)){
     796      TcgEvent.PCRIndex  = 1;
     797      TcgEvent.EventType = EV_TABLE_OF_DEVICES;
     798      TcgEvent.EventSize = sizeof (HandoffTables);
     799
     800      HandoffTables.NumberOfTables = 1;
     801      HandoffTables.TableEntry[0].VendorGuid  = gEfiMpServiceProtocolGuid;
     802      HandoffTables.TableEntry[0].VendorTable = ProcessorLocBuf;
     803
     804      Status = TcgDxeHashLogExtendEventI (
     805                 &mTcgDxeData,
     806                 (UINT8*)(UINTN)ProcessorLocBuf,
     807                 sizeof(EFI_CPU_PHYSICAL_LOCATION) * ProcessorNum,
     808                 &TcgEvent,
     809                 (UINT8*)&HandoffTables
     810                 );
     811
     812      FreePool(ProcessorLocBuf);
     813    }
    671814  }
    672815
     
    8951038             (VOID **) &BootOrder
    8961039             );
    897   if (Status == EFI_NOT_FOUND) {
     1040  if (Status == EFI_NOT_FOUND || BootOrder == NULL) {
    8981041    return EFI_SUCCESS;
    8991042  }
    900   ASSERT (BootOrder != NULL);
    9011043
    9021044  if (EFI_ERROR (Status)) {
     1045    //
     1046    // BootOrder can't be NULL if status is not EFI_NOT_FOUND
     1047    //
    9031048    FreePool (BootOrder);
    9041049    return Status;
     
    9661111               EFI_CALLING_EFI_APPLICATION
    9671112               );
    968     ASSERT_EFI_ERROR (Status);
     1113    if (EFI_ERROR (Status)) {
     1114      DEBUG ((EFI_D_ERROR, "%s not Measured. Error!\n", EFI_CALLING_EFI_APPLICATION));
     1115    }
    9691116
    9701117    //
     
    9731120    for (PcrIndex = 0; PcrIndex < 8; PcrIndex++) {
    9741121      Status = MeasureSeparatorEvent (PcrIndex);
    975       ASSERT_EFI_ERROR (Status);
     1122      if (EFI_ERROR (Status)) {
     1123        DEBUG ((EFI_D_ERROR, "Seperator Event not Measured. Error!\n"));
     1124      }
    9761125    }
    9771126
     
    9941143               EFI_RETURNING_FROM_EFI_APPLICATOIN
    9951144               );
    996     ASSERT_EFI_ERROR (Status);
     1145    if (EFI_ERROR (Status)) {
     1146      DEBUG ((EFI_D_ERROR, "%s not Measured. Error!\n", EFI_RETURNING_FROM_EFI_APPLICATOIN));
     1147    }
    9971148  }
    9981149
     
    10251176  EFI_ACPI_TABLE_PROTOCOL           *AcpiTable;
    10261177  UINT8                             Checksum;
     1178  UINT64                            OemTableId;
    10271179
    10281180  Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTable);
     
    10321184
    10331185  if (PcdGet8 (PcdTpmPlatformClass) == TCG_PLATFORM_TYPE_CLIENT) {
    1034  
     1186    CopyMem (mTcgClientAcpiTemplate.Header.OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (mTcgClientAcpiTemplate.Header.OemId));
     1187    OemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
     1188    CopyMem (&mTcgClientAcpiTemplate.Header.OemTableId, &OemTableId, sizeof (UINT64));
     1189    mTcgClientAcpiTemplate.Header.OemRevision      = PcdGet32 (PcdAcpiDefaultOemRevision);
     1190    mTcgClientAcpiTemplate.Header.CreatorId        = PcdGet32 (PcdAcpiDefaultCreatorId);
     1191    mTcgClientAcpiTemplate.Header.CreatorRevision  = PcdGet32 (PcdAcpiDefaultCreatorRevision);
    10351192    //
    10361193    // The ACPI table must be checksumed before calling the InstallAcpiTable()
     
    10471204                            );
    10481205  } else {
    1049 
     1206    CopyMem (mTcgServerAcpiTemplate.Header.OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (mTcgServerAcpiTemplate.Header.OemId));
     1207    OemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
     1208    CopyMem (&mTcgServerAcpiTemplate.Header.OemTableId, &OemTableId, sizeof (UINT64));
     1209    mTcgServerAcpiTemplate.Header.OemRevision      = PcdGet32 (PcdAcpiDefaultOemRevision);
     1210    mTcgServerAcpiTemplate.Header.CreatorId        = PcdGet32 (PcdAcpiDefaultCreatorId);
     1211    mTcgServerAcpiTemplate.Header.CreatorRevision  = PcdGet32 (PcdAcpiDefaultCreatorRevision);
    10501212    //
    10511213    // The ACPI table must be checksumed before calling the InstallAcpiTable()
     
    10621224                            );
    10631225  }
    1064   ASSERT_EFI_ERROR (Status);
     1226
     1227  if (EFI_ERROR (Status)) {
     1228    DEBUG((EFI_D_ERROR, "Tcg Acpi Table installation failure"));
     1229  }
    10651230}
    10661231
     
    10891254             EFI_EXIT_BOOT_SERVICES_INVOCATION
    10901255             );
    1091   ASSERT_EFI_ERROR (Status);
     1256  if (EFI_ERROR (Status)) {
     1257    DEBUG ((EFI_D_ERROR, "%s not Measured. Error!\n", EFI_EXIT_BOOT_SERVICES_INVOCATION));
     1258  }
    10921259
    10931260  //
     
    10971264             EFI_EXIT_BOOT_SERVICES_SUCCEEDED
    10981265             );
    1099   ASSERT_EFI_ERROR (Status);
     1266  if (EFI_ERROR (Status)){
     1267    DEBUG ((EFI_D_ERROR, "%s not Measured. Error!\n", EFI_EXIT_BOOT_SERVICES_SUCCEEDED));
     1268  }
     1269}
     1270
     1271/**
     1272  Exit Boot Services Failed Event notification handler.
     1273
     1274  Measure Failure of ExitBootServices.
     1275
     1276  @param[in]  Event     Event whose notification function is being invoked
     1277  @param[in]  Context   Pointer to the notification function's context
     1278
     1279**/
     1280VOID
     1281EFIAPI
     1282OnExitBootServicesFailed (
     1283  IN      EFI_EVENT                 Event,
     1284  IN      VOID                      *Context
     1285  )
     1286{
     1287  EFI_STATUS    Status;
     1288
     1289  //
     1290  // Measure Failure of ExitBootServices,
     1291  //
     1292  Status = TcgMeasureAction (
     1293             EFI_EXIT_BOOT_SERVICES_FAILED
     1294             );
     1295  if (EFI_ERROR (Status)){
     1296    DEBUG ((EFI_D_ERROR, "%s not Measured. Error!\n", EFI_EXIT_BOOT_SERVICES_FAILED));
     1297  }
    11001298}
    11011299
     
    11521350  EFI_EVENT                         Event;
    11531351  VOID                              *Registration;
     1352
     1353  if (!CompareGuid (PcdGetPtr(PcdTpmInstanceGuid), &gEfiTpmDeviceInstanceTpm12Guid)){
     1354    DEBUG ((EFI_D_ERROR, "No TPM12 instance required!\n"));
     1355    return EFI_UNSUPPORTED;
     1356  }
     1357
     1358  if (GetFirstGuidHob (&gTpmErrorHobGuid) != NULL) {
     1359    DEBUG ((EFI_D_ERROR, "TPM error!\n"));
     1360    return EFI_DEVICE_ERROR;
     1361  }
    11541362
    11551363  mTcgDxeData.TpmHandle = (TIS_TPM_HANDLE)(UINTN)TPM_BASE_ADDRESS;
     
    11771385                  &mTcgDxeData.TcgProtocol
    11781386                  );
    1179   //
    1180   // Install ACPI Table
    1181   //
    1182   EfiCreateProtocolNotifyEvent (&gEfiAcpiTableProtocolGuid, TPL_CALLBACK, InstallAcpiTable, NULL, &Registration);
    1183    
    1184   if (!EFI_ERROR (Status) && !mTcgDxeData.BsCap.TPMDeactivatedFlag) {
     1387  if (!EFI_ERROR (Status) && (!mTcgDxeData.BsCap.TPMDeactivatedFlag) && mTcgDxeData.BsCap.TPMPresentFlag) {
    11851388    //
    11861389    // Setup the log area and copy event log from hob list to it
     
    12071410                    &Event
    12081411                    );
    1209   }
    1210 
     1412
     1413    //
     1414    // Measure Exit Boot Service failed
     1415    //
     1416    Status = gBS->CreateEventEx (
     1417                    EVT_NOTIFY_SIGNAL,
     1418                    TPL_NOTIFY,
     1419                    OnExitBootServicesFailed,
     1420                    NULL,
     1421                    &gEventExitBootServicesFailedGuid,
     1422                    &Event
     1423                    );
     1424  }
     1425
     1426  //
     1427  // Install ACPI Table
     1428  //
     1429  EfiCreateProtocolNotifyEvent (&gEfiAcpiTableProtocolGuid, TPL_CALLBACK, InstallAcpiTable, NULL, &Registration);
     1430 
    12111431  return Status;
    12121432}
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgDxe/TcgDxe.inf

    r48674 r58459  
    11## @file
    2 Component file for module TcgDxe.
     2Produces TCG protocol and measures boot environment
    33#  This module will produce TCG protocol and measure boot environment.
    44#
    5 # Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
     5# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
    66# This program and the accompanying materials
    77# are licensed and made available under the terms and conditions of the BSD License
     
    1616  INF_VERSION                    = 0x00010005
    1717  BASE_NAME                      = TcgDxe
     18  MODULE_UNI_FILE                = TcgDxe.uni
    1819  FILE_GUID                      = A5683620-7998-4bb2-A377-1C1E31E1E215
    1920  MODULE_TYPE                    = DXE_DRIVER
     
    5051  PrintLib
    5152  UefiLib
     53  PcdLib
     54  ReportStatusCodeLib
    5255
    5356[Guids]
    54   gEfiSmbiosTableGuid                           # ALWAYS_CONSUMED
    55   gEfiGlobalVariableGuid                        # ALWAYS_CONSUMED
    56   gTcgEventEntryHobGuid
    57   gEfiEventReadyToBootGuid
    58   gEfiEventExitBootServicesGuid
     57  ## SOMETIMES_CONSUMES     ## SystemTable           # Smbios Table
     58  ## SOMETIMES_CONSUMES     ## GUID                  # Handoff Table for measurement.
     59  gEfiSmbiosTableGuid
     60 
     61  gEfiGlobalVariableGuid                             ## SOMETIMES_CONSUMES  ## Variable:L"BootXXXX"
     62  gTcgEventEntryHobGuid                              ## SOMETIMES_CONSUMES  ## HOB
     63  gTpmErrorHobGuid                                   ## SOMETIMES_CONSUMES  ## HOB
     64  gEfiEventExitBootServicesGuid                      ## CONSUMES            ## Event
     65  gEventExitBootServicesFailedGuid                   ## SOMETIMES_CONSUMES  ## Event
     66  gEfiTpmDeviceInstanceTpm12Guid                     ## PRODUCES            ## GUID       # TPM device identifier
    5967
    6068[Protocols]
    61   gEfiTcgProtocolGuid                           ## PRODUCES
    62   gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED
    63   gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED
    64 
     69  gEfiTcgProtocolGuid                                ## PRODUCES
     70  gEfiAcpiTableProtocolGuid                          ## NOTIFY
     71  gEfiMpServiceProtocolGuid                          ## SOMETIMES_CONSUMES
     72 
    6573[Pcd]
    66   gEfiSecurityPkgTokenSpaceGuid.PcdTpmPlatformClass
     74  gEfiSecurityPkgTokenSpaceGuid.PcdTpmPlatformClass              ## SOMETIMES_CONSUMES
     75  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid               ## CONSUMES
     76  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId             ## SOMETIMES_CONSUMES
     77  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId        ## SOMETIMES_CONSUMES
     78  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision       ## SOMETIMES_CONSUMES
     79  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId         ## SOMETIMES_CONSUMES
     80  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision   ## SOMETIMES_CONSUMES
     81  gEfiSecurityPkgTokenSpaceGuid.PcdStatusCodeSubClassTpmDevice   ## SOMETIMES_CONSUMES
    6782
    6883[Depex]
    6984  TRUE
    7085
     86[UserExtensions.TianoCore."ExtraFiles"]
     87  TcgDxeExtra.uni
     88 
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgDxe/TisDxe.c

    r48674 r58459  
    234234  }
    235235
     236  //
     237  // Check input to avoid overflow.
     238  //
     239  if ((UINT32) (~0)- *DataLength < (UINT32)Size) {
     240    return EFI_INVALID_PARAMETER;
     241  }
     242
    236243  if(*DataLength + (UINT32) Size > TPMCMDBUFLENGTH) {
    237244    return EFI_BUFFER_TOO_SMALL;
     
    292299    case 'r':
    293300      Size = VA_ARG (*ap, UINTN);
    294       if(*DataIndex + (UINT32) Size <= RespSize) {
    295         break;
     301      //
     302      // If overflowed, which means Size is big enough for Response data.
     303      // skip this check. Copy the whole data
     304      //
     305      if ((UINT32) (~0)- *DataIndex >= (UINT32)Size) {
     306        if(*DataIndex + (UINT32) Size <= RespSize) {
     307          break;
     308        }
    296309      }
     310
    297311      *DataFinished = TRUE;
    298312      if (*DataIndex >= RespSize) {
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgDxe/TpmComm.c

    r48674 r58459  
    22  Utility functions used by TPM Dxe driver.
    33
    4 Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
     4Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
    55This program and the accompanying materials
    66are licensed and made available under the terms and conditions of the BSD License
     
    145145  )
    146146{
    147   UINT32                            NewLogSize;
     147  UINTN                            NewLogSize;
     148
     149  //
     150  // Prevent Event Overflow
     151  //
     152  if (NewEventHdr->EventSize > (UINTN)(~0) - sizeof (*NewEventHdr)) {
     153    return EFI_OUT_OF_RESOURCES;
     154  }
    148155
    149156  NewLogSize = sizeof (*NewEventHdr) + NewEventHdr->EventSize;
    150   if (NewLogSize + *LogSize > MaxSize) {
     157  if (NewLogSize > MaxSize - *LogSize) {
    151158    return EFI_OUT_OF_RESOURCES;
    152159  }
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgPei/TcgPei.c

    r48674 r58459  
    22  Initialize TPM device and measure FVs before handing off control to DXE.
    33
    4 Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
     4Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
    55This program and the accompanying materials
    66are licensed and made available under the terms and conditions of the BSD License
     
    1818#include <IndustryStandard/UefiTcgPlatform.h>
    1919#include <Ppi/FirmwareVolumeInfo.h>
     20#include <Ppi/FirmwareVolumeInfo2.h>
    2021#include <Ppi/LockPhysicalPresence.h>
    2122#include <Ppi/TpmInitialized.h>
    2223#include <Ppi/FirmwareVolume.h>
     24#include <Ppi/EndOfPeiPhase.h>
     25#include <Ppi/FirmwareVolumeInfoMeasurementExcluded.h>
     26
    2327#include <Guid/TcgEventHob.h>
     28#include <Guid/MeasuredFvHob.h>
     29#include <Guid/TpmInstance.h>
     30
    2431#include <Library/DebugLib.h>
    2532#include <Library/BaseMemoryLib.h>
     
    3037#include <Library/PcdLib.h>
    3138#include <Library/PeiServicesTablePointerLib.h>
     39#include <Library/BaseLib.h>
     40#include <Library/MemoryAllocationLib.h>
     41#include <Library/ReportStatusCodeLib.h>
    3242
    3343#include "TpmComm.h"
     
    4151};
    4252
     53EFI_PEI_PPI_DESCRIPTOR  mTpmInitializationDonePpiList = {
     54  EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
     55  &gPeiTpmInitializationDonePpiGuid,
     56  NULL
     57};
     58
     59EFI_PLATFORM_FIRMWARE_BLOB *mMeasuredBaseFvInfo;
     60UINT32 mMeasuredBaseFvIndex = 0;
     61
     62EFI_PLATFORM_FIRMWARE_BLOB *mMeasuredChildFvInfo;
     63UINT32 mMeasuredChildFvIndex = 0;
     64
     65EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI *mMeasurementExcludedFvPpi;
     66
    4367/**
    4468  Lock physical presence if needed.
     
    7397EFIAPI
    7498FirmwareVolmeInfoPpiNotifyCallback (
     99  IN EFI_PEI_SERVICES              **PeiServices,
     100  IN EFI_PEI_NOTIFY_DESCRIPTOR     *NotifyDescriptor,
     101  IN VOID                          *Ppi
     102  );
     103
     104/**
     105  Record all measured Firmware Volum Information into a Guid Hob
     106
     107  @param[in] PeiServices       An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
     108  @param[in] NotifyDescriptor  Address of the notification descriptor data structure.
     109  @param[in] Ppi               Address of the PPI that was installed.
     110
     111  @retval EFI_SUCCESS          The FV Info is measured and recorded to TPM.
     112  @return Others               Fail to measure FV.
     113
     114**/
     115EFI_STATUS
     116EFIAPI
     117EndofPeiSignalNotifyCallBack (
    75118  IN EFI_PEI_SERVICES              **PeiServices,
    76119  IN EFI_PEI_NOTIFY_DESCRIPTOR     *NotifyDescriptor,
     
    85128  },
    86129  {
    87     (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
     130    EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,
    88131    &gEfiPeiFirmwareVolumeInfoPpiGuid,
    89132    FirmwareVolmeInfoPpiNotifyCallback
     133  },
     134  {
     135    EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,
     136    &gEfiPeiFirmwareVolumeInfo2PpiGuid,
     137    FirmwareVolmeInfoPpiNotifyCallback
     138  },
     139  {
     140    (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
     141    &gEfiEndOfPeiSignalPpiGuid,
     142    EndofPeiSignalNotifyCallBack
    90143  }
    91144};
    92145
    93 CHAR8 mSCrtmVersion[] = "{D20BC7C6-A1A5-415c-AE85-38290AB6BE04}";
    94 
    95 EFI_PLATFORM_FIRMWARE_BLOB mMeasuredFvInfo[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];
    96 UINT32 mMeasuredFvIndex = 0;
     146/**
     147  Record all measured Firmware Volum Information into a Guid Hob
     148  Guid Hob payload layout is
     149
     150     UINT32 *************************** FIRMWARE_BLOB number
     151     EFI_PLATFORM_FIRMWARE_BLOB******** BLOB Array
     152
     153  @param[in] PeiServices       An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
     154  @param[in] NotifyDescriptor  Address of the notification descriptor data structure.
     155  @param[in] Ppi               Address of the PPI that was installed.
     156
     157  @retval EFI_SUCCESS          The FV Info is measured and recorded to TPM.
     158  @return Others               Fail to measure FV.
     159
     160**/
     161EFI_STATUS
     162EFIAPI
     163EndofPeiSignalNotifyCallBack (
     164  IN EFI_PEI_SERVICES              **PeiServices,
     165  IN EFI_PEI_NOTIFY_DESCRIPTOR     *NotifyDescriptor,
     166  IN VOID                          *Ppi
     167  )
     168
     169  MEASURED_HOB_DATA *MeasuredHobData;
     170
     171  MeasuredHobData = NULL;
     172
     173  //
     174  // Create a Guid hob to save all measured Fv
     175  //
     176  MeasuredHobData = BuildGuidHob(
     177                      &gMeasuredFvHobGuid,
     178                      sizeof(UINTN) + sizeof(EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredBaseFvIndex + mMeasuredChildFvIndex)
     179                      );
     180
     181  if (MeasuredHobData != NULL){
     182    //
     183    // Save measured FV info enty number
     184    //
     185    MeasuredHobData->Num = mMeasuredBaseFvIndex + mMeasuredChildFvIndex;
     186
     187    //
     188    // Save measured base Fv info
     189    //
     190    CopyMem (MeasuredHobData->MeasuredFvBuf, mMeasuredBaseFvInfo, sizeof(EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredBaseFvIndex));
     191
     192    //
     193    // Save measured child Fv info
     194    //
     195    CopyMem (&MeasuredHobData->MeasuredFvBuf[mMeasuredBaseFvIndex] , mMeasuredChildFvInfo, sizeof(EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredChildFvIndex));
     196  }
     197
     198  return EFI_SUCCESS;
     199}
    97200
    98201/**
     
    126229  EFI_STATUS                        Status;
    127230  VOID                              *HobData;
     231 
     232  if (GetFirstGuidHob (&gTpmErrorHobGuid) != NULL) {
     233    return EFI_DEVICE_ERROR;
     234  }
    128235
    129236  HobData = NULL;
     
    134241               &NewEventHdr->Digest
    135242               );
    136     ASSERT_EFI_ERROR (Status);
     243    if (EFI_ERROR (Status)) {
     244      goto Done;
     245    }
    137246  }
    138247
     
    144253             NULL
    145254             );
    146   ASSERT_EFI_ERROR (Status);
     255  if (EFI_ERROR (Status)) {
     256    goto Done;
     257  }
    147258
    148259  HobData = BuildGuidHob (
     
    151262             );
    152263  if (HobData == NULL) {
    153     return EFI_OUT_OF_RESOURCES;
     264    Status = EFI_OUT_OF_RESOURCES;
     265    goto Done;
    154266  }
    155267
     
    157269  HobData = (VOID *) ((UINT8*)HobData + sizeof (*NewEventHdr));
    158270  CopyMem (HobData, NewEventData, NewEventHdr->EventSize);
    159   return EFI_SUCCESS;
     271
     272Done:
     273  if ((Status == EFI_DEVICE_ERROR) || (Status == EFI_TIMEOUT)) {
     274    DEBUG ((EFI_D_ERROR, "HashLogExtendEvent - %r. Disable TPM.\n", Status));
     275    BuildGuidHob (&gTpmErrorHobGuid,0);
     276    REPORT_STATUS_CODE (
     277      EFI_ERROR_CODE | EFI_ERROR_MINOR,
     278      (PcdGet32 (PcdStatusCodeSubClassTpmDevice) | EFI_P_EC_INTERFACE_ERROR)
     279      );
     280    Status = EFI_DEVICE_ERROR;
     281  }
     282  return Status;
    160283}
    161284
     
    181304
    182305  //
    183   // Here, only a static GUID is measured instead of real CRTM version.
     306  // Use FirmwareVersion string to represent CRTM version.
    184307  // OEMs should get real CRTM version string and measure it.
    185308  //
     
    187310  TcgEventHdr.PCRIndex  = 0;
    188311  TcgEventHdr.EventType = EV_S_CRTM_VERSION;
    189   TcgEventHdr.EventSize = sizeof (mSCrtmVersion);
     312  TcgEventHdr.EventSize = (UINT32) StrSize((CHAR16*)PcdGetPtr (PcdFirmwareVersionString));
     313
    190314  return HashLogExtendEvent (
    191315           PeiServices,
    192            (UINT8*)&mSCrtmVersion,
     316           (UINT8*)PcdGetPtr (PcdFirmwareVersionString),
    193317           TcgEventHdr.EventSize,
    194318           TpmHandle,
    195319           &TcgEventHdr,
    196            (UINT8*)&mSCrtmVersion
     320           (UINT8*)PcdGetPtr (PcdFirmwareVersionString)
    197321           );
    198322}
     
    227351
    228352  //
     353  // Check if it is in Excluded FV list
     354  //
     355  if (mMeasurementExcludedFvPpi != NULL) {
     356    for (Index = 0; Index < mMeasurementExcludedFvPpi->Count; Index ++) {
     357      if (mMeasurementExcludedFvPpi->Fv[Index].FvBase == FvBase) {
     358        DEBUG ((DEBUG_INFO, "The FV which is excluded by TcgPei starts at: 0x%x\n", FvBase));
     359        DEBUG ((DEBUG_INFO, "The FV which is excluded by TcgPei has the size: 0x%x\n", FvLength));
     360        return EFI_SUCCESS;
     361      }
     362    }
     363  }
     364
     365  //
    229366  // Check whether FV is in the measured FV list.
    230367  //
    231   for (Index = 0; Index < mMeasuredFvIndex; Index ++) {
    232     if (mMeasuredFvInfo[Index].BlobBase == FvBase) {
     368  for (Index = 0; Index < mMeasuredBaseFvIndex; Index ++) {
     369    if (mMeasuredBaseFvInfo[Index].BlobBase == FvBase) {
    233370      return EFI_SUCCESS;
    234371    }
     
    256393             (UINT8*) &FvBlob
    257394             );
    258   ASSERT_EFI_ERROR (Status);
    259395
    260396  //
    261397  // Add new FV into the measured FV list.
    262398  //
    263   ASSERT (mMeasuredFvIndex < FixedPcdGet32 (PcdPeiCoreMaxFvSupported));
    264   if (mMeasuredFvIndex < FixedPcdGet32 (PcdPeiCoreMaxFvSupported)) {
    265     mMeasuredFvInfo[mMeasuredFvIndex].BlobBase   = FvBase;
    266     mMeasuredFvInfo[mMeasuredFvIndex++].BlobLength = FvLength;
     399  ASSERT (mMeasuredBaseFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported));
     400  if (mMeasuredBaseFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported)) {
     401    mMeasuredBaseFvInfo[mMeasuredBaseFvIndex].BlobBase   = FvBase;
     402    mMeasuredBaseFvInfo[mMeasuredBaseFvIndex].BlobLength = FvLength;
     403    mMeasuredBaseFvIndex++;
    267404  }
    268405
     
    352489  EFI_STATUS                        Status;
    353490  EFI_PEI_FIRMWARE_VOLUME_PPI       *FvPpi;
     491  UINTN                             Index;
    354492
    355493  Fv = (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *) Ppi;
     
    370508  //
    371509  // This is an FV from an FFS file, and the parent FV must have already been measured,
    372   // No need to measure twice, so just returns
     510  // No need to measure twice, so just record the FV and return
    373511  //
    374512  if (Fv->ParentFvName != NULL || Fv->ParentFileName != NULL ) {
     513   
     514    ASSERT (mMeasuredChildFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported));
     515    if (mMeasuredChildFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported)) {
     516      //
     517      // Check whether FV is in the measured child FV list.
     518      //
     519      for (Index = 0; Index < mMeasuredChildFvIndex; Index++) {
     520        if (mMeasuredChildFvInfo[Index].BlobBase == (EFI_PHYSICAL_ADDRESS) (UINTN) Fv->FvInfo) {
     521          return EFI_SUCCESS;
     522        }
     523      }
     524      mMeasuredChildFvInfo[mMeasuredChildFvIndex].BlobBase   = (EFI_PHYSICAL_ADDRESS) (UINTN) Fv->FvInfo;
     525      mMeasuredChildFvInfo[mMeasuredChildFvIndex].BlobLength = Fv->FvInfoSize;
     526      mMeasuredChildFvIndex++;
     527    }
    375528    return EFI_SUCCESS;
    376529  }
     
    380533
    381534/**
    382   Lock physical presence if needed.
     535  Set physicalPresenceLifetimeLock, physicalPresenceHWEnable and physicalPresenceCMDEnable bit by corresponding PCDs.
     536  And lock physical presence if needed.
    383537
    384538  @param[in] PeiServices        An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
     
    404558  BOOLEAN                           CmdEnable;
    405559  TIS_TPM_HANDLE                    TpmHandle;
     560  TPM_PHYSICAL_PRESENCE             PhysicalPresenceValue;
    406561
    407562  TpmHandle        = (TIS_TPM_HANDLE) (UINTN) TPM_BASE_ADDRESS;
    408   LockPhysicalPresencePpi = (PEI_LOCK_PHYSICAL_PRESENCE_PPI *) Ppi;
    409 
    410   if (!LockPhysicalPresencePpi->LockPhysicalPresence ((CONST EFI_PEI_SERVICES**) PeiServices)) {
    411     return EFI_SUCCESS;
    412   }
    413 
    414   //
    415   // Lock TPM physical presence.
    416   //
    417563
    418564  Status = TpmCommGetCapability (PeiServices, TpmHandle, NULL, &LifetimeLock, &CmdEnable);
    419565  if (EFI_ERROR (Status)) {
    420566    return Status;
     567  }
     568
     569  //
     570  // 1. Set physicalPresenceLifetimeLock, physicalPresenceHWEnable and physicalPresenceCMDEnable bit by PCDs.
     571  //
     572  if (PcdGetBool (PcdPhysicalPresenceLifetimeLock) && !LifetimeLock) {
     573    //
     574    // Lock TPM LifetimeLock is required, and LifetimeLock is not locked yet.
     575    //
     576    PhysicalPresenceValue = TPM_PHYSICAL_PRESENCE_LIFETIME_LOCK;
     577
     578    if (PcdGetBool (PcdPhysicalPresenceCmdEnable)) {
     579      PhysicalPresenceValue |= TPM_PHYSICAL_PRESENCE_CMD_ENABLE;
     580      CmdEnable = TRUE;
     581    } else {
     582      PhysicalPresenceValue |= TPM_PHYSICAL_PRESENCE_CMD_DISABLE;
     583      CmdEnable = FALSE;
     584    }
     585
     586    if (PcdGetBool (PcdPhysicalPresenceHwEnable)) {
     587      PhysicalPresenceValue |= TPM_PHYSICAL_PRESENCE_HW_ENABLE;
     588    } else {
     589      PhysicalPresenceValue |= TPM_PHYSICAL_PRESENCE_HW_DISABLE;
     590    }     
     591     
     592    Status = TpmCommPhysicalPresence (
     593               PeiServices,
     594               TpmHandle,
     595               PhysicalPresenceValue
     596               );
     597    if (EFI_ERROR (Status)) {
     598      return Status;
     599    }
     600  }
     601 
     602  //
     603  // 2. Lock physical presence if it is required.
     604  //
     605  LockPhysicalPresencePpi = (PEI_LOCK_PHYSICAL_PRESENCE_PPI *) Ppi;
     606  if (!LockPhysicalPresencePpi->LockPhysicalPresence ((CONST EFI_PEI_SERVICES**) PeiServices)) {
     607    return EFI_SUCCESS;
    421608  }
    422609
     
    500687  TIS_TPM_HANDLE                    TpmHandle;
    501688
     689  Status = PeiServicesLocatePpi (
     690               &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid,
     691               0,
     692               NULL,
     693               (VOID**)&mMeasurementExcludedFvPpi
     694               );
     695  // Do not check status, because it is optional
     696
     697  mMeasuredBaseFvInfo  = (EFI_PLATFORM_FIRMWARE_BLOB *) AllocateZeroPool (sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * PcdGet32 (PcdPeiCoreMaxFvSupported));
     698  ASSERT (mMeasuredBaseFvInfo != NULL);
     699  mMeasuredChildFvInfo = (EFI_PLATFORM_FIRMWARE_BLOB *) AllocateZeroPool (sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * PcdGet32 (PcdPeiCoreMaxFvSupported));
     700  ASSERT (mMeasuredChildFvInfo != NULL);
     701
    502702  TpmHandle = (TIS_TPM_HANDLE)(UINTN)TPM_BASE_ADDRESS;
    503703  Status = TisPcRequestUseTpm ((TIS_PC_REGISTERS_PTR)TpmHandle);
     
    507707
    508708  if (IsTpmUsable (PeiServices, TpmHandle)) {
    509     Status = MeasureCRTMVersion (PeiServices, TpmHandle);
    510     ASSERT_EFI_ERROR (Status);
     709    if (PcdGet8 (PcdTpmScrtmPolicy) == 1) {
     710      Status = MeasureCRTMVersion (PeiServices, TpmHandle);
     711    }
    511712
    512713    Status = MeasureMainBios (PeiServices, TpmHandle);
     
    543744{
    544745  EFI_STATUS                        Status;
     746  EFI_STATUS                        Status2;
    545747  EFI_BOOT_MODE                     BootMode;
    546748  TIS_TPM_HANDLE                    TpmHandle;
    547749
    548   if (PcdGetBool (PcdHideTpmSupport) && PcdGetBool (PcdHideTpm)) {
     750  if (!CompareGuid (PcdGetPtr(PcdTpmInstanceGuid), &gEfiTpmDeviceInstanceTpm12Guid)){
     751    DEBUG ((EFI_D_ERROR, "No TPM12 instance required!\n"));
    549752    return EFI_UNSUPPORTED;
    550753  }
    551754
    552   Status = (**PeiServices).RegisterForShadow(FileHandle);
    553   if (Status == EFI_ALREADY_STARTED) {
    554     mImageInMemory = TRUE;
    555   } else if (Status == EFI_NOT_FOUND) {
    556     ASSERT_EFI_ERROR (Status);
     755  if (GetFirstGuidHob (&gTpmErrorHobGuid) != NULL) {
     756    DEBUG ((EFI_D_ERROR, "TPM error!\n"));
     757    return EFI_DEVICE_ERROR;
     758  }
     759
     760  //
     761  // Initialize TPM device
     762  //
     763  Status = PeiServicesGetBootMode (&BootMode);
     764  ASSERT_EFI_ERROR (Status);
     765
     766  //
     767  // In S3 path, skip shadow logic. no measurement is required
     768  //
     769  if (BootMode != BOOT_ON_S3_RESUME) {
     770    Status = (**PeiServices).RegisterForShadow(FileHandle);
     771    if (Status == EFI_ALREADY_STARTED) {
     772      mImageInMemory = TRUE;
     773    } else if (Status == EFI_NOT_FOUND) {
     774      ASSERT_EFI_ERROR (Status);
     775    }
    557776  }
    558777
    559778  if (!mImageInMemory) {
    560     //
    561     // Initialize TPM device
    562     //
    563     Status = PeiServicesGetBootMode (&BootMode);
    564     ASSERT_EFI_ERROR (Status);
    565 
    566779    TpmHandle = (TIS_TPM_HANDLE)(UINTN)TPM_BASE_ADDRESS;
    567780    Status = TisPcRequestUseTpm ((TIS_PC_REGISTERS_PTR)TpmHandle);
    568781    if (EFI_ERROR (Status)) {
    569782      DEBUG ((DEBUG_ERROR, "TPM not detected!\n"));
    570       return Status;
    571     }
    572 
    573     Status = TpmCommStartup ((EFI_PEI_SERVICES**)PeiServices, TpmHandle, BootMode);
    574     if (EFI_ERROR (Status) ) {
    575       return Status;
    576     }
    577     Status = TpmCommContinueSelfTest ((EFI_PEI_SERVICES**)PeiServices, TpmHandle);
    578     if (EFI_ERROR (Status)) {
    579       return Status;
    580     }
     783      goto Done;
     784    }
     785
     786    if (PcdGet8 (PcdTpmInitializationPolicy) == 1) {
     787      Status = TpmCommStartup ((EFI_PEI_SERVICES**)PeiServices, TpmHandle, BootMode);
     788      if (EFI_ERROR (Status) ) {
     789        goto Done;
     790      }
     791    }
     792
     793    //
     794    // TpmSelfTest is optional on S3 path, skip it to save S3 time
     795    //
     796    if (BootMode != BOOT_ON_S3_RESUME) {
     797      Status = TpmCommContinueSelfTest ((EFI_PEI_SERVICES**)PeiServices, TpmHandle);
     798      if (EFI_ERROR (Status)) {
     799        goto Done;
     800      }
     801    }
     802
     803    //
     804    // Only intall TpmInitializedPpi on success
     805    //
    581806    Status = PeiServicesInstallPpi (&mTpmInitializedPpiList);
    582807    ASSERT_EFI_ERROR (Status);
     
    585810  if (mImageInMemory) {
    586811    Status = PeimEntryMP ((EFI_PEI_SERVICES**)PeiServices);
    587     if (EFI_ERROR (Status)) {
    588       return Status;
    589     }
    590   }
     812    return Status;
     813  }
     814
     815Done:
     816  if (EFI_ERROR (Status)) {
     817    DEBUG ((EFI_D_ERROR, "TPM error! Build Hob\n"));
     818    BuildGuidHob (&gTpmErrorHobGuid,0);
     819    REPORT_STATUS_CODE (
     820      EFI_ERROR_CODE | EFI_ERROR_MINOR,
     821      (PcdGet32 (PcdStatusCodeSubClassTpmDevice) | EFI_P_EC_INTERFACE_ERROR)
     822      );
     823  }
     824  //
     825  // Always intall TpmInitializationDonePpi no matter success or fail.
     826  // Other driver can know TPM initialization state by TpmInitializedPpi.
     827  //
     828  Status2 = PeiServicesInstallPpi (&mTpmInitializationDonePpiList);
     829  ASSERT_EFI_ERROR (Status2);
    591830
    592831  return Status;
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgPei/TcgPei.inf

    r48674 r58459  
    11## @file
    2 This module will initialize TPM device and measure FVs in PEI phase.
     2Initializes TPM device and measures FVs in PEI phase
    33#
    4 # Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     4#  This module will initialize TPM device, measure reported FVs and BIOS version.
     5#  This module may also lock TPM physical presence and physicalPresenceLifetimeLock.
     6#
     7# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
    58# This program and the accompanying materials
    69# are licensed and made available under the terms and conditions of the BSD License
     
    1518  INF_VERSION                    = 0x00010005
    1619  BASE_NAME                      = TcgPei
     20  MODULE_UNI_FILE                = TcgPei.uni
    1721  FILE_GUID                      = 2BE1E4A6-6505-43b3-9FFC-A3C8330E0432
    1822  MODULE_TYPE                    = PEIM
     
    2428#
    2529#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC
     30#
     31# [BootMode]
     32#   S3_RESUME                 ## SOMETIMES_CONSUMES
    2633#
    2734
     
    4754  IoLib
    4855  PeiServicesTablePointerLib
     56  BaseLib
     57  PcdLib
     58  MemoryAllocationLib
     59  ReportStatusCodeLib
    4960
    5061[Guids]
    51   gTcgEventEntryHobGuid
     62  gTcgEventEntryHobGuid                                               ## PRODUCES               ## HOB
     63  gTpmErrorHobGuid                                                    ## SOMETIMES_PRODUCES     ## HOB
     64  gMeasuredFvHobGuid                                                  ## PRODUCES               ## HOB
     65  gEfiTpmDeviceInstanceTpm12Guid                                      ## PRODUCES               ## GUID       # TPM device identifier
    5266
    5367[Ppis]
    54   gPeiLockPhysicalPresencePpiGuid
    55   gEfiPeiFirmwareVolumeInfoPpiGuid
    56   gPeiTpmInitializedPpiGuid
     68  gPeiLockPhysicalPresencePpiGuid                                     ## SOMETIMES_CONSUMES     ## NOTIFY
     69  gEfiPeiFirmwareVolumeInfoPpiGuid                                    ## SOMETIMES_CONSUMES     ## NOTIFY
     70  gEfiPeiFirmwareVolumeInfo2PpiGuid                                   ## SOMETIMES_CONSUMES     ## NOTIFY
     71  gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid                 ## SOMETIMES_CONSUMES
     72  gPeiTpmInitializedPpiGuid                                           ## SOMETIMES_PRODUCES
     73  gPeiTpmInitializationDonePpiGuid                                    ## PRODUCES
     74  gEfiEndOfPeiSignalPpiGuid                                           ## SOMETIMES_CONSUMES     ## NOTIFY
    5775
    5876[Pcd]
    59   gEfiSecurityPkgTokenSpaceGuid.PcdHideTpm
    60 
    61 [FixedPcd]
    62   gEfiSecurityPkgTokenSpaceGuid.PcdHideTpmSupport
     77  gEfiSecurityPkgTokenSpaceGuid.PcdPhysicalPresenceLifetimeLock       ## SOMETIMES_CONSUMES
     78  gEfiSecurityPkgTokenSpaceGuid.PcdPhysicalPresenceCmdEnable          ## SOMETIMES_CONSUMES
     79  gEfiSecurityPkgTokenSpaceGuid.PcdPhysicalPresenceHwEnable           ## SOMETIMES_CONSUMES
     80  gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString             ## SOMETIMES_CONSUMES
     81  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid                    ## CONSUMES
     82  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInitializationPolicy            ## CONSUMES
     83  gEfiSecurityPkgTokenSpaceGuid.PcdTpmScrtmPolicy                     ## SOMETIMES_CONSUMES
    6384  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported             ## CONSUMES
     85  gEfiSecurityPkgTokenSpaceGuid.PcdStatusCodeSubClassTpmDevice        ## SOMETIMES_CONSUMES
    6486
    6587[Depex]
    6688  gEfiPeiMasterBootModePpiGuid AND
    67   gEfiPeiReadOnlyVariable2PpiGuid
     89  gEfiPeiReadOnlyVariable2PpiGuid AND
     90  gEfiTpmDeviceSelectedGuid
     91
     92[UserExtensions.TianoCore."ExtraFiles"]
     93  TcgPeiExtra.uni
     94 
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgPei/TpmComm.c

    r48674 r58459  
    22  Utility functions used by TPM PEI driver.
    33 
    4 Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
     4Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
    55This program and the accompanying materials
    66are licensed and made available under the terms and conditions of the BSD License
     
    223223  CopyMem (&SendBuffer.TpmDigest, (UINT8 *)DigestToExtend, sizeof (TPM_DIGEST));
    224224  Status = TisTpmCommand (PeiServices, TpmHandle, (UINT8 *)&SendBuffer, TpmSendSize, RecvBuffer, &TpmRecvSize);
    225   ASSERT_EFI_ERROR (Status);
     225  if (EFI_ERROR (Status)) {
     226    return Status;
     227  }
    226228
    227229  if(NewPcrValue != NULL) {
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgSmm/TcgSmm.c

    r48674 r58459  
    33  functions for physical presence and ClearMemory.
    44
    5 Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
     5  Caution: This module requires additional review when modified.
     6  This driver will have external input - variable and ACPINvs data in SMM mode.
     7  This external input must be validated carefully to avoid security issue.
     8
     9  PhysicalPresenceCallback() and MemoryClearCallback() will receive untrusted input and do some check.
     10
     11Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
    612This program and the accompanying materials
    713are licensed and made available under the terms and conditions of the BSD License
     
    2127/**
    2228  Software SMI callback for TPM physical presence which is called from ACPI method.
     29
     30  Caution: This function may receive untrusted input.
     31  Variable and ACPINvs are external input, so this function will validate
     32  its data structure to be valid value.
    2333
    2434  @param[in]      DispatchHandle  The unique handle assigned to this handler by SmiHandlerRegister().
     
    4454  UINTN                          DataSize;
    4555  EFI_PHYSICAL_PRESENCE          PpData;
    46   UINT8                          Flags;
     56  EFI_PHYSICAL_PRESENCE_FLAGS    Flags;
    4757  BOOLEAN                        RequestConfirmed;
    4858
     
    5868                           &PpData
    5969                           );
    60   if (EFI_ERROR (Status)) {
    61     return EFI_SUCCESS;
    62   }
    6370
    6471  DEBUG ((EFI_D_INFO, "[TPM] PP callback, Parameter = %x\n", mTcgNvs->PhysicalPresence.Parameter));
    6572  if (mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_RETURN_REQUEST_RESPONSE_TO_OS) {
     73    if (EFI_ERROR (Status)) {
     74      mTcgNvs->PhysicalPresence.ReturnCode  = PP_RETURN_TPM_OPERATION_RESPONSE_FAILURE;
     75      mTcgNvs->PhysicalPresence.LastRequest = 0;
     76      mTcgNvs->PhysicalPresence.Response    = 0;
     77      DEBUG ((EFI_D_ERROR, "[TPM] Get PP variable failure! Status = %r\n", Status));
     78      return EFI_SUCCESS;
     79    }
     80    mTcgNvs->PhysicalPresence.ReturnCode  = PP_RETURN_TPM_OPERATION_RESPONSE_SUCCESS;
    6681    mTcgNvs->PhysicalPresence.LastRequest = PpData.LastPPRequest;
    6782    mTcgNvs->PhysicalPresence.Response    = PpData.PPResponse;
    6883  } else if ((mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS)
    6984          || (mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS_2)) {
     85    if (EFI_ERROR (Status)) {
     86      mTcgNvs->PhysicalPresence.ReturnCode = TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE;
     87      DEBUG ((EFI_D_ERROR, "[TPM] Get PP variable failure! Status = %r\n", Status));
     88      return EFI_SUCCESS;
     89    }
    7090    if (mTcgNvs->PhysicalPresence.Request == PHYSICAL_PRESENCE_SET_OPERATOR_AUTH) {
    7191      //
    7292      // This command requires UI to prompt user for Auth data.
    7393      //
    74       mTcgNvs->PhysicalPresence.ReturnCode = PP_SUBMIT_REQUEST_NOT_IMPLEMENTED;
     94      mTcgNvs->PhysicalPresence.ReturnCode = TCG_PP_SUBMIT_REQUEST_TO_PREOS_NOT_IMPLEMENTED;
    7595      return EFI_SUCCESS;
    7696    }
     
    89109
    90110    if (EFI_ERROR (Status)) {
    91       mTcgNvs->PhysicalPresence.ReturnCode = PP_SUBMIT_REQUEST_GENERAL_FAILURE;
    92       return EFI_SUCCESS;
    93     }
    94     mTcgNvs->PhysicalPresence.ReturnCode = PP_SUBMIT_REQUEST_SUCCESS;
     111      mTcgNvs->PhysicalPresence.ReturnCode = TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE;
     112      return EFI_SUCCESS;
     113    }
     114    mTcgNvs->PhysicalPresence.ReturnCode = TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS;
     115
     116    if (mTcgNvs->PhysicalPresence.Request >= TCG_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {
     117      DataSize = sizeof (EFI_PHYSICAL_PRESENCE_FLAGS);
     118      Status = mSmmVariable->SmmGetVariable (
     119                               PHYSICAL_PRESENCE_FLAGS_VARIABLE,
     120                               &gEfiPhysicalPresenceGuid,
     121                               NULL,
     122                               &DataSize,
     123                               &Flags
     124                               );
     125      if (EFI_ERROR (Status)) {
     126        Flags.PPFlags = TCG_BIOS_TPM_MANAGEMENT_FLAG_NO_PPI_PROVISION;
     127      }
     128      mTcgNvs->PhysicalPresence.ReturnCode = TcgPpVendorLibSubmitRequestToPreOSFunction (mTcgNvs->PhysicalPresence.Request, Flags.PPFlags);
     129    }
    95130  } else if (mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_GET_USER_CONFIRMATION_STATUS_FOR_REQUEST) {
    96     Flags = PpData.Flags; 
     131    if (EFI_ERROR (Status)) {
     132      mTcgNvs->PhysicalPresence.ReturnCode = TCG_PP_GET_USER_CONFIRMATION_BLOCKED_BY_BIOS_CONFIGURATION;
     133      DEBUG ((EFI_D_ERROR, "[TPM] Get PP variable failure! Status = %r\n", Status));
     134      return EFI_SUCCESS;
     135    }
     136    //
     137    // Get the Physical Presence flags
     138    //
     139    DataSize = sizeof (EFI_PHYSICAL_PRESENCE_FLAGS);
     140    Status = mSmmVariable->SmmGetVariable (
     141                             PHYSICAL_PRESENCE_FLAGS_VARIABLE,
     142                             &gEfiPhysicalPresenceGuid,
     143                             NULL,
     144                             &DataSize,
     145                             &Flags
     146                             );
     147    if (EFI_ERROR (Status)) {
     148      mTcgNvs->PhysicalPresence.ReturnCode = TCG_PP_GET_USER_CONFIRMATION_BLOCKED_BY_BIOS_CONFIGURATION;
     149      DEBUG ((EFI_D_ERROR, "[TPM] Get PP flags failure! Status = %r\n", Status));
     150      return EFI_SUCCESS;
     151    }
     152
    97153    RequestConfirmed = FALSE;
    98154
     
    108164      case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_OWNER_TRUE:
    109165      case PHYSICAL_PRESENCE_DEACTIVATE_DISABLE_OWNER_FALSE:
    110         if ((Flags & FLAG_NO_PPI_PROVISION) != 0) {
     166        if ((Flags.PPFlags & TCG_BIOS_TPM_MANAGEMENT_FLAG_NO_PPI_PROVISION) != 0) {
    111167          RequestConfirmed = TRUE;
    112168        }
     
    115171      case PHYSICAL_PRESENCE_CLEAR:
    116172      case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR:
    117         if ((Flags & FLAG_NO_PPI_CLEAR) != 0) {
     173        if ((Flags.PPFlags & TCG_BIOS_TPM_MANAGEMENT_FLAG_NO_PPI_CLEAR) != 0) {
    118174          RequestConfirmed = TRUE;
    119175        }
     
    121177
    122178      case PHYSICAL_PRESENCE_DEFERRED_PP_UNOWNERED_FIELD_UPGRADE:
    123         if ((Flags & FLAG_NO_PPI_MAINTENANCE) != 0) {
     179        if ((Flags.PPFlags & TCG_BIOS_TPM_MANAGEMENT_FLAG_NO_PPI_MAINTENANCE) != 0) {
    124180          RequestConfirmed = TRUE;
    125181        }
     
    128184      case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR_ENABLE_ACTIVATE:
    129185      case PHYSICAL_PRESENCE_CLEAR_ENABLE_ACTIVATE:
    130         if ((Flags & FLAG_NO_PPI_CLEAR) != 0 && (Flags & FLAG_NO_PPI_PROVISION) != 0) {
     186        if ((Flags.PPFlags & TCG_BIOS_TPM_MANAGEMENT_FLAG_NO_PPI_CLEAR) != 0 && (Flags.PPFlags & TCG_BIOS_TPM_MANAGEMENT_FLAG_NO_PPI_PROVISION) != 0) {
    131187          RequestConfirmed = TRUE;
    132188        }
     
    144200        // This command requires UI to prompt user for Auth data
    145201        //
    146         mTcgNvs->PhysicalPresence.ReturnCode = PP_REQUEST_NOT_IMPLEMENTED;
     202        mTcgNvs->PhysicalPresence.ReturnCode = TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;
    147203        return EFI_SUCCESS;
     204      default:
     205        break;
    148206    }
    149207
    150208    if (RequestConfirmed) {
    151       mTcgNvs->PhysicalPresence.ReturnCode = PP_REQUEST_ALLOWED_AND_PPUSER_NOT_REQUIRED;
     209      mTcgNvs->PhysicalPresence.ReturnCode = TCG_PP_GET_USER_CONFIRMATION_ALLOWED_AND_PPUSER_NOT_REQUIRED;
    152210    } else {
    153       mTcgNvs->PhysicalPresence.ReturnCode = PP_REQUEST_ALLOWED_AND_PPUSER_REQUIRED;
     211      mTcgNvs->PhysicalPresence.ReturnCode = TCG_PP_GET_USER_CONFIRMATION_ALLOWED_AND_PPUSER_REQUIRED;
    154212    }   
     213    if (mTcgNvs->PhysicalPresence.Request >= TCG_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {
     214      mTcgNvs->PhysicalPresence.ReturnCode = TcgPpVendorLibGetUserConfirmationStatusFunction (mTcgNvs->PhysicalPresence.Request, Flags.PPFlags);
     215    }
    155216  }
    156217
     
    161222/**
    162223  Software SMI callback for MemoryClear which is called from ACPI method.
     224
     225  Caution: This function may receive untrusted input.
     226  Variable and ACPINvs are external input, so this function will validate
     227  its data structure to be valid value.
    163228
    164229  @param[in]      DispatchHandle  The unique handle assigned to this handler by SmiHandlerRegister().
     
    198263                             );
    199264    if (EFI_ERROR (Status)) {
     265      mTcgNvs->MemoryClear.ReturnCode = MOR_REQUEST_GENERAL_FAILURE;
     266      DEBUG ((EFI_D_ERROR, "[TPM] Get MOR variable failure! Status = %r\n", Status));
    200267      return EFI_SUCCESS;
    201268    }
     
    217284  if (EFI_ERROR (Status)) {
    218285    mTcgNvs->MemoryClear.ReturnCode = MOR_REQUEST_GENERAL_FAILURE;
     286    DEBUG ((EFI_D_ERROR, "[TPM] Set MOR variable failure! Status = %r\n", Status));
    219287  }
    220288
     
    296364  ASSERT_EFI_ERROR (Status);
    297365
     366
     367  //
     368  // Measure to PCR[0] with event EV_POST_CODE ACPI DATA
     369  //
     370  TpmMeasureAndLogData(
     371    0,
     372    EV_POST_CODE,
     373    EV_POSTCODE_INFO_ACPI_DATA,
     374    ACPI_DATA_LEN,
     375    Table,
     376    TableSize
     377    );
     378
     379
    298380  ASSERT (Table->OemTableId == SIGNATURE_64 ('T', 'c', 'g', 'T', 'a', 'b', 'l', 'e'));
     381  CopyMem (Table->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (Table->OemId) );
    299382  mTcgNvs = AssignOpRegion (Table, SIGNATURE_32 ('T', 'N', 'V', 'S'), (UINT16) sizeof (TCG_NVS));
    300383  ASSERT (mTcgNvs != NULL);
     
    343426  EFI_HANDLE                     SwHandle;
    344427
     428  if (!CompareGuid (PcdGetPtr(PcdTpmInstanceGuid), &gEfiTpmDeviceInstanceTpm12Guid)){
     429    DEBUG ((EFI_D_ERROR, "No TPM12 instance required!\n"));
     430    return EFI_UNSUPPORTED;
     431  }
     432
    345433  Status = PublishAcpiTable ();
    346434  ASSERT_EFI_ERROR (Status);
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgSmm/TcgSmm.h

    r48674 r58459  
    22  The header file for TCG SMM driver.
    33 
    4 Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
     4Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.<BR>
    55This program and the accompanying materials
    66are licensed and made available under the terms and conditions of the BSD License
     
    1818#include <PiDxe.h>
    1919#include <IndustryStandard/Acpi.h>
     20#include <IndustryStandard/UefiTcgPlatform.h>
     21
    2022#include <Guid/PhysicalPresenceData.h>
    2123#include <Guid/MemoryOverwriteControl.h>
     24#include <Guid/TpmInstance.h>
     25
    2226#include <Protocol/SmmSwDispatch2.h>
    2327#include <Protocol/AcpiTable.h>
     
    3135#include <Library/UefiBootServicesTableLib.h>
    3236#include <Library/DxeServicesLib.h>
     37#include <Library/TpmMeasurementLib.h>
     38#include <Library/PcdLib.h>
     39#include <Library/TcgPpVendorLib.h>
    3340
    3441#pragma pack(1)
     
    7885
    7986//
    80 // The return code for Get User Confirmation Status for Operation
     87// The return code for Return TPM Operation Response to OS Environment
    8188//
    82 #define PP_REQUEST_NOT_IMPLEMENTED                                 0
    83 #define PP_REQUEST_BIOS_ONLY                                       1
    84 #define PP_REQUEST_BLOCKED                                         2
    85 #define PP_REQUEST_ALLOWED_AND_PPUSER_REQUIRED                     3
    86 #define PP_REQUEST_ALLOWED_AND_PPUSER_NOT_REQUIRED                 4
    87 
    88 //
    89 // The return code for Sumbit TPM Request to Pre-OS Environment
    90 // and Sumbit TPM Request to Pre-OS Environment 2
    91 //
    92 #define PP_SUBMIT_REQUEST_SUCCESS                                  0
    93 #define PP_SUBMIT_REQUEST_NOT_IMPLEMENTED                          1
    94 #define PP_SUBMIT_REQUEST_GENERAL_FAILURE                          2
    95 #define PP_SUBMIT_REQUEST_BLOCKED_BY_BIOS_SETTINGS                 3
    96 
     89#define PP_RETURN_TPM_OPERATION_RESPONSE_SUCCESS                   0
     90#define PP_RETURN_TPM_OPERATION_RESPONSE_FAILURE                   1
    9791
    9892//
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgSmm/TcgSmm.inf

    r48674 r58459  
    11## @file
    2 #  This driver implements TPM definition block in ACPI table and
    3 #  registers SMI callback functions for physical presence and
    4 #  MemoryClear to handle the requests from ACPI method.
     2#  Implements ACPI metholds for the TCG feature
    53#
    6 # Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
     4#  This driver implements TPM definition block in ACPI table and registers SMI
     5#  callback functions for physical presence and MemoryClear to handle the requests
     6#  from ACPI method.
     7#
     8#  Caution: This module requires additional review when modified.
     9#  This driver will have external input - variable and ACPINvs data in SMM mode.
     10#  This external input must be validated carefully to avoid security issue.
     11#
     12# Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
    713# This program and the accompanying materials
    814# are licensed and made available under the terms and conditions of the BSD License
     
    1723  INF_VERSION                    = 0x00010005
    1824  BASE_NAME                      = TcgSmm
     25  MODULE_UNI_FILE                = TcgSmm.uni
    1926  FILE_GUID                      = 42293093-76B9-4482-8C02-3BEFDEA9B35D
    2027  MODULE_TYPE                    = DXE_SMM_DRIVER
     
    4148  DebugLib
    4249  DxeServicesLib
     50  TpmMeasurementLib
     51  PcdLib
     52  TcgPpVendorLib
    4353
    4454[Guids]
     55  ## SOMETIMES_PRODUCES ## Variable:L"PhysicalPresence"
     56  ## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresence"
     57  ## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresenceFlags"
    4558  gEfiPhysicalPresenceGuid
     59
     60  ## SOMETIMES_PRODUCES ## Variable:L"MemoryOverwriteRequestControl"
     61  ## SOMETIMES_CONSUMES ## Variable:L"MemoryOverwriteRequestControl"
    4662  gEfiMemoryOverwriteControlDataGuid
     63 
     64  gEfiTpmDeviceInstanceTpm12Guid                        ## PRODUCES           ## GUID       # TPM device identifier
    4765
    4866[Protocols]
    49   gEfiSmmSwDispatch2ProtocolGuid                # PROTOCOL ALWAYS_CONSUMED
    50   gEfiSmmVariableProtocolGuid                   # PROTOCOL ALWAYS_CONSUMED
    51   gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED
     67  gEfiSmmSwDispatch2ProtocolGuid                        ## CONSUMES
     68  gEfiSmmVariableProtocolGuid                           ## CONSUMES
     69  gEfiAcpiTableProtocolGuid                             ## CONSUMES
     70
     71[Pcd]
     72  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid      ## CONSUMES
     73  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId    ## SOMETIMES_CONSUMES
    5274
    5375[Depex]
     
    5678  gEfiSmmVariableProtocolGuid AND
    5779  gEfiTcgProtocolGuid
     80 
     81[UserExtensions.TianoCore."ExtraFiles"]
     82  TcgSmmExtra.uni
     83 
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgSmm/Tpm.asl

    r48674 r58459  
    33  and MemoryClear.
    44
    5 Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
     5Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
    66This program and the accompanying materials
    77are licensed and made available under the terms and conditions of the BSD License
     
    1717  "Tpm.aml",
    1818  "SSDT",
    19   1,
    20   "Intel_",
     19  2,
     20  "INTEL ",
    2121  "TcgTable",
    2222  0x1000
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette