# AmiTcgPlatformPeiAfterMem

| Field       | Value                                      |
|-------------|--------------------------------------------|
| Index       | 391                                        |
| Module      | AmiTcgPlatformPeiAfterMem                  |
| Size        | 35,428 bytes (8A64h)                       |
| Phase       | PEI (After Memory)                         |
| SHA256      | 0406da03c52edd2c988b094f6c0c392ae614238175c7448ef81a2ba2ac90dcca |
| Functions   | 78                                         |

## Overview

AmiTcgPlatformPeiAfterMem is a PEI module from AmiModulePkg/TCG2 that provides TCG (Trusted Computing Group) platform initialization after system memory is available. It measures DXE firmware volumes into PCRs, manages TPM startup (TPM12/TPM20), and publishes TPM-related HOBs for later boot phases. This module executes after memory initialization and handles the post-memory TCG boot sequence.

## Key Functions

- **TcgPlatformPeiEntry** -- Main entry dispatch; checks boot mode, installs TCG PPI, performs TPM startup
- **TcgPlatformAfterMemInit** -- Core initialization; enumerates firmware volumes, creates TPM FV HOB structures
- **MeasureLogDxeFwVol** -- Iterates DXE firmware volumes, hashes each, and extends the measurement into a PCR
- **TpmMeasureDigestIntoPCR** -- Sends TPM extend command to record a digest into a specified PCR
- **TpmStartupCommand** -- Sends TPM_Startup command (ST_CLEAR or ST_STATE) to the TPM
- **PeiServicesInstallPpi** -- Installs TCG-related PPI notifiers for downstream PEIMs
- **LocateTcgOrTpmPpi** -- Locates both gTcgPpiGuid and gTpmDevicePpiGuid PPIs
- **BootGuardTcg2MeasureCRTMVersion** -- Measures CRTM version from Boot Guard policy
- **InitHashContext / AllocateAndMeasureFwVol / HashFirmwareVolume** -- SHA-1 hashing utilities

## Dependencies

- PiPei, Uefi base libraries
- TPM device PPI (gTpmDevicePpiGuid)
- TCG PPI (gTcgPpiGuid)
- PCD services (PeiPcdSetSku, PeiGetPcdPtr)
- Debug services (DebugPrintWrapper, AssertReport)
- Boot Guard policy HOB for CRTM measurement
- HOB services for FV ROM area enumeration

## Platform

- **Architecture**: IA-32 (x86)
- **Subsystem**: EFI_BOOT_SERVICE_DRIVER (0x0B)
- **Source**: AmiModulePkg/TCG2/Common/AmiTcgPlatformPei/AmiTcgPlatformPeiAfterMem.c
- **Linker**: MSVS 2015