diff options
author | 2023-10-10 14:33:42 +0000 | |
---|---|---|
committer | 2023-10-10 14:33:42 +0000 | |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/edk2/DynamicTablesPkg/Include | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/edk2/DynamicTablesPkg/Include')
13 files changed, 3497 insertions, 0 deletions
diff --git a/roms/edk2/DynamicTablesPkg/Include/AcpiTableGenerator.h b/roms/edk2/DynamicTablesPkg/Include/AcpiTableGenerator.h new file mode 100644 index 000000000..ef5018c31 --- /dev/null +++ b/roms/edk2/DynamicTablesPkg/Include/AcpiTableGenerator.h @@ -0,0 +1,365 @@ +/** @file
+
+ Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Glossary:
+ - Cm or CM - Configuration Manager
+ - Obj or OBJ - Object
+ - Std or STD - Standard
+**/
+
+#ifndef ACPI_TABLE_GENERATOR_H_
+#define ACPI_TABLE_GENERATOR_H_
+
+#include <IndustryStandard/Acpi.h>
+
+// Module specific include files.
+#include <TableGenerator.h>
+
+#pragma pack(1)
+
+/**
+The Dynamic Tables Framework provisions two classes of ACPI table
+generators.
+ - Standard generators: The ACPI table generators implemented by the
+ Dynamic Tables Framework.
+ - OEM generators: The ACPI table generators customized by the OEM.
+
+The Dynamic Tables Framework implements the following ACPI table generators:
+ - RAW : This is the simplest ACPI table generator. It simply installs
+ the ACPI table provided in the AcpiTableData member of the
+ CM_STD_OBJ_ACPI_TABLE_INFO. The ACPI table data is provided by
+ the Configuration Manager and is generated using an implementation
+ defined mechanism.
+ - DSDT : The DSDT generator is a clone of the RAW generator. The difference
+ is in the way the ACPI Table Data is generated from an AML file.
+ - SSDT : The SSDT generator is a clone of the RAW generator. The difference
+ is in the way the ACPI Table Data is generated from an AML file.
+ - FADT : The FADT generator collates the required platform information from
+ the Configuration Manager and builds the FADT table.
+ - MADT : The MADT generator collates the GIC information from the
+ Configuration Manager and builds the MADT table.
+ - GTDT : The GTDT generator collates the Timer information from the
+ Configuration Manager and builds the GTDT table.
+ - DBG2 : The DBG2 generator collates the debug serial port information from
+ the Configuration Manager and builds the DBG2 table.
+ - SPCR : The SPCR generator collates the serial port information from the
+ Configuration Manager and builds the SPCR table.
+ - MCFG : The MCFG generator collates the PCI configuration space information
+ from the Configuration Manager and builds the MCFG table.
+ - IORT : The IORT generator collates the IO Topology information from the
+ Configuration Manager and builds the IORT table.
+ - PPTT : The PPTT generator collates the processor topology information from
+ the Configuration Manager and builds the PPTT table.
+ - SRAT : The SRAT generator collates the system resource affinity information
+ from the Configuration Manager and builds the SRAT table.
+ - SSDT Serial-Port:
+ The SSDT Serial generator collates the Serial port information
+ from the Configuration Manager and patches the SSDT Serial Port
+ template to build the SSDT Serial port table.
+*/
+
+/** The ACPI_TABLE_GENERATOR_ID type describes ACPI table generator ID.
+*/
+typedef TABLE_GENERATOR_ID ACPI_TABLE_GENERATOR_ID;
+
+/** The ESTD_ACPI_TABLE_ID enum describes the ACPI table IDs reserved for
+ the standard generators.
+*/
+typedef enum StdAcpiTableId {
+ EStdAcpiTableIdReserved = 0x0000, ///< Reserved
+ EStdAcpiTableIdRaw, ///< RAW Generator
+ EStdAcpiTableIdDsdt = EStdAcpiTableIdRaw, ///< DSDT Generator
+ EStdAcpiTableIdSsdt = EStdAcpiTableIdRaw, ///< SSDT Generator
+ EStdAcpiTableIdFadt, ///< FADT Generator
+ EStdAcpiTableIdMadt, ///< MADT Generator
+ EStdAcpiTableIdGtdt, ///< GTDT Generator
+ EStdAcpiTableIdDbg2, ///< DBG2 Generator
+ EStdAcpiTableIdSpcr, ///< SPCR Generator
+ EStdAcpiTableIdMcfg, ///< MCFG Generator
+ EStdAcpiTableIdIort, ///< IORT Generator
+ EStdAcpiTableIdPptt, ///< PPTT Generator
+ EStdAcpiTableIdSrat, ///< SRAT Generator
+ EStdAcpiTableIdSsdtSerialPort, ///< SSDT Serial-Port Generator
+ EStdAcpiTableIdMax
+} ESTD_ACPI_TABLE_ID;
+
+/** This macro checks if the Table Generator ID is for an ACPI Table Generator.
+
+ @param [in] TableGeneratorId The table generator ID.
+
+ @return TRUE if the table generator ID is for an ACPI Table
+ Generator.
+**/
+#define IS_GENERATOR_TYPE_ACPI(TableGeneratorId) \
+ (GET_TABLE_TYPE (TableGeneratorId) == ETableGeneratorTypeAcpi)
+
+/** This macro checks if the Table Generator ID is for a standard ACPI
+ Table Generator.
+
+ @param [in] TableGeneratorId The table generator ID.
+
+ @return TRUE if the table generator ID is for a standard ACPI
+ Table Generator.
+**/
+#define IS_VALID_STD_ACPI_GENERATOR_ID(TableGeneratorId) \
+ ( \
+ IS_GENERATOR_NAMESPACE_STD (TableGeneratorId) && \
+ IS_GENERATOR_TYPE_ACPI (TableGeneratorId) && \
+ ((GET_TABLE_ID (GeneratorId) >= EStdAcpiTableIdRaw) && \
+ (GET_TABLE_ID (GeneratorId) < EStdAcpiTableIdMax)) \
+ )
+
+/** This macro creates a standard ACPI Table Generator ID.
+
+ @param [in] TableId The table generator ID.
+
+ @return a standard ACPI table generator ID.
+**/
+#define CREATE_STD_ACPI_TABLE_GEN_ID(TableId) \
+ CREATE_TABLE_GEN_ID ( \
+ ETableGeneratorTypeAcpi, \
+ ETableGeneratorNameSpaceStd, \
+ TableId \
+ )
+
+/** This macro creates an OEM ACPI Table Generator ID.
+
+ @param [in] TableId The table generator ID.
+
+ @return an OEM ACPI table generator ID.
+**/
+#define CREATE_OEM_ACPI_TABLE_GEN_ID(TableId) \
+ CREATE_TABLE_GEN_ID ( \
+ ETableGeneratorTypeAcpi, \
+ ETableGeneratorNameSpaceOem, \
+ TableId \
+ )
+
+/** The Creator ID for the ACPI tables generated using
+ the standard ACPI table generators.
+*/
+#define TABLE_GENERATOR_CREATOR_ID_ARM SIGNATURE_32('A', 'R', 'M', 'H')
+
+/** A macro to initialise the common header part of EFI ACPI tables as
+ defined by the EFI_ACPI_DESCRIPTION_HEADER structure.
+
+ @param [in] Signature The ACPI table signature.
+ @param [in] Type The ACPI table structure.
+ @param [in] Revision The ACPI table revision.
+**/
+#define ACPI_HEADER(Signature, Type, Revision) { \
+ Signature, /* UINT32 Signature */ \
+ sizeof (Type), /* UINT32 Length */ \
+ Revision, /* UINT8 Revision */ \
+ 0, /* UINT8 Checksum */ \
+ { 0, 0, 0, 0, 0, 0 }, /* UINT8 OemId[6] */ \
+ 0, /* UINT64 OemTableId */ \
+ 0, /* UINT32 OemRevision */ \
+ 0, /* UINT32 CreatorId */ \
+ 0 /* UINT32 CreatorRevision */\
+ }
+
+/** A macro to dump the common header part of EFI ACPI tables as
+ defined by the EFI_ACPI_DESCRIPTION_HEADER structure.
+
+ @param [in] AcpiHeader The pointer to the ACPI table header.
+**/
+#define DUMP_ACPI_TABLE_HEADER(AcpiHeader) \
+ DEBUG (( \
+ DEBUG_INFO, \
+ "ACPI TABLE %c%c%c%c : Rev 0x%x : Length : 0x%x\n", \
+ (AcpiHeader->Signature & 0xFF), \
+ ((AcpiHeader->Signature >> 8) & 0xFF), \
+ ((AcpiHeader->Signature >> 16) & 0xFF), \
+ ((AcpiHeader->Signature >> 24) & 0xFF), \
+ AcpiHeader->Revision, \
+ AcpiHeader->Length \
+ ));
+
+/** Forward declarations.
+*/
+typedef struct ConfigurationManagerProtocol EDKII_CONFIGURATION_MANAGER_PROTOCOL;
+typedef struct CmAStdObjAcpiTableInfo CM_STD_OBJ_ACPI_TABLE_INFO;
+typedef struct AcpiTableGenerator ACPI_TABLE_GENERATOR;
+
+/** This function pointer describes the interface to ACPI table build
+ functions provided by the ACPI table generator and called by the
+ Table Manager to build an ACPI table.
+
+ @param [in] This Pointer to the ACPI table generator.
+ @param [in] AcpiTableInfo Pointer to the ACPI table information.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol interface.
+ @param [out] Table Pointer to the generated ACPI table.
+
+ @return EFI_SUCCESS If the table is generated successfully or other
+ failure codes as returned by the generator.
+**/
+typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_BUILD_TABLE) (
+ IN CONST ACPI_TABLE_GENERATOR * This,
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
+ OUT EFI_ACPI_DESCRIPTION_HEADER ** Table
+ );
+
+/** This function pointer describes the interface used by the
+ Table Manager to give the generator an opportunity to free
+ any resources allocated for building the ACPI table.
+
+ @param [in] This Pointer to the ACPI table generator.
+ @param [in] AcpiTableInfo Pointer to the ACPI Table Info.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in, out] Table Pointer to the ACPI Table.
+
+ @return EFI_SUCCESS If freed successfully or other failure codes
+ as returned by the generator.
+**/
+typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_FREE_TABLE) (
+ IN CONST ACPI_TABLE_GENERATOR * CONST This,
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table
+ );
+
+/** This function pointer describes an extended interface to build
+ ACPI Tables. The ACPI table generator can generate multiple
+ ACPI Tables and return a pointer to the list of ACPI tables.
+ The FreeTableResourcesEx() must be called to free any resources
+ that may have been allocated using this interface.
+
+ @param [in] This Pointer to the ACPI table generator.
+ @param [in] AcpiTableInfo Pointer to the ACPI table information.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol interface.
+ @param [out] Table Pointer to a list of generated ACPI table(s).
+ @param [out] TableCount Number of generated ACPI table(s).
+
+ @return EFI_SUCCESS If the table is generated successfully or other
+ failure codes as returned by the generator.
+**/
+typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_BUILD_TABLEEX) (
+ IN CONST ACPI_TABLE_GENERATOR * This,
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
+ OUT EFI_ACPI_DESCRIPTION_HEADER *** Table,
+ OUT UINTN * CONST TableCount
+ );
+
+/** This function pointer describes an extended interface used by the
+ Table Manager to give the generator an opportunity to free
+ any resources allocated for building the ACPI table. This interface
+ must be used in conjunction with the BuildAcpiTableEx interface.
+
+ @param [in] This Pointer to the ACPI table generator.
+ @param [in] AcpiTableInfo Pointer to the ACPI Table Info.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in, out] Table Pointer to the list of ACPI Table(s).
+ @param [in] TableCount Number of ACPI table(s).
+
+ @return EFI_SUCCESS If freed successfully or other failure codes
+ as returned by the generator.
+**/
+typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_FREE_TABLEEX) (
+ IN CONST ACPI_TABLE_GENERATOR * CONST This,
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER *** CONST Table,
+ IN CONST UINTN TableCount
+ );
+
+/** The ACPI_TABLE_GENERATOR structure provides an interface that the
+ Table Manager can use to invoke the functions to build ACPI tables.
+
+ Note: Although the Generator is required to implement at least
+ one pair of interfaces (BuildAcpiTable & FreeTableResources or
+ BuildAcpiTableEx & FreeTableResourcesEx) for generating the ACPI
+ table(s), if both pair of interfaces are implemented the extended
+ version will take precedence.
+**/
+typedef struct AcpiTableGenerator {
+ /// The ACPI table generator ID.
+ ACPI_TABLE_GENERATOR_ID GeneratorID;
+
+ /// String describing the ACPI table generator.
+ CONST CHAR16 * Description;
+
+ /// The ACPI table signature.
+ UINT32 AcpiTableSignature;
+
+ /// The ACPI table revision.
+ UINT8 AcpiTableRevision;
+
+ /// The minimum supported ACPI table revision.
+ UINT8 MinAcpiTableRevision;
+
+ /// The ACPI table creator ID.
+ UINT32 CreatorId;
+
+ /// The ACPI table creator revision.
+ UINT32 CreatorRevision;
+
+ /// ACPI table build function pointer.
+ ACPI_TABLE_GENERATOR_BUILD_TABLE BuildAcpiTable;
+
+ /** The function to free any resources
+ allocated for building the ACPI table.
+ */
+ ACPI_TABLE_GENERATOR_FREE_TABLE FreeTableResources;
+
+ /// ACPI table extended build function pointer.
+ ACPI_TABLE_GENERATOR_BUILD_TABLEEX BuildAcpiTableEx;
+
+ /** The function to free any resources
+ allocated for building the ACPI table
+ using the extended interface.
+ */
+ ACPI_TABLE_GENERATOR_FREE_TABLEEX FreeTableResourcesEx;
+} ACPI_TABLE_GENERATOR;
+
+/** Register ACPI table factory generator.
+
+ The ACPI table factory maintains a list of the Standard and OEM ACPI
+ table generators.
+
+ @param [in] Generator Pointer to the ACPI table generator.
+
+ @retval EFI_SUCCESS The Generator was registered
+ successfully.
+ @retval EFI_INVALID_PARAMETER The Generator ID is invalid or
+ the Generator pointer is NULL.
+ @retval EFI_ALREADY_STARTED The Generator for the Table ID is
+ already registered.
+**/
+EFI_STATUS
+EFIAPI
+RegisterAcpiTableGenerator (
+ IN CONST ACPI_TABLE_GENERATOR * CONST Generator
+ );
+
+/** Deregister ACPI generator.
+
+ This function is called by the ACPI table generator to deregister itself
+ from the ACPI table factory.
+
+ @param [in] Generator Pointer to the ACPI table generator.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER The generator is invalid.
+ @retval EFI_NOT_FOUND The requested generator is not found
+ in the list of registered generators.
+**/
+EFI_STATUS
+EFIAPI
+DeregisterAcpiTableGenerator (
+ IN CONST ACPI_TABLE_GENERATOR * CONST Generator
+ );
+
+#pragma pack()
+
+#endif // ACPI_TABLE_GENERATOR_H_
+
diff --git a/roms/edk2/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/roms/edk2/DynamicTablesPkg/Include/ArmNameSpaceObjects.h new file mode 100644 index 000000000..b2534a650 --- /dev/null +++ b/roms/edk2/DynamicTablesPkg/Include/ArmNameSpaceObjects.h @@ -0,0 +1,830 @@ +/** @file
+
+ Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Glossary:
+ - Cm or CM - Configuration Manager
+ - Obj or OBJ - Object
+ - Std or STD - Standard
+**/
+
+#ifndef ARM_NAMESPACE_OBJECTS_H_
+#define ARM_NAMESPACE_OBJECTS_H_
+
+#include <StandardNameSpaceObjects.h>
+
+#pragma pack(1)
+
+/** The EARM_OBJECT_ID enum describes the Object IDs
+ in the ARM Namespace
+*/
+typedef enum ArmObjectID {
+ EArmObjReserved, ///< 0 - Reserved
+ EArmObjBootArchInfo, ///< 1 - Boot Architecture Info
+ EArmObjCpuInfo, ///< 2 - CPU Info
+ EArmObjPowerManagementProfileInfo, ///< 3 - Power Management Profile Info
+ EArmObjGicCInfo, ///< 4 - GIC CPU Interface Info
+ EArmObjGicDInfo, ///< 5 - GIC Distributor Info
+ EArmObjGicMsiFrameInfo, ///< 6 - GIC MSI Frame Info
+ EArmObjGicRedistributorInfo, ///< 7 - GIC Redistributor Info
+ EArmObjGicItsInfo, ///< 8 - GIC ITS Info
+ EArmObjSerialConsolePortInfo, ///< 9 - Serial Console Port Info
+ EArmObjSerialDebugPortInfo, ///< 10 - Serial Debug Port Info
+ EArmObjGenericTimerInfo, ///< 11 - Generic Timer Info
+ EArmObjPlatformGTBlockInfo, ///< 12 - Platform GT Block Info
+ EArmObjGTBlockTimerFrameInfo, ///< 13 - Generic Timer Block Frame Info
+ EArmObjPlatformGenericWatchdogInfo, ///< 14 - Platform Generic Watchdog
+ EArmObjPciConfigSpaceInfo, ///< 15 - PCI Configuration Space Info
+ EArmObjHypervisorVendorIdentity, ///< 16 - Hypervisor Vendor Id
+ EArmObjFixedFeatureFlags, ///< 17 - Fixed feature flags for FADT
+ EArmObjItsGroup, ///< 18 - ITS Group
+ EArmObjNamedComponent, ///< 19 - Named Component
+ EArmObjRootComplex, ///< 20 - Root Complex
+ EArmObjSmmuV1SmmuV2, ///< 21 - SMMUv1 or SMMUv2
+ EArmObjSmmuV3, ///< 22 - SMMUv3
+ EArmObjPmcg, ///< 23 - PMCG
+ EArmObjGicItsIdentifierArray, ///< 24 - GIC ITS Identifier Array
+ EArmObjIdMappingArray, ///< 25 - ID Mapping Array
+ EArmObjSmmuInterruptArray, ///< 26 - SMMU Interrupt Array
+ EArmObjProcHierarchyInfo, ///< 27 - Processor Hierarchy Info
+ EArmObjCacheInfo, ///< 28 - Cache Info
+ EArmObjProcNodeIdInfo, ///< 29 - Processor Node ID Info
+ EArmObjCmRef, ///< 30 - CM Object Reference
+ EArmObjMemoryAffinityInfo, ///< 31 - Memory Affinity Info
+ EArmObjDeviceHandleAcpi, ///< 32 - Device Handle Acpi
+ EArmObjDeviceHandlePci, ///< 33 - Device Handle Pci
+ EArmObjGenericInitiatorAffinityInfo, ///< 34 - Generic Initiator Affinity
+ EArmObjSerialPortInfo, ///< 35 - Generic Serial Port Info
+ EArmObjMax
+} EARM_OBJECT_ID;
+
+/** A structure that describes the
+ ARM Boot Architecture flags.
+
+ ID: EArmObjBootArchInfo
+*/
+typedef struct CmArmBootArchInfo {
+ /** This is the ARM_BOOT_ARCH flags field of the FADT Table
+ described in the ACPI Table Specification.
+ */
+ UINT16 BootArchFlags;
+} CM_ARM_BOOT_ARCH_INFO;
+
+/** A structure that describes the
+ Power Management Profile Information for the Platform.
+
+ ID: EArmObjPowerManagementProfileInfo
+*/
+typedef struct CmArmPowerManagementProfileInfo {
+ /** This is the Preferred_PM_Profile field of the FADT Table
+ described in the ACPI Specification
+ */
+ UINT8 PowerManagementProfile;
+} CM_ARM_POWER_MANAGEMENT_PROFILE_INFO;
+
+/** A structure that describes the
+ GIC CPU Interface for the Platform.
+
+ ID: EArmObjGicCInfo
+*/
+typedef struct CmArmGicCInfo {
+ /// The GIC CPU Interface number.
+ UINT32 CPUInterfaceNumber;
+
+ /** The ACPI Processor UID. This must match the
+ _UID of the CPU Device object information described
+ in the DSDT/SSDT for the CPU.
+ */
+ UINT32 AcpiProcessorUid;
+
+ /** The flags field as described by the GICC structure
+ in the ACPI Specification.
+ */
+ UINT32 Flags;
+
+ /** The parking protocol version field as described by
+ the GICC structure in the ACPI Specification.
+ */
+ UINT32 ParkingProtocolVersion;
+
+ /** The Performance Interrupt field as described by
+ the GICC structure in the ACPI Specification.
+ */
+ UINT32 PerformanceInterruptGsiv;
+
+ /** The CPU Parked address field as described by
+ the GICC structure in the ACPI Specification.
+ */
+ UINT64 ParkedAddress;
+
+ /** The base address for the GIC CPU Interface
+ as described by the GICC structure in the
+ ACPI Specification.
+ */
+ UINT64 PhysicalBaseAddress;
+
+ /** The base address for GICV interface
+ as described by the GICC structure in the
+ ACPI Specification.
+ */
+ UINT64 GICV;
+
+ /** The base address for GICH interface
+ as described by the GICC structure in the
+ ACPI Specification.
+ */
+ UINT64 GICH;
+
+ /** The GICV maintenance interrupt
+ as described by the GICC structure in the
+ ACPI Specification.
+ */
+ UINT32 VGICMaintenanceInterrupt;
+
+ /** The base address for GICR interface
+ as described by the GICC structure in the
+ ACPI Specification.
+ */
+ UINT64 GICRBaseAddress;
+
+ /** The MPIDR for the CPU
+ as described by the GICC structure in the
+ ACPI Specification.
+ */
+ UINT64 MPIDR;
+
+ /** The Processor Power Efficiency class
+ as described by the GICC structure in the
+ ACPI Specification.
+ */
+ UINT8 ProcessorPowerEfficiencyClass;
+
+ /** Statistical Profiling Extension buffer overflow GSIV. Zero if
+ unsupported by this processor. This field was introduced in
+ ACPI 6.3 (MADT revision 5) and is therefore ignored when
+ generating MADT revision 4 or lower.
+ */
+ UINT16 SpeOverflowInterrupt;
+
+ /** The proximity domain to which the logical processor belongs.
+ This field is used to populate the GICC affinity structure
+ in the SRAT table.
+ */
+ UINT32 ProximityDomain;
+
+ /** The clock domain to which the logical processor belongs.
+ This field is used to populate the GICC affinity structure
+ in the SRAT table.
+ */
+ UINT32 ClockDomain;
+
+ /** The GICC Affinity flags field as described by the GICC Affinity structure
+ in the SRAT table.
+ */
+ UINT32 AffinityFlags;
+} CM_ARM_GICC_INFO;
+
+/** A structure that describes the
+ GIC Distributor information for the Platform.
+
+ ID: EArmObjGicDInfo
+*/
+typedef struct CmArmGicDInfo {
+ /// The Physical Base address for the GIC Distributor.
+ UINT64 PhysicalBaseAddress;
+
+ /** The global system interrupt
+ number where this GIC Distributor's
+ interrupt inputs start.
+ */
+ UINT32 SystemVectorBase;
+
+ /** The GIC version as described
+ by the GICD structure in the
+ ACPI Specification.
+ */
+ UINT8 GicVersion;
+} CM_ARM_GICD_INFO;
+
+/** A structure that describes the
+ GIC MSI Frame information for the Platform.
+
+ ID: EArmObjGicMsiFrameInfo
+*/
+typedef struct CmArmGicMsiFrameInfo {
+ /// The GIC MSI Frame ID
+ UINT32 GicMsiFrameId;
+
+ /// The Physical base address for the MSI Frame
+ UINT64 PhysicalBaseAddress;
+
+ /** The GIC MSI Frame flags
+ as described by the GIC MSI frame
+ structure in the ACPI Specification.
+ */
+ UINT32 Flags;
+
+ /// SPI Count used by this frame
+ UINT16 SPICount;
+
+ /// SPI Base used by this frame
+ UINT16 SPIBase;
+} CM_ARM_GIC_MSI_FRAME_INFO;
+
+/** A structure that describes the
+ GIC Redistributor information for the Platform.
+
+ ID: EArmObjGicRedistributorInfo
+*/
+typedef struct CmArmGicRedistInfo {
+ /** The physical address of a page range
+ containing all GIC Redistributors.
+ */
+ UINT64 DiscoveryRangeBaseAddress;
+
+ /// Length of the GIC Redistributor Discovery page range
+ UINT32 DiscoveryRangeLength;
+} CM_ARM_GIC_REDIST_INFO;
+
+/** A structure that describes the
+ GIC Interrupt Translation Service information for the Platform.
+
+ ID: EArmObjGicItsInfo
+*/
+typedef struct CmArmGicItsInfo {
+ /// The GIC ITS ID
+ UINT32 GicItsId;
+
+ /// The physical address for the Interrupt Translation Service
+ UINT64 PhysicalBaseAddress;
+
+ /** The proximity domain to which the logical processor belongs.
+ This field is used to populate the GIC ITS affinity structure
+ in the SRAT table.
+ */
+ UINT32 ProximityDomain;
+} CM_ARM_GIC_ITS_INFO;
+
+/** A structure that describes the
+ Serial Port information for the Platform.
+
+ ID: EArmObjSerialConsolePortInfo or
+ EArmObjSerialDebugPortInfo or
+ EArmObjSerialPortInfo
+*/
+typedef struct CmArmSerialPortInfo {
+ /// The physical base address for the serial port
+ UINT64 BaseAddress;
+
+ /// The serial port interrupt
+ UINT32 Interrupt;
+
+ /// The serial port baud rate
+ UINT64 BaudRate;
+
+ /// The serial port clock
+ UINT32 Clock;
+
+ /// Serial Port subtype
+ UINT16 PortSubtype;
+
+ /// The Base address length
+ UINT64 BaseAddressLength;
+} CM_ARM_SERIAL_PORT_INFO;
+
+/** A structure that describes the
+ Generic Timer information for the Platform.
+
+ ID: EArmObjGenericTimerInfo
+*/
+typedef struct CmArmGenericTimerInfo {
+ /// The physical base address for the counter control frame
+ UINT64 CounterControlBaseAddress;
+
+ /// The physical base address for the counter read frame
+ UINT64 CounterReadBaseAddress;
+
+ /// The secure PL1 timer interrupt
+ UINT32 SecurePL1TimerGSIV;
+
+ /// The secure PL1 timer flags
+ UINT32 SecurePL1TimerFlags;
+
+ /// The non-secure PL1 timer interrupt
+ UINT32 NonSecurePL1TimerGSIV;
+
+ /// The non-secure PL1 timer flags
+ UINT32 NonSecurePL1TimerFlags;
+
+ /// The virtual timer interrupt
+ UINT32 VirtualTimerGSIV;
+
+ /// The virtual timer flags
+ UINT32 VirtualTimerFlags;
+
+ /// The non-secure PL2 timer interrupt
+ UINT32 NonSecurePL2TimerGSIV;
+
+ /// The non-secure PL2 timer flags
+ UINT32 NonSecurePL2TimerFlags;
+
+ /// GSIV for the virtual EL2 timer
+ UINT32 VirtualPL2TimerGSIV;
+
+ /// Flags for the virtual EL2 timer
+ UINT32 VirtualPL2TimerFlags;
+} CM_ARM_GENERIC_TIMER_INFO;
+
+/** A structure that describes the
+ Platform Generic Block Timer Frame information for the Platform.
+
+ ID: EArmObjGTBlockTimerFrameInfo
+*/
+typedef struct CmArmGTBlockTimerFrameInfo {
+ /// The Generic Timer frame number
+ UINT8 FrameNumber;
+
+ /// The physical base address for the CntBase block
+ UINT64 PhysicalAddressCntBase;
+
+ /// The physical base address for the CntEL0Base block
+ UINT64 PhysicalAddressCntEL0Base;
+
+ /// The physical timer interrupt
+ UINT32 PhysicalTimerGSIV;
+
+ /** The physical timer flags as described by the GT Block
+ Timer frame Structure in the ACPI Specification.
+ */
+ UINT32 PhysicalTimerFlags;
+
+ /// The virtual timer interrupt
+ UINT32 VirtualTimerGSIV;
+
+ /** The virtual timer flags as described by the GT Block
+ Timer frame Structure in the ACPI Specification.
+ */
+ UINT32 VirtualTimerFlags;
+
+ /** The common timer flags as described by the GT Block
+ Timer frame Structure in the ACPI Specification.
+ */
+ UINT32 CommonFlags;
+} CM_ARM_GTBLOCK_TIMER_FRAME_INFO;
+
+/** A structure that describes the
+ Platform Generic Block Timer information for the Platform.
+
+ ID: EArmObjPlatformGTBlockInfo
+*/
+typedef struct CmArmGTBlockInfo {
+ /// The physical base address for the GT Block Timer structure
+ UINT64 GTBlockPhysicalAddress;
+
+ /// The number of timer frames implemented in the GT Block
+ UINT32 GTBlockTimerFrameCount;
+
+ /// Reference token for the GT Block timer frame list
+ CM_OBJECT_TOKEN GTBlockTimerFrameToken;
+} CM_ARM_GTBLOCK_INFO;
+
+/** A structure that describes the
+ SBSA Generic Watchdog information for the Platform.
+
+ ID: EArmObjPlatformGenericWatchdogInfo
+*/
+typedef struct CmArmGenericWatchdogInfo {
+ /// The physical base address of the SBSA Watchdog control frame
+ UINT64 ControlFrameAddress;
+
+ /// The physical base address of the SBSA Watchdog refresh frame
+ UINT64 RefreshFrameAddress;
+
+ /// The watchdog interrupt
+ UINT32 TimerGSIV;
+
+ /** The flags for the watchdog as described by the SBSA watchdog
+ structure in the ACPI specification.
+ */
+ UINT32 Flags;
+} CM_ARM_GENERIC_WATCHDOG_INFO;
+
+/** A structure that describes the
+ PCI Configuration Space information for the Platform.
+
+ ID: EArmObjPciConfigSpaceInfo
+*/
+typedef struct CmArmPciConfigSpaceInfo {
+ /// The physical base address for the PCI segment
+ UINT64 BaseAddress;
+
+ /// The PCI segment group number
+ UINT16 PciSegmentGroupNumber;
+
+ /// The start bus number
+ UINT8 StartBusNumber;
+
+ /// The end bus number
+ UINT8 EndBusNumber;
+} CM_ARM_PCI_CONFIG_SPACE_INFO;
+
+/** A structure that describes the
+ Hypervisor Vendor ID information for the Platform.
+
+ ID: EArmObjHypervisorVendorIdentity
+*/
+typedef struct CmArmHypervisorVendorId {
+ /// The hypervisor Vendor ID
+ UINT64 HypervisorVendorId;
+} CM_ARM_HYPERVISOR_VENDOR_ID;
+
+/** A structure that describes the
+ Fixed feature flags for the Platform.
+
+ ID: EArmObjFixedFeatureFlags
+*/
+typedef struct CmArmFixedFeatureFlags {
+ /// The Fixed feature flags
+ UINT32 Flags;
+} CM_ARM_FIXED_FEATURE_FLAGS;
+
+/** A structure that describes the
+ ITS Group node for the Platform.
+
+ ID: EArmObjItsGroup
+*/
+typedef struct CmArmItsGroupNode {
+ /// An unique token used to identify this object
+ CM_OBJECT_TOKEN Token;
+ /// The number of ITS identifiers in the ITS node
+ UINT32 ItsIdCount;
+ /// Reference token for the ITS identifier array
+ CM_OBJECT_TOKEN ItsIdToken;
+} CM_ARM_ITS_GROUP_NODE;
+
+/** A structure that describes the
+ GIC ITS Identifiers for an ITS Group node.
+
+ ID: EArmObjGicItsIdentifierArray
+*/
+typedef struct CmArmGicItsIdentifier {
+ /// The ITS Identifier
+ UINT32 ItsId;
+} CM_ARM_ITS_IDENTIFIER;
+
+/** A structure that describes the
+ Named component node for the Platform.
+
+ ID: EArmObjNamedComponent
+*/
+typedef struct CmArmNamedComponentNode {
+ /// An unique token used to identify this object
+ CM_OBJECT_TOKEN Token;
+ /// Number of ID mappings
+ UINT32 IdMappingCount;
+ /// Reference token for the ID mapping array
+ CM_OBJECT_TOKEN IdMappingToken;
+
+ /// Flags for the named component
+ UINT32 Flags;
+
+ /// Memory access properties : Cache coherent attributes
+ UINT32 CacheCoherent;
+ /// Memory access properties : Allocation hints
+ UINT8 AllocationHints;
+ /// Memory access properties : Memory access flags
+ UINT8 MemoryAccessFlags;
+
+ /// Memory access properties : Address size limit
+ UINT8 AddressSizeLimit;
+ /** ASCII Null terminated string with the full path to
+ the entry in the namespace for this object.
+ */
+ CHAR8* ObjectName;
+} CM_ARM_NAMED_COMPONENT_NODE;
+
+/** A structure that describes the
+ Root complex node for the Platform.
+
+ ID: EArmObjRootComplex
+*/
+typedef struct CmArmRootComplexNode {
+ /// An unique token used to identify this object
+ CM_OBJECT_TOKEN Token;
+ /// Number of ID mappings
+ UINT32 IdMappingCount;
+ /// Reference token for the ID mapping array
+ CM_OBJECT_TOKEN IdMappingToken;
+
+ /// Memory access properties : Cache coherent attributes
+ UINT32 CacheCoherent;
+ /// Memory access properties : Allocation hints
+ UINT8 AllocationHints;
+ /// Memory access properties : Memory access flags
+ UINT8 MemoryAccessFlags;
+
+ /// ATS attributes
+ UINT32 AtsAttribute;
+ /// PCI segment number
+ UINT32 PciSegmentNumber;
+ /// Memory address size limit
+ UINT8 MemoryAddressSize;
+} CM_ARM_ROOT_COMPLEX_NODE;
+
+/** A structure that describes the
+ SMMUv1 or SMMUv2 node for the Platform.
+
+ ID: EArmObjSmmuV1SmmuV2
+*/
+typedef struct CmArmSmmuV1SmmuV2Node {
+ /// An unique token used to identify this object
+ CM_OBJECT_TOKEN Token;
+ /// Number of ID mappings
+ UINT32 IdMappingCount;
+ /// Reference token for the ID mapping array
+ CM_OBJECT_TOKEN IdMappingToken;
+
+ /// SMMU Base Address
+ UINT64 BaseAddress;
+ /// Length of the memory range covered by the SMMU
+ UINT64 Span;
+ /// SMMU Model
+ UINT32 Model;
+ /// SMMU flags
+ UINT32 Flags;
+
+ /// Number of context interrupts
+ UINT32 ContextInterruptCount;
+ /// Reference token for the context interrupt array
+ CM_OBJECT_TOKEN ContextInterruptToken;
+
+ /// Number of PMU interrupts
+ UINT32 PmuInterruptCount;
+ /// Reference token for the PMU interrupt array
+ CM_OBJECT_TOKEN PmuInterruptToken;
+
+ /// GSIV of the SMMU_NSgIrpt interrupt
+ UINT32 SMMU_NSgIrpt;
+ /// SMMU_NSgIrpt interrupt flags
+ UINT32 SMMU_NSgIrptFlags;
+ /// GSIV of the SMMU_NSgCfgIrpt interrupt
+ UINT32 SMMU_NSgCfgIrpt;
+ /// SMMU_NSgCfgIrpt interrupt flags
+ UINT32 SMMU_NSgCfgIrptFlags;
+} CM_ARM_SMMUV1_SMMUV2_NODE;
+
+/** A structure that describes the
+ SMMUv3 node for the Platform.
+
+ ID: EArmObjSmmuV3
+*/
+typedef struct CmArmSmmuV3Node {
+ /// An unique token used to identify this object
+ CM_OBJECT_TOKEN Token;
+ /// Number of ID mappings
+ UINT32 IdMappingCount;
+ /// Reference token for the ID mapping array
+ CM_OBJECT_TOKEN IdMappingToken;
+
+ /// SMMU Base Address
+ UINT64 BaseAddress;
+ /// SMMU flags
+ UINT32 Flags;
+ /// VATOS address
+ UINT64 VatosAddress;
+ /// Model
+ UINT32 Model;
+ /// GSIV of the Event interrupt if SPI based
+ UINT32 EventInterrupt;
+ /// PRI Interrupt if SPI based
+ UINT32 PriInterrupt;
+ /// GERR interrupt if GSIV based
+ UINT32 GerrInterrupt;
+ /// Sync interrupt if GSIV based
+ UINT32 SyncInterrupt;
+
+ /// Proximity domain flag
+ UINT32 ProximityDomain;
+ /// Index into the array of ID mapping
+ UINT32 DeviceIdMappingIndex;
+} CM_ARM_SMMUV3_NODE;
+
+/** A structure that describes the
+ PMCG node for the Platform.
+
+ ID: EArmObjPmcg
+*/
+typedef struct CmArmPmcgNode {
+ /// An unique token used to identify this object
+ CM_OBJECT_TOKEN Token;
+ /// Number of ID mappings
+ UINT32 IdMappingCount;
+ /// Reference token for the ID mapping array
+ CM_OBJECT_TOKEN IdMappingToken;
+
+ /// Base Address for performance monitor counter group
+ UINT64 BaseAddress;
+ /// GSIV for the Overflow interrupt
+ UINT32 OverflowInterrupt;
+ /// Page 1 Base address
+ UINT64 Page1BaseAddress;
+
+ /// Reference token for the IORT node associated with this node
+ CM_OBJECT_TOKEN ReferenceToken;
+} CM_ARM_PMCG_NODE;
+
+/** A structure that describes the
+ ID Mappings for the Platform.
+
+ ID: EArmObjIdMappingArray
+*/
+typedef struct CmArmIdMapping {
+ /// Input base
+ UINT32 InputBase;
+ /// Number of input IDs
+ UINT32 NumIds;
+ /// Output Base
+ UINT32 OutputBase;
+ /// Reference token for the output node
+ CM_OBJECT_TOKEN OutputReferenceToken;
+ /// Flags
+ UINT32 Flags;
+} CM_ARM_ID_MAPPING;
+
+/** A structure that describes the
+ SMMU interrupts for the Platform.
+
+ ID: EArmObjSmmuInterruptArray
+*/
+typedef struct CmArmSmmuInterrupt {
+ /// Interrupt number
+ UINT32 Interrupt;
+
+ /// Flags
+ UINT32 Flags;
+} CM_ARM_SMMU_INTERRUPT;
+
+/** A structure that describes the Processor Hierarchy Node (Type 0) in PPTT
+
+ ID: EArmObjProcHierarchyInfo
+*/
+typedef struct CmArmProcHierarchyInfo {
+ /// A unique token used to identify this object
+ CM_OBJECT_TOKEN Token;
+ /// Processor structure flags (ACPI 6.3 - January 2019, PPTT, Table 5-155)
+ UINT32 Flags;
+ /// Token for the parent CM_ARM_PROC_HIERARCHY_INFO object in the processor
+ /// topology. A value of CM_NULL_TOKEN means this node has no parent.
+ CM_OBJECT_TOKEN ParentToken;
+ /// Token of the associated CM_ARM_GICC_INFO object which has the
+ /// corresponding ACPI Processor ID. A value of CM_NULL_TOKEN means this
+ /// node represents a group of associated processors and it does not have an
+ /// associated GIC CPU interface.
+ CM_OBJECT_TOKEN GicCToken;
+ /// Number of resources private to this Node
+ UINT32 NoOfPrivateResources;
+ /// Token of the array which contains references to the resources private to
+ /// this CM_ARM_PROC_HIERARCHY_INFO instance. This field is ignored if
+ /// the NoOfPrivateResources is 0, in which case it is recommended to set
+ /// this field to CM_NULL_TOKEN.
+ CM_OBJECT_TOKEN PrivateResourcesArrayToken;
+} CM_ARM_PROC_HIERARCHY_INFO;
+
+/** A structure that describes the Cache Type Structure (Type 1) in PPTT
+
+ ID: EArmObjCacheInfo
+*/
+typedef struct CmArmCacheInfo {
+ /// A unique token used to identify this object
+ CM_OBJECT_TOKEN Token;
+ /// Reference token for the next level of cache that is private to the same
+ /// CM_ARM_PROC_HIERARCHY_INFO instance. A value of CM_NULL_TOKEN means this
+ /// entry represents the last cache level appropriate to the processor
+ /// hierarchy node structures using this entry.
+ CM_OBJECT_TOKEN NextLevelOfCacheToken;
+ /// Size of the cache in bytes
+ UINT32 Size;
+ /// Number of sets in the cache
+ UINT32 NumberOfSets;
+ /// Integer number of ways. The maximum associativity supported by
+ /// ACPI Cache type structure is limited to MAX_UINT8. However,
+ /// the maximum number of ways supported by the architecture is
+ /// PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX. Therfore this field
+ /// is 32-bit wide.
+ UINT32 Associativity;
+ /// Cache attributes (ACPI 6.3 - January 2019, PPTT, Table 5-156)
+ UINT8 Attributes;
+ /// Line size in bytes
+ UINT16 LineSize;
+} CM_ARM_CACHE_INFO;
+
+/** A structure that describes the ID Structure (Type 2) in PPTT
+
+ ID: EArmObjProcNodeIdInfo
+*/
+typedef struct CmArmProcNodeIdInfo {
+ /// A unique token used to identify this object
+ CM_OBJECT_TOKEN Token;
+ // Vendor ID (as described in ACPI ID registry)
+ UINT32 VendorId;
+ /// First level unique node ID
+ UINT64 Level1Id;
+ /// Second level unique node ID
+ UINT64 Level2Id;
+ /// Major revision of the node
+ UINT16 MajorRev;
+ /// Minor revision of the node
+ UINT16 MinorRev;
+ /// Spin revision of the node
+ UINT16 SpinRev;
+} CM_ARM_PROC_NODE_ID_INFO;
+
+/** A structure that describes a reference to another Configuration Manager
+ object.
+
+ This is useful for creating an array of reference tokens. The framework
+ can then query the configuration manager for these arrays using the
+ object ID EArmObjCmRef.
+
+ This can be used is to represent one-to-many relationships between objects.
+
+ ID: EArmObjCmRef
+*/
+typedef struct CmArmObjRef {
+ /// Token of the CM object being referenced
+ CM_OBJECT_TOKEN ReferenceToken;
+} CM_ARM_OBJ_REF;
+
+/** A structure that describes the Memory Affinity Structure (Type 1) in SRAT
+
+ ID: EArmObjMemoryAffinityInfo
+*/
+typedef struct CmArmMemoryAffinityInfo {
+ /// The proximity domain to which the "range of memory" belongs.
+ UINT32 ProximityDomain;
+
+ /// Base Address
+ UINT64 BaseAddress;
+
+ /// Length
+ UINT64 Length;
+
+ /// Flags
+ UINT32 Flags;
+} CM_ARM_MEMORY_AFFINITY_INFO;
+
+/** A structure that describes the ACPI Device Handle (Type 0) in the
+ Generic Initiator Affinity structure in SRAT
+
+ ID: EArmObjDeviceHandleAcpi
+*/
+typedef struct CmArmDeviceHandleAcpi {
+ /// Hardware ID
+ UINT64 Hid;
+
+ /// Unique Id
+ UINT32 Uid;
+} CM_ARM_DEVICE_HANDLE_ACPI;
+
+/** A structure that describes the PCI Device Handle (Type 1) in the
+ Generic Initiator Affinity structure in SRAT
+
+ ID: EArmObjDeviceHandlePci
+*/
+typedef struct CmArmDeviceHandlePci {
+ /// PCI Segment Number
+ UINT16 SegmentNumber;
+
+ /// PCI Bus Number - Max 256 busses (Bits 15:8 of BDF)
+ UINT8 BusNumber;
+
+ /// PCI Device Number - Max 32 devices (Bits 7:3 of BDF)
+ UINT8 DeviceNumber;
+
+ /// PCI Function Number - Max 8 functions (Bits 2:0 of BDF)
+ UINT8 FunctionNumber;
+} CM_ARM_DEVICE_HANDLE_PCI;
+
+/** A structure that describes the Generic Initiator Affinity structure in SRAT
+
+ ID: EArmObjGenericInitiatorAffinityInfo
+*/
+typedef struct CmArmGenericInitiatorAffinityInfo {
+ /// The proximity domain to which the generic initiator belongs.
+ UINT32 ProximityDomain;
+
+ /// Flags
+ UINT32 Flags;
+
+ /// Device Handle Type
+ UINT8 DeviceHandleType;
+
+ /// Reference Token for the Device Handle
+ CM_OBJECT_TOKEN DeviceHandleToken;
+} CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO;
+
+#pragma pack()
+
+#endif // ARM_NAMESPACE_OBJECTS_H_
diff --git a/roms/edk2/DynamicTablesPkg/Include/ConfigurationManagerHelper.h b/roms/edk2/DynamicTablesPkg/Include/ConfigurationManagerHelper.h new file mode 100644 index 000000000..29f34a043 --- /dev/null +++ b/roms/edk2/DynamicTablesPkg/Include/ConfigurationManagerHelper.h @@ -0,0 +1,126 @@ +/** @file
+
+ Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Glossary:
+ - Cm or CM - Configuration Manager
+ - Obj or OBJ - Object
+**/
+
+#ifndef CONFIGURATION_MANAGER_HELPER_H_
+#define CONFIGURATION_MANAGER_HELPER_H_
+
+/** The GET_OBJECT_LIST macro expands to a function that is used to retrieve
+ an object or an object list from the Configuration Manager using the
+ Configuration Manager Protocol interface.
+
+ The macro expands to a function which has the following prototype:
+
+ STATIC
+ EFI_STATUS
+ EFIAPI
+ Get<CmObjectId> (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
+ IN CONST CM_OBJECT_TOKEN Token OPTIONAL,
+ OUT Type ** List,
+ OUT UINT32 * Count OPTIONAL
+ );
+
+ Generated function parameters:
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager protocol
+ interface.
+ @param [in] Token Reference token for the Object.
+ @param [out] List Pointer to the Object list.
+ @param [out] Count Count of the objects returned in the list.
+
+ Macro Parameters:
+ @param [in] CmObjectNameSpace The Object Namespace
+ @param [in] CmObjectId Object Id.
+ @param [in] Type Structure used to describe the Object.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object information is not found.
+ @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
+ Manager is less than the Object size for the
+ requested object.
+**/
+#define GET_OBJECT_LIST(CmObjectNameSpace, CmObjectId, Type) \
+STATIC \
+EFI_STATUS \
+EFIAPI \
+Get##CmObjectId ( \
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, \
+ IN CONST CM_OBJECT_TOKEN Token OPTIONAL, \
+ OUT Type ** List, \
+ OUT UINT32 * CONST Count OPTIONAL \
+ ) \
+{ \
+ EFI_STATUS Status; \
+ CM_OBJ_DESCRIPTOR CmObjectDesc; \
+ UINT32 ObjCount = 0; \
+ if (List == NULL) { \
+ Status = EFI_INVALID_PARAMETER; \
+ DEBUG (( \
+ DEBUG_ERROR, \
+ "ERROR: Get" #CmObjectId ": Invalid out parameter for" \
+ " object list. Status = %r\n", \
+ Status \
+ )); \
+ goto error_handler; \
+ } \
+ Status = CfgMgrProtocol->GetObject ( \
+ CfgMgrProtocol, \
+ CREATE_CM_OBJECT_ID ( \
+ CmObjectNameSpace, \
+ CmObjectId \
+ ), \
+ Token, \
+ &CmObjectDesc \
+ ); \
+ if (EFI_ERROR (Status)) { \
+ DEBUG (( \
+ DEBUG_INFO, \
+ "INFO: Get" #CmObjectId ": Platform does not implement " \
+ #CmObjectId ". Status = %r\n", \
+ Status \
+ )); \
+ *List = NULL; \
+ goto error_handler; \
+ } \
+ if (CmObjectDesc.ObjectId != \
+ CREATE_CM_OBJECT_ID (CmObjectNameSpace, CmObjectId)) { \
+ DEBUG (( \
+ DEBUG_ERROR, \
+ "ERROR: Get" #CmObjectId ": " #CmObjectId \
+ ": Invalid ObjectId = 0x%x\n, expected Id = 0x%x\n", \
+ CmObjectDesc.ObjectId, \
+ CREATE_CM_OBJECT_ID (CmObjectNameSpace, CmObjectId) \
+ )); \
+ ASSERT (FALSE); \
+ Status = EFI_INVALID_PARAMETER; \
+ goto error_handler; \
+ } \
+ if (CmObjectDesc.Size < (sizeof (Type) * CmObjectDesc.Count)) { \
+ DEBUG (( \
+ DEBUG_ERROR, \
+ "ERROR: Get" #CmObjectId ": " #CmObjectId \
+ ": Buffer too small, size = 0x%x\n", \
+ CmObjectDesc.Size \
+ )); \
+ ASSERT (FALSE); \
+ Status = EFI_BAD_BUFFER_SIZE; \
+ goto error_handler; \
+ } \
+ ObjCount = CmObjectDesc.Count; \
+ *List = (Type*)CmObjectDesc.Data; \
+error_handler: \
+ if (Count != NULL) { \
+ *Count = ObjCount; \
+ } \
+ return Status; \
+}
+
+#endif // CONFIGURATION_MANAGER_HELPER_H_
diff --git a/roms/edk2/DynamicTablesPkg/Include/ConfigurationManagerObject.h b/roms/edk2/DynamicTablesPkg/Include/ConfigurationManagerObject.h new file mode 100644 index 000000000..b0d3e709e --- /dev/null +++ b/roms/edk2/DynamicTablesPkg/Include/ConfigurationManagerObject.h @@ -0,0 +1,190 @@ +/** @file
+
+ Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Glossary:
+ - Cm or CM - Configuration Manager
+ - Obj or OBJ - Object
+**/
+
+#ifndef CONFIGURATION_MANAGER_OBJECT_H_
+#define CONFIGURATION_MANAGER_OBJECT_H_
+
+#include <ArmNameSpaceObjects.h>
+#include <StandardNameSpaceObjects.h>
+
+#pragma pack(1)
+
+/** The CM_OBJECT_ID type is used to identify the Configuration Manager
+ objects.
+
+ Description of Configuration Manager Object ID
+_______________________________________________________________________________
+|31 |30 |29 |28 || 27 | 26 | 25 | 24 || 23 | 22 | 21 | 20 || 19 | 18 | 17 | 16|
+-------------------------------------------------------------------------------
+| Name Space ID || 0 | 0 | 0 | 0 || 0 | 0 | 0 | 0 || 0 | 0 | 0 | 0|
+_______________________________________________________________________________
+
+Bits: [31:28] - Name Space ID
+ 0000 - Standard
+ 0001 - ARM
+ 1000 - Custom/OEM
+ All other values are reserved.
+
+Bits: [27:16] - Reserved.
+_______________________________________________________________________________
+|15 |14 |13 |12 || 11 | 10 | 9 | 8 || 7 | 6 | 5 | 4 || 3 | 2 | 1 | 0|
+-------------------------------------------------------------------------------
+| 0 | 0 | 0 | 0 || 0 | 0 | 0 | 0 || Object ID |
+_______________________________________________________________________________
+
+Bits: [15:8] - Are reserved and must be zero.
+
+Bits: [7:0] - Object ID
+
+Object ID's in the Standard Namespace:
+ 0 - Configuration Manager Revision
+ 1 - ACPI Table List
+ 2 - SMBIOS Table List
+
+Object ID's in the ARM Namespace:
+ 0 - Reserved
+ 1 - Boot Architecture Info
+ 2 - CPU Info
+ 3 - Power Management Profile Info
+ 4 - GICC Info
+ 5 - GICD Info
+ 6 - GIC MSI Frame Info
+ 7 - GIC Redistributor Info
+ 8 - GIC ITS Info
+ 9 - Serial Console Port Info
+ 10 - Serial Debug Port Info
+ 11 - Generic Timer Info
+ 12 - Platform GT Block Info
+ 13 - Generic Timer Block Frame Info
+ 14 - Platform Generic Watchdog
+ 15 - PCI Configuration Space Info
+ 16 - Hypervisor Vendor Id
+ 17 - Fixed feature flags for FADT
+ 18 - ITS Group
+ 19 - Named Component
+ 20 - Root Complex
+ 21 - SMMUv1 or SMMUv2
+ 22 - SMMUv3
+ 23 - PMCG
+ 24 - GIC ITS Identifier Array
+ 25 - ID Mapping Array
+ 26 - SMMU Interrupt Array
+ 27 - Processor Hierarchy Info
+ 28 - Cache Info
+ 29 - Processor Hierarchy Node ID Info
+ 30 - CM Object Reference
+*/
+typedef UINT32 CM_OBJECT_ID;
+
+/** A mask for Object ID
+*/
+#define OBJECT_ID_MASK 0xFF
+
+/** A mask for Namespace ID
+*/
+#define NAMESPACE_ID_MASK 0xF
+
+/** Starting bit position for Namespace ID
+*/
+#define NAMESPACE_ID_BIT_SHIFT 28
+
+/** The EOBJECT_NAMESPACE_ID enum describes the defined namespaces
+ for the Configuration Manager Objects.
+*/
+typedef enum ObjectNameSpaceID {
+ EObjNameSpaceStandard, ///< Standard Objects Namespace
+ EObjNameSpaceArm, ///< ARM Objects Namespace
+ EObjNameSpaceOem = 0x8, ///< OEM Objects Namespace
+ EObjNameSpaceMax
+} EOBJECT_NAMESPACE_ID;
+
+/** A descriptor for Configuration Manager Objects.
+
+ The Configuration Manager Protocol interface uses this descriptor
+ to return the Configuration Manager Objects.
+*/
+typedef struct CmObjDescriptor {
+ /// Object Id
+ CM_OBJECT_ID ObjectId;
+
+ /// Size of the described Object or Object List
+ UINT32 Size;
+
+ /// Pointer to the described Object or Object List
+ VOID * Data;
+
+ /// Count of objects in the list
+ UINT32 Count;
+} CM_OBJ_DESCRIPTOR;
+
+#pragma pack()
+
+/** This macro returns the namespace ID from the CmObjectID.
+
+ @param [in] CmObjectId The Configuration Manager Object ID.
+
+ @retval Returns the Namespace ID corresponding to the CmObjectID.
+**/
+#define GET_CM_NAMESPACE_ID(CmObjectId) \
+ (((CmObjectId) >> NAMESPACE_ID_BIT_SHIFT) & \
+ NAMESPACE_ID_MASK)
+
+/** This macro returns the Object ID from the CmObjectID.
+
+ @param [in] CmObjectId The Configuration Manager Object ID.
+
+ @retval Returns the Object ID corresponding to the CmObjectID.
+**/
+#define GET_CM_OBJECT_ID(CmObjectId) ((CmObjectId) & OBJECT_ID_MASK)
+
+/** This macro returns a Configuration Manager Object ID
+ from the NameSpace ID and the ObjectID.
+
+ @param [in] NameSpaceId The namespace ID for the Object.
+ @param [in] ObjectId The Object ID.
+
+ @retval Returns the Configuration Manager Object ID.
+**/
+#define CREATE_CM_OBJECT_ID(NameSpaceId, ObjectId) \
+ ((((NameSpaceId) & NAMESPACE_ID_MASK) << NAMESPACE_ID_BIT_SHIFT) | \
+ ((ObjectId) & OBJECT_ID_MASK))
+
+/** This macro returns a Configuration Manager Object ID
+ in the Standard Object Namespace.
+
+ @param [in] ObjectId The Object ID.
+
+ @retval Returns a Standard Configuration Manager Object ID.
+**/
+#define CREATE_CM_STD_OBJECT_ID(ObjectId) \
+ (CREATE_CM_OBJECT_ID (EObjNameSpaceStandard, ObjectId))
+
+/** This macro returns a Configuration Manager Object ID
+ in the ARM Object Namespace.
+
+ @param [in] ObjectId The Object ID.
+
+ @retval Returns an ARM Configuration Manager Object ID.
+**/
+#define CREATE_CM_ARM_OBJECT_ID(ObjectId) \
+ (CREATE_CM_OBJECT_ID (EObjNameSpaceArm, ObjectId))
+
+/** This macro returns a Configuration Manager Object ID
+ in the OEM Object Namespace.
+
+ @param [in] ObjectId The Object ID.
+
+ @retval Returns an OEM Configuration Manager Object ID.
+**/
+#define CREATE_CM_OEM_OBJECT_ID(ObjectId) \
+ (CREATE_CM_OBJECT_ID (EObjNameSpaceOem, ObjectId))
+
+#endif // CONFIGURATION_MANAGER_OBJECT_H_
diff --git a/roms/edk2/DynamicTablesPkg/Include/DeviceTreeTableGenerator.h b/roms/edk2/DynamicTablesPkg/Include/DeviceTreeTableGenerator.h new file mode 100644 index 000000000..d4842b32a --- /dev/null +++ b/roms/edk2/DynamicTablesPkg/Include/DeviceTreeTableGenerator.h @@ -0,0 +1,176 @@ +/** @file
+
+ Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Glossary:
+ - Cm or CM - Configuration Manager
+ - Obj or OBJ - Object
+ - Std or STD - Standard
+**/
+
+#ifndef DEVICETREE_TABLE_GENERATOR_H_
+#define DEVICETREE_TABLE_GENERATOR_H_
+
+#include <TableGenerator.h>
+
+#pragma pack(1)
+
+/** The DT_TABLE_GENERATOR_ID type describes Device Tree table generator ID.
+*/
+typedef TABLE_GENERATOR_ID DT_TABLE_GENERATOR_ID;
+
+/** The ESTD_DT_TABLE_ID enum describes the DT table IDs reserved for
+ the standard generators.
+*/
+typedef enum StdDtTableId {
+ EStdDtTableIdReserved = 0x0000, ///< Reserved.
+ EStdDtTableIdRaw, ///< RAW Generator.
+ EStdDtTableIdMax
+} ESTD_DT_TABLE_ID;
+
+/** This macro checks if the Table Generator ID is for an DT Table Generator.
+
+ @param [in] TableGeneratorId The table generator ID.
+
+ @return TRUE if the table generator ID is for an DT Table
+ Generator.
+**/
+#define IS_GENERATOR_TYPE_DT(TableGeneratorId) \
+ (GET_TABLE_TYPE(TableGeneratorId) == ETableGeneratorTypeDt)
+
+/** This macro checks if the Table Generator ID is for a standard DT
+ Table Generator.
+
+ @param [in] TableGeneratorId The table generator ID.
+
+ @return TRUE if the table generator ID is for a standard DT
+ Table Generator.
+**/
+#define IS_VALID_STD_DT_GENERATOR_ID(TableGeneratorId) \
+ ( \
+ IS_GENERATOR_NAMESPACE_STD(TableGeneratorId) && \
+ IS_GENERATOR_TYPE_DT(TableGeneratorId) && \
+ ((GET_TABLE_ID(GeneratorId) >= EStdDtTableIdRaw) && \
+ (GET_TABLE_ID(GeneratorId) < EStdDtTableIdMax)) \
+ )
+
+/** This macro creates a standard DT Table Generator ID.
+
+ @param [in] TableId The table generator ID.
+
+ @return a standard DT table generator ID.
+**/
+#define CREATE_STD_DT_TABLE_GEN_ID(TableId) \
+ CREATE_TABLE_GEN_ID ( \
+ ETableGeneratorTypeDt, \
+ ETableGeneratorNameSpaceStd, \
+ TableId \
+ )
+
+/** Forward declarations.
+*/
+typedef struct ConfigurationManagerProtocol EDKII_CONFIGURATION_MANAGER_PROTOCOL;
+typedef struct CmAStdObjDtTableInfo CM_STD_OBJ_DT_TABLE_INFO;
+typedef struct DtTableGenerator DT_TABLE_GENERATOR;
+
+/** This function pointer describes the interface to DT table build
+ functions provided by the DT table generator and called by the
+ Table Manager to build an DT table.
+
+ @param [in] Generator Pointer to the DT table generator.
+ @param [in] DtTableInfo Pointer to the DT table information.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol interface.
+ @param [out] Table Pointer to the generated DT table.
+
+ @return EFI_SUCCESS If the table is generated successfully or other
+ failure codes as returned by the generator.
+**/
+typedef EFI_STATUS (*DT_TABLE_GENERATOR_BUILD_TABLE) (
+ IN CONST DT_TABLE_GENERATOR * Generator,
+ IN CONST CM_STD_OBJ_DT_TABLE_INFO * CONST DtTableInfo,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
+ OUT VOID ** Table
+ );
+
+/** This function pointer describes the interface to used by the
+ Table Manager to give the generator an opportunity to free
+ any resources allocated for building the DT table.
+
+ @param [in] Generator Pointer to the DT table generator.
+ @param [in] DtTableInfo Pointer to the DT table information.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol interface.
+ @param [in] Table Pointer to the generated DT table.
+
+ @return EFI_SUCCESS If freed successfully or other failure codes
+ as returned by the generator.
+**/
+typedef EFI_STATUS (*DT_TABLE_GENERATOR_FREE_TABLE) (
+ IN CONST DT_TABLE_GENERATOR * Generator,
+ IN CONST CM_STD_OBJ_DT_TABLE_INFO * CONST DtTableInfo,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
+ IN VOID ** Table
+ );
+
+/** The DT_TABLE_GENERATOR structure provides an interface that the
+ Table Manager can use to invoke the functions to build DT tables.
+*/
+typedef struct DtTableGenerator {
+ /// The DT table generator ID.
+ DT_TABLE_GENERATOR_ID GeneratorID;
+
+ /// String describing the DT table generator.
+ CONST CHAR16 * Description;
+
+ /// DT table build function pointer.
+ DT_TABLE_GENERATOR_BUILD_TABLE BuildDtTable;
+
+ /// The function to free any resources allocated for building the DT table.
+ DT_TABLE_GENERATOR_FREE_TABLE FreeTableResources;
+} DT_TABLE_GENERATOR;
+
+/** Register DT table factory generator.
+
+ The DT table factory maintains a list of the Standard and OEM DT
+ table generators.
+
+ @param [in] Generator Pointer to the DT table generator.
+
+ @retval EFI_SUCCESS The Generator was registered
+ successfully.
+ @retval EFI_INVALID_PARAMETER The Generator ID is invalid or
+ the Generator pointer is NULL.
+ @retval EFI_ALREADY_STARTED The Generator for the Table ID is
+ already registered.
+**/
+EFI_STATUS
+EFIAPI
+RegisterDtTableGenerator (
+ IN CONST DT_TABLE_GENERATOR * CONST Generator
+ );
+
+/** Deregister DT generator.
+
+ This function is called by the DT table generator to deregister itself
+ from the DT table factory.
+
+ @param [in] Generator Pointer to the DT table generator.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER The generator is invalid.
+ @retval EFI_NOT_FOUND The requested generator is not found
+ in the list of registered generators.
+**/
+EFI_STATUS
+EFIAPI
+DeregisterDtTableGenerator (
+ IN CONST DT_TABLE_GENERATOR * CONST Generator
+ );
+
+#pragma pack()
+
+#endif // DEVICETREE_TABLE_GENERATOR_H_
+
diff --git a/roms/edk2/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/roms/edk2/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h new file mode 100644 index 000000000..1dcb93861 --- /dev/null +++ b/roms/edk2/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -0,0 +1,631 @@ +/** @file
+ AML Lib.
+
+ Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef AML_LIB_H_
+#define AML_LIB_H_
+
+/**
+ @mainpage Dynamic AML Generation
+ @{
+ @par Summary
+ @{
+ ACPI tables are categorized as data tables and definition block
+ tables. Dynamic Tables Framework currently supports generation of ACPI
+ data tables. Generation of definition block tables is difficult as these
+ tables are encoded in ACPI Machine Language (AML), which has a complex
+ grammar.
+
+ Dynamic AML Generation is an extension to the Dynamic tables Framework.
+ One of the techniques used to simplify definition block generation is to
+ fixup a template SSDT table.
+
+ Dynamic AML aims to provide a framework that allows fixing up of an ACPI
+ SSDT template with appropriate information about the hardware.
+
+ This framework consists of an:
+ - AMLLib core that implements a rich set of interfaces to parse, traverse
+ and update AML data.
+ - AMLLib library APIs that provides interfaces to search and updates nodes
+ in the AML namespace.
+ @}
+ @}
+*/
+
+#include <IndustryStandard/Acpi.h>
+
+#ifndef AML_HANDLE
+
+/** Node handle.
+*/
+typedef void* AML_NODE_HANDLE;
+
+/** Root Node handle.
+*/
+typedef void* AML_ROOT_NODE_HANDLE;
+
+/** Object Node handle.
+*/
+typedef void* AML_OBJECT_NODE_HANDLE;
+
+/** Data Node handle.
+*/
+typedef void* AML_DATA_NODE_HANDLE;
+
+#endif // AML_HANDLE
+
+/** Parse the definition block.
+
+ The function parses the whole AML blob. It starts with the ACPI DSDT/SSDT
+ header and then parses the AML bytestream.
+ A tree structure is returned via the RootPtr.
+ The tree must be deleted with the AmlDeleteTree function.
+
+ @ingroup UserApis
+
+ @param [in] DefinitionBlock Pointer to the definition block.
+ @param [out] RootPtr Pointer to the root node of the AML tree.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_BUFFER_TOO_SMALL No space left in the buffer.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Could not allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlParseDefinitionBlock (
+ IN CONST EFI_ACPI_DESCRIPTION_HEADER * DefinitionBlock,
+ OUT AML_ROOT_NODE_HANDLE * RootPtr
+ );
+
+/** Serialize an AML definition block.
+
+ This functions allocates memory with the "AllocateZeroPool ()"
+ function. This memory is used to serialize the AML tree and is
+ returned in the Table.
+
+ @ingroup UserApis
+
+ @param [in] RootNode Root node of the tree.
+ @param [out] Table On return, hold the serialized
+ definition block.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Could not allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlSerializeDefinitionBlock (
+ IN AML_ROOT_NODE_HANDLE RootNode,
+ OUT EFI_ACPI_DESCRIPTION_HEADER ** Table
+ );
+
+/** Clone a node and its children (clone a tree branch).
+
+ The cloned branch returned is not attached to any tree.
+
+ @ingroup UserApis
+
+ @param [in] Node Pointer to a node.
+ Node is the head of the branch to clone.
+ @param [out] ClonedNode Pointer holding the head of the created cloned
+ branch.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Could not allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlCloneTree (
+ IN AML_NODE_HANDLE Node,
+ OUT AML_NODE_HANDLE * ClonedNode
+ );
+
+/** Delete a Node and its children.
+
+ The Node must be removed from the tree first,
+ or must be the root node.
+
+ @ingroup UserApis
+
+ @param [in] Node Pointer to the node to delete.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+AmlDeleteTree (
+ IN AML_NODE_HANDLE Node
+ );
+
+/** Detach the Node from the tree.
+
+ The function will fail if the Node is in its parent's fixed
+ argument list.
+ The Node is not deleted. The deletion is done separately
+ from the removal.
+
+ @ingroup UserApis
+
+ @param [in] Node Pointer to a Node.
+ Must be a data node or an object node.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+AmlDetachNode (
+ IN AML_NODE_HANDLE Node
+ );
+
+/** Find a node in the AML namespace, given an ASL path and a reference Node.
+
+ - The AslPath can be an absolute path, or a relative path from the
+ reference Node;
+ - Node must be a root node or a namespace node;
+ - A root node is expected to be at the top of the tree.
+
+ E.g.:
+ For the following AML namespace, with the ReferenceNode being the node with
+ the name "AAAA":
+ - the node with the name "BBBB" can be found by looking for the ASL
+ path "BBBB";
+ - the root node can be found by looking for the ASL relative path "^",
+ or the absolute path "\\".
+
+ AML namespace:
+ \
+ \-AAAA <- ReferenceNode
+ \-BBBB
+
+ @ingroup NameSpaceApis
+
+ @param [in] ReferenceNode Reference node.
+ If a relative path is given, the
+ search is done from this node. If
+ an absolute path is given, the
+ search is done from the root node.
+ Must be a root node or an object
+ node which is part of the
+ namespace.
+ @param [in] AslPath ASL path to the searched node in
+ the namespace. An ASL path name is
+ NULL terminated. Can be a relative
+ or absolute path.
+ E.g.: "\\_SB.CLU0.CPU0" or "^CPU0"
+ @param [out] OutNode Pointer to the found node.
+ Contains NULL if not found.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_BUFFER_TOO_SMALL No space left in the buffer.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Out of memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlFindNode (
+ IN AML_NODE_HANDLE ReferenceNode,
+ IN CHAR8 * AslPath,
+ OUT AML_NODE_HANDLE * OutNode
+ );
+
+/**
+ @defgroup UserApis User APIs
+ @{
+ User APIs are implemented to ease most common actions that might be done
+ using the AmlLib. They allow to find specific objects like "_UID" or
+ "_CRS" and to update their value. It also shows what can be done using
+ AmlLib functions.
+ @}
+*/
+
+/** Update the name of a DeviceOp object node.
+
+ @ingroup UserApis
+
+ @param [in] DeviceOpNode Object node representing a Device.
+ Must have an OpCode=AML_NAME_OP, SubOpCode=0.
+ OpCode/SubOpCode.
+ DeviceOp object nodes are defined in ASL
+ using the "Device ()" function.
+ @param [in] NewNameString The new Device's name.
+ Must be a NULL-terminated ASL NameString
+ e.g.: "DEV0", "DV15.DEV0", etc.
+ The input string is copied.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+AmlDeviceOpUpdateName (
+ IN AML_OBJECT_NODE_HANDLE DeviceOpNode,
+ IN CHAR8 * NewNameString
+ );
+
+/** Update an integer value defined by a NameOp object node.
+
+ For compatibility reasons, the NameOpNode must initially
+ contain an integer.
+
+ @ingroup UserApis
+
+ @param [in] NameOpNode NameOp object node.
+ Must have an OpCode=AML_NAME_OP, SubOpCode=0.
+ NameOp object nodes are defined in ASL
+ using the "Name ()" function.
+ @param [in] NewInt New Integer value to assign.
+ Must be a UINT64.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+AmlNameOpUpdateInteger (
+ IN AML_OBJECT_NODE_HANDLE NameOpNode,
+ IN UINT64 NewInt
+ );
+
+/** Update a string value defined by a NameOp object node.
+
+ The NameOpNode must initially contain a string.
+ The EISAID ASL macro converts a string to an integer. This, it is
+ not accepted.
+
+ @ingroup UserApis
+
+ @param [in] NameOpNode NameOp object node.
+ Must have an OpCode=AML_NAME_OP, SubOpCode=0.
+ NameOp object nodes are defined in ASL
+ using the "Name ()" function.
+ @param [in] NewName New NULL terminated string to assign to
+ the NameOpNode.
+ The input string is copied.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+AmlNameOpUpdateString (
+ IN AML_OBJECT_NODE_HANDLE NameOpNode,
+ IN CONST CHAR8 * NewName
+ );
+
+/** Get the first Resource Data element contained in a "_CRS" object.
+
+ In the following ASL code, the function will return the Resource Data
+ node corresponding to the "QWordMemory ()" ASL macro.
+ Name (_CRS, ResourceTemplate() {
+ QWordMemory (...) {...},
+ Interrupt (...) {...}
+ }
+ )
+
+ Note:
+ - The "_CRS" object must be declared using ASL "Name (Declare Named Object)".
+ - "_CRS" declared using ASL "Method (Declare Control Method)" is not
+ supported.
+
+ @ingroup UserApis
+
+ @param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
+ Must have an OpCode=AML_NAME_OP, SubOpCode=0.
+ NameOp object nodes are defined in ASL
+ using the "Name ()" function.
+ @param [out] OutRdNode Pointer to the first Resource Data element of
+ the "_CRS" object. A Resource Data element
+ is stored in a data node.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+AmlNameOpCrsGetFirstRdNode (
+ IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
+ OUT AML_DATA_NODE_HANDLE * OutRdNode
+ );
+
+/** Get the Resource Data element following the CurrRdNode Resource Data.
+
+ In the following ASL code, if CurrRdNode corresponds to the first
+ "QWordMemory ()" ASL macro, the function will return the Resource Data
+ node corresponding to the "Interrupt ()" ASL macro.
+ Name (_CRS, ResourceTemplate() {
+ QwordMemory (...) {...},
+ Interrupt (...) {...}
+ }
+ )
+
+ The CurrRdNode Resource Data node must be defined in an object named "_CRS"
+ and defined by a "Name ()" ASL function.
+
+ @ingroup UserApis
+
+ @param [in] CurrRdNode Pointer to the current Resource Data element of
+ the "_CRS" variable.
+ @param [out] OutRdNode Pointer to the Resource Data element following
+ the CurrRdNode.
+ Contain a NULL pointer if CurrRdNode is the
+ last Resource Data element in the list.
+ The "End Tag" is not considered as a resource
+ data element and is not returned.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+AmlNameOpCrsGetNextRdNode (
+ IN AML_DATA_NODE_HANDLE CurrRdNode,
+ OUT AML_DATA_NODE_HANDLE * OutRdNode
+ );
+
+/** Update the first interrupt of an Interrupt resource data node.
+
+ The flags of the Interrupt resource data are left unchanged.
+
+ The InterruptRdNode corresponds to the Resource Data created by the
+ "Interrupt ()" ASL macro. It is an Extended Interrupt Resource Data.
+ See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descriptor"
+ for more information about Extended Interrupt Resource Data.
+
+ @ingroup UserApis
+
+ @param [in] InterruptRdNode Pointer to the an extended interrupt
+ resource data node.
+ @param [in] Irq Interrupt value to update.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Out of resources.
+**/
+EFI_STATUS
+EFIAPI
+AmlUpdateRdInterrupt (
+ IN AML_DATA_NODE_HANDLE InterruptRdNode,
+ IN UINT32 Irq
+ );
+
+/** Update the base address and length of a QWord resource data node.
+
+ @ingroup UserApis
+
+ @param [in] QWordRdNode Pointer a QWord resource data
+ node.
+ @param [in] BaseAddress Base address.
+ @param [in] BaseAddressLength Base address length.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Out of resources.
+**/
+EFI_STATUS
+EFIAPI
+AmlUpdateRdQWord (
+ IN AML_DATA_NODE_HANDLE QWordRdNode,
+ IN UINT64 BaseAddress,
+ IN UINT64 BaseAddressLength
+ );
+
+/** Add an Interrupt Resource Data node.
+
+ This function creates a Resource Data element corresponding to the
+ "Interrupt ()" ASL function, stores it in an AML Data Node.
+
+ It then adds it after the input CurrRdNode in the list of resource data
+ element.
+
+ The Resource Data effectively created is an Extended Interrupt Resource
+ Data. See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descriptor"
+ for more information about Extended Interrupt Resource Data.
+
+ The Extended Interrupt contains one single interrupt.
+
+ This function allocates memory to create a data node. It is the caller's
+ responsibility to either:
+ - attach this node to an AML tree;
+ - delete this node.
+
+ Note: The _CRS node must be defined using the ASL Name () function.
+ e.g. Name (_CRS, ResourceTemplate () {
+ ...
+ }
+
+ @ingroup UserApis
+
+ @param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
+ Must have an OpCode=AML_NAME_OP, SubOpCode=0.
+ NameOp object nodes are defined in ASL
+ using the "Name ()" function.
+ @param [in] ResourceConsumer The device consumes the specified interrupt
+ or produces it for use by a child device.
+ @param [in] EdgeTriggered The interrupt is edge triggered or
+ level triggered.
+ @param [in] ActiveLow The interrupt is active-high or active-low.
+ @param [in] Shared The interrupt can be shared with other
+ devices or not (Exclusive).
+ @param [in] IrqList Interrupt list. Must be non-NULL.
+ @param [in] IrqCount Interrupt count. Must be non-zero.
+
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Could not allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlCodeGenCrsAddRdInterrupt (
+ IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
+ IN BOOLEAN ResourceConsumer,
+ IN BOOLEAN EdgeTriggered,
+ IN BOOLEAN ActiveLow,
+ IN BOOLEAN Shared,
+ IN UINT32 * IrqList,
+ IN UINT8 IrqCount
+ );
+
+/** AML code generation for DefinitionBlock.
+
+ Create a Root Node handle.
+ It is the caller's responsibility to free the allocated memory
+ with the AmlDeleteTree function.
+
+ AmlCodeGenDefinitionBlock (TableSignature, OemId, TableID, OEMRevision) is
+ equivalent to the following ASL code:
+ DefinitionBlock (AMLFileName, TableSignature, ComplianceRevision,
+ OemId, TableID, OEMRevision) {}
+ with the ComplianceRevision set to 2 and the AMLFileName is ignored.
+
+ @ingroup CodeGenApis
+
+ @param[in] TableSignature 4-character ACPI signature.
+ Must be 'DSDT' or 'SSDT'.
+ @param[in] OemId 6-character string OEM identifier.
+ @param[in] OemTableId 8-character string OEM table identifier.
+ @param[in] OemRevision OEM revision number.
+ @param[out] DefinitionBlockTerm The ASL Term handle representing a
+ Definition Block.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlCodeGenDefinitionBlock (
+ IN CONST CHAR8 * TableSignature,
+ IN CONST CHAR8 * OemId,
+ IN CONST CHAR8 * OemTableId,
+ IN UINT32 OemRevision,
+ OUT AML_ROOT_NODE_HANDLE * NewRootNode
+ );
+
+/** AML code generation for a Name object node, containing a String.
+
+ AmlCodeGenNameString ("_HID", "HID0000", ParentNode, NewObjectNode) is
+ equivalent of the following ASL code:
+ Name(_HID, "HID0000")
+
+ @ingroup CodeGenApis
+
+ @param [in] NameString The new variable name.
+ Must be a NULL-terminated ASL NameString
+ e.g.: "DEV0", "DV15.DEV0", etc.
+ The input string is copied.
+ @param [in] String NULL terminated String to associate to the
+ NameString.
+ @param [in] ParentNode If provided, set ParentNode as the parent
+ of the node created.
+ @param [out] NewObjectNode If success, contains the created node.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlCodeGenNameString (
+ IN CONST CHAR8 * NameString,
+ IN CHAR8 * String,
+ IN AML_NODE_HANDLE ParentNode, OPTIONAL
+ OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL
+ );
+
+/** AML code generation for a Name object node, containing an Integer.
+
+ AmlCodeGenNameInteger ("_UID", 1, ParentNode, NewObjectNode) is
+ equivalent of the following ASL code:
+ Name(_UID, One)
+
+ @ingroup CodeGenApis
+
+ @param [in] NameString The new variable name.
+ Must be a NULL-terminated ASL NameString
+ e.g.: "DEV0", "DV15.DEV0", etc.
+ The input string is copied.
+ @param [in] Integer Integer to associate to the NameString.
+ @param [in] ParentNode If provided, set ParentNode as the parent
+ of the node created.
+ @param [out] NewObjectNode If success, contains the created node.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlCodeGenNameInteger (
+ IN CONST CHAR8 * NameString,
+ IN UINT64 Integer,
+ IN AML_NODE_HANDLE ParentNode, OPTIONAL
+ OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL
+ );
+
+/** AML code generation for a Device object node.
+
+ AmlCodeGenDevice ("COM0", ParentNode, NewObjectNode) is
+ equivalent of the following ASL code:
+ Device(COM0) {}
+
+ @ingroup CodeGenApis
+
+ @param [in] NameString The new Device's name.
+ Must be a NULL-terminated ASL NameString
+ e.g.: "DEV0", "DV15.DEV0", etc.
+ The input string is copied.
+ @param [in] ParentNode If provided, set ParentNode as the parent
+ of the node created.
+ @param [out] NewObjectNode If success, contains the created node.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlCodeGenDevice (
+ IN CONST CHAR8 * NameString,
+ IN AML_NODE_HANDLE ParentNode, OPTIONAL
+ OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL
+ );
+
+/** AML code generation for a Scope object node.
+
+ AmlCodeGenScope ("_SB", ParentNode, NewObjectNode) is
+ equivalent of the following ASL code:
+ Scope(_SB) {}
+
+ @ingroup CodeGenApis
+
+ @param [in] NameString The new Scope's name.
+ Must be a NULL-terminated ASL NameString
+ e.g.: "DEV0", "DV15.DEV0", etc.
+ The input string is copied.
+ @param [in] ParentNode If provided, set ParentNode as the parent
+ of the node created.
+ @param [out] NewObjectNode If success, contains the created node.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlCodeGenScope (
+ IN CONST CHAR8 * NameString,
+ IN AML_NODE_HANDLE ParentNode, OPTIONAL
+ OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL
+ );
+
+#endif // AML_LIB_H_
diff --git a/roms/edk2/DynamicTablesPkg/Include/Library/SsdtSerialPortFixupLib.h b/roms/edk2/DynamicTablesPkg/Include/Library/SsdtSerialPortFixupLib.h new file mode 100644 index 000000000..4605f3f34 --- /dev/null +++ b/roms/edk2/DynamicTablesPkg/Include/Library/SsdtSerialPortFixupLib.h @@ -0,0 +1,68 @@ +/** @file
+ Ssdt Serial Port Fixup Library
+
+ Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef SSDT_SERIAL_PORT_LIB_H_
+#define SSDT_SERIAL_PORT_LIB_H_
+
+/** Build a SSDT table describing the input serial port.
+
+ The table created by this function must be freed by FreeSsdtSerialTable.
+
+ @param [in] AcpiTableInfo Pointer to the ACPI table information.
+ @param [in] SerialPortInfo Serial port to describe in the SSDT table.
+ @param [in] Name The Name to give to the Device.
+ Must be a NULL-terminated ASL NameString
+ e.g.: "DEV0", "DV15.DEV0", etc.
+ @param [in] Uid UID for the Serial Port.
+ @param [out] Table If success, pointer to the created SSDT table.
+
+ @retval EFI_SUCCESS Table generated successfully.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND Could not find information.
+ @retval EFI_OUT_OF_RESOURCES Could not allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+BuildSsdtSerialPortTable (
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * AcpiTableInfo,
+ IN CONST CM_ARM_SERIAL_PORT_INFO * SerialPortInfo,
+ IN CONST CHAR8 * Name,
+ IN CONST UINT64 Uid,
+ OUT EFI_ACPI_DESCRIPTION_HEADER ** Table
+ );
+
+/** Free an SSDT table previously created by
+ the BuildSsdtSerialTable function.
+
+ @param [in] Table Pointer to a SSDT table allocated by
+ the BuildSsdtSerialTable function.
+
+ @retval EFI_SUCCESS Success.
+**/
+EFI_STATUS
+EFIAPI
+FreeSsdtSerialPortTable (
+ IN EFI_ACPI_DESCRIPTION_HEADER * Table
+ );
+
+/** Validate the Serial Port Information.
+
+ @param [in] SerialPortInfoTable Table of CM_ARM_SERIAL_PORT_INFO.
+ @param [in] SerialPortCount Count of SerialPort in the table.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+ValidateSerialPortInfo (
+ IN CONST CM_ARM_SERIAL_PORT_INFO * SerialPortInfoTable,
+ IN UINT32 SerialPortCount
+ );
+
+#endif // SSDT_SERIAL_PORT_LIB_H_
diff --git a/roms/edk2/DynamicTablesPkg/Include/Library/TableHelperLib.h b/roms/edk2/DynamicTablesPkg/Include/Library/TableHelperLib.h new file mode 100644 index 000000000..099a0a454 --- /dev/null +++ b/roms/edk2/DynamicTablesPkg/Include/Library/TableHelperLib.h @@ -0,0 +1,123 @@ +/** @file
+
+ Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Glossary:
+ - PFN - Pointer to a Function
+
+**/
+
+#ifndef TABLE_HELPER_LIB_H_
+#define TABLE_HELPER_LIB_H_
+
+/** The GetCgfMgrInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGER_INFO
+ object from the Configuration Manager.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager protocol
+ interface.
+ @param [out] CfgMfrInfo Pointer to the Configuration Manager Info
+ object structure.
+
+ @retval EFI_SUCCESS The object is returned.
+ @retval EFI_INVALID_PARAMETER The Object ID is invalid.
+ @retval EFI_NOT_FOUND The requested Object is not found.
+ @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
+ Manager is less than the Object size.
+**/
+EFI_STATUS
+EFIAPI
+GetCgfMgrInfo (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
+ OUT CM_STD_OBJ_CONFIGURATION_MANAGER_INFO ** CfgMfrInfo
+ );
+
+/** The AddAcpiHeader function updates the ACPI header structure. It uses the
+ ACPI table Generator and the Configuration Manager protocol to obtain the
+ information required for constructing the header.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ protocol interface.
+ @param [in] Generator Pointer to the ACPI table Generator.
+ @param [in,out] AcpiHeader Pointer to the ACPI table header to be
+ updated.
+ @param [in] AcpiTableInfo Pointer to the ACPI table info structure.
+ @param [in] Length Length of the ACPI table.
+
+ @retval EFI_SUCCESS The ACPI table is updated successfully.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object information is not found.
+ @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
+ Manager is less than the Object size for the
+ requested object.
+**/
+EFI_STATUS
+EFIAPI
+AddAcpiHeader (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
+ IN CONST ACPI_TABLE_GENERATOR * CONST Generator,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER * CONST AcpiHeader,
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
+ IN CONST UINT32 Length
+ );
+
+/**
+ Function prototype for testing if two arbitrary objects are equal.
+
+ @param [in] Object1 Pointer to the first object to compare.
+ @param [in] Object2 Pointer to the second object to compare.
+ @param [in] Index1 Index of Object1. This value is optional and
+ can be ignored by the specified implementation.
+ @param [in] Index2 Index of Object2. This value is optional and
+ can be ignored by the specified implementation.
+
+ @retval TRUE Object1 and Object2 are equal.
+ @retval FALSE Object1 and Object2 are NOT equal.
+**/
+typedef
+BOOLEAN
+(EFIAPI *PFN_IS_EQUAL)(
+ IN CONST VOID * Object1,
+ IN CONST VOID * Object2,
+ IN UINTN Index1 OPTIONAL,
+ IN UINTN Index2 OPTIONAL
+ );
+
+/**
+ Test and report if a duplicate entry exists in the given array of comparable
+ elements.
+
+ @param [in] Array Array of elements to test for duplicates.
+ @param [in] Count Number of elements in Array.
+ @param [in] ElementSize Size of an element in bytes
+ @param [in] EqualTestFunction The function to call to check if any two
+ elements are equal.
+
+ @retval TRUE A duplicate element was found or one of
+ the input arguments is invalid.
+ @retval FALSE Every element in Array is unique.
+**/
+BOOLEAN
+EFIAPI
+FindDuplicateValue (
+ IN CONST VOID * Array,
+ IN CONST UINTN Count,
+ IN CONST UINTN ElementSize,
+ IN PFN_IS_EQUAL EqualTestFunction
+ );
+
+/** Convert a hex number to its ASCII code.
+
+ @param [in] x Hex number to convert.
+ Must be 0 <= x < 16.
+
+ @return The ASCII code corresponding to x.
+**/
+UINT8
+EFIAPI
+AsciiFromHex (
+ IN UINT8 x
+ );
+
+#endif // TABLE_HELPER_LIB_H_
diff --git a/roms/edk2/DynamicTablesPkg/Include/Protocol/ConfigurationManagerProtocol.h b/roms/edk2/DynamicTablesPkg/Include/Protocol/ConfigurationManagerProtocol.h new file mode 100644 index 000000000..7de1be3b2 --- /dev/null +++ b/roms/edk2/DynamicTablesPkg/Include/Protocol/ConfigurationManagerProtocol.h @@ -0,0 +1,122 @@ +/** @file
+
+ Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Glossary:
+ - Cm or CM - Configuration Manager
+ - Obj or OBJ - Object
+**/
+
+#ifndef CONFIGURATION_MANAGER_PROTOCOL_H_
+#define CONFIGURATION_MANAGER_PROTOCOL_H_
+
+#include <ConfigurationManagerObject.h>
+
+/** This macro defines the Configuration Manager Protocol GUID.
+
+ GUID: {D85A4835-5A82-4894-AC02-706F43D5978E}
+*/
+#define EDKII_CONFIGURATION_MANAGER_PROTOCOL_GUID \
+ { 0xd85a4835, 0x5a82, 0x4894, \
+ { 0xac, 0x2, 0x70, 0x6f, 0x43, 0xd5, 0x97, 0x8e } \
+ };
+
+/** This macro defines the Configuration Manager Protocol Revision.
+*/
+#define EDKII_CONFIGURATION_MANAGER_PROTOCOL_REVISION CREATE_REVISION (1, 0)
+
+#pragma pack(1)
+
+/**
+ Forward declarations:
+*/
+typedef struct ConfigurationManagerProtocol EDKII_CONFIGURATION_MANAGER_PROTOCOL;
+typedef struct PlatformRepositoryInfo EDKII_PLATFORM_REPOSITORY_INFO;
+
+/** The GetObject function defines the interface implemented by the
+ Configuration Manager Protocol for returning the Configuration
+ Manager Objects.
+
+ @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 [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.
+ @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration Manager
+ is less than the Object size for the requested
+ object.
+**/
+typedef
+EFI_STATUS
+(EFIAPI * EDKII_CONFIGURATION_MANAGER_GET_OBJECT) (
+ 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
+ );
+
+/** The SetObject function defines the interface implemented by the
+ Configuration Manager Protocol for updating the Configuration
+ Manager Objects.
+
+ @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 [out] CmObject Pointer to the Configuration Manager Object
+ descriptor describing the Object.
+
+ @retval EFI_SUCCESS The operation completed successfully.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object information is not found.
+ @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration Manager
+ is less than the Object size for the requested
+ object.
+ @retval EFI_UNSUPPORTED This operation is not supported.
+**/
+typedef
+EFI_STATUS
+(EFIAPI * EDKII_CONFIGURATION_MANAGER_SET_OBJECT) (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This,
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN CONST CM_OBJECT_TOKEN Token OPTIONAL,
+ IN CM_OBJ_DESCRIPTOR * CONST CmObject
+ );
+
+/** The EDKII_CONFIGURATION_MANAGER_PROTOCOL structure describes the
+ Configuration Manager Protocol interface.
+*/
+typedef struct ConfigurationManagerProtocol {
+ /// The Configuration Manager Protocol revision.
+ UINT32 Revision;
+
+ /** The interface used to request information about
+ the Configuration Manager Objects.
+ */
+ EDKII_CONFIGURATION_MANAGER_GET_OBJECT GetObject;
+
+ /** The interface used to update the information stored
+ in the Configuration Manager repository.
+ */
+ EDKII_CONFIGURATION_MANAGER_SET_OBJECT SetObject;
+
+ /** Pointer to an implementation defined abstract repository
+ provisioned by the Configuration Manager.
+ */
+ EDKII_PLATFORM_REPOSITORY_INFO * PlatRepoInfo;
+} EDKII_CONFIGURATION_MANAGER_PROTOCOL;
+
+/** The Configuration Manager Protocol GUID.
+*/
+extern EFI_GUID gEdkiiConfigurationManagerProtocolGuid;
+
+#pragma pack()
+
+#endif // CONFIGURATION_MANAGER_PROTOCOL_H_
diff --git a/roms/edk2/DynamicTablesPkg/Include/Protocol/DynamicTableFactoryProtocol.h b/roms/edk2/DynamicTablesPkg/Include/Protocol/DynamicTableFactoryProtocol.h new file mode 100644 index 000000000..ff2331b06 --- /dev/null +++ b/roms/edk2/DynamicTablesPkg/Include/Protocol/DynamicTableFactoryProtocol.h @@ -0,0 +1,254 @@ +/** @file
+
+ Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Glossary:
+ - ACPI - Advanced Configuration and Power Interface
+ - SMBIOS - System Management BIOS
+ - DT - Device Tree
+**/
+
+#ifndef DYNAMIC_TABLE_FACTORY_PROTOCOL_H_
+#define DYNAMIC_TABLE_FACTORY_PROTOCOL_H_
+
+#include <AcpiTableGenerator.h>
+#include <SmbiosTableGenerator.h>
+#include <DeviceTreeTableGenerator.h>
+
+/** This macro defines the Dynamic Table Factory Protocol GUID.
+
+ GUID: {91D1E327-FE5A-49B8-AB65-0ECE2DDB45EC}
+*/
+#define EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL_GUID \
+ { 0x91d1e327, 0xfe5a, 0x49b8, \
+ { 0xab, 0x65, 0xe, 0xce, 0x2d, 0xdb, 0x45, 0xec } \
+ };
+
+/** This macro defines the Configuration Manager Protocol Revision.
+*/
+#define EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL_REVISION CREATE_REVISION (1, 0)
+
+#pragma pack(1)
+
+/**
+ Forward declarations:
+*/
+typedef struct DynamicTableFactoryProtocol EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL;
+typedef struct DynamicTableFactoryInfo EDKII_DYNAMIC_TABLE_FACTORY_INFO;
+
+/** Return a pointer to the ACPI table generator.
+
+ @param [in] This Pointer to the Dynamic Table Factory Protocol.
+ @param [in] TableId The ACPI table generator ID for the
+ requested generator.
+ @param [out] Generator Pointer to the requested ACPI table
+ generator.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The requested generator is not found
+ in the list of registered generators.
+**/
+typedef
+EFI_STATUS
+(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_GET_ACPI_TABLE_GENERATOR) (
+ IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This,
+ IN CONST ACPI_TABLE_GENERATOR_ID GeneratorId,
+ OUT CONST ACPI_TABLE_GENERATOR ** CONST Generator
+ );
+
+/** Registers an ACPI table generator.
+
+ @param [in] Generator Pointer to the ACPI table generator.
+
+ @retval EFI_SUCCESS The Generator was registered
+ successfully.
+ @retval EFI_INVALID_PARAMETER The Generator ID is invalid or
+ the Generator pointer is NULL.
+ @retval EFI_ALREADY_STARTED The Generator for the Table ID is
+ already registered.
+**/
+typedef
+EFI_STATUS
+(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_ACPI_TABLE_GENERATOR) (
+ IN CONST ACPI_TABLE_GENERATOR * CONST Generator
+ );
+
+/** Deregister an ACPI table generator.
+
+ @param [in] Generator Pointer to the ACPI table generator.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER The generator is invalid.
+ @retval EFI_NOT_FOUND The requested generator is not found
+ in the list of registered generators.
+**/
+typedef
+EFI_STATUS
+(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_ACPI_TABLE_GENERATOR) (
+ IN CONST ACPI_TABLE_GENERATOR * CONST Generator
+ );
+
+/** Return a pointer to the SMBIOS table generator.
+
+ @param [in] This Pointer to the Dynamic Table Factory Protocol.
+ @param [in] TableId The SMBIOS table generator ID for the
+ requested generator.
+ @param [out] Generator Pointer to the requested SMBIOS table
+ generator.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The requested generator is not found
+ in the list of registered generators.
+**/
+typedef
+EFI_STATUS
+(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_GET_SMBIOS_TABLE_GENERATOR) (
+ IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This,
+ IN CONST SMBIOS_TABLE_GENERATOR_ID GeneratorId,
+ OUT CONST SMBIOS_TABLE_GENERATOR ** CONST Generator
+ );
+
+/** Register a SMBIOS table generator.
+
+ @param [in] Generator Pointer to the SMBIOS table generator.
+
+ @retval EFI_SUCCESS The Generator was registered
+ successfully.
+ @retval EFI_INVALID_PARAMETER The Generator ID is invalid or
+ the Generator pointer is NULL.
+ @retval EFI_ALREADY_STARTED The Generator for the Table ID is
+ already registered.
+**/
+typedef
+EFI_STATUS
+(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_SMBIOS_TABLE_GENERATOR) (
+ IN CONST SMBIOS_TABLE_GENERATOR * CONST Generator
+ );
+
+/** Deregister a SMBIOS table generator.
+
+ @param [in] Generator Pointer to the SMBIOS table generator.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER The generator is invalid.
+ @retval EFI_NOT_FOUND The requested generator is not found
+ in the list of registered generators.
+**/
+typedef
+EFI_STATUS
+(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_SMBIOS_TABLE_GENERATOR) (
+ IN CONST SMBIOS_TABLE_GENERATOR * CONST Generator
+ );
+
+/** Return a pointer to the Device Tree table generator.
+
+ @param [in] This Pointer to the Dynamic Table Factory Protocol.
+ @param [in] TableId The Device Tree table generator ID for the
+ requested generator.
+ @param [out] Generator Pointer to the requested Device Tree table
+ generator.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The requested generator is not found
+ in the list of registered generators.
+**/
+typedef
+EFI_STATUS
+(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_GET_DT_TABLE_GENERATOR) (
+ IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This,
+ IN CONST DT_TABLE_GENERATOR_ID GeneratorId,
+ OUT CONST DT_TABLE_GENERATOR ** CONST Generator
+ );
+
+/** Register a DT table generator.
+
+ @param [in] Generator Pointer to the DT table generator.
+
+ @retval EFI_SUCCESS The Generator was registered
+ successfully.
+ @retval EFI_INVALID_PARAMETER The Generator ID is invalid or
+ the Generator pointer is NULL.
+ @retval EFI_ALREADY_STARTED The Generator for the Table ID is
+ already registered.
+**/
+typedef
+EFI_STATUS
+(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_DT_TABLE_GENERATOR) (
+ IN CONST DT_TABLE_GENERATOR * CONST Generator
+ );
+
+/** Deregister a DT table generator.
+
+ This function is called by the DT table generator to deregister itself
+ from the DT table factory.
+
+ @param [in] Generator Pointer to the DT table generator.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER The generator is invalid.
+ @retval EFI_NOT_FOUND The requested generator is not found
+ in the list of registered generators.
+**/
+typedef
+EFI_STATUS
+(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_DT_TABLE_GENERATOR) (
+ IN CONST DT_TABLE_GENERATOR * CONST Generator
+ );
+
+/** A structure describing the Dynamic Table Factory Protocol interface.
+*/
+typedef struct DynamicTableFactoryProtocol {
+ /// The Dynamic Table Factory Protocol revision.
+ UINT32 Revision;
+
+ /// The interface used to request an ACPI Table Generator.
+ EDKII_DYNAMIC_TABLE_FACTORY_GET_ACPI_TABLE_GENERATOR GetAcpiTableGenerator;
+
+ /// Register an ACPI table Generator
+ EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_ACPI_TABLE_GENERATOR
+ RegisterAcpiTableGenerator;
+
+ /// Deregister an ACPI table Generator
+ EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_ACPI_TABLE_GENERATOR
+ DeregisterAcpiTableGenerator;
+
+ /// The interface used to request a SMBIOS Table Generator.
+ EDKII_DYNAMIC_TABLE_FACTORY_GET_SMBIOS_TABLE_GENERATOR GetSmbiosTableGenerator;
+
+ /// Register an SMBIOS table Generator
+ EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_SMBIOS_TABLE_GENERATOR
+ RegisterSmbiosTableGenerator;
+
+ /// Deregister an SMBIOS table Generator
+ EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_SMBIOS_TABLE_GENERATOR
+ DeregisterSmbiosTableGenerator;
+
+ /// The interface used to request a Device Tree Table Generator.
+ EDKII_DYNAMIC_TABLE_FACTORY_GET_DT_TABLE_GENERATOR GetDtTableGenerator;
+
+ /// Register a DT generator
+ EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_DT_TABLE_GENERATOR
+ RegisterDtTableGenerator;
+
+ /// Deregister a DT generator
+ EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_DT_TABLE_GENERATOR
+ DeregisterDtTableGenerator;
+
+ /** Pointer to the data structure that holds the
+ list of registered table generators
+ */
+ EDKII_DYNAMIC_TABLE_FACTORY_INFO * TableFactoryInfo;
+} EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL;
+
+/** The Dynamic Table Factory Protocol GUID.
+*/
+extern EFI_GUID gEdkiiDynamicTableFactoryProtocolGuid;
+
+#pragma pack()
+
+#endif // DYNAMIC_TABLE_FACTORY_PROTOCOL_H_
diff --git a/roms/edk2/DynamicTablesPkg/Include/SmbiosTableGenerator.h b/roms/edk2/DynamicTablesPkg/Include/SmbiosTableGenerator.h new file mode 100644 index 000000000..9fbf9fc0c --- /dev/null +++ b/roms/edk2/DynamicTablesPkg/Include/SmbiosTableGenerator.h @@ -0,0 +1,234 @@ +/** @file
+
+ Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef SMBIOS_TABLE_GENERATOR_H_
+#define SMBIOS_TABLE_GENERATOR_H_
+
+#include <IndustryStandard/SmBios.h>
+
+#include <TableGenerator.h>
+
+#pragma pack(1)
+
+/** The SMBIOS_TABLE_GENERATOR_ID type describes SMBIOS table generator ID.
+*/
+typedef TABLE_GENERATOR_ID SMBIOS_TABLE_GENERATOR_ID;
+
+/** The ESTD_SMBIOS_TABLE_ID enum describes the SMBIOS table IDs reserved for
+ the standard generators.
+
+ NOTE: The SMBIOS Generator IDs do not match the table type numbers!
+ This allows 0 to be used to catch invalid parameters.
+*/
+typedef enum StdSmbiosTableGeneratorId {
+ EStdSmbiosTableIdReserved = 0x0000,
+ EStdSmbiosTableIdRAW,
+ EStdSmbiosTableIdType00,
+ EStdSmbiosTableIdType01,
+ EStdSmbiosTableIdType02,
+ EStdSmbiosTableIdType03,
+ EStdSmbiosTableIdType04,
+ EStdSmbiosTableIdType05,
+ EStdSmbiosTableIdType06,
+ EStdSmbiosTableIdType07,
+ EStdSmbiosTableIdType08,
+ EStdSmbiosTableIdType09,
+ EStdSmbiosTableIdType10,
+ EStdSmbiosTableIdType11,
+ EStdSmbiosTableIdType12,
+ EStdSmbiosTableIdType13,
+ EStdSmbiosTableIdType14,
+ EStdSmbiosTableIdType15,
+ EStdSmbiosTableIdType16,
+ EStdSmbiosTableIdType17,
+ EStdSmbiosTableIdType18,
+ EStdSmbiosTableIdType19,
+ EStdSmbiosTableIdType20,
+ EStdSmbiosTableIdType21,
+ EStdSmbiosTableIdType22,
+ EStdSmbiosTableIdType23,
+ EStdSmbiosTableIdType24,
+ EStdSmbiosTableIdType25,
+ EStdSmbiosTableIdType26,
+ EStdSmbiosTableIdType27,
+ EStdSmbiosTableIdType28,
+ EStdSmbiosTableIdType29,
+ EStdSmbiosTableIdType30,
+ EStdSmbiosTableIdType31,
+ EStdSmbiosTableIdType32,
+ EStdSmbiosTableIdType33,
+ EStdSmbiosTableIdType34,
+ EStdSmbiosTableIdType35,
+ EStdSmbiosTableIdType36,
+ EStdSmbiosTableIdType37,
+ EStdSmbiosTableIdType38,
+ EStdSmbiosTableIdType39,
+ EStdSmbiosTableIdType40,
+ EStdSmbiosTableIdType41,
+ EStdSmbiosTableIdType42,
+
+ // IDs 43 - 125 are reserved
+
+ EStdSmbiosTableIdType126 = (EStdSmbiosTableIdType00 + 126),
+ EStdSmbiosTableIdType127,
+ EStdSmbiosTableIdMax
+} ESTD_SMBIOS_TABLE_ID;
+
+/** This macro checks if the Table Generator ID is for an SMBIOS Table
+ Generator.
+
+ @param [in] TableGeneratorId The table generator ID.
+
+ @return TRUE if the table generator ID is for an SMBIOS Table
+ Generator.
+**/
+#define IS_GENERATOR_TYPE_SMBIOS(TableGeneratorId) \
+ ( \
+ GET_TABLE_TYPE (TableGeneratorId) == \
+ ETableGeneratorTypeSmbios \
+ )
+
+/** This macro checks if the Table Generator ID is for a standard SMBIOS
+ Table Generator.
+
+ @param [in] TableGeneratorId The table generator ID.
+
+ @return TRUE if the table generator ID is for a standard SMBIOS
+ Table Generator.
+**/
+#define IS_VALID_STD_SMBIOS_GENERATOR_ID(TableGeneratorId) \
+ ( \
+ IS_GENERATOR_NAMESPACE_STD(TableGeneratorId) && \
+ IS_GENERATOR_TYPE_SMBIOS(TableGeneratorId) && \
+ ((GET_TABLE_ID(GeneratorId) >= EStdSmbiosTableIdRaw) && \
+ (GET_TABLE_ID(GeneratorId) < EStdSmbiosTableIdMax)) \
+ )
+
+/** This macro creates a standard SMBIOS Table Generator ID.
+
+ @param [in] TableId The table generator ID.
+
+ @return a standard SMBIOS table generator ID.
+**/
+#define CREATE_STD_SMBIOS_TABLE_GEN_ID(TableId) \
+ CREATE_TABLE_GEN_ID ( \
+ ETableGeneratorTypeSmbios, \
+ ETableGeneratorNameSpaceStd, \
+ TableId \
+ )
+
+/** Forward declarations.
+*/
+typedef struct ConfigurationManagerProtocol EDKII_CONFIGURATION_MANAGER_PROTOCOL;
+typedef struct CmStdObjSmbiosTableInfo CM_STD_OBJ_SMBIOS_TABLE_INFO;
+typedef struct SmbiosTableGenerator SMBIOS_TABLE_GENERATOR;
+
+/** This function pointer describes the interface to SMBIOS table build
+ functions provided by the SMBIOS table generator and called by the
+ Table Manager to build an SMBIOS table.
+
+ @param [in] Generator Pointer to the SMBIOS table generator.
+ @param [in] SmbiosTableInfo Pointer to the SMBIOS table information.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol interface.
+ @param [out] Table Pointer to the generated SMBIOS table.
+
+ @return EFI_SUCCESS If the table is generated successfully or other
+ failure codes as returned by the generator.
+**/
+typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_BUILD_TABLE) (
+ IN CONST SMBIOS_TABLE_GENERATOR * Generator,
+ IN CM_STD_OBJ_SMBIOS_TABLE_INFO * CONST SmbiosTableInfo,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
+ OUT SMBIOS_STRUCTURE ** Table
+ );
+
+/** This function pointer describes the interface to used by the
+ Table Manager to give the generator an opportunity to free
+ any resources allocated for building the SMBIOS table.
+
+ @param [in] Generator Pointer to the SMBIOS table generator.
+ @param [in] SmbiosTableInfo Pointer to the SMBIOS table information.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol interface.
+ @param [in] Table Pointer to the generated SMBIOS table.
+
+ @return EFI_SUCCESS If freed successfully or other failure codes
+ as returned by the generator.
+**/
+typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_FREE_TABLE) (
+ IN CONST SMBIOS_TABLE_GENERATOR * Generator,
+ IN CONST CM_STD_OBJ_SMBIOS_TABLE_INFO * CONST SmbiosTableInfo,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
+ IN SMBIOS_STRUCTURE ** Table
+ );
+
+/** The SMBIOS_TABLE_GENERATOR structure provides an interface that the
+ Table Manager can use to invoke the functions to build SMBIOS tables.
+*/
+typedef struct SmbiosTableGenerator {
+ /// The SMBIOS table generator ID.
+ SMBIOS_TABLE_GENERATOR_ID GeneratorID;
+
+ /// String describing the DT table
+ /// generator.
+ CONST CHAR16* Description;
+
+ /// The SMBIOS table type.
+ SMBIOS_TYPE Type;
+
+ /// SMBIOS table build function pointer.
+ SMBIOS_TABLE_GENERATOR_BUILD_TABLE BuildSmbiosTable;
+
+ /** The function to free any resources
+ allocated for building the SMBIOS table.
+ */
+ SMBIOS_TABLE_GENERATOR_FREE_TABLE FreeTableResources;
+} SMBIOS_TABLE_GENERATOR;
+
+/** Register SMBIOS table factory generator.
+
+ The SMBIOS table factory maintains a list of the Standard and OEM SMBIOS
+ table generators.
+
+ @param [in] Generator Pointer to the SMBIOS table generator.
+
+ @retval EFI_SUCCESS The Generator was registered
+ successfully.
+ @retval EFI_INVALID_PARAMETER The Generator ID is invalid or
+ the Generator pointer is NULL.
+ @retval EFI_ALREADY_STARTED The Generator for the Table ID is
+ already registered.
+**/
+EFI_STATUS
+EFIAPI
+RegisterSmbiosTableGenerator (
+ IN CONST SMBIOS_TABLE_GENERATOR * CONST Generator
+ );
+
+/** Deregister SMBIOS generator.
+
+ This function is called by the SMBIOS table generator to deregister itself
+ from the SMBIOS table factory.
+
+ @param [in] Generator Pointer to the SMBIOS table generator.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER The generator is invalid.
+ @retval EFI_NOT_FOUND The requested generator is not found
+ in the list of registered generators.
+**/
+EFI_STATUS
+EFIAPI
+DeregisterSmbiosTableGenerator (
+ IN CONST SMBIOS_TABLE_GENERATOR * CONST Generator
+ );
+#pragma pack()
+
+#endif // SMBIOS_TABLE_GENERATOR_H_
+
diff --git a/roms/edk2/DynamicTablesPkg/Include/StandardNameSpaceObjects.h b/roms/edk2/DynamicTablesPkg/Include/StandardNameSpaceObjects.h new file mode 100644 index 000000000..0ba6b1636 --- /dev/null +++ b/roms/edk2/DynamicTablesPkg/Include/StandardNameSpaceObjects.h @@ -0,0 +1,131 @@ +/** @file
+
+ Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Glossary:
+ - Cm or CM - Configuration Manager
+ - Obj or OBJ - Object
+ - Std or STD - Standard
+**/
+
+#ifndef STANDARD_NAMESPACE_OBJECTS_H_
+#define STANDARD_NAMESPACE_OBJECTS_H_
+
+#include <AcpiTableGenerator.h>
+#include <SmbiosTableGenerator.h>
+
+#pragma pack(1)
+
+/** A macro defining a reserved zero/NULL token value that
+ does not identify any object.
+*/
+#define CM_NULL_TOKEN 0
+
+/** A reference token that the Configuration Manager can use
+ to identify a Configuration Manager object.
+
+ This can be used to differentiate between instances of
+ objects of the same types. The identification scheme is
+ implementation defined and is defined by the Configuration
+ Manager.
+
+ Typically the token is used to identify a specific instance
+ from a set of objects in a call to the GetObject()/SetObject(),
+ implemented by the Configuration Manager protocol.
+
+ Note: The token value 0 is reserved for a NULL token and does
+ not identify any object.
+**/
+typedef UINTN CM_OBJECT_TOKEN;
+
+/** The ESTD_OBJECT_ID enum describes the Object IDs
+ in the Standard Namespace.
+*/
+typedef enum StdObjectID {
+ EStdObjCfgMgrInfo = 0x00000000, ///< 0 - Configuration Manager Info
+ EStdObjAcpiTableList, ///< 1 - ACPI table Info List
+ EStdObjSmbiosTableList, ///< 2 - SMBIOS table Info List
+ EStdObjMax
+} ESTD_OBJECT_ID;
+
+/** A structure that describes the Configuration Manager Information.
+*/
+typedef struct CmStdObjConfigurationManagerInfo {
+ /// The Configuration Manager Revision.
+ UINT32 Revision;
+
+ /** The OEM ID. This information is used to
+ populate the ACPI table header information.
+ */
+ UINT8 OemId[6];
+} CM_STD_OBJ_CONFIGURATION_MANAGER_INFO;
+
+/** A structure used to describe the ACPI table generators to be invoked.
+
+ The AcpiTableData member of this structure may be used to directly provide
+ the binary ACPI table data which is required by the following standard
+ generators:
+ - RAW
+ - DSDT
+ - SSDT
+
+ Providing the ACPI table data is optional and depends on the generator
+ that is being invoked. If unused, set AcpiTableData to NULL.
+*/
+typedef struct CmAStdObjAcpiTableInfo {
+ /// The signature of the ACPI Table to be installed
+ UINT32 AcpiTableSignature;
+
+ /// The ACPI table revision
+ UINT8 AcpiTableRevision;
+
+ /// The ACPI Table Generator ID
+ ACPI_TABLE_GENERATOR_ID TableGeneratorId;
+
+ /// Optional pointer to the ACPI table data
+ EFI_ACPI_DESCRIPTION_HEADER * AcpiTableData;
+
+ /// An OEM-supplied string that the OEM uses to identify the particular
+ /// data table. This field is particularly useful when defining a definition
+ /// block to distinguish definition block functions. The OEM assigns each
+ /// dissimilar table a new OEM Table ID.
+ /// This field could be constructed using the SIGNATURE_64() macro.
+ /// e.g. SIGNATURE_64 ('A','R','M','H','G','T','D','T')
+ /// Note: If this field is not populated (has value of Zero), then the
+ /// Generators shall populate this information using part of the
+ /// CM_STD_OBJ_CONFIGURATION_MANAGER_INFO.OemId field and the
+ /// ACPI table signature.
+ UINT64 OemTableId;
+
+ /// An OEM-supplied revision number. Larger numbers are assumed to be
+ /// newer revisions.
+ /// Note: If this field is not populated (has value of Zero), then the
+ /// Generators shall populate this information using the revision of the
+ /// Configuration Manager (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO.Revision).
+ UINT32 OemRevision;
+} CM_STD_OBJ_ACPI_TABLE_INFO;
+
+/** A structure used to describe the SMBIOS table generators to be invoked.
+
+ The SmbiosTableData member of this structure is used to provide
+ the SMBIOS table data which is required by the following standard
+ generator(s):
+ - RAW
+
+ Providing the SMBIOS table data is optional and depends on the
+ generator that is being invoked. If unused, set the SmbiosTableData
+ to NULL.
+*/
+typedef struct CmStdObjSmbiosTableInfo {
+ /// The SMBIOS Table Generator ID
+ SMBIOS_TABLE_GENERATOR_ID TableGeneratorId;
+
+ /// Optional pointer to the SMBIOS table data
+ SMBIOS_STRUCTURE * SmbiosTableData;
+} CM_STD_OBJ_SMBIOS_TABLE_INFO;
+
+#pragma pack()
+
+#endif // STANDARD_NAMESPACE_OBJECTS_H_
diff --git a/roms/edk2/DynamicTablesPkg/Include/TableGenerator.h b/roms/edk2/DynamicTablesPkg/Include/TableGenerator.h new file mode 100644 index 000000000..da6434a48 --- /dev/null +++ b/roms/edk2/DynamicTablesPkg/Include/TableGenerator.h @@ -0,0 +1,247 @@ +/** @file
+
+ Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Glossary:
+ - ACPI - Advanced Configuration and Power Interface
+ - SMBIOS - System Management BIOS
+ - DT - Device Tree
+**/
+
+#ifndef TABLE_GENERATOR_H_
+#define TABLE_GENERATOR_H_
+
+/** The TABLE_GENERATOR_ID type describes the Table Generator ID
+
+ Table Generator ID
+
+_______________________________________________________________________________
+| 31 | 30 |29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17| 16|
+-------------------------------------------------------------------------------
+|TNSID| 0 | TT | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0| 0|
+_______________________________________________________________________________
+_______________________________________________________________________________
+|15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0|
+-------------------------------------------------------------------------------
+| Table ID |
+_______________________________________________________________________________
+
+ Bit [31] - Table NameSpace ID (TNSID)
+ 0 - Standard
+ 1 - Custom/OEM
+
+ Bit [30] - Reserved, Must be Zero
+
+ Bit [29:28] - Table Type (TT)
+ 0 - ACPI Table
+ 1 - SMBIOS Table
+ 2 - DT (Device Tree) Table
+ 3 - Reserved (INVALID)
+
+ Bit [27:16] - Reserved, Must Be Zero
+
+ Bit [15:0] - Table ID
+
+ Standard ACPI Table IDs:
+ 0 - Reserved
+ 1 - RAW
+ 2 - FADT
+ 3 - DSDT
+ 4 - SSDT
+ 5 - MADT
+ 6 - GTDT
+ 7 - DBG2
+ 8 - SPCR
+ 9 - MCFG
+ 10 - PPTT
+
+ Standard SMBIOS Table IDs:
+ 0 - Reserved
+ 1 - RAW
+ 2 - Table Type00
+ 3 - Table Type01
+ 4 - Table Type02
+ 5 - Table Type03
+ 6 - Table Type04
+ 7 - Table Type05
+ 8 - Table Type06
+ 9 - Table Type07
+ 10 - Table Type08
+ 11 - Table Type09
+ 12 - Table Type10
+ 13 - Table Type11
+ 14 - Table Type12
+ 15 - Table Type13
+ 16 - Table Type14
+ 17 - Table Type15
+ 18 - Table Type16
+ 19 - Table Type17
+ 20 - Table Type18
+ 21 - Table Type19
+ 22 - Table Type20
+ 23 - Table Type21
+ 24 - Table Type22
+ 25 - Table Type23
+ 26 - Table Type24
+ 27 - Table Type25
+ 28 - Table Type26
+ 29 - Table Type27
+ 30 - Table Type28
+ 31 - Table Type29
+ 32 - Table Type30
+ 33 - Table Type31
+ 34 - Table Type32
+ 35 - Table Type33
+ 36 - Table Type34
+ 37 - Table Type35
+ 38 - Table Type36
+ 39 - Table Type37
+ 40 - Table Type38
+ 41 - Table Type39
+ 42 - Table Type40
+ 43 - Table Type41
+ 44 - Table Type42
+ 45-127 - Reserved
+ 128 - Table Type126
+ 129 - Table Type127
+**/
+typedef UINT32 TABLE_GENERATOR_ID;
+
+/** This enum lists the Table Generator Types.
+*/
+typedef enum TableGeneratorType {
+ ETableGeneratorTypeAcpi = 0, ///< ACPI Table Generator Type.
+ ETableGeneratorTypeSmbios, ///< SMBIOS Table Generator Type.
+ ETableGeneratorTypeDt, ///< Device Tree Table Generator Type.
+ ETableGeneratorTypeReserved
+} ETABLE_GENERATOR_TYPE;
+
+/** This enum lists the namespaces for the Table Generators.
+*/
+typedef enum TableGeneratorNameSpace {
+ ETableGeneratorNameSpaceStd = 0, ///< Standard Namespace.
+ ETableGeneratorNameSpaceOem ///< OEM Namespace.
+} ETABLE_GENERATOR_NAMESPACE;
+
+/** A mask for the Table ID bits of TABLE_GENERATOR_ID.
+*/
+#define TABLE_ID_MASK 0xFF
+
+/** A mask for the Namespace ID bits of TABLE_GENERATOR_ID.
+*/
+#define TABLE_NAMESPACEID_MASK (BIT31)
+
+/** A mask for the Table Type bits of TABLE_GENERATOR_ID.
+*/
+#define TABLE_TYPE_MASK (BIT29 | BIT28)
+
+/** Starting bit position for the Table Type bits
+*/
+#define TABLE_TYPE_BIT_SHIFT 28
+
+/** Starting bit position for the Table Namespace ID bit
+*/
+#define TABLE_NAMESPACE_ID_BIT_SHIFT 31
+
+/** This macro returns the Table ID from the TableGeneratorId.
+
+ @param [in] TableGeneratorId The table generator ID.
+
+ @return the Table ID described by the TableGeneratorId.
+**/
+#define GET_TABLE_ID(TableGeneratorId) \
+ ((TableGeneratorId) & TABLE_ID_MASK)
+
+/** This macro returns the Table type from the TableGeneratorId.
+
+ @param [in] TableGeneratorId The table generator ID.
+
+ @return the Table type described by the TableGeneratorId.
+**/
+#define GET_TABLE_TYPE(TableGeneratorId) \
+ (((TableGeneratorId) & TABLE_TYPE_MASK) >> TABLE_TYPE_BIT_SHIFT)
+
+/** This macro returns the Namespace ID from the TableGeneratorId.
+
+ @param [in] TableGeneratorId The table generator ID.
+
+ @return the Namespace described by the TableGeneratorId.
+**/
+#define GET_TABLE_NAMESPACEID(TableGeneratorId) \
+ (((TableGeneratorId) & TABLE_NAMESPACEID_MASK) >> \
+ TABLE_NAMESPACE_ID_BIT_SHIFT)
+
+/** This macro checks if the TableGeneratorId is in the Standard Namespace.
+
+ @param [in] TableGeneratorId The table generator ID.
+
+ @return TRUE if the TableGeneratorId is in the Standard Namespace.
+**/
+#define IS_GENERATOR_NAMESPACE_STD(TableGeneratorId) \
+ ( \
+ GET_TABLE_NAMESPACEID(TableGeneratorId) == \
+ ETableGeneratorNameSpaceStd \
+ )
+
+/** This macro creates a TableGeneratorId
+
+ @param [in] TableType The table type.
+ @param [in] TableNameSpaceId The namespace ID for the table.
+ @param [in] TableId The table ID.
+
+ @return a TableGeneratorId calculated from the inputs.
+**/
+#define CREATE_TABLE_GEN_ID(TableType, TableNameSpaceId, TableId) \
+ ((((TableType) << TABLE_TYPE_BIT_SHIFT) & TABLE_TYPE_MASK) | \
+ (((TableNameSpaceId) << TABLE_NAMESPACE_ID_BIT_SHIFT) & \
+ TABLE_NAMESPACEID_MASK) | ((TableId) & TABLE_ID_MASK))
+
+/** Starting bit position for MAJOR revision
+*/
+#define MAJOR_REVISION_BIT_SHIFT 16
+
+/** A mask for Major revision.
+*/
+#define MAJOR_REVISION_MASK 0xFFFF
+
+/** A mask for Minor revision.
+*/
+#define MINOR_REVISION_MASK 0xFFFF
+
+/** This macro generates a Major.Minor version
+ where the Major and Minor fields are 16 bit.
+
+ @param [in] Major The Major revision.
+ @param [in] Minor The Minor revision.
+
+ @return a 32 bit representation of the type Major.Minor.
+**/
+#define CREATE_REVISION(Major, Minor) \
+ ((((Major) & MAJOR_REVISION_MASK) << MAJOR_REVISION_BIT_SHIFT) | \
+ ((Minor) & MINOR_REVISION_MASK))
+
+/** This macro returns the Major revision
+
+ Extracts Major from the 32 bit representation of the type Major.Minor
+
+ @param [in] Revision The Revision value which is 32 bit.
+
+ @return the Major part of the revision.
+**/
+#define GET_MAJOR_REVISION(Revision) \
+ (((Revision) >> MAJOR_REVISION_BIT_SHIFT) & MAJOR_REVISION_MASK)
+
+/** This macro returns the Minor revision
+
+ Extracts Minor from the 32 bit representation of the type Major.Minor
+
+ @param [in] Revision The Revision value which is 32 bit.
+
+ @return the Minor part of the revision.
+**/
+#define GET_MINOR_REVISION(Revision) ((Revision) & MINOR_REVISION_MASK)
+
+#endif // TABLE_GENERATOR_H_
+
|