Enhance ACPI FPDT DXE and SMM driver to accept the extension boot records.
Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Eric Jin <eric.jin@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13292 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
ACPI Firmware Performance Data Table (FPDT) implementation specific definitions.
|
ACPI Firmware Performance Data Table (FPDT) implementation specific definitions.
|
||||||
|
|
||||||
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -35,6 +35,14 @@
|
|||||||
/// GUID - gEfiFirmwarePerformanceGuid
|
/// GUID - gEfiFirmwarePerformanceGuid
|
||||||
/// Data - FIRMWARE_SEC_PERFORMANCE (defined in <Ppi/SecPerformance.h>)
|
/// Data - FIRMWARE_SEC_PERFORMANCE (defined in <Ppi/SecPerformance.h>)
|
||||||
///
|
///
|
||||||
|
/// SMI:
|
||||||
|
/// GUID - gEfiFirmwarePerformanceGuid
|
||||||
|
/// Data - SMM_BOOT_RECORD_COMMUNICATE
|
||||||
|
///
|
||||||
|
/// StatusCodeData:
|
||||||
|
/// Type - gEfiFirmwarePerformanceGuid
|
||||||
|
/// Data - One or more boot record
|
||||||
|
///
|
||||||
#define EFI_FIRMWARE_PERFORMANCE_GUID \
|
#define EFI_FIRMWARE_PERFORMANCE_GUID \
|
||||||
{ \
|
{ \
|
||||||
0xc095791a, 0x3001, 0x47b2, {0x80, 0xc9, 0xea, 0xc7, 0x31, 0x9f, 0x2f, 0xa4 } \
|
0xc095791a, 0x3001, 0x47b2, {0x80, 0xc9, 0xea, 0xc7, 0x31, 0x9f, 0x2f, 0xa4 } \
|
||||||
@ -72,6 +80,9 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_ACPI_5_0_FPDT_PERFORMANCE_TABLE_HEADER Header; ///< Common ACPI table header.
|
EFI_ACPI_5_0_FPDT_PERFORMANCE_TABLE_HEADER Header; ///< Common ACPI table header.
|
||||||
EFI_ACPI_5_0_FPDT_FIRMWARE_BASIC_BOOT_RECORD BasicBoot; ///< Basic Boot Resume performance record.
|
EFI_ACPI_5_0_FPDT_FIRMWARE_BASIC_BOOT_RECORD BasicBoot; ///< Basic Boot Resume performance record.
|
||||||
|
//
|
||||||
|
// one or more boot performance records.
|
||||||
|
//
|
||||||
} BOOT_PERFORMANCE_TABLE;
|
} BOOT_PERFORMANCE_TABLE;
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -93,6 +104,19 @@ typedef struct {
|
|||||||
|
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
|
//
|
||||||
|
// Log BOOT RECORD from SMM driver on boot time.
|
||||||
|
//
|
||||||
|
#define SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE 1
|
||||||
|
#define SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA 2
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINTN Function;
|
||||||
|
EFI_STATUS ReturnStatus;
|
||||||
|
UINTN BootRecordSize;
|
||||||
|
VOID *BootRecordData;
|
||||||
|
} SMM_BOOT_RECORD_COMMUNICATE;
|
||||||
|
|
||||||
extern EFI_GUID gEfiFirmwarePerformanceGuid;
|
extern EFI_GUID gEfiFirmwarePerformanceGuid;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -813,6 +813,10 @@
|
|||||||
[PcdsPatchableInModule]
|
[PcdsPatchableInModule]
|
||||||
## Specify memory size with page number for PEI code when
|
## Specify memory size with page number for PEI code when
|
||||||
# the feature of Loading Module at Fixed Address is enabled
|
# the feature of Loading Module at Fixed Address is enabled
|
||||||
|
## This PCD specifies the additional pad size in FPDT Basic Boot Performance Table for
|
||||||
|
# the extension FPDT boot records got after ReadyToBoot and before ExitBootService.
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdExtFpdtBootRecordPadSize|0x0|UINT32|0x0001005F
|
||||||
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdLoadFixAddressPeiCodePageNumber|0|UINT32|0x00000029
|
gEfiMdeModulePkgTokenSpaceGuid.PcdLoadFixAddressPeiCodePageNumber|0|UINT32|0x00000029
|
||||||
|
|
||||||
## Specify memory size with page number for DXE boot time code when
|
## Specify memory size with page number for DXE boot time code when
|
||||||
|
@ -2,9 +2,10 @@
|
|||||||
This module install ACPI Firmware Performance Data Table (FPDT).
|
This module install ACPI Firmware Performance Data Table (FPDT).
|
||||||
|
|
||||||
This module register report status code listener to collect performance data
|
This module register report status code listener to collect performance data
|
||||||
for Firmware Basic Boot Performance Record and install FPDT to ACPI table.
|
for Firmware Basic Boot Performance Record and other boot performance records,
|
||||||
|
and install FPDT to ACPI table.
|
||||||
|
|
||||||
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -21,6 +22,7 @@
|
|||||||
|
|
||||||
#include <Protocol/ReportStatusCodeHandler.h>
|
#include <Protocol/ReportStatusCodeHandler.h>
|
||||||
#include <Protocol/AcpiTable.h>
|
#include <Protocol/AcpiTable.h>
|
||||||
|
#include <Protocol/SmmCommunication.h>
|
||||||
|
|
||||||
#include <Guid/Acpi.h>
|
#include <Guid/Acpi.h>
|
||||||
#include <Guid/FirmwarePerformance.h>
|
#include <Guid/FirmwarePerformance.h>
|
||||||
@ -46,6 +48,8 @@
|
|||||||
#define EFI_ACPI_OEM_REVISION 0x00000001
|
#define EFI_ACPI_OEM_REVISION 0x00000001
|
||||||
#define EFI_ACPI_CREATOR_ID 0x5446534D // TBD "MSFT"
|
#define EFI_ACPI_CREATOR_ID 0x5446534D // TBD "MSFT"
|
||||||
#define EFI_ACPI_CREATOR_REVISION 0x01000013 // TBD
|
#define EFI_ACPI_CREATOR_REVISION 0x01000013 // TBD
|
||||||
|
#define EXTENSION_RECORD_SIZE 0x10000
|
||||||
|
#define SMM_BOOT_RECORD_COMM_SIZE OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof(SMM_BOOT_RECORD_COMMUNICATE)
|
||||||
|
|
||||||
EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
|
EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
|
||||||
|
|
||||||
@ -53,8 +57,10 @@ EFI_EVENT mReadyToBootEvent;
|
|||||||
EFI_EVENT mLegacyBootEvent;
|
EFI_EVENT mLegacyBootEvent;
|
||||||
EFI_EVENT mExitBootServicesEvent;
|
EFI_EVENT mExitBootServicesEvent;
|
||||||
UINTN mFirmwarePerformanceTableTemplateKey = 0;
|
UINTN mFirmwarePerformanceTableTemplateKey = 0;
|
||||||
|
UINT32 mBootRecordSize = 0;
|
||||||
|
UINT32 mBootRecordMaxSize = 0;
|
||||||
|
UINT8 *mBootRecordBuffer = NULL;
|
||||||
|
|
||||||
FIRMWARE_PERFORMANCE_RUNTIME_DATA *mPerformanceRuntimeData = NULL;
|
|
||||||
BOOT_PERFORMANCE_TABLE *mAcpiBootPerformanceTable = NULL;
|
BOOT_PERFORMANCE_TABLE *mAcpiBootPerformanceTable = NULL;
|
||||||
S3_PERFORMANCE_TABLE *mAcpiS3PerformanceTable = NULL;
|
S3_PERFORMANCE_TABLE *mAcpiS3PerformanceTable = NULL;
|
||||||
|
|
||||||
@ -232,9 +238,17 @@ InstallFirmwarePerformanceDataTable (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol;
|
EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol;
|
||||||
FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable;
|
|
||||||
EFI_PHYSICAL_ADDRESS Address;
|
EFI_PHYSICAL_ADDRESS Address;
|
||||||
UINTN Size;
|
UINTN Size;
|
||||||
|
UINT8 SmmBootRecordCommBuffer[SMM_BOOT_RECORD_COMM_SIZE];
|
||||||
|
EFI_SMM_COMMUNICATE_HEADER *SmmCommBufferHeader;
|
||||||
|
SMM_BOOT_RECORD_COMMUNICATE *SmmCommData;
|
||||||
|
UINTN CommSize;
|
||||||
|
UINTN PerformanceRuntimeDataSize;
|
||||||
|
UINT8 *PerformanceRuntimeData;
|
||||||
|
UINT8 *PerformanceRuntimeDataHead;
|
||||||
|
EFI_SMM_COMMUNICATION_PROTOCOL *Communication;
|
||||||
|
FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get AcpiTable Protocol.
|
// Get AcpiTable Protocol.
|
||||||
@ -245,14 +259,61 @@ InstallFirmwarePerformanceDataTable (
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Prepare memory for runtime Performance Record.
|
// Collect boot records from SMM drivers.
|
||||||
//
|
//
|
||||||
mPerformanceRuntimeData = NULL;
|
SmmCommData = NULL;
|
||||||
ZeroMem (&PerformanceVariable, sizeof (PerformanceVariable));
|
Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &Communication);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
//
|
||||||
|
// Initialize communicate buffer
|
||||||
|
//
|
||||||
|
SmmCommBufferHeader = (EFI_SMM_COMMUNICATE_HEADER*)SmmBootRecordCommBuffer;
|
||||||
|
SmmCommData = (SMM_BOOT_RECORD_COMMUNICATE*)SmmCommBufferHeader->Data;
|
||||||
|
ZeroMem((UINT8*)SmmCommData, sizeof(SMM_BOOT_RECORD_COMMUNICATE));
|
||||||
|
|
||||||
|
CopyGuid (&SmmCommBufferHeader->HeaderGuid, &gEfiFirmwarePerformanceGuid);
|
||||||
|
SmmCommBufferHeader->MessageLength = sizeof(SMM_BOOT_RECORD_COMMUNICATE);
|
||||||
|
CommSize = SMM_BOOT_RECORD_COMM_SIZE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the size of boot records.
|
||||||
|
//
|
||||||
|
SmmCommData->Function = SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE;
|
||||||
|
SmmCommData->BootRecordData = NULL;
|
||||||
|
Status = Communication->Communicate (Communication, SmmBootRecordCommBuffer, &CommSize);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
if (!EFI_ERROR (SmmCommData->ReturnStatus) && SmmCommData->BootRecordSize != 0) {
|
||||||
|
//
|
||||||
|
// Get all boot records
|
||||||
|
//
|
||||||
|
SmmCommData->Function = SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA;
|
||||||
|
SmmCommData->BootRecordData = AllocateZeroPool(SmmCommData->BootRecordSize);
|
||||||
|
ASSERT (SmmCommData->BootRecordData != NULL);
|
||||||
|
|
||||||
|
Status = Communication->Communicate (Communication, SmmBootRecordCommBuffer, &CommSize);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
ASSERT_EFI_ERROR(SmmCommData->ReturnStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prepare memory for runtime Performance Record.
|
||||||
|
// Runtime performance records includes two tables S3 performance table and Boot performance table.
|
||||||
|
// S3 Performance table includes S3Resume and S3Suspend records.
|
||||||
|
// Boot Performance table includes BasicBoot record, and one or more appended Boot Records.
|
||||||
|
//
|
||||||
|
PerformanceRuntimeData = NULL;
|
||||||
|
PerformanceRuntimeDataSize = sizeof (S3_PERFORMANCE_TABLE) + sizeof (BOOT_PERFORMANCE_TABLE) + mBootRecordSize + PcdGet32 (PcdExtFpdtBootRecordPadSize);
|
||||||
|
if (SmmCommData != NULL) {
|
||||||
|
PerformanceRuntimeDataSize += SmmCommData->BootRecordSize;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Try to allocate the same runtime buffer as last time boot.
|
// Try to allocate the same runtime buffer as last time boot.
|
||||||
//
|
//
|
||||||
Size = sizeof (FIRMWARE_PERFORMANCE_VARIABLE);
|
ZeroMem (&PerformanceVariable, sizeof (PerformanceVariable));
|
||||||
|
Size = sizeof (PerformanceVariable);
|
||||||
Status = gRT->GetVariable (
|
Status = gRT->GetVariable (
|
||||||
EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
|
EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
|
||||||
&gEfiFirmwarePerformanceGuid,
|
&gEfiFirmwarePerformanceGuid,
|
||||||
@ -261,35 +322,86 @@ InstallFirmwarePerformanceDataTable (
|
|||||||
&PerformanceVariable
|
&PerformanceVariable
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Address = PerformanceVariable.BootPerformanceTablePointer;
|
Address = PerformanceVariable.S3PerformanceTablePointer;
|
||||||
Status = gBS->AllocatePages (
|
Status = gBS->AllocatePages (
|
||||||
AllocateAddress,
|
AllocateAddress,
|
||||||
EfiReservedMemoryType,
|
EfiReservedMemoryType,
|
||||||
EFI_SIZE_TO_PAGES (sizeof (FIRMWARE_PERFORMANCE_RUNTIME_DATA)),
|
EFI_SIZE_TO_PAGES (PerformanceRuntimeDataSize),
|
||||||
&Address
|
&Address
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
mPerformanceRuntimeData = (FIRMWARE_PERFORMANCE_RUNTIME_DATA *) (UINTN) Address;
|
PerformanceRuntimeData = (UINT8 *) (UINTN) Address;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mPerformanceRuntimeData == NULL) {
|
if (PerformanceRuntimeData == NULL) {
|
||||||
//
|
//
|
||||||
// Fail to allocate at specified address, continue to allocate at any address.
|
// Fail to allocate at specified address, continue to allocate at any address.
|
||||||
//
|
//
|
||||||
mPerformanceRuntimeData = FpdtAllocateReservedMemoryBelow4G (sizeof (FIRMWARE_PERFORMANCE_RUNTIME_DATA));
|
PerformanceRuntimeData = FpdtAllocateReservedMemoryBelow4G (PerformanceRuntimeDataSize);
|
||||||
}
|
}
|
||||||
DEBUG ((EFI_D_INFO, "FPDT: Performance Runtime Data address = 0x%x\n", mPerformanceRuntimeData));
|
DEBUG ((EFI_D_INFO, "FPDT: Performance Runtime Data address = 0x%x\n", PerformanceRuntimeData));
|
||||||
|
|
||||||
if (mPerformanceRuntimeData == NULL) {
|
if (PerformanceRuntimeData == NULL) {
|
||||||
|
if (SmmCommData != NULL && SmmCommData->BootRecordData != NULL) {
|
||||||
|
FreePool (SmmCommData->BootRecordData);
|
||||||
|
}
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PerformanceRuntimeDataHead = PerformanceRuntimeData;
|
||||||
|
|
||||||
|
if (FeaturePcdGet (PcdFirmwarePerformanceDataTableS3Support)) {
|
||||||
|
//
|
||||||
|
// Prepare S3 Performance Table.
|
||||||
|
//
|
||||||
|
mAcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *) PerformanceRuntimeData;
|
||||||
|
CopyMem (mAcpiS3PerformanceTable, &mS3PerformanceTableTemplate, sizeof (mS3PerformanceTableTemplate));
|
||||||
|
PerformanceRuntimeData = PerformanceRuntimeData + mAcpiS3PerformanceTable->Header.Length;
|
||||||
|
DEBUG ((EFI_D_INFO, "FPDT: ACPI S3 Performance Table address = 0x%x\n", mAcpiS3PerformanceTable));
|
||||||
|
//
|
||||||
|
// Save S3 Performance Table address to Variable for use in Firmware Performance PEIM.
|
||||||
|
//
|
||||||
|
PerformanceVariable.S3PerformanceTablePointer = (EFI_PHYSICAL_ADDRESS) (UINTN) mAcpiS3PerformanceTable;
|
||||||
|
//
|
||||||
|
// Update S3 Performance Table Pointer in template.
|
||||||
|
//
|
||||||
|
mFirmwarePerformanceTableTemplate.S3PointerRecord.S3PerformanceTablePointer = (UINT64) PerformanceVariable.S3PerformanceTablePointer;
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// Exclude S3 Performance Table Pointer from FPDT table template.
|
||||||
|
//
|
||||||
|
mFirmwarePerformanceTableTemplate.Header.Length -= sizeof (EFI_ACPI_5_0_FPDT_S3_PERFORMANCE_TABLE_POINTER_RECORD);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Prepare Boot Performance Table.
|
// Prepare Boot Performance Table.
|
||||||
//
|
//
|
||||||
mAcpiBootPerformanceTable = &mPerformanceRuntimeData->BootPerformance;
|
mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) PerformanceRuntimeData;
|
||||||
CopyMem (mAcpiBootPerformanceTable, &mBootPerformanceTableTemplate, sizeof (mBootPerformanceTableTemplate));
|
//
|
||||||
|
// Fill Basic Boot record to Boot Performance Table.
|
||||||
|
//
|
||||||
|
CopyMem (PerformanceRuntimeData, &mBootPerformanceTableTemplate, sizeof (mBootPerformanceTableTemplate));
|
||||||
|
PerformanceRuntimeData = PerformanceRuntimeData + mAcpiBootPerformanceTable->Header.Length;
|
||||||
|
//
|
||||||
|
// Fill Boot records from boot drivers.
|
||||||
|
//
|
||||||
|
CopyMem (PerformanceRuntimeData, mBootRecordBuffer, mBootRecordSize);
|
||||||
|
mAcpiBootPerformanceTable->Header.Length += mBootRecordSize;
|
||||||
|
PerformanceRuntimeData = PerformanceRuntimeData + mBootRecordSize;
|
||||||
|
if (SmmCommData != NULL && SmmCommData->BootRecordData != NULL) {
|
||||||
|
//
|
||||||
|
// Fill Boot records from SMM drivers.
|
||||||
|
//
|
||||||
|
CopyMem (PerformanceRuntimeData, SmmCommData->BootRecordData, SmmCommData->BootRecordSize);
|
||||||
|
FreePool (SmmCommData->BootRecordData);
|
||||||
|
mAcpiBootPerformanceTable->Header.Length = (UINT32) (mAcpiBootPerformanceTable->Header.Length + SmmCommData->BootRecordSize);
|
||||||
|
PerformanceRuntimeData = PerformanceRuntimeData + SmmCommData->BootRecordSize;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Reserve space for boot records after ReadyToBoot.
|
||||||
|
//
|
||||||
|
PerformanceRuntimeData = PerformanceRuntimeData + PcdGet32 (PcdExtFpdtBootRecordPadSize);
|
||||||
DEBUG ((EFI_D_INFO, "FPDT: ACPI Boot Performance Table address = 0x%x\n", mAcpiBootPerformanceTable));
|
DEBUG ((EFI_D_INFO, "FPDT: ACPI Boot Performance Table address = 0x%x\n", mAcpiBootPerformanceTable));
|
||||||
//
|
//
|
||||||
// Save Boot Performance Table address to Variable for use in S4 resume.
|
// Save Boot Performance Table address to Variable for use in S4 resume.
|
||||||
@ -300,30 +412,6 @@ InstallFirmwarePerformanceDataTable (
|
|||||||
//
|
//
|
||||||
mFirmwarePerformanceTableTemplate.BootPointerRecord.BootPerformanceTablePointer = (UINT64) (UINTN) mAcpiBootPerformanceTable;
|
mFirmwarePerformanceTableTemplate.BootPointerRecord.BootPerformanceTablePointer = (UINT64) (UINTN) mAcpiBootPerformanceTable;
|
||||||
|
|
||||||
if (FeaturePcdGet (PcdFirmwarePerformanceDataTableS3Support)) {
|
|
||||||
//
|
|
||||||
// Prepare S3 Performance Table.
|
|
||||||
//
|
|
||||||
mAcpiS3PerformanceTable = &mPerformanceRuntimeData->S3Performance;
|
|
||||||
CopyMem (mAcpiS3PerformanceTable, &mS3PerformanceTableTemplate, sizeof (mS3PerformanceTableTemplate));
|
|
||||||
DEBUG ((EFI_D_INFO, "FPDT: ACPI S3 Performance Table address = 0x%x\n", mAcpiS3PerformanceTable));
|
|
||||||
|
|
||||||
//
|
|
||||||
// Save S3 Performance Table address to Variable for use in Firmware Performance PEIM.
|
|
||||||
//
|
|
||||||
PerformanceVariable.S3PerformanceTablePointer = (EFI_PHYSICAL_ADDRESS) (UINTN) mAcpiS3PerformanceTable;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Update S3 Performance Table Pointer in template.
|
|
||||||
//
|
|
||||||
mFirmwarePerformanceTableTemplate.S3PointerRecord.S3PerformanceTablePointer = (UINT64) PerformanceVariable.S3PerformanceTablePointer;
|
|
||||||
} else {
|
|
||||||
//
|
|
||||||
// Exclude S3 Performance Table Pointer from FPDT table template.
|
|
||||||
//
|
|
||||||
mFirmwarePerformanceTableTemplate.Header.Length -= sizeof (EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Save Runtime Performance Table pointers to Variable.
|
// Save Runtime Performance Table pointers to Variable.
|
||||||
//
|
//
|
||||||
@ -331,7 +419,7 @@ InstallFirmwarePerformanceDataTable (
|
|||||||
EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
|
EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
|
||||||
&gEfiFirmwarePerformanceGuid,
|
&gEfiFirmwarePerformanceGuid,
|
||||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
sizeof (FIRMWARE_PERFORMANCE_VARIABLE),
|
sizeof (PerformanceVariable),
|
||||||
&PerformanceVariable
|
&PerformanceVariable
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
@ -347,12 +435,22 @@ InstallFirmwarePerformanceDataTable (
|
|||||||
&mFirmwarePerformanceTableTemplateKey
|
&mFirmwarePerformanceTableTemplateKey
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
FreePool (mPerformanceRuntimeData);
|
FreePool (PerformanceRuntimeDataHead);
|
||||||
mAcpiBootPerformanceTable = NULL;
|
mAcpiBootPerformanceTable = NULL;
|
||||||
mAcpiS3PerformanceTable = NULL;
|
mAcpiS3PerformanceTable = NULL;
|
||||||
return Status;
|
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;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,6 +636,42 @@ FpdtStatusCodeListenerDxe (
|
|||||||
// Unregister boot time report status code listener.
|
// Unregister boot time report status code listener.
|
||||||
//
|
//
|
||||||
mRscHandlerProtocol->Unregister (FpdtStatusCodeListenerDxe);
|
mRscHandlerProtocol->Unregister (FpdtStatusCodeListenerDxe);
|
||||||
|
} else if (Data != NULL && CompareGuid (&Data->Type, &gEfiFirmwarePerformanceGuid)) {
|
||||||
|
//
|
||||||
|
// Append one or more Boot records
|
||||||
|
//
|
||||||
|
if (mAcpiBootPerformanceTable == NULL) {
|
||||||
|
//
|
||||||
|
// Append Boot records before FPDT ACPI table is installed.
|
||||||
|
//
|
||||||
|
if (mBootRecordSize + Data->Size > mBootRecordMaxSize) {
|
||||||
|
mBootRecordBuffer = ReallocatePool (mBootRecordSize, mBootRecordSize + Data->Size + EXTENSION_RECORD_SIZE, mBootRecordBuffer);
|
||||||
|
ASSERT (mBootRecordBuffer != NULL);
|
||||||
|
mBootRecordMaxSize = mBootRecordSize + Data->Size + EXTENSION_RECORD_SIZE;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Save boot record into the temp memory space.
|
||||||
|
//
|
||||||
|
CopyMem (mBootRecordBuffer + mBootRecordSize, Data + 1, Data->Size);
|
||||||
|
mBootRecordSize += Data->Size;
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// Append Boot records after FPDT ACPI table is installed.
|
||||||
|
//
|
||||||
|
if (mBootRecordSize + Data->Size > mBootRecordMaxSize) {
|
||||||
|
//
|
||||||
|
// No enough space to save boot record.
|
||||||
|
//
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// Save boot record into BootPerformance table
|
||||||
|
//
|
||||||
|
CopyMem (mBootRecordBuffer + mBootRecordSize, Data + 1, Data->Size);
|
||||||
|
mBootRecordSize += Data->Size;
|
||||||
|
mAcpiBootPerformanceTable->Header.Length = mBootRecordSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Ignore else progress code.
|
// Ignore else progress code.
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
## @file
|
## @file
|
||||||
# This module install ACPI Firmware Performance Data Table (FPDT).
|
# This module installs ACPI Firmware Performance Data Table (FPDT).
|
||||||
#
|
#
|
||||||
# This module register report status code listener to collect performance data
|
# This module registers report status code listener to collect performance data
|
||||||
# for Firmware Basic Boot Performance Record and install FPDT to ACPI table.
|
# for Firmware Basic Boot Performance Record and other boot performance records,
|
||||||
|
# and install FPDT to ACPI table.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -52,6 +53,7 @@
|
|||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiAcpiTableProtocolGuid ## SOMETIMES_CONSUMES
|
gEfiAcpiTableProtocolGuid ## SOMETIMES_CONSUMES
|
||||||
gEfiRscHandlerProtocolGuid ## CONSUMES
|
gEfiRscHandlerProtocolGuid ## CONSUMES
|
||||||
|
gEfiSmmCommunicationProtocolGuid ## SOMETIMES_CONSUMES
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gEfiEventExitBootServicesGuid ## CONSUMES
|
gEfiEventExitBootServicesGuid ## CONSUMES
|
||||||
@ -60,11 +62,15 @@
|
|||||||
gEfiAcpiTableGuid ## SOMETIMES_CONSUMES
|
gEfiAcpiTableGuid ## SOMETIMES_CONSUMES
|
||||||
gEfiAcpi10TableGuid ## SOMETIMES_CONSUMES
|
gEfiAcpi10TableGuid ## SOMETIMES_CONSUMES
|
||||||
gEfiAcpi20TableGuid ## SOMETIMES_CONSUMES
|
gEfiAcpi20TableGuid ## SOMETIMES_CONSUMES
|
||||||
gEfiFirmwarePerformanceGuid ## CONSUMES
|
gEfiFirmwarePerformanceGuid ## PRODUCES ## Variable:L"FirmwarePerformance"
|
||||||
|
gEfiFirmwarePerformanceGuid ## SOMETIMES_CONSUMES ## Hob
|
||||||
|
gEfiFirmwarePerformanceGuid ## SOMETIMES_CONSUMES ## SmiHandler
|
||||||
|
gEfiFirmwarePerformanceGuid ## SOMETIMES_CONSUMES ## StatusCode Data
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderLoad
|
gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderLoad
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderStart
|
gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderStart
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdExtFpdtBootRecordPadSize
|
||||||
|
|
||||||
[FeaturePcd]
|
[FeaturePcd]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwarePerformanceDataTableS3Support
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwarePerformanceDataTableS3Support
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This module update S3 Suspend Performance Record in ACPI Firmware Performance Data Table.
|
This module collects performance data for SMM driver boot records and S3 Suspend Performance Record.
|
||||||
|
|
||||||
This module register report status code listener to collect performance data
|
This module registers report status code listener to collect performance data
|
||||||
for S3 Suspend Performance Record.
|
for SMM driver boot records and S3 Suspend Performance Record.
|
||||||
|
|
||||||
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -20,6 +20,7 @@
|
|||||||
#include <IndustryStandard/Acpi50.h>
|
#include <IndustryStandard/Acpi50.h>
|
||||||
|
|
||||||
#include <Protocol/SmmReportStatusCodeHandler.h>
|
#include <Protocol/SmmReportStatusCodeHandler.h>
|
||||||
|
#include <Protocol/SmmAccess2.h>
|
||||||
|
|
||||||
#include <Guid/FirmwarePerformance.h>
|
#include <Guid/FirmwarePerformance.h>
|
||||||
|
|
||||||
@ -29,10 +30,24 @@
|
|||||||
#include <Library/TimerLib.h>
|
#include <Library/TimerLib.h>
|
||||||
#include <Library/LockBoxLib.h>
|
#include <Library/LockBoxLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
|
#include <Library/BaseMemoryLib.h>
|
||||||
|
#include <Library/MemoryAllocationLib.h>
|
||||||
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
|
#include <Library/SynchronizationLib.h>
|
||||||
|
|
||||||
|
#define EXTENSION_RECORD_SIZE 0x1000
|
||||||
|
|
||||||
EFI_SMM_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
|
EFI_SMM_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
|
||||||
UINT64 mSuspendStartTime = 0;
|
UINT64 mSuspendStartTime = 0;
|
||||||
BOOLEAN mS3SuspendLockBoxSaved = FALSE;
|
BOOLEAN mS3SuspendLockBoxSaved = FALSE;
|
||||||
|
UINT32 mBootRecordSize = 0;
|
||||||
|
UINT32 mBootRecordMaxSize = 0;
|
||||||
|
UINT8 *mBootRecordBuffer = NULL;
|
||||||
|
|
||||||
|
EFI_SMRAM_DESCRIPTOR *mSmramRanges;
|
||||||
|
UINTN mSmramRangeCount;
|
||||||
|
SPIN_LOCK mSmmFpdtLock;
|
||||||
|
BOOLEAN mSmramIsOutOfResource = FALSE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Report status code listener for SMM. This is used to record the performance
|
Report status code listener for SMM. This is used to record the performance
|
||||||
@ -66,6 +81,7 @@ FpdtStatusCodeListenerSmm (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT64 CurrentTime;
|
UINT64 CurrentTime;
|
||||||
EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD S3SuspendRecord;
|
EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD S3SuspendRecord;
|
||||||
|
UINT8 *NewRecordBuffer;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check whether status code is what we are interested in.
|
// Check whether status code is what we are interested in.
|
||||||
@ -73,6 +89,39 @@ FpdtStatusCodeListenerSmm (
|
|||||||
if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) != EFI_PROGRESS_CODE) {
|
if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) != EFI_PROGRESS_CODE) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Collect one or more Boot records in boot time
|
||||||
|
//
|
||||||
|
if (Data != NULL && CompareGuid (&Data->Type, &gEfiFirmwarePerformanceGuid)) {
|
||||||
|
AcquireSpinLock (&mSmmFpdtLock);
|
||||||
|
|
||||||
|
if (mBootRecordSize + Data->Size > mBootRecordMaxSize) {
|
||||||
|
//
|
||||||
|
// Try to allocate big SMRAM data to store Boot record.
|
||||||
|
//
|
||||||
|
if (mSmramIsOutOfResource) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
NewRecordBuffer = AllocatePool (mBootRecordSize + Data->Size + EXTENSION_RECORD_SIZE);
|
||||||
|
if (NewRecordBuffer == NULL) {
|
||||||
|
mSmramIsOutOfResource = TRUE;
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
CopyMem (NewRecordBuffer, mBootRecordBuffer, mBootRecordSize);
|
||||||
|
mBootRecordBuffer = NewRecordBuffer;
|
||||||
|
mBootRecordMaxSize = mBootRecordSize + Data->Size + EXTENSION_RECORD_SIZE;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Save boot record into the temp memory space.
|
||||||
|
//
|
||||||
|
CopyMem (mBootRecordBuffer + mBootRecordSize, Data + 1, Data->Size);
|
||||||
|
mBootRecordSize += Data->Size;
|
||||||
|
|
||||||
|
ReleaseSpinLock (&mSmmFpdtLock);
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
if ((Value != PcdGet32 (PcdProgressCodeS3SuspendStart)) &&
|
if ((Value != PcdGet32 (PcdProgressCodeS3SuspendStart)) &&
|
||||||
(Value != PcdGet32 (PcdProgressCodeS3SuspendEnd))) {
|
(Value != PcdGet32 (PcdProgressCodeS3SuspendEnd))) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
@ -122,6 +171,107 @@ FpdtStatusCodeListenerSmm (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function check if the address is in SMRAM.
|
||||||
|
|
||||||
|
@param Buffer the buffer address to be checked.
|
||||||
|
@param Length the buffer length to be checked.
|
||||||
|
|
||||||
|
@retval TRUE this address is in SMRAM.
|
||||||
|
@retval FALSE this address is NOT in SMRAM.
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
InternalIsAddressInSmram (
|
||||||
|
IN EFI_PHYSICAL_ADDRESS Buffer,
|
||||||
|
IN UINT64 Length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN Index;
|
||||||
|
|
||||||
|
for (Index = 0; Index < mSmramRangeCount; Index ++) {
|
||||||
|
if (((Buffer >= mSmramRanges[Index].CpuStart) && (Buffer < mSmramRanges[Index].CpuStart + mSmramRanges[Index].PhysicalSize)) ||
|
||||||
|
((mSmramRanges[Index].CpuStart >= Buffer) && (mSmramRanges[Index].CpuStart < Buffer + Length))) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Communication service SMI Handler entry.
|
||||||
|
|
||||||
|
This SMI handler provides services for report SMM boot records.
|
||||||
|
|
||||||
|
@param[in] DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
|
||||||
|
@param[in] RegisterContext Points to an optional handler context which was specified when the
|
||||||
|
handler was registered.
|
||||||
|
@param[in, out] CommBuffer A pointer to a collection of data in memory that will
|
||||||
|
be conveyed from a non-SMM environment into an SMM environment.
|
||||||
|
@param[in, out] CommBufferSize The size of the CommBuffer.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The interrupt was handled and quiesced. No other handlers should still be called.
|
||||||
|
@retval EFI_INVALID_PARAMETER The interrupt parameter is not valid.
|
||||||
|
@retval EFI_ACCESS_DENIED The interrupt buffer can't be written.
|
||||||
|
@retval EFI_UNSUPPORTED The interrupt is not supported.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
FpdtSmiHandler (
|
||||||
|
IN EFI_HANDLE DispatchHandle,
|
||||||
|
IN CONST VOID *RegisterContext,
|
||||||
|
IN OUT VOID *CommBuffer,
|
||||||
|
IN OUT UINTN *CommBufferSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
SMM_BOOT_RECORD_COMMUNICATE *SmmCommData;
|
||||||
|
|
||||||
|
ASSERT (CommBuffer != NULL);
|
||||||
|
if (CommBuffer == NULL || *CommBufferSize < sizeof (SMM_BOOT_RECORD_COMMUNICATE)) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
|
SmmCommData = (SMM_BOOT_RECORD_COMMUNICATE*)CommBuffer;
|
||||||
|
|
||||||
|
switch (SmmCommData->Function) {
|
||||||
|
case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE :
|
||||||
|
SmmCommData->BootRecordSize = mBootRecordSize;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA :
|
||||||
|
if (SmmCommData->BootRecordData == NULL || SmmCommData->BootRecordSize < mBootRecordSize) {
|
||||||
|
Status = EFI_INVALID_PARAMETER;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Sanity check
|
||||||
|
//
|
||||||
|
SmmCommData->BootRecordSize = mBootRecordSize;
|
||||||
|
if (InternalIsAddressInSmram ((EFI_PHYSICAL_ADDRESS)(UINTN)SmmCommData->BootRecordData, mBootRecordSize)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "Smm Data buffer is in SMRAM!\n"));
|
||||||
|
Status = EFI_ACCESS_DENIED;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
CopyMem (
|
||||||
|
(UINT8*)SmmCommData->BootRecordData,
|
||||||
|
mBootRecordBuffer,
|
||||||
|
mBootRecordSize
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
ASSERT (FALSE);
|
||||||
|
Status = EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
SmmCommData->ReturnStatus = Status;
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The module Entry Point of the Firmware Performance Data Table SMM driver.
|
The module Entry Point of the Firmware Performance Data Table SMM driver.
|
||||||
|
|
||||||
@ -139,8 +289,15 @@ FirmwarePerformanceSmmEntryPoint (
|
|||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (FeaturePcdGet (PcdFirmwarePerformanceDataTableS3Support)) {
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
EFI_HANDLE Handle;
|
||||||
|
EFI_SMM_ACCESS2_PROTOCOL *SmmAccess;
|
||||||
|
UINTN Size;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize spin lock
|
||||||
|
//
|
||||||
|
InitializeSpinLock (&mSmmFpdtLock);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get SMM Report Status Code Handler Protocol.
|
// Get SMM Report Status Code Handler Protocol.
|
||||||
@ -153,13 +310,39 @@ FirmwarePerformanceSmmEntryPoint (
|
|||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Register report status code listener for S3 Suspend Start and End.
|
// Register report status code listener for BootRecords and S3 Suspend Start and End.
|
||||||
//
|
//
|
||||||
Status = mRscHandlerProtocol->Register (FpdtStatusCodeListenerSmm);
|
Status = mRscHandlerProtocol->Register (FpdtStatusCodeListenerSmm);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get SMRAM information
|
||||||
|
//
|
||||||
|
Status = gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL, (VOID **)&SmmAccess);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
Size = 0;
|
||||||
|
Status = SmmAccess->GetCapabilities (SmmAccess, &Size, NULL);
|
||||||
|
ASSERT (Status == EFI_BUFFER_TOO_SMALL);
|
||||||
|
|
||||||
|
Status = gSmst->SmmAllocatePool (
|
||||||
|
EfiRuntimeServicesData,
|
||||||
|
Size,
|
||||||
|
(VOID **)&mSmramRanges
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
Status = SmmAccess->GetCapabilities (SmmAccess, &Size, mSmramRanges);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
mSmramRangeCount = Size / sizeof (EFI_SMRAM_DESCRIPTOR);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Register SMI handler.
|
||||||
|
//
|
||||||
|
Handle = NULL;
|
||||||
|
Status = gSmst->SmiHandlerRegister (FpdtSmiHandler, &gEfiFirmwarePerformanceGuid, &Handle);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
} else {
|
|
||||||
return EFI_UNSUPPORTED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
## @file
|
## @file
|
||||||
# This module update S3 Suspend Performance Record in ACPI Firmware Performance Data Table.
|
# This module collects performance data for SMM driver boot records and S3 Suspend Performance Record.
|
||||||
#
|
#
|
||||||
# This module register report status code listener to collect performance data
|
# This module registers report status code listener to collect performance data
|
||||||
# for S3 Suspend Performance Record.
|
# for SMM boot performance records and S3 Suspend Performance Record.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -45,15 +45,19 @@
|
|||||||
TimerLib
|
TimerLib
|
||||||
LockBoxLib
|
LockBoxLib
|
||||||
PcdLib
|
PcdLib
|
||||||
|
BaseMemoryLib
|
||||||
|
MemoryAllocationLib
|
||||||
|
UefiBootServicesTableLib
|
||||||
|
SynchronizationLib
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiSmmRscHandlerProtocolGuid ## CONSUMES
|
gEfiSmmRscHandlerProtocolGuid ## CONSUMES
|
||||||
|
gEfiSmmAccess2ProtocolGuid ## CONSUMES
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gEfiFirmwarePerformanceGuid ## CONSUMES
|
gEfiFirmwarePerformanceGuid ## CONSUMES ## LockBox
|
||||||
|
gEfiFirmwarePerformanceGuid ## PRODUCES ## SmiHandler
|
||||||
[FeaturePcd]
|
gEfiFirmwarePerformanceGuid ## SOMETIMES_CONSUMES ## StatusCode Data
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwarePerformanceDataTableS3Support
|
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeS3SuspendStart
|
gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeS3SuspendStart
|
||||||
|
Reference in New Issue
Block a user