Skip to content

Commit

Permalink
DynamicTablesPkg: Adds X64 FACS generator library
Browse files Browse the repository at this point in the history
Adds a library to generate the ACPI FACS table for X64 architecture.
It gathers the necessary FACS information from the configuration manager.
Additionally, it includes an event to update the hardware signature
in the FACS table, where the hardware signature is the
CRC of all ACPI table's CRC

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 Jan 24, 2025
1 parent feb8d49 commit eda58c1
Show file tree
Hide file tree
Showing 8 changed files with 538 additions and 6 deletions.
4 changes: 3 additions & 1 deletion DynamicTablesPkg/DynamicTables.dsc.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Dsc include file for Dynamic Tables Framework.
#
# Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.<BR>
# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
# Copyright (C) 2024 - 2025 Advanced Micro Devices, Inc. All rights reserved.<BR>
# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
Expand Down Expand Up @@ -57,6 +57,7 @@
#
# Generators (IA32/X64 specific)
#
DynamicTablesPkg/Library/Acpi/X64/AcpiFacsLib/AcpiFacsLib.inf
DynamicTablesPkg/Library/Acpi/X64/AcpiHpetLib/AcpiHpetLib.inf
DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLib/AcpiMadtLib.inf
DynamicTablesPkg/Library/Acpi/X64/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
Expand All @@ -72,6 +73,7 @@
NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf
NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiSpmiLib/AcpiSpmiLib.inf
# X64 specific
NULL|DynamicTablesPkg/Library/Acpi/X64/AcpiFacsLib/AcpiFacsLib.inf
NULL|DynamicTablesPkg/Library/Acpi/X64/AcpiHpetLib/AcpiHpetLib.inf
NULL|DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLib/AcpiMadtLib.inf
NULL|DynamicTablesPkg/Library/Acpi/X64/AcpiWsmtLib/AcpiWsmtLib.inf
Expand Down
5 changes: 4 additions & 1 deletion DynamicTablesPkg/DynamicTablesPkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Copyright (c) 2019, Linaro Limited. All rights reserved.<BR>
# Copyright (c) 2019 - 2022, Arm Limited. All rights reserved.<BR>
# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
# Copyright (C) 2024 - 2025 Advanced Micro Devices, Inc. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
Expand All @@ -27,12 +27,15 @@
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf

[LibraryClasses.ARM, LibraryClasses.AARCH64]
PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
Expand Down
5 changes: 4 additions & 1 deletion DynamicTablesPkg/Include/AcpiTableGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.<BR>
Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.<BR>
Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2024 - 2025 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Expand Down Expand Up @@ -78,6 +78,8 @@ The Dynamic Tables Framework implements the following ACPI table generators:
- SPMI : The SPMI generator collects the SPMI interface and
optionally SPMI interrupt and deviceid (or uid) information from the
Configuration Manager and builds the SPMI table.
- FACS : The FACS generator collates the FACS information from the
Configuration Manager and builds the FACS table.
*/

/** The ACPI_TABLE_GENERATOR_ID type describes ACPI table generator ID.
Expand Down Expand Up @@ -111,6 +113,7 @@ typedef enum StdAcpiTableId {
EStdAcpiTableIdHpet, ///< HPET Generator
EStdAcpiTableIdSsdtHpet, ///< SSDT HPET Generator
EStdAcpiTableIdSpmi, ///< SPMI Generator
EStdAcpiTableIdFacs, ///< FACS Generator
EStdAcpiTableIdMax
} ESTD_ACPI_TABLE_ID;

Expand Down
17 changes: 15 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 - 2025 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Expand Down Expand Up @@ -50,7 +50,8 @@ typedef enum X64ObjectID {
EX64ObjIoApicInfo, ///< 14 - IO APIC info
EX64ObjIntrSourceOverrideInfo, ///< 15 - Interrupt Source Override info
EX64ObjLocalApicX2ApicNmiInfo, ///< 16 - Local APIC and X2APIC NMI info
EX64ObjMax ///< 17 - Maximum Object ID
EX64ObjFacsInfo, ///< 17 - FACS info
EX64ObjMax ///< 18 - Maximum Object ID
} EX64_OBJECT_ID;

/** A structure that describes the
Expand Down Expand Up @@ -265,5 +266,17 @@ typedef struct CmX64LocalApicX2ApicNmiInfo {
UINT8 LocalApicLint;
} CM_X64_LOCAL_APIC_X2APIC_NMI_INFO;

/**
A structure that describes the FACS information.
ID: EX64ObjFacsInfo
*/
typedef struct CmX64FacsInfo {
UINT32 FirmwareWakingVector;
UINT32 Flags;
UINT64 XFirmwareWakingVector;
UINT32 OspmFlags;
} CM_X64_FACS_INFO;

#pragma pack()
#endif // X64_NAMESPACE_OBJECTS_H_
35 changes: 35 additions & 0 deletions DynamicTablesPkg/Library/Acpi/X64/AcpiFacsLib/AcpiFacsLib.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## @file
# Creates ACPI FACS tables for AMD platforms.
#
# Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##

[Defines]
INF_VERSION = 1.30
BASE_NAME = AcpiFacsLib
FILE_GUID = A159F551-FE6D-44FF-82B1-947F466215D4
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = NULL|DXE_DRIVER
CONSTRUCTOR = AcpiFacsLibConstructor
DESTRUCTOR = AcpiFacsLibDestructor

[Sources]
FacsGenerator.c

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

[LibraryClasses]
BaseLib
DebugLib
UefiLib

[Guids]
gEfiAcpiTableGuid
gEfiEventReadyToBootGuid
Loading

0 comments on commit eda58c1

Please sign in to comment.