# TcgPlatformSetupPeiPolicy

| Field       | Value                                               |
|-------------|-----------------------------------------------------|
| Index       | 388                                                 |
| Module      | TcgPlatformSetupPeiPolicy                           |
| Size        | 3104 bytes (0xC20)                                  |
| Phase       | PEI                                                 |
| Format      | PE32                                                |
| Machine     | x86 (0x014C)                                        |
| Sections    | .text, .rdata, .data, .reloc                        |
| Entry Point | 0x340                                               |
| Functions   | 13                                                  |
| Source      | AmiModulePkg/TCG2/Common/TcgPlatformSetupPeiPolicy  |

## Overview

TcgPlatformSetupPeiPolicy reads TPM configuration options from the platform setup and writes them into a policy PPI that is consumed by TPM drivers later in PEI and DXE. It handles TPM device selection, interface type, interrupt configuration, ACPI revision reporting, and vendor-specific flag bits.

The module installs a platform policy PPI populated with TPM setup variables (device enable, select, interface type, IRQ polarity, PTP IRQ, clear owner, flags, ACPI revision), ensuring consistent TPM configuration across all phases of boot.

## Key Functions

- **TcgPlatformSetupPolicyEntry** -- Main entry; locates the TPM protocol, reads setup variables, populates the policy data structure, and installs the policy PPI.
- **CompareMem** -- Constant-time memory comparison for data validation.
- **GetDebugOutputInterface** -- Locates the EFI debug output PPI for error reporting.
- **GetTpmState** -- Reads TPM presence state from CMOS register 0x4A.
- **GetPeiServicesTablePointer** -- Retrieves the PEI services pointer via IDT.

## Dependencies

- TPM device protocol
- Platform setup PPI (setup variables)
- PEI services
- Debug output PPI (for ASSERT reporting)
- CMOS register 0x4A for TPM state

## Platform

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