Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamicTablesPkg: Prepare for supporting other archs #5974

Merged
merged 56 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
dda10c8
DynamicTablesPkg: Introduce an Arch Common Namespace
samimujawar Feb 14, 2024
bb44602
DynamicTablesPkg/SsdtCpuTopology: Update function's parameter descrip…
pierregondois Mar 21, 2024
efcde20
DynamicTablesPkg: Replace ProcNodeIdInfo with EArmObjReserved29
samimujawar Mar 7, 2024
3a7a8d0
DynamicTablesPkg: Introduce ObjectId to validate CmObject Parser Array
samimujawar Mar 7, 2024
84ce8a3
DynamicTablesPkg: Introduce an Arch Common Namespace header file
samimujawar Mar 6, 2024
2fbd188
DynamicTablesPkg: Add support for ArchCommon objects in CmObjParser
samimujawar Mar 7, 2024
2f992a1
DynamicTablesPkg: TokenFixer: Return Non Arm NS objs as unsupported
samimujawar Mar 9, 2024
278d830
DynamicTablesPkg: Update DynamicPlatRepo for Arch Common namespace
samimujawar Mar 6, 2024
241415c
DynamicTablesPkg: Update documentation for CM_OBJECT_ID
samimujawar Mar 8, 2024
0bc0d47
DynamicTablesPkg: Drop Cpu Info object ID from Arm Namespace
samimujawar Mar 5, 2024
ccbf556
DynamicTablesPkg: Drop Reserved29 object ID from Arm Namespace
samimujawar Mar 5, 2024
c462c2f
ArmVirtPkg: Kvmtool: Update ConfigMgr to support ArchCommon
samimujawar Mar 7, 2024
02138e7
DynamicTablesPkg: Move Power Mgmt Profile Info Object
samimujawar Mar 5, 2024
b3cd18e
ArmVirtPkg: Kvmtool: Update Power Mgmt Profile info in Cfg Manager
samimujawar Apr 16, 2024
3f437e6
DynamicTablesPkg: Move Serial Port Info Objects to Arch Common
samimujawar Mar 6, 2024
de6e8da
DynamicTablesPkg: Move Hypervisor Vendor Id to Arch Common
samimujawar Mar 6, 2024
d27aef0
DynamicTablesPkg: Move FADT Fixed Features Flags to Arch Common
samimujawar Mar 6, 2024
18d1b41
DynamicTablesPkg: Move Cm Reference object to Arch Common
samimujawar Mar 6, 2024
f6112a7
DynamicTablesPkg: Move Pci Config Space Info to Arm namespace
samimujawar Mar 8, 2024
6be800d
ArmVirtPkg: Kvmtool: Update Pci Config Space Info in Cfg Manager
samimujawar Apr 16, 2024
b0d1371
DynamicTablesPkg: Move Pci Address Map Info to Arch Common
samimujawar Mar 8, 2024
3321092
DynamicTablesPkg: Move CM_ARM_GENERIC_INTERRUPT struct to Arch Common
samimujawar Mar 8, 2024
db55d04
DynamicTablesPkg: Move Pci Interrupt Map Info to Arch Common
samimujawar Mar 8, 2024
f8bbf17
DynamicTablesPkg: Move Mem Affinity Info to Arch Common
samimujawar Mar 11, 2024
38320ab
DynamicTablesPkg: Move ACPI device Handle object to Arch Common
samimujawar Mar 11, 2024
97686c1
DynamicTablesPkg: Move PCI device Handle object to Arch Common
samimujawar Mar 11, 2024
825ca0a
DynamicTablesPkg: Move Generic Initiator affinity info to Arch Common
samimujawar Mar 11, 2024
80d18cb
DynamicTablesPkg: Move LPI info object to Arch Common
samimujawar Mar 11, 2024
ea07db1
DynamicTablesPkg: Rename GicCToken field in Processor Hierarchy Info
samimujawar Mar 11, 2024
9f8b2a5
DynamicTablesPkg: Move Processor hierarchy info to Arch Common
samimujawar Mar 11, 2024
368450b
DynamicTablesPkg: Move Cache info to Arch Common
samimujawar Mar 11, 2024
602619f
DynamicTablesPkg: Move Continuous perf control info to Arch Common
samimujawar Mar 11, 2024
dcf51fc
DynamicTablesPkg: Move PCC structure definitions to Arch Common
samimujawar Mar 11, 2024
1995897
DynamicTablesPkg: Move PCC Type0 info to Arch Common
samimujawar Mar 11, 2024
6d92b8f
DynamicTablesPkg: Move PCC Type1 info to Arch Common
samimujawar Mar 11, 2024
e98ccd8
DynamicTablesPkg: Move PCC Type2 info to Arch Common
samimujawar Mar 11, 2024
c259d0b
DynamicTablesPkg: Move PCC Type 3 & 4 info to Arch Common
samimujawar Mar 11, 2024
a387b24
DynamicTablesPkg: Move PCC Type 5 info to Arch Common
samimujawar Mar 11, 2024
01c62b6
DynamicTablesPkg: Move PSD info to Arch Common
samimujawar Mar 11, 2024
050a688
DynamicTablesPkg: Acpi: Move generic libraries to common folder
pierregondois Jun 10, 2024
177001e
DynamicTablesPkg: Acpi: Prepare common libraries to support other archs
pierregondois Jun 10, 2024
6411e55
DynamicTablesPkg: AcpiFadtLib: Prepare to support other archs
pierregondois Jun 10, 2024
cd16918
DynamicTablesPkg: AcpiDbg2Lib: Prepare to support other archs
pierregondois Jun 10, 2024
5988839
DynamicTablesPkg: AcpiSpcrLib: Prepare to support other archs
pierregondois Jun 10, 2024
6a5b5e3
DynamicTablesPkg: AcpiSratLib: Prepare to support other archs
pierregondois Jun 10, 2024
bc4f632
DynamicTablesPkg: AcpiSsdtCpuTopologyLib: Avoid dependency on GICC
pierregondois Jun 10, 2024
3735002
DynamicTablesPkg: DynamicTableManagerDxe: Refactor PresenceArray
pierregondois Jun 10, 2024
2e712d6
DynamicTablesPkg: FdtHwInfoParserLib: Move ARM parsers to Arm directory
pierregondois Jun 10, 2024
211a2bd
DynamicTablesPkg: FdtHwInfoParserLib: Refactor to prepare for other a…
pierregondois Jun 10, 2024
b815cc7
DynamicTablesPkg: FdtHwInfoParserLib: Make Pci parser arch neutral
pierregondois Jun 10, 2024
39e2865
DynamicTablesPkg: FdtHwInfoParserLib: Make Serial Port parser arch ne…
pierregondois Jun 10, 2024
0ff5483
DynamicTablesPkg: FdtHwInfoParserLib: Move ArmLib.h to ArmGicCParser.c
pierregondois Jun 10, 2024
f55b288
DynamicTablesPkg: FdtHwInfoParserLib: Move IRQ map to arch folder
pierregondois Jun 10, 2024
958a68c
DynamicTablesPkg: FdtHwInfoParserLib: Create wrapper to get INTC addr…
pierregondois Jun 10, 2024
37a2b76
DynamicTablesPkg: Fix conversion compiler warnings
pierregondois Jul 3, 2024
dec4e3a
DynamicTablesPkg: Add EFIAPI to generators hooks
pierregondois Jul 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 76 additions & 4 deletions ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,9 @@ GetStandardNameSpaceObject (
//
Status = DynamicPlatRepoGetObject (
PlatformRepo->DynamicPlatformRepo,
CREATE_CM_ARM_OBJECT_ID (EArmObjPciConfigSpaceInfo),
CREATE_CM_ARCH_COMMON_OBJECT_ID (
EArchCommonObjPciConfigSpaceInfo
),
CM_NULL_TOKEN,
&CmObjDesc
);
Expand Down Expand Up @@ -723,7 +725,7 @@ GetStandardNameSpaceObject (
}

/**
Return an ARM namespace object.
Return an ArchCommon namespace object.

@param [in] This Pointer to the Configuration Manager Protocol.
@param [in] CmObjectId The Configuration Manager Object ID.
Expand All @@ -738,7 +740,7 @@ GetStandardNameSpaceObject (
**/
EFI_STATUS
EFIAPI
GetArmNameSpaceObject (
GetArchCommonNameSpaceObject (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST This,
IN CONST CM_OBJECT_ID CmObjectId,
IN CONST CM_OBJECT_TOKEN Token OPTIONAL,
Expand All @@ -761,7 +763,7 @@ GetArmNameSpaceObject (
// First check among the static objects.
//
switch (GET_CM_OBJECT_ID (CmObjectId)) {
case EArmObjPowerManagementProfileInfo:
case EArchCommonObjPowerManagementProfileInfo:
Status = HandleCmObject (
CmObjectId,
&PlatformRepo->PmProfileInfo,
Expand All @@ -771,6 +773,73 @@ GetArmNameSpaceObject (
);
break;

default:
//
// No match found among the static objects.
// Check the dynamic objects.
//
Status = DynamicPlatRepoGetObject (
PlatformRepo->DynamicPlatformRepo,
CmObjectId,
Token,
CmObject
);
break;
} // switch

if (Status == EFI_NOT_FOUND) {
DEBUG ((
DEBUG_INFO,
"INFO: CmObjectId " FMT_CM_OBJECT_ID ". Status = %r\n",
CmObjectId,
Status
));
} else {
ASSERT_EFI_ERROR (Status);
}

return Status;
}

/**
Return an ARM namespace object.

@param [in] This Pointer to the Configuration Manager Protocol.
@param [in] CmObjectId The Configuration Manager Object ID.
@param [in] Token An optional token identifying the object. If
unused this must be CM_NULL_TOKEN.
@param [in, out] CmObject Pointer to the Configuration Manager Object
descriptor describing the requested Object.

@retval EFI_SUCCESS Success.
@retval EFI_INVALID_PARAMETER A parameter is invalid.
@retval EFI_NOT_FOUND The required object information is not found.
**/
EFI_STATUS
EFIAPI
GetArmNameSpaceObject (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST This,
IN CONST CM_OBJECT_ID CmObjectId,
IN CONST CM_OBJECT_TOKEN Token OPTIONAL,
IN OUT CM_OBJ_DESCRIPTOR *CONST CmObject
)
{
EFI_STATUS Status;
EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo;

if ((This == NULL) || (CmObject == NULL)) {
ASSERT (This != NULL);
ASSERT (CmObject != NULL);
return EFI_INVALID_PARAMETER;
}

Status = EFI_NOT_FOUND;
PlatformRepo = This->PlatRepoInfo;

//
// First check among the static objects.
//
switch (GET_CM_OBJECT_ID (CmObjectId)) {
case EArmObjItsGroup:
Status = HandleCmObject (
CmObjectId,
Expand Down Expand Up @@ -929,6 +998,9 @@ ArmKvmtoolPlatformGetObject (
case EObjNameSpaceStandard:
Status = GetStandardNameSpaceObject (This, CmObjectId, Token, CmObject);
break;
case EObjNameSpaceArchCommon:
Status = GetArchCommonNameSpaceObject (This, CmObjectId, Token, CmObject);
break;
case EObjNameSpaceArm:
Status = GetArmNameSpaceObject (This, CmObjectId, Token, CmObject);
break;
Expand Down
20 changes: 10 additions & 10 deletions ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,53 +73,53 @@ typedef struct PlatformRepositoryInfo {
///
/// Configuration Manager Information.
///
CM_STD_OBJ_CONFIGURATION_MANAGER_INFO CmInfo;
CM_STD_OBJ_CONFIGURATION_MANAGER_INFO CmInfo;

///
/// List of ACPI tables
///
CM_STD_OBJ_ACPI_TABLE_INFO CmAcpiTableList[PLAT_ACPI_TABLE_COUNT];
CM_STD_OBJ_ACPI_TABLE_INFO CmAcpiTableList[PLAT_ACPI_TABLE_COUNT];

///
/// Power management profile information
///
CM_ARM_POWER_MANAGEMENT_PROFILE_INFO PmProfileInfo;
CM_ARCH_COMMON_POWER_MANAGEMENT_PROFILE_INFO PmProfileInfo;

///
/// ITS Group node
///
CM_ARM_ITS_GROUP_NODE ItsGroupInfo;
CM_ARM_ITS_GROUP_NODE ItsGroupInfo;

///
/// ITS Identifier array
///
CM_ARM_ITS_IDENTIFIER ItsIdentifierArray[1];
CM_ARM_ITS_IDENTIFIER ItsIdentifierArray[1];

///
/// PCI Root complex node
///
CM_ARM_ROOT_COMPLEX_NODE RootComplexInfo;
CM_ARM_ROOT_COMPLEX_NODE RootComplexInfo;

///
/// Array of DeviceID mapping
///
CM_ARM_ID_MAPPING DeviceIdMapping[1];
CM_ARM_ID_MAPPING DeviceIdMapping[1];

///
/// Dynamic platform repository.
/// CmObj created by parsing the Kvmtool device tree are stored here.
///
DYNAMIC_PLATFORM_REPOSITORY_INFO *DynamicPlatformRepo;
DYNAMIC_PLATFORM_REPOSITORY_INFO *DynamicPlatformRepo;

///
/// Base address of the FDT.
///
VOID *FdtBase;
VOID *FdtBase;

///
/// A handle to the FDT HwInfoParser.
///
HW_INFO_PARSER_HANDLE FdtParserHandle;
HW_INFO_PARSER_HANDLE FdtParserHandle;
} EDKII_PLATFORM_REPOSITORY_INFO;

#endif // CONFIGURATION_MANAGER_H_
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/** @file
ARM Dynamic Table Manager Dxe

Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

**/

#include <Library/DebugLib.h>
#include <Library/PcdLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Protocol/AcpiSystemDescriptionTable.h>
#include <Protocol/AcpiTable.h>

// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
#include <ConfigurationManagerHelper.h>
#include <DeviceTreeTableGenerator.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
#include <Protocol/DynamicTableFactoryProtocol.h>
#include "DynamicTableManagerDxe.h"

///
/// Array containing the ACPI tables to check.
/// We require the FADT, MADT, GTDT and the DSDT tables to boot.
/// This list also include optional ACPI tables: DBG2, SPCR.
/// The FADT table must be placed at index 0.
///
STATIC ACPI_TABLE_PRESENCE_INFO mAcpiVerifyTables[] = {
{ EStdAcpiTableIdFadt, EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, "FADT", TRUE, 0 },
{ EStdAcpiTableIdMadt, EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, "MADT", TRUE, 0 },
{ EStdAcpiTableIdGtdt, EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, "GTDT", TRUE, 0 },
{ EStdAcpiTableIdDsdt, EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, "DSDT", TRUE, 0 },
{ EStdAcpiTableIdDbg2, EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE, "DBG2", FALSE, 0 },
{ EStdAcpiTableIdSpcr, EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, "SPCR", FALSE, 0 },
};

/** Get the arch specific ACPI table presence information.

@param [out] PresenceArray Array containing the ACPI tables to check.
@param [out] PresenceArrayCount Count of elements in the PresenceArray.
@param [out] FadtIndex Index of the FADT table in the PresenceArray.
-1 if absent.

@retval EFI_SUCCESS Success.
**/
EFI_STATUS
EFIAPI
GetAcpiTablePresenceInfo (
OUT ACPI_TABLE_PRESENCE_INFO **PresenceArray,
OUT UINT32 *PresenceArrayCount,
OUT INT32 *FadtIndex
)
{
*PresenceArray = mAcpiVerifyTables;
*PresenceArrayCount = ARRAY_SIZE (mAcpiVerifyTables);
*FadtIndex = ACPI_TABLE_VERIFY_FADT;

return EFI_SUCCESS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,57 +23,15 @@
#include <Protocol/DynamicTableFactoryProtocol.h>
#include <SmbiosTableGenerator.h>

///
/// Bit definitions for acceptable ACPI table presence formats.
/// Currently only ACPI tables present in the ACPI info list and
/// already installed will count towards "Table Present" during
/// verification routine.
///
#define ACPI_TABLE_PRESENT_INFO_LIST BIT0
#define ACPI_TABLE_PRESENT_INSTALLED BIT1

///
/// Order of ACPI table being verified during presence inspection.
///
#define ACPI_TABLE_VERIFY_FADT 0
#define ACPI_TABLE_VERIFY_MADT 1
#define ACPI_TABLE_VERIFY_GTDT 2
#define ACPI_TABLE_VERIFY_DSDT 3
#define ACPI_TABLE_VERIFY_DBG2 4
#define ACPI_TABLE_VERIFY_SPCR 5
#define ACPI_TABLE_VERIFY_COUNT 6

///
/// Private data structure to verify the presence of mandatory
/// or optional ACPI tables.
///
typedef struct {
/// ESTD ID for the ACPI table of interest.
ESTD_ACPI_TABLE_ID EstdTableId;
/// Standard UINT32 ACPI signature.
UINT32 AcpiTableSignature;
/// 4 character ACPI table name (the 5th char8 is for null terminator).
CHAR8 AcpiTableName[sizeof (UINT32) + 1];
/// Indicator on whether the ACPI table is required.
BOOLEAN IsMandatory;
/// Formats of verified presences, as defined by ACPI_TABLE_PRESENT_*
/// This field should be initialized to 0 and will be populated during
/// verification routine.
UINT16 Presence;
} ACPI_TABLE_PRESENCE_INFO;
#include "DynamicTableManagerDxe.h"

///
/// We require the FADT, MADT, GTDT and the DSDT tables to boot.
/// This list also include optional ACPI tables: DBG2, SPCR.
///
ACPI_TABLE_PRESENCE_INFO mAcpiVerifyTables[ACPI_TABLE_VERIFY_COUNT] = {
{ EStdAcpiTableIdFadt, EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, "FADT", TRUE, 0 },
{ EStdAcpiTableIdMadt, EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, "MADT", TRUE, 0 },
{ EStdAcpiTableIdGtdt, EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, "GTDT", TRUE, 0 },
{ EStdAcpiTableIdDsdt, EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, "DSDT", TRUE, 0 },
{ EStdAcpiTableIdDbg2, EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE, "DBG2", FALSE, 0 },
{ EStdAcpiTableIdSpcr, EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, "SPCR", FALSE, 0 },
};
STATIC ACPI_TABLE_PRESENCE_INFO *mAcpiVerifyTables;
STATIC UINT32 mAcpiVerifyTablesCount;
STATIC INT32 mAcpiVerifyTablesFadtIndex;

/** This macro expands to a function that retrieves the ACPI Table
List from the Configuration Manager.
Expand Down Expand Up @@ -472,7 +430,7 @@ VerifyMandatoryTablesArePresent (

// Check against the statically initialized ACPI tables to see if they are in ACPI info list
while (AcpiTableCount-- != 0) {
for (Index = 0; Index < ACPI_TABLE_VERIFY_COUNT; Index++) {
for (Index = 0; Index < mAcpiVerifyTablesCount; Index++) {
if (AcpiTableInfo[AcpiTableCount].AcpiTableSignature == mAcpiVerifyTables[Index].AcpiTableSignature) {
mAcpiVerifyTables[Index].Presence |= ACPI_TABLE_PRESENT_INFO_LIST;
// Found this table, skip the rest.
Expand All @@ -491,7 +449,7 @@ VerifyMandatoryTablesArePresent (
return Status;
}

for (Index = 0; Index < ACPI_TABLE_VERIFY_COUNT; Index++) {
for (Index = 0; Index < mAcpiVerifyTablesCount; Index++) {
Handle = 0;
InstalledTableIndex = 0;
do {
Expand All @@ -511,7 +469,7 @@ VerifyMandatoryTablesArePresent (

// Reset the return Status value to EFI_SUCCESS. We do not fully care if the table look up has failed.
Status = EFI_SUCCESS;
for (Index = 0; Index < ACPI_TABLE_VERIFY_COUNT; Index++) {
for (Index = 0; Index < mAcpiVerifyTablesCount; Index++) {
if (mAcpiVerifyTables[Index].Presence == 0) {
if (mAcpiVerifyTables[Index].IsMandatory) {
DEBUG ((DEBUG_ERROR, "ERROR: %a Table not found.\n", mAcpiVerifyTables[Index].AcpiTableName));
Expand Down Expand Up @@ -623,7 +581,9 @@ ProcessAcpiTables (
}

// Add the FADT Table first.
if ((mAcpiVerifyTables[ACPI_TABLE_VERIFY_FADT].Presence & ACPI_TABLE_PRESENT_INSTALLED) == 0) {
if ((mAcpiVerifyTablesFadtIndex >= 0) &&
((mAcpiVerifyTables[mAcpiVerifyTablesFadtIndex].Presence & ACPI_TABLE_PRESENT_INSTALLED) == 0))
{
// FADT is not yet installed
for (Idx = 0; Idx < AcpiTableCount; Idx++) {
if (CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt) ==
Expand Down Expand Up @@ -785,6 +745,16 @@ DynamicTableManagerDxeInitialize (
CfgMfrInfo->OemId[5]
));

Status = GetAcpiTablePresenceInfo (
&mAcpiVerifyTables,
&mAcpiVerifyTablesCount,
&mAcpiVerifyTablesFadtIndex
);
if (EFI_ERROR (Status)) {
ASSERT_EFI_ERROR (Status);
return Status;
}

Status = ProcessAcpiTables (TableFactoryProtocol, CfgMgrProtocol);
if (EFI_ERROR (Status)) {
DEBUG ((
Expand Down
Loading
Loading