Skip to content

Commit

Permalink
DynamicTablesPkg: Add X64 MADT table generator
Browse files Browse the repository at this point in the history
Updates X64 namespace object.
Updates the object parser.
Updates the Readme.

Cc: Sami Mujawar <[email protected]>
Cc: Pierre Gondois <[email protected]>
Signed-off-by: Abdul Lateef Attar <[email protected]>
  • Loading branch information
Abdul Lateef Attar authored and pierregondois committed Nov 28, 2024
1 parent 24d835a commit e89ff68
Show file tree
Hide file tree
Showing 7 changed files with 778 additions and 16 deletions.
6 changes: 4 additions & 2 deletions DynamicTablesPkg/DynamicTables.dsc.inc
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@
#
# Generators (IA32/X64 specific)
#
DynamicTablesPkg/Library/Acpi/X64/AcpiWsmtLib/AcpiWsmtLib.inf
DynamicTablesPkg/Library/Acpi/X64/AcpiHpetLib/AcpiHpetLib.inf
DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLib/AcpiMadtLib.inf
DynamicTablesPkg/Library/Acpi/X64/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
DynamicTablesPkg/Library/Acpi/X64/AcpiWsmtLib/AcpiWsmtLib.inf

#
# Dynamic Table Factory Dxe
Expand All @@ -71,9 +72,10 @@
NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf
NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiSpmiLib/AcpiSpmiLib.inf
# X64 specific
NULL|DynamicTablesPkg/Library/Acpi/X64/AcpiWsmtLib/AcpiWsmtLib.inf
NULL|DynamicTablesPkg/Library/Acpi/X64/AcpiHpetLib/AcpiHpetLib.inf
NULL|DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLib/AcpiMadtLib.inf
NULL|DynamicTablesPkg/Library/Acpi/X64/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
NULL|DynamicTablesPkg/Library/Acpi/X64/AcpiWsmtLib/AcpiWsmtLib.inf
}

[Components.ARM, Components.AARCH64]
Expand Down
4 changes: 3 additions & 1 deletion DynamicTablesPkg/DynamicTablesPkg.ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# CI configuration for DynamicTablesPkg
#
# Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
{
Expand Down Expand Up @@ -131,7 +132,8 @@
"TABLEEX",
"TNSID",
"Vatos",
"WBINVD"
"WBINVD",
"xapic"
], # words to extend to the dictionary for this package
"IgnoreStandardPaths": [], # Standard Plugin defined paths that
# should be ignore
Expand Down
78 changes: 76 additions & 2 deletions DynamicTablesPkg/Include/X64NameSpaceObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Defines the X64 Namespace Object.
Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Expand All @@ -17,6 +17,15 @@

#include <IndustryStandard/Acpi.h>

/** The LOCAL_APIC_MODE enum describes the Local APIC
mode in the X64 Namespace
*/
typedef enum {
LocalApicModeInvalid = 0,
LocalApicModeXApic,
LocalApicModeX2Apic
} LOCAL_APIC_MODE;

/** The EX64_OBJECT_ID enum describes the Object IDs
in the X64 Namespace
*/
Expand All @@ -33,7 +42,12 @@ typedef enum X64ObjectID {
EX64ObjFadtMiscInfo, ///< 9 - FADT Legacy fields info
EX64ObjWsmtFlagsInfo, ///< 10 - WSMT protection flags info
EX64ObjHpetInfo, ///< 11 - HPET device info
EX64ObjMax ///< 12 - Maximum Object ID
EX64ObjMadtInfo, ///< 12 - MADT info
EX64ObjLocalApicX2ApicInfo, ///< 13 - Local APIC and X2APIC info
EX64ObjIoApicInfo, ///< 14 - IO APIC info
EX64ObjIntrSourceOverrideInfo, ///< 15 - Interrupt Source Override info
EX64ObjLocalApicX2ApicNmiInfo, ///< 16 - Local APIC and X2APIC NMI info
EX64ObjMax ///< 17 - Maximum Object ID
} EX64_OBJECT_ID;

/** A structure that describes the
Expand Down Expand Up @@ -188,4 +202,64 @@ typedef struct CmX64HpetInfo {
UINT16 MainCounterMinimumClockTickInPeriodicMode;
UINT8 PageProtectionAndOemAttribute;
} CM_X64_HPET_INFO;

/**
A structure that describes the MADT information.
ID: EX64ObjMadtInfo
*/
typedef struct CmX64MadtInfo {
UINT32 LocalApicAddress;
UINT32 Flags;
LOCAL_APIC_MODE ApicMode;
} CM_X64_MADT_INFO;

/**
A structure that describes the Local APIC and X2APIC information.
This structure includes fields from the ACPI_6_5_LOCAL_APIC_STRUCTURE
and ACPI_6_5_LOCAL_X2APIC_STRUCTURE from the ACPI specifications.
Additional fields are included to support CPU SSDT topology generation.
ID: EX64ObjLocalApicX2ApicInfo
*/
typedef struct CmX64LocalApicX2ApicInfo {
UINT32 ApicId;
UINT32 Flags;
UINT32 AcpiProcessorUid;
} CM_X64_LOCAL_APIC_X2APIC_INFO;

/**
A structure that describes the IO APIC information.
ID: EX64ObjIoApicInfo
*/
typedef struct CmX64IoApicInfo {
UINT8 IoApicId;
UINT32 IoApicAddress;
UINT32 GlobalSystemInterruptBase;
} CM_X64_IO_APIC_INFO;

/**
A structure that describes the Interrupt Source Override information.
ID: EX64ObjIntrSourceOverrideInfo
*/
typedef struct CmX64IntrSourceOverrideInfo {
UINT8 Bus;
UINT8 Source;
UINT32 GlobalSystemInterrupt;
UINT16 Flags;
} CM_X64_INTR_SOURCE_OVERRIDE_INFO;

/**
A structure that describes the Local APIC NMI information.
ID: EX64ObjLocalApicX2ApicNmiInfo
*/
typedef struct CmX64LocalApicX2ApicNmiInfo {
UINT16 Flags;
UINT32 AcpiProcessorUid;
UINT8 LocalApicLint;
} CM_X64_LOCAL_APIC_X2APIC_NMI_INFO;

#endif // X64_NAMESPACE_OBJECTS_H_
35 changes: 35 additions & 0 deletions DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLib/AcpiMadtLib.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## @file
# MADT Table Generator
#
# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

[Defines]
INF_VERSION = 1.30
BASE_NAME = AcpiMadtLib
FILE_GUID = 3D0CA837-FDA2-4546-9CDC-42953238E456
VERSION_STRING = 1.0
MODULE_TYPE = DXE_DRIVER
LIBRARY_CLASS = NULL|DXE_DRIVER
CONSTRUCTOR = AcpiMadtLibConstructor
DESTRUCTOR = AcpiMadtLibDestructor

#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64
#

[Sources.IA32, Sources.X64]
MadtGenerator.c

[Packages]
DynamicTablesPkg/DynamicTablesPkg.dec
MdeModulePkg/MdeModulePkg.dec
MdePkg/MdePkg.dec

[LibraryClasses]
BaseLib
DebugLib
Loading

0 comments on commit e89ff68

Please sign in to comment.