+/**\r
+ Get HID string of TPM2 ACPI device object\r
+\r
+ @param[in] HID Points to HID String Buffer.\r
+ @param[in] Size HID String size in bytes. Must >= TPM_HID_ACPI_SIZE\r
+\r
+ @return HID String get status.\r
+\r
+**/\r
+EFI_STATUS\r
+GetTpm2HID(\r
+ CHAR8 *HID,\r
+ UINTN Size\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ UINT32 ManufacturerID;\r
+ UINT32 FirmwareVersion1;\r
+ UINT32 FirmwareVersion2;\r
+ BOOLEAN PnpHID;\r
+\r
+ PnpHID = TRUE;\r
+\r
+ ZeroMem(HID, Size);\r
+\r
+ //\r
+ // Get Manufacturer ID\r
+ //\r
+ Status = Tpm2GetCapabilityManufactureID(&ManufacturerID);\r
+ if (!EFI_ERROR(Status)) {\r
+ DEBUG((DEBUG_INFO, "TPM_PT_MANUFACTURER 0x%08x\n", ManufacturerID));\r
+ //\r
+ // ManufacturerID defined in TCG Vendor ID Registry\r
+ // may tailed with 0x00 or 0x20\r
+ //\r
+ if ((ManufacturerID >> 24) == 0x00 || ((ManufacturerID >> 24) == 0x20)) {\r
+ //\r
+ // HID containing PNP ID "NNN####"\r
+ // NNN is uppercase letter for Vendor ID specified by manufacturer\r
+ //\r
+ CopyMem(HID, &ManufacturerID, 3);\r
+ } else {\r
+ //\r
+ // HID containing ACP ID "NNNN####"\r
+ // NNNN is uppercase letter for Vendor ID specified by manufacturer\r
+ //\r
+ CopyMem(HID, &ManufacturerID, 4);\r
+ PnpHID = FALSE;\r
+ }\r
+ } else {\r
+ DEBUG ((DEBUG_ERROR, "Get TPM_PT_MANUFACTURER failed %x!\n", Status));\r
+ ASSERT(FALSE);\r
+ return Status;\r
+ }\r
+\r
+ Status = Tpm2GetCapabilityFirmwareVersion(&FirmwareVersion1, &FirmwareVersion2);\r
+ if (!EFI_ERROR(Status)) {\r
+ DEBUG((DEBUG_INFO, "TPM_PT_FIRMWARE_VERSION_1 0x%x\n", FirmwareVersion1));\r
+ DEBUG((DEBUG_INFO, "TPM_PT_FIRMWARE_VERSION_2 0x%x\n", FirmwareVersion2));\r
+ //\r
+ // #### is Firmware Version 1\r
+ //\r
+ if (PnpHID) {\r
+ AsciiSPrint(HID + 3, TPM_HID_PNP_SIZE - 3, "%02d%02d", ((FirmwareVersion1 & 0xFFFF0000) >> 16), (FirmwareVersion1 && 0x0000FFFF));\r
+ } else {\r
+ AsciiSPrint(HID + 4, TPM_HID_ACPI_SIZE - 4, "%02d%02d", ((FirmwareVersion1 & 0xFFFF0000) >> 16), (FirmwareVersion1 && 0x0000FFFF));\r
+ }\r
+\r
+ } else {\r
+ DEBUG ((DEBUG_ERROR, "Get TPM_PT_FIRMWARE_VERSION_X failed %x!\n", Status));\r
+ ASSERT(FALSE);\r
+ return Status;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r