# Tcg2Dxe

## Function Table

| Address | Name | Description |
|---------|------|-------------|
|  | **DebugPrint** |  |
|  | **Tcg2GetSpecVersion** |  |
|  | **MorCheckAndClear** |  |
|  | **TreeSetActivePcrs** |  |
|  | **TreeGetResultOfSetActivePcrs** |  |
|  | **TreeGetEventLog** |  |
|  | **Tpm20DxeAcpiUpdate** |  |
|  | **TpmServFlagsLockCallback** |  |
|  | **CopyTcgLog** |  |
|  | **InstallTrEEProtocol** |  |
|  | **TrEEUpdateTpmDeviceASL** |  |
|  | **LibGetDsdt** |  |
|  | **DriverInit** |  |
|  | **TreeDxeEntry** |  |
|  | **ModuleEntryPoint** |  |
|  | **SecureBootSetupCheck** |  |
| Globals | **(data segment at 0x13740-0x13C60)** |  |
| Protocol | **Interfaces** |  |
| 0x13B18 | **static EFI_RUNTIME_SERVICES   *gRT;            // 0x13B28** |  |
| 0x13B10 | **static EFI_HANDLE              gImageHandle;   // 0x13B20** |  |
| 0x13B48 | **// ACPI table pointers (found via LibGetDsdt)** |  |
| 0x13B58 | **static UINT64                  mXsdtDsdtAddr;  // 0x13B50** |  |
| Event | **log buffers (allocated via BS->AllocatePool)** |  |
| 0x13C00 | **static UINT8                  *mTreeExtraTcpLog;        // 0x13C08** |  |
| 0x13C38 | **// Event log tracking** |  |
| 0x13AD8 | **static UINT8                  mEventLogTruncated;       // 0x13AC0** |  |
| 0x13AE8 | **// TPM capabilities** |  |
| 0x13A90 | **static UINT32                 mSupportedPcrBankBitMap;  // 0x13AAC** |  |
| 0x13AB0 | **static UINT16                 mMaxCapsSize;             // 0x139F8** |  |
| 0x13A10 | **static UINT32                 mTpmPcrCount;             // 0x13980** |  |
| TPM2 | **Protocol & CRB handles** |  |
| 0x13B00 | **static void                  *mTrEEProtocol;            // 0x13AB8** |  |
| 0x13C40 | **static UINT32                 mTpmDeviceFlags;          // 0x13850** |  |
| ACPI | **update state** |  |
| 0x13AC8 | **static void                  *mAcpiProtocol;            // 0x13B58** |  |
| 0x13BF0 | **static void                  *mResetNotification;       // 0x13C30** |  |
| 0x13C28 | **// Internal state** |  |
| 0x13AA8 | **static UINT64                 mImageContextHandle;      // 0x13AE0** |  |
| 0x13B90 | **static UINT32                 mSecureBootSetup;         // 0x19B0** |  |
| 0x19B1 | **static UINT32                 mDefaultProvision;        // 0x19B2** |  |
| Debug | **Print (sub_9C8C)** |  |
| AMD | **platform debug output via IO port 0x70/0x71 (CMOS).** |  |
| Checks | **CMOS index 0x4B bit for debug level.** |  |
| Tcg2GetSpecVersion | **(sub_9B4)** |  |
| Returns | **byte at offset 6 from TPM2 protocol structure.** |  |
| MorCheckAndClear | **(sub_D00)** |  |
| Reads | **MemoryOverwriteRequestControl variable. If MOR bit is set** |  |
| performs | **memory clear and reports.** |  |
| TreeGetCapability | **(sub_1928)** |  |
| Fills | **EFI_TCG2_PROTOCOL capabilities structure.** |  |
| TreeSetActivePcrs | **(sub_1820)** |  |
| Sets | **active PCR banks. Validates against supported banks.** |  |
| Persists | **via AMITCGPPIVAR2 UEFI variable.** |  |
| TreeGetResultOfSetActivePcrs | **(sub_1728)** |  |
| Checks | **result of a prior SetActivePcrs via AMITCGPPIVAR variable.** |  |
| TreeGetEventLog | **(sub_1EEC)** |  |
| Returns | **event log location, last entry pointer, and truncated flag.** |  |
| Checks | **TCG2 spec version and returns appropriate log.** |  |
| TC | **log format** |  |
| SHA1 | **log available** |  |
| Tpm20DxeAcpiUpdate | **(sub_7DA4)** |  |
| Registered | **as a notification callback.** |  |
| Locates | **DSDT, updates TPM device ASL objects.** |  |
| TpmServFlagsLockCallback | **(sub_7B88)** |  |
| Called | **when gEdkiiVariableLockProtocolGuid is available.** |  |
| Locks | **the TpmServFlags variable.** |  |
| CopyTcgLog | **(sub_411C)** |  |
| Copies | **the TCG event log from the PEI HOB into the allocated** |  |
| DXE | **event log buffer.** |  |
| Set | **structure version** |  |
| InstallTrEEProtocol | **(sub_7ED8)** |  |
| Allocates | **event log buffers, installs TCG2 config table** |  |
| and | **registers the TrEE (TCG2) protocol.** |  |
| TrEEUpdateTpmDeviceASL | **(sub_4324)** |  |
| Updates | **ACPI DSDT with TPM device ASL objects** |  |
| LibGetDsdt | **(sub_FEAC)** |  |
| Locate | **DSDT table in ACPI tables.** |  |
| Searches | **RSDT/XSDT to find DSDT address.** |  |
| Search | **through ACPI tables** |  |
| DriverInit | **(sub_420)** |  |
| Standard | **UEFI driver init. Saves image handle, system table** |  |
| boot | **services, runtime services. Calls DxeServicesTableLib init** |  |
| and | **performs delay calibration via PIT.** |  |
| Init | **DxeServicesTable** |  |
| Calibrate | **delay via PIT (8253 timer)** |  |
| Initialize | **DXE services table pointer** |  |
| TreeDxeEntry | **(sub_8238) - Main Driver Entry** |  |
| Return | **EFI_SUCCESS** |  |
| Phase | **1: Locate TPM2 device protocol** |  |
| Phase | **2: Allocate ACPI buffer** |  |
| Phase | **3: Register ACPI update event** |  |
| Phase | **4: Read TpmServFlags via RT->GetVariable** |  |
| Phase | **5: Lock TpmServFlags** |  |
| Register | **callback for when lock protocol appears** |  |
| Phase | **6: Check TPM presence** |  |
| Phase | **7: Install protocols** |  |
| Phase | **8: Update ACPI tables** |  |
| Phase | **9: Set TPM2 device active PCR banks** |  |
| StructureVersion | **TpmDeviceCaps[12] = 0;   // ProtocolSpecVersion** |  |
| SupportedEventLogs | **((VOID (**)(VOID *, UINT8))Tpm2Handle)[32] (TpmDeviceCaps, TRUE);** |  |
| ModuleEntryPoint | **(0x3F4)** |  |
| SecureBootSetupCheck | **(sub_43C)** |  |
| Reads | **SecureBootSetup and SetupMode variables to determine** |  |
| secure | **boot state. Called before main entry during init.** |  |
| End | **of Tcg2Dxe.c** | all functions renamed and documented |
| Address | **range summary:** |  |
| 0x3F4 | **_ModuleEntryPoint** |  |
| 0x420 | **DriverInit (sub_420)** |  |
| 0x43C | **SecureBootSetupCheck (sub_43C)** |  |
| 0x610 | **Tpm2SequenceComplete (SM3 variant)** |  |
| 0x748 | **HashMultiAlg (combines all algorithm hashes)** |  |
| 0xD70 | **Tpm2QueryPcrBanks** |  |
| 0x1100 | **Tpm2AllocatePCR** |  |
| 0x1928 | **TreeGetCapability** |  |
| 0x22FC | **InternalTcg20CommonExtend (TPM2 extend command)** |  |
| 0x2728 | **TpmHashLogExtendEvent** |  |
| 0x3414 | **TreeHashLogExtendEvent** |  |
| 0x4D50 | **TreeProcessDbVariable** |  |
| 0x4F3C | **TreeHashImageExtend** |  |
| 0x5AC0 | **HashAllAlgorithms** |  |
| 0x5C88 | **HashUpdateAll** |  |
| 0x5EDC | **HashBuffer** |  |
| 0x620C | **HashMultiAlgFull** |  |
| 0x711C | **TreeMeasurePeImage** |  |
| 0x7CA0 | **ReadTpmServFlags (with retry)** |  |
| 0x8238 | **TreeDxeEntry (main driver entry)** |  |
| 0x91EC | **CopyDigestToOutput** |  |
| 0x92D0 | **WalkNextEventLogEntry** |  |
| 0x9504 | **GetLastEventLogEntry** |  |
| 0x9564 | **(walk helper for event log)** |  |
| 0x9750 | **Tpm2InitCommand** |  |
| 0x983C | **Tpm2SequenceUpdate** |  |
| 0x9A00 | **Tpm2SequenceComplete** |  |
| 0x9C8C | **DebugPrint (CMOS debug output)** |  |
| 0x9D14 | **DebugAssert** |  |
| 0x9D54 | **DebugEnabled (stub returning 1)** |  |
| 0x9D58 | **DebugLevelCheck (stub returning a1 != 0)** |  |
| 0x9D60 | **CopyMem** |  |
| 0xA3C | **Tpm2IsCrbPresent** |  |
| 0xA9DC | **Sha256BlockProcess (SHA256 transform)** |  |
| 0xBC6C | **Sha1Finalize** |  |
| 0xBD94 | **Sha1BlockProcess (SHA1 transform)** |  |
| 0xE384 | **Sha256Update** |  |
| 0xE454 | **Sha256Finalize** |  |
| 0xE5DC | **Sha384Init** |  |
| 0xE660 | **Sha512Finalize** |  |
| 0xE6A8 | **Sha512BlockProcess (SHA512 transform)** |  |
| 0xEC80 | **Sha512Update** |  |
| 0xED58 | **Sha512FinalCustom** |  |
| 0xEE80 | **Tpm2CopySwap (byte-swap copy)** |  |
| 0x101A4 | **AcpiUpdateAmlTable** |  |
| 0x10750 | **GetImageContext (PE/COFF header parsing)** |  |
| 0x10ADC | **EventLogTimer** |  |
| 0x10B10 | **EventLogTimerWithData** |  |
| 0x10BF0 | **GetPpiServices** |  |

---
*Generated by HR650X BIOS Decompilation Project*