本文整理汇总了C++中EFI_ACPI_TABLE_PROTOCOL::InstallAcpiTable方法的典型用法代码示例。如果您正苦于以下问题:C++ EFI_ACPI_TABLE_PROTOCOL::InstallAcpiTable方法的具体用法?C++ EFI_ACPI_TABLE_PROTOCOL::InstallAcpiTable怎么用?C++ EFI_ACPI_TABLE_PROTOCOL::InstallAcpiTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EFI_ACPI_TABLE_PROTOCOL
的用法示例。
在下文中一共展示了EFI_ACPI_TABLE_PROTOCOL::InstallAcpiTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
/**
Install TCG ACPI Table when ACPI Table Protocol is available.
A system's firmware uses an ACPI table to identify the system's TCG capabilities
to the Post-Boot environment. The information in this ACPI table is not guaranteed
to be valid until the Host Platform transitions from pre-boot state to post-boot state.
@param[in] Event Event whose notification function is being invoked
@param[in] Context Pointer to the notification function's context
**/
VOID
EFIAPI
InstallAcpiTable (
IN EFI_EVENT Event,
IN VOID* Context
)
{
UINTN TableKey;
EFI_STATUS Status;
EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
UINT8 Checksum;
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTable);
if (EFI_ERROR (Status)) {
return;
}
if (PcdGet8 (PcdTpmPlatformClass) == TCG_PLATFORM_TYPE_CLIENT) {
//
// The ACPI table must be checksumed before calling the InstallAcpiTable()
// service of the ACPI table protocol to install it.
//
Checksum = CalculateCheckSum8 ((UINT8 *)&mTcgClientAcpiTemplate, sizeof (mTcgClientAcpiTemplate));
mTcgClientAcpiTemplate.Header.Checksum = Checksum;
Status = AcpiTable->InstallAcpiTable (
AcpiTable,
&mTcgClientAcpiTemplate,
sizeof (mTcgClientAcpiTemplate),
&TableKey
);
} else {
//
// The ACPI table must be checksumed before calling the InstallAcpiTable()
// service of the ACPI table protocol to install it.
//
Checksum = CalculateCheckSum8 ((UINT8 *)&mTcgServerAcpiTemplate, sizeof (mTcgServerAcpiTemplate));
mTcgServerAcpiTemplate.Header.Checksum = Checksum;
Status = AcpiTable->InstallAcpiTable (
AcpiTable,
&mTcgServerAcpiTemplate,
sizeof (mTcgServerAcpiTemplate),
&TableKey
);
}
ASSERT_EFI_ERROR (Status);
}
示例2: GetSectionFromFv
/**
Initialize and publish TPM items in ACPI table.
@retval EFI_SUCCESS The TCG ACPI table is published successfully.
@retval Others The TCG ACPI table is not published.
**/
EFI_STATUS
PublishAcpiTable (
VOID
)
{
EFI_STATUS Status;
EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
UINTN TableKey;
EFI_ACPI_DESCRIPTION_HEADER *Table;
UINTN TableSize;
Status = GetSectionFromFv (
&gEfiCallerIdGuid,
EFI_SECTION_RAW,
0,
(VOID **) &Table,
&TableSize
);
ASSERT_EFI_ERROR (Status);
//
// Measure to PCR[0] with event EV_POST_CODE ACPI DATA
//
TpmMeasureAndLogData(
0,
EV_POST_CODE,
EV_POSTCODE_INFO_ACPI_DATA,
ACPI_DATA_LEN,
Table,
TableSize
);
ASSERT (Table->OemTableId == SIGNATURE_64 ('T', 'p', 'm', '2', 'T', 'a', 'b', 'l'));
CopyMem (Table->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (Table->OemId) );
mTcgNvs = AssignOpRegion (Table, SIGNATURE_32 ('T', 'N', 'V', 'S'), (UINT16) sizeof (TCG_NVS));
ASSERT (mTcgNvs != NULL);
//
// Publish the TPM ACPI table
//
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);
ASSERT_EFI_ERROR (Status);
TableKey = 0;
Status = AcpiTable->InstallAcpiTable (
AcpiTable,
Table,
TableSize,
&TableKey
);
ASSERT_EFI_ERROR (Status);
return Status;
}
示例3: TpmMeasureAndLogData
/**
Publish TPM2 ACPI table
@retval EFI_SUCCESS The TPM2 ACPI table is published successfully.
@retval Others The TPM2 ACPI table is not published.
**/
EFI_STATUS
PublishTpm2 (
VOID
)
{
EFI_STATUS Status;
EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
UINTN TableKey;
UINT64 OemTableId;
//
// Measure to PCR[0] with event EV_POST_CODE ACPI DATA
//
TpmMeasureAndLogData(
0,
EV_POST_CODE,
EV_POSTCODE_INFO_ACPI_DATA,
ACPI_DATA_LEN,
&mTpm2AcpiTemplate,
sizeof(mTpm2AcpiTemplate)
);
CopyMem (mTpm2AcpiTemplate.Header.OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (mTpm2AcpiTemplate.Header.OemId));
OemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
CopyMem (&mTpm2AcpiTemplate.Header.OemTableId, &OemTableId, sizeof (UINT64));
mTpm2AcpiTemplate.Header.OemRevision = PcdGet32 (PcdAcpiDefaultOemRevision);
mTpm2AcpiTemplate.Header.CreatorId = PcdGet32 (PcdAcpiDefaultCreatorId);
mTpm2AcpiTemplate.Header.CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision);
//
// Construct ACPI table
//
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);
ASSERT_EFI_ERROR (Status);
Status = AcpiTable->InstallAcpiTable (
AcpiTable,
&mTpm2AcpiTemplate,
sizeof(mTpm2AcpiTemplate),
&TableKey
);
ASSERT_EFI_ERROR (Status);
return Status;
}
示例4: GetSectionFromFv
/**
Initialize and publish TPM items in ACPI table.
@retval EFI_SUCCESS The TCG ACPI table is published successfully.
@retval Others The TCG ACPI table is not published.
**/
EFI_STATUS
PublishAcpiTable (
VOID
)
{
EFI_STATUS Status;
EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
UINTN TableKey;
EFI_ACPI_DESCRIPTION_HEADER *Table;
UINTN TableSize;
Status = GetSectionFromFv (
&gEfiCallerIdGuid,
EFI_SECTION_RAW,
0,
(VOID **) &Table,
&TableSize
);
ASSERT_EFI_ERROR (Status);
ASSERT (Table->OemTableId == SIGNATURE_64 ('T', 'c', 'g', 'T', 'a', 'b', 'l', 'e'));
mTcgNvs = AssignOpRegion (Table, SIGNATURE_32 ('T', 'N', 'V', 'S'), (UINT16) sizeof (TCG_NVS));
ASSERT (mTcgNvs != NULL);
//
// Publish the TPM ACPI table
//
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);
ASSERT_EFI_ERROR (Status);
TableKey = 0;
Status = AcpiTable->InstallAcpiTable (
AcpiTable,
Table,
TableSize,
&TableKey
);
ASSERT_EFI_ERROR (Status);
return Status;
}
示例5: DEBUG
STATIC
VOID
EFIAPI
InstallAcpiTable (
IN EFI_EVENT Event,
IN VOID* Context
)
{
UINTN TableKey;
EFI_STATUS Status;
EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL,
(VOID **)&AcpiTable);
if (EFI_ERROR (Status)) {
return;
}
Status = AcpiTable->InstallAcpiTable (AcpiTable, mSsdt, mSsdtSize, &TableKey);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "%a: failed to install SSDT table for eMMC - %r\n",
__FUNCTION__, Status));
}
}
示例6: CompareGuid
/**
Publish and remove the iSCSI Boot Firmware Table according to the iSCSI
session status.
**/
VOID
IScsiPublishIbft (
VOID
)
{
EFI_STATUS Status;
EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol;
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_HEADER *Table;
UINTN HandleCount;
EFI_HANDLE *HandleBuffer;
UINT8 *Heap;
UINT8 Checksum;
UINTN Index;
EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp;
EFI_ACPI_DESCRIPTION_HEADER *Rsdt;
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTableProtocol);
if (EFI_ERROR (Status)) {
return ;
}
//
// Find ACPI table RSD_PTR from system table
//
for (Index = 0, Rsdp = NULL; Index < gST->NumberOfTableEntries; Index++) {
if (CompareGuid (&(gST->ConfigurationTable[Index].VendorGuid), &gEfiAcpi20TableGuid) ||
CompareGuid (&(gST->ConfigurationTable[Index].VendorGuid), &gEfiAcpi10TableGuid) ||
CompareGuid (&(gST->ConfigurationTable[Index].VendorGuid), &gEfiAcpiTableGuid)
) {
//
// A match was found.
//
Rsdp = (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *) gST->ConfigurationTable[Index].VendorTable;
break;
}
}
if (Rsdp == NULL) {
return ;
} else {
Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->RsdtAddress;
}
if (mIbftInstalled) {
Status = AcpiTableProtocol->UninstallAcpiTable (
AcpiTableProtocol,
mTableKey
);
if (EFI_ERROR (Status)) {
return ;
}
mIbftInstalled = FALSE;
}
//
// Get all iSCSI private protocols.
//
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiCallerIdGuid,
NULL,
&HandleCount,
&HandleBuffer
);
if (EFI_ERROR (Status)) {
return ;
}
//
// Allocate 4k bytes to hold the ACPI table.
//
Table = AllocateZeroPool (IBFT_MAX_SIZE);
if (Table == NULL) {
return ;
}
Heap = (UINT8 *) Table + IBFT_HEAP_OFFSET;
//
// Fill in the various section of the iSCSI Boot Firmware Table.
//
IScsiInitIbfTableHeader (Table, Rsdt->OemId, &Rsdt->OemTableId);
IScsiInitControlSection (Table, HandleCount);
IScsiFillInitiatorSection (Table, &Heap, HandleBuffer[0]);
IScsiFillNICAndTargetSections (Table, &Heap, HandleCount, HandleBuffer);
Checksum = CalculateCheckSum8((UINT8 *)Table, Table->Length);
Table->Checksum = Checksum;
FreePool (HandleBuffer);
//
// Install or update the iBFT table.
//
Status = AcpiTableProtocol->InstallAcpiTable (
//.........这里部分代码省略.........
示例7: ASSERT
//.........这里部分代码省略.........
mGlobalNvsArea.Area->IoApicSize = (UINT32)PcdGet64(PcdIoApicSize);
mGlobalNvsArea.Area->TpmPresent = (UINT32)(FALSE);
//
// Find the AcpiTable protocol
//
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID**)&AcpiTable);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
//
// Initialize MADT table
//
Status = MadtTableInitialize (&CurrentTable, &Size);
ASSERT_EFI_ERROR (Status);
//
// Perform any table specific updates.
//
AcpiUpdateTable ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable, &Version);
//
// Update the check sum
// It needs to be zeroed before the checksum calculation
//
((EFI_ACPI_SDT_HEADER *)CurrentTable)->Checksum = 0;
((EFI_ACPI_SDT_HEADER *)CurrentTable)->Checksum =
CalculateCheckSum8 ((VOID *)CurrentTable, CurrentTable->Length);
//
// Add the table
//
TableHandle = 0;
Status = AcpiTable->InstallAcpiTable (
AcpiTable,
CurrentTable,
CurrentTable->Length,
&TableHandle
);
ASSERT_EFI_ERROR (Status);
CurrentTable = NULL;
//
// Init Pci Device PRT PRW information structure from PCD
//
mConfigData = (PCI_DEVICE_SETTING *)AllocateZeroPool (sizeof (PCI_DEVICE_SETTING));
ASSERT_EFI_ERROR (mConfigData);
InitPciDeviceInfoStructure (mConfigData);
//
// Get the Acpi SDT protocol for manipulation on acpi table
//
Status = gBS->LocateProtocol (&gEfiAcpiSdtProtocolGuid, NULL, (VOID **)&mAcpiSdt);
ASSERT_EFI_ERROR (Status);
//
// Locate the firmware volume protocol
//
Status = LocateSupportProtocol (&gEfiFirmwareVolume2ProtocolGuid, (VOID**)&FwVol, 1);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
//
// Read tables from the storage file.
//
while (Status == EFI_SUCCESS) {
示例8: EfiGetSystemConfigurationTable
//.........这里部分代码省略.........
EFI_ACPI_DESCRIPTION_HEADER *Rsdt;
EFI_ACPI_DESCRIPTION_HEADER *Xsdt;
Rsdt = NULL;
Xsdt = NULL;
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTableProtocol);
if (EFI_ERROR (Status)) {
return ;
}
//
// Find ACPI table RSD_PTR from system table
//
Status = EfiGetSystemConfigurationTable (&gEfiAcpiTableGuid, (VOID **) &Rsdp);
if (EFI_ERROR (Status)) {
Status = EfiGetSystemConfigurationTable (&gEfiAcpi10TableGuid, (VOID **) &Rsdp);
}
if (EFI_ERROR (Status) || (Rsdp == NULL)) {
return ;
} else if (Rsdp->Revision >= EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION && Rsdp->XsdtAddress != 0) {
Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->XsdtAddress;
} else if (Rsdp->RsdtAddress != 0) {
Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->RsdtAddress;
}
if ((Xsdt == NULL) && (Rsdt == NULL)) {
return ;
}
if (mIbftInstalled) {
Status = AcpiTableProtocol->UninstallAcpiTable (
AcpiTableProtocol,
mTableKey
);
if (EFI_ERROR (Status)) {
return ;
}
mIbftInstalled = FALSE;
}
//
// Get all iSCSI private protocols.
//
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiCallerIdGuid,
NULL,
&HandleCount,
&HandleBuffer
);
if (EFI_ERROR (Status)) {
return ;
}
//
// Allocate 4k bytes to hold the ACPI table.
//
Table = AllocateZeroPool (IBFT_MAX_SIZE);
if (Table == NULL) {
return ;
}
Heap = (UINT8 *) Table + IBFT_HEAP_OFFSET;
//
// Fill in the various section of the iSCSI Boot Firmware Table.
//
if (Rsdp->Revision >= EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION) {
IScsiInitIbfTableHeader (Table, Xsdt->OemId, &Xsdt->OemTableId);
} else {
IScsiInitIbfTableHeader (Table, Rsdt->OemId, &Rsdt->OemTableId);
}
IScsiInitControlSection (Table, HandleCount);
IScsiFillInitiatorSection (Table, &Heap, HandleBuffer[0]);
IScsiFillNICAndTargetSections (Table, &Heap, HandleCount, HandleBuffer);
Checksum = CalculateCheckSum8((UINT8 *)Table, Table->Length);
Table->Checksum = Checksum;
FreePool (HandleBuffer);
//
// Install or update the iBFT table.
//
Status = AcpiTableProtocol->InstallAcpiTable (
AcpiTableProtocol,
Table,
Table->Length,
&mTableKey
);
if (EFI_ERROR(Status)) {
return;
}
mIbftInstalled = TRUE;
FreePool (Table);
}
示例9: LocateSupportProtocol
EFI_STATUS
PublishAcpiTablesFromFv (
VOID
)
{
EFI_STATUS Status;
EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol;
EFI_ACPI_COMMON_HEADER *CurrentTable;
UINT32 FvStatus;
UINTN Size;
EFI_ACPI_TABLE_VERSION Version;
UINTN TableHandle;
INTN Instance;
EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
Instance = 0;
TableHandle = 0;
CurrentTable = NULL;
FwVol = NULL;
//
// Find the AcpiTable protocol
//
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID**)&AcpiTable);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
//
// Locate the firmware volume protocol
//
Status = LocateSupportProtocol (&gEfiFirmwareVolume2ProtocolGuid, (VOID**)&FwVol, 1);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
//
// Read tables from the storage file.
//
while (Status == EFI_SUCCESS) {
Status = FwVol->ReadSection (
FwVol,
&gEfiCallerIdGuid,
EFI_SECTION_RAW,
Instance,
(VOID**)&CurrentTable,
&Size,
&FvStatus
);
if (!EFI_ERROR(Status)) {
//
// Perform any table specific updates.
//
AcpiUpdateTable ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable, &Version);
//
// Add the table
//
TableHandle = 0;
Status = AcpiTable->InstallAcpiTable (
AcpiTable,
CurrentTable,
((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Length,
&TableHandle
);
if (EFI_ERROR(Status)) {
return EFI_ABORTED;
}
//
// Increment the instance
//
Instance++;
CurrentTable = NULL;
}
}
//
// Finished
//
return EFI_SUCCESS;
}
示例10: LocateFvInstanceWithTables
/**
Entrypoint of Acpi Platform driver.
@param ImageHandle
@param SystemTable
@return EFI_SUCCESS
@return EFI_LOAD_ERROR
@return EFI_OUT_OF_RESOURCES
**/
EFI_STATUS
EFIAPI
AcpiPlatformEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol;
INTN Instance;
EFI_ACPI_COMMON_HEADER *CurrentTable;
UINTN TableHandle;
UINT32 FvStatus;
UINTN TableSize;
UINTN Size;
Instance = 0;
CurrentTable = NULL;
TableHandle = 0;
//
// Find the AcpiTable protocol
//
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID**)&AcpiTable);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
//
// Locate the firmware volume protocol
//
Status = LocateFvInstanceWithTables (&FwVol);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
//
// Read tables from the storage file.
//
while (Status == EFI_SUCCESS) {
Status = FwVol->ReadSection (
FwVol,
(EFI_GUID*)PcdGetPtr (PcdAcpiTableStorageFile),
EFI_SECTION_RAW,
Instance,
(VOID**) &CurrentTable,
&Size,
&FvStatus
);
if (!EFI_ERROR(Status)) {
//
// Add the table
//
TableHandle = 0;
TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Length;
ASSERT (Size >= TableSize);
//
// Checksum ACPI table
//
AcpiPlatformChecksum ((UINT8*)CurrentTable, TableSize);
//
// Install ACPI table
//
Status = AcpiTable->InstallAcpiTable (
AcpiTable,
CurrentTable,
TableSize,
&TableHandle
);
//
// Free memory allocated by ReadSection
//
gBS->FreePool (CurrentTable);
if (EFI_ERROR(Status)) {
return EFI_ABORTED;
}
//
// Increment the instance
//
Instance++;
CurrentTable = NULL;
}
//.........这里部分代码省略.........
示例11: Table
//.........这里部分代码省略.........
FreePool (SmmCommData->BootRecordData);
}
if (SmmBootRecordCommBuffer != NULL) {
FreePool (SmmBootRecordCommBuffer);
}
if (mAcpiS3PerformanceTable != NULL) {
FreePages (mAcpiS3PerformanceTable, EFI_SIZE_TO_PAGES (sizeof (S3_PERFORMANCE_TABLE)));
}
return EFI_OUT_OF_RESOURCES;
}
//
// Prepare Boot Performance Table.
//
BootPerformanceData = (UINT8 *) mAcpiBootPerformanceTable;
//
// Fill Basic Boot record to Boot Performance Table.
//
CopyMem (mAcpiBootPerformanceTable, &mBootPerformanceTableTemplate, sizeof (mBootPerformanceTableTemplate));
BootPerformanceData = BootPerformanceData + mAcpiBootPerformanceTable->Header.Length;
//
// Fill Boot records from boot drivers.
//
CopyMem (BootPerformanceData, mBootRecordBuffer, mBootRecordSize);
mAcpiBootPerformanceTable->Header.Length += mBootRecordSize;
BootPerformanceData = BootPerformanceData + mBootRecordSize;
if (SmmCommData != NULL && SmmCommData->BootRecordData != NULL) {
//
// Fill Boot records from SMM drivers.
//
CopyMem (BootPerformanceData, SmmCommData->BootRecordData, SmmCommData->BootRecordSize);
FreePool (SmmCommData->BootRecordData);
mAcpiBootPerformanceTable->Header.Length = (UINT32) (mAcpiBootPerformanceTable->Header.Length + SmmCommData->BootRecordSize);
BootPerformanceData = BootPerformanceData + SmmCommData->BootRecordSize;
}
if (SmmBootRecordCommBuffer != NULL) {
FreePool (SmmBootRecordCommBuffer);
}
//
// Save Boot Performance Table address to Variable for use in S4 resume.
//
PerformanceVariable.BootPerformanceTablePointer = (EFI_PHYSICAL_ADDRESS) (UINTN) mAcpiBootPerformanceTable;
//
// Update Boot Performance Table Pointer in template.
//
mFirmwarePerformanceTableTemplate.BootPointerRecord.BootPerformanceTablePointer = (UINT64) (UINTN) mAcpiBootPerformanceTable;
//
// Save S3 Performance Table address to Variable for use in S4 resume.
//
PerformanceVariable.S3PerformanceTablePointer = (EFI_PHYSICAL_ADDRESS) (UINTN) mAcpiS3PerformanceTable;
//
// Update S3 Performance Table Pointer in template.
//
mFirmwarePerformanceTableTemplate.S3PointerRecord.S3PerformanceTablePointer = (UINT64) (UINTN) mAcpiS3PerformanceTable;
//
// Save Runtime Performance Table pointers to Variable.
//
Status = gRT->SetVariable (
EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
&gEfiFirmwarePerformanceGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
sizeof (PerformanceVariable),
&PerformanceVariable
);
ASSERT_EFI_ERROR (Status);
//
// Publish Firmware Performance Data Table.
//
FpdtAcpiTableChecksum ((UINT8 *) &mFirmwarePerformanceTableTemplate, mFirmwarePerformanceTableTemplate.Header.Length);
Status = AcpiTableProtocol->InstallAcpiTable (
AcpiTableProtocol,
&mFirmwarePerformanceTableTemplate,
mFirmwarePerformanceTableTemplate.Header.Length,
&mFirmwarePerformanceTableTemplateKey
);
if (EFI_ERROR (Status)) {
FreePages (mAcpiBootPerformanceTable, EFI_SIZE_TO_PAGES (BootPerformanceDataSize));
if (mAcpiS3PerformanceTable != NULL) {
FreePages (mAcpiS3PerformanceTable, EFI_SIZE_TO_PAGES (sizeof (S3_PERFORMANCE_TABLE)));
}
mAcpiBootPerformanceTable = NULL;
mAcpiS3PerformanceTable = NULL;
return Status;
}
//
// Free temp Boot record, and update Boot Record to point to Basic Boot performance table.
//
if (mBootRecordBuffer != NULL) {
FreePool (mBootRecordBuffer);
}
mBootRecordBuffer = (UINT8 *) mAcpiBootPerformanceTable;
mBootRecordSize = mAcpiBootPerformanceTable->Header.Length;
mBootRecordMaxSize = mBootRecordSize + PcdGet32 (PcdExtFpdtBootRecordPadSize);
return EFI_SUCCESS;
}
示例12: FillSysTablesInfo
//.........这里部分代码省略.........
Instance = 0;
CurrentTable = NULL;
TableHandle = 0;
//
// Find the AcpiTable protocol
//
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID**)&AcpiTable);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
#ifdef VBOX
//
// VBOX already has tables prepared in memory - just reuse them.
//
FillSysTablesInfo(VBoxTables, sizeof(VBoxTables)/sizeof(VBoxTables[0]));
#else
//
//
// Locate the firmware volume protocol
//
Status = LocateFvInstanceWithTables (&FwVol);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
#endif
//
// Read tables from the storage file.
//
while (Status == EFI_SUCCESS) {
#ifdef VBOX
CurrentTable = (EFI_ACPI_COMMON_HEADER *)VBoxTables[Instance];
Status = (CurrentTable == NULL) ? EFI_NOT_FOUND : EFI_SUCCESS;
if (CurrentTable) {
Size = CurrentTable->Length;
DEBUG((EFI_D_ERROR, "adding %p %d\n", CurrentTable, Size));
} else
Size = 0; // Just to shut up the compiler.
#else
Status = FwVol->ReadSection (
FwVol,
(EFI_GUID*)PcdGetPtr (PcdAcpiTableStorageFile),
EFI_SECTION_RAW,
Instance,
(VOID**) &CurrentTable,
&Size,
&FvStatus
);
#endif
if (!EFI_ERROR(Status)) {
//
// Add the table
//
TableHandle = 0;
TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Length;
#ifdef VBOX
DEBUG((DEBUG_INFO, "Size:%d, TableSize:%d\n", Size, TableSize));
#endif
ASSERT (Size >= TableSize);
//
// Checksum ACPI table
//
AcpiPlatformChecksum ((UINT8*)CurrentTable, TableSize);
//
// Install ACPI table
//
Status = AcpiTable->InstallAcpiTable (
AcpiTable,
CurrentTable,
TableSize,
&TableHandle
);
#ifndef VBOX /* In case we're reading ACPI tables from memory we haven't
allocated this memory, so it isn't required to free it */
//
// Free memory allocated by ReadSection
//
gBS->FreePool (CurrentTable);
if (EFI_ERROR(Status)) {
return EFI_ABORTED;
}
#endif
//
// Increment the instance
//
Instance++;
CurrentTable = NULL;
}
}
return EFI_SUCCESS;
}
示例13: while
//.........这里部分代码省略.........
//
// See if it has the ACPI storage file
//
Size = 0;
FvStatus = 0;
Status = FwVol->ReadFile (
FwVol,
&gAmdFchAcpiGuid,
NULL,
&Size,
&FileType,
&Attributes,
&FvStatus
);
//
// If we found it, then we are done
//
if (Status == EFI_SUCCESS) {
break;
}
}
//
// Read tables from the storage file.
//
Instance = 0;
CurrentTable = NULL;
while (Status == EFI_SUCCESS) {
Status = FwVol->ReadSection (
FwVol,
&gAmdFchAcpiGuid,
EFI_SECTION_RAW,
Instance,
&CurrentTable,
&Size,
&FvStatus
);
if (!EFI_ERROR (Status)) {
//
// Check the table ID to modify the table
//
if (((EFI_ACPI_DESCRIPTION_HEADER*) CurrentTable)->OemTableId == EFI_SIGNATURE_64 ('F', 'C', 'H', 'A', 'C', 'P', 'I', 0)) {
FchAcpiBlockPtr = (EFI_ACPI_DESCRIPTION_HEADER*) CurrentTable;
Status = FchUpdateAcpiDataTable (FchAcpiProtocol, &FchAcpiBlockPtr);
TableHandle = 0;
TableSize = FchAcpiBlockPtr->Length;
//
// Install ACPI table
//
Status = AcpiTableProtocol->InstallAcpiTable (
AcpiTableProtocol,
FchAcpiBlockPtr,
TableSize,
&TableHandle
);
//
// Free memory allocated by ReadSection
//
gBS->FreePool (FchAcpiBlockPtr);
if (EFI_ERROR (Status)) {
return;
}
}
//
// Increment the instance
//
Instance++;
CurrentTable = NULL;
}
}
//
// Our exit status is determined by the success of the previous operations
// If the protocol was found, Instance already points to it.
//
//
// Free any allocated buffers
//
gBS->FreePool (HandleBuffer);
Handle = NULL;
Status = gBS->InstallProtocolInterface (
&Handle,
&gFchAcpiTableInstallGuid,
EFI_NATIVE_INTERFACE,
NULL
);
if (EFI_ERROR (Status)) {
return;
}
}
示例14: TpmMeasureAndLogData
/**
Publish TPM2 ACPI table
@retval EFI_SUCCESS The TPM2 ACPI table is published successfully.
@retval Others The TPM2 ACPI table is not published.
**/
EFI_STATUS
PublishTpm2 (
VOID
)
{
EFI_STATUS Status;
EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
UINTN TableKey;
UINT64 OemTableId;
EFI_TPM2_ACPI_CONTROL_AREA *ControlArea;
PTP_INTERFACE_TYPE InterfaceType;
//
// Measure to PCR[0] with event EV_POST_CODE ACPI DATA
//
TpmMeasureAndLogData(
0,
EV_POST_CODE,
EV_POSTCODE_INFO_ACPI_DATA,
ACPI_DATA_LEN,
&mTpm2AcpiTemplate,
sizeof(mTpm2AcpiTemplate)
);
InterfaceType = GetPtpInterface ((VOID *) (UINTN) PcdGet64 (PcdTpmBaseAddress));
switch (InterfaceType) {
case PtpInterfaceCrb:
mTpm2AcpiTemplate.StartMethod = EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_INTERFACE;
mTpm2AcpiTemplate.AddressOfControlArea = PcdGet64 (PcdTpmBaseAddress) + 0x40;
ControlArea = (EFI_TPM2_ACPI_CONTROL_AREA *)(UINTN)mTpm2AcpiTemplate.AddressOfControlArea;
ControlArea->CommandSize = 0xF80;
ControlArea->ResponseSize = 0xF80;
ControlArea->Command = PcdGet64 (PcdTpmBaseAddress) + 0x80;
ControlArea->Response = PcdGet64 (PcdTpmBaseAddress) + 0x80;
break;
case PtpInterfaceFifo:
case PtpInterfaceTis:
break;
default:
DEBUG((EFI_D_ERROR, "TPM2 InterfaceType get error! %d\n", InterfaceType));
break;
}
CopyMem (mTpm2AcpiTemplate.Header.OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (mTpm2AcpiTemplate.Header.OemId));
OemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
CopyMem (&mTpm2AcpiTemplate.Header.OemTableId, &OemTableId, sizeof (UINT64));
mTpm2AcpiTemplate.Header.OemRevision = PcdGet32 (PcdAcpiDefaultOemRevision);
mTpm2AcpiTemplate.Header.CreatorId = PcdGet32 (PcdAcpiDefaultCreatorId);
mTpm2AcpiTemplate.Header.CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision);
//
// Construct ACPI table
//
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);
ASSERT_EFI_ERROR (Status);
Status = AcpiTable->InstallAcpiTable (
AcpiTable,
&mTpm2AcpiTemplate,
sizeof(mTpm2AcpiTemplate),
&TableKey
);
ASSERT_EFI_ERROR (Status);
return Status;
}
示例15: while
//.........这里部分代码省略.........
}
//
// Read tables from the storage file.
//
Instance = 0;
CurrentTable = NULL;
while (Status == EFI_SUCCESS) {
Status = FwVol->ReadSection (
FwVol,
&gAmdFchD3ColdAcpiGuid,
EFI_SECTION_RAW,
Instance,
&CurrentTable,
&Size,
&FvStatus
);
if (!EFI_ERROR (Status)) {
//
// Check the table ID to modify the table
//
if (((EFI_ACPI_DESCRIPTION_HEADER*) CurrentTable)->OemTableId == EFI_SIGNATURE_64 ('F', 'C', 'H', 'C', 'S', 'D', '3', 0)) {
FchD3ColdAcpiBlockPtr = (EFI_ACPI_DESCRIPTION_HEADER*) CurrentTable;
Status = FchD3ColdUpdateAcpiTable (FchAcpiProtocol, &FchD3ColdAcpiBlockPtr);
TableHandle = 0;
TableSize = FchD3ColdAcpiBlockPtr->Length;
//
// Install ACPI table
//
Status = AcpiTableProtocol->InstallAcpiTable (
AcpiTableProtocol,
FchD3ColdAcpiBlockPtr,
TableSize,
&TableHandle
);
//
// Free memory allocated by ReadSection
//
gBS->FreePool (CurrentTable);
if (EFI_ERROR (Status)) {
return;
}
}
//
// Increment the instance
//
Instance++;
CurrentTable = NULL;
}
}
//
// Our exit status is determined by the success of the previous operations
// If the protocol was found, Instance already points to it.
//
//
// Free any allocated buffers
//
gBS->FreePool (HandleBuffer);