TianoCore EDK2 master
Loading...
Searching...
No Matches
SratGenerator.c File Reference

Go to the source code of this file.

Macros

#define SRAT_GENERATOR_REVISION   CREATE_REVISION (1, 0)
 

Functions

 GET_OBJECT_LIST (EObjNameSpaceArchCommon, EArchCommonObjMemoryAffinityInfo, CM_ARCH_COMMON_MEMORY_AFFINITY_INFO)
 
 GET_OBJECT_LIST (EObjNameSpaceArchCommon, EArchCommonObjGenericInitiatorAffinityInfo, CM_ARCH_COMMON_GENERIC_INITIATOR_AFFINITY_INFO)
 
 GET_OBJECT_LIST (EObjNameSpaceArchCommon, EArchCommonObjDeviceHandleAcpi, CM_ARCH_COMMON_DEVICE_HANDLE_ACPI)
 
 GET_OBJECT_LIST (EObjNameSpaceArchCommon, EArchCommonObjDeviceHandlePci, CM_ARCH_COMMON_DEVICE_HANDLE_PCI)
 
STATIC UINT16 GetBdf (IN CONST CM_ARCH_COMMON_DEVICE_HANDLE_PCI *DeviceHandlePci)
 
STATIC EFI_STATUS AddMemoryAffinity (IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *CONST Srat, IN CONST UINT32 MemAffOffset, IN CONST CM_ARCH_COMMON_MEMORY_AFFINITY_INFO *MemAffInfo, IN UINT32 MemAffCount)
 
STATIC EFI_STATUS AddGenericInitiatorAffinity (IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *CONST Srat, IN CONST UINT32 GenInitAffOff, IN CONST CM_ARCH_COMMON_GENERIC_INITIATOR_AFFINITY_INFO *GenInitAffInfo, IN UINT32 GenInitAffCount)
 
STATIC EFI_STATUS EFIAPI BuildSratTable (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, OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table)
 
STATIC EFI_STATUS EFIAPI FreeSratTableResources (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)
 
EFI_STATUS EFIAPI AcpiSratLibConstructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
EFI_STATUS EFIAPI AcpiSratLibDestructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

STATIC CONST ACPI_TABLE_GENERATOR SratGenerator
 

Detailed Description

SRAT Table Generator

Copyright (c) 2019 - 2020, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent

Reference(s):
  • ACPI 6.3 Specification, January 2019
Glossary:
  • Cm or CM - Configuration Manager
  • Obj or OBJ - Object

Definition in file SratGenerator.c.

Macro Definition Documentation

◆ SRAT_GENERATOR_REVISION

#define SRAT_GENERATOR_REVISION   CREATE_REVISION (1, 0)

The SRAT Table Generator revision.

Definition at line 584 of file SratGenerator.c.

Function Documentation

◆ AcpiSratLibConstructor()

EFI_STATUS EFIAPI AcpiSratLibConstructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Register the Generator with the ACPI Table Factory.

Parameters
[in]ImageHandleThe handle to the image.
[in]SystemTablePointer to the System Table.
Return values
EFI_SUCCESSThe Generator is registered.
EFI_INVALID_PARAMETERA parameter is invalid.
EFI_ALREADY_STARTEDThe Generator for the Table ID is already registered.

Definition at line 628 of file SratGenerator.c.

◆ AcpiSratLibDestructor()

EFI_STATUS EFIAPI AcpiSratLibDestructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Deregister the Generator from the ACPI Table Factory.

Parameters
[in]ImageHandleThe handle to the image.
[in]SystemTablePointer to the System Table.
Return values
EFI_SUCCESSThe Generator is deregistered.
EFI_INVALID_PARAMETERA parameter is invalid.
EFI_NOT_FOUNDThe Generator is not registered.

Definition at line 652 of file SratGenerator.c.

◆ AddGenericInitiatorAffinity()

STATIC EFI_STATUS AddGenericInitiatorAffinity ( IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST  CfgMgrProtocol,
IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *CONST  Srat,
IN CONST UINT32  GenInitAffOff,
IN CONST CM_ARCH_COMMON_GENERIC_INITIATOR_AFFINITY_INFO GenInitAffInfo,
IN UINT32  GenInitAffCount 
)

Add the Generic Initiator Affinity Structures in the SRAT Table.

Parameters
[in]CfgMgrProtocolPointer to the Configuration Manager Protocol Interface.
[in]SratPointer to the SRAT Table.
[in]GenInitAffOffOffset of the Generic Initiator Affinity information in the SRAT Table.
[in]GenInitAffInfoPointer to the Generic Initiator Affinity Information list.
[in]GenInitAffCountCount of Generic Initiator Affinity objects.
Return values
EFI_SUCCESSTable generated successfully.
EFI_INVALID_PARAMETERA parameter is invalid.
EFI_NOT_FOUNDThe required object information is not found.
EFI_BAD_BUFFER_SIZEThe size returned by the Configuration Manager is less than the Object size for the requested object.

Definition at line 179 of file SratGenerator.c.

◆ AddMemoryAffinity()

STATIC EFI_STATUS AddMemoryAffinity ( IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST  CfgMgrProtocol,
IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *CONST  Srat,
IN CONST UINT32  MemAffOffset,
IN CONST CM_ARCH_COMMON_MEMORY_AFFINITY_INFO MemAffInfo,
IN UINT32  MemAffCount 
)

Add the Memory Affinity Structures in the SRAT Table.

Parameters
[in]CfgMgrProtocolPointer to the Configuration Manager Protocol Interface.
[in]SratPointer to the SRAT Table.
[in]MemAffOffsetOffset of the Memory Affinity information in the SRAT Table.
[in]MemAffInfoPointer to the Memory Affinity Information list.
[in]MemAffCountCount of Memory Affinity objects.
Return values
EFI_SUCCESSTable generated successfully.

Definition at line 119 of file SratGenerator.c.

◆ BuildSratTable()

Construct the SRAT ACPI table.

Called by the Dynamic Table Manager, this function invokes the Configuration Manager protocol interface to get the required hardware information for generating the ACPI table.

If this function allocates any resources then they must be freed in the FreeXXXXTableResources function.

Parameters
[in]ThisPointer to the table generator.
[in]AcpiTableInfoPointer to the ACPI Table Info.
[in]CfgMgrProtocolPointer to the Configuration Manager Protocol Interface.
[out]TablePointer to the constructed ACPI Table.
Return values
EFI_SUCCESSTable generated successfully.
EFI_INVALID_PARAMETERA parameter is invalid.
EFI_NOT_FOUNDThe required object was not found.
EFI_BAD_BUFFER_SIZEThe size returned by the Configuration Manager is less than the Object size for the requested object.
EFI_OUT_OF_RESOURCESMemory allocation failed.

Definition at line 334 of file SratGenerator.c.

◆ FreeSratTableResources()

Free any resources allocated for constructing the SRAT.

Parameters
[in]ThisPointer to the table generator.
[in]AcpiTableInfoPointer to the ACPI Table Info.
[in]CfgMgrProtocolPointer to the Configuration Manager Protocol Interface.
[in,out]TablePointer to the ACPI Table.
Return values
EFI_SUCCESSThe resources were freed successfully.
EFI_INVALID_PARAMETERThe table pointer is NULL or invalid.

Definition at line 556 of file SratGenerator.c.

◆ GET_OBJECT_LIST() [1/4]

This macro expands to a function that retrieves the ACPI Device Handle information from the Configuration Manager.

◆ GET_OBJECT_LIST() [2/4]

This macro expands to a function that retrieves the PCI Device Handle information from the Configuration Manager.

◆ GET_OBJECT_LIST() [3/4]

This macro expands to a function that retrieves the Generic Initiator Affinity information from the Configuration Manager.

◆ GET_OBJECT_LIST() [4/4]

Standard SRAT Generator

Requirements: The following Configuration Manager Object(s) are used by this Generator:

  • EArchCommonObjMemoryAffinityInfo (OPTIONAL)
  • EArchCommonObjGenericInitiatorAffinityInfo (OPTIONAL)
  • EArchCommonObjDeviceHandleAcpi (OPTIONAL)
  • EArchCommonObjDeviceHandlePci (OPTIONAL) This macro expands to a function that retrieves the Memory Affinity information from the Configuration Manager.

◆ GetBdf()

STATIC UINT16 GetBdf ( IN CONST CM_ARCH_COMMON_DEVICE_HANDLE_PCI DeviceHandlePci)

Return the PCI Device information in BDF format

PCI Bus Number - Max 256 busses (Bits 15:8 of BDF) PCI Device Number - Max 32 devices (Bits 7:3 of BDF) PCI Function Number - Max 8 functions (Bits 2:0 of BDF)

Parameters
[in]DeviceHandlePciPointer to the PCI Device Handle.
Return values
BDFvalue corresponding to the PCI Device Handle.

Definition at line 93 of file SratGenerator.c.

Variable Documentation

◆ SratGenerator

Initial value:
= {
L"ACPI.STD.SRAT.GENERATOR",
}
#define EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_REVISION
Definition: Acpi63.h:648
#define EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_SIGNATURE
Definition: Acpi63.h:2826
#define CREATE_STD_ACPI_TABLE_GEN_ID(TableId)
#define TABLE_GENERATOR_CREATOR_ID
@ EStdAcpiTableIdSrat
SRAT Generator.
#define NULL
Definition: Base.h:319
#define SRAT_GENERATOR_REVISION
STATIC EFI_STATUS EFIAPI BuildSratTable(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, OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table)
STATIC EFI_STATUS EFIAPI FreeSratTableResources(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)

The interface for the SRAT Table Generator.

Definition at line 590 of file SratGenerator.c.