Newer
Older
AMI-Aptio-BIOS-Reversed / AmiModulePkg / TCG2 / Common / AmiTcgPlatformPei / AmiTcgPlatformPeiBeforeMem / README.md
@Ajax Dong Ajax Dong 2 days ago 2 KB Restructure the repo

AmiTcgPlatformPeiBeforeMem

Field Value
Index 390
Module AmiTcgPlatformPeiBeforeMem
Size 2656 bytes (0xA60)
Phase PEI (pre-memory)
Format PE32
Machine x86 (0x014C)
Sections .text, .rdata, .data, .reloc
Entry Point 0x3A0
Functions 15
Source AmiModulePkg/TCG2/Common/AmiTcgPlatformPei/BeforeMem

Overview

AmiTcgPlatformPeiBeforeMem is an early PEI module that performs TPM platform policy detection and initialization before main memory (DRAM) is available. It checks TPM presence through CMOS register 0x4A, writes the TPM status to a PCD (offset 1024068 from the PCD pointer), installs the TPM detection result PPI, and determines whether a TPM device (SPI TPM 2.0 or LPC TPM 1.2) is present on the platform.

Running entirely from cache-as-RAM, this module ensures that TPM platform policy is established at the earliest possible stage, enabling the chain of trust from the pre-memory PEI environment.

Key Functions

  • ModuleEntryPoint -- Main entry; reads TPM policy PCD, writes CMOS TPM status, installs result PPI.
  • PlatformTcgPolicyInstallOrLocate -- Installs or locates the TPM platform policy PPI for peer consumption.
  • CheckTpmPresenceViaCmos -- Detects TPM presence by reading CMOS register 0x4A and optionally checking MMIO at 0xFDAF0490.
  • WriteCmosTpmStatus -- Writes TPM status value (0x0500) to PCD-derived CMOS address.
  • GetPcdPointer / PeiPcdGetBool -- PCD access for TPM platform policy tokens.
  • LocateReportStatusCodePpi -- Finds the report status code PPI for error logging.
  • GetPeiServicesTablePointer -- Retrieves PEI services via IDT.

Dependencies

  • PCD database (TPM policy tokens)
  • CMOS register 0x4A for TPM state
  • Report Status Code PPI (for debug output)
  • PEI services (PPI install/locate)
  • Pre-memory execution environment (CAR)

Platform

Intel Purley platform, pre-memory PEI phase, AMI TCG2 implementation, 32-bit.