Skip to content

Commit

Permalink
DynamicTablesPkg: Generate X64 CPU SSDT Topology
Browse files Browse the repository at this point in the history
Creates processor objects based on configuration data.

Cc: Sami Mujawar <[email protected]>
Cc: Pierre Gondois <[email protected]>
Signed-off-by: Abdul Lateef Attar <[email protected]>
  • Loading branch information
Abdul Lateef Attar authored and Abdul Lateef Attar committed Nov 20, 2024
1 parent e41e493 commit 93f3739
Showing 1 changed file with 66 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,40 @@
@retval EFI_UNSUPPORTED Not supported
**/

#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Protocol/AcpiTable.h>

// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
#include <ConfigurationManagerHelper.h>
#include <Library/AcpiHelperLib.h>
#include <Library/TableHelperLib.h>
#include <Library/AmlLib/AmlLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>

#include "SsdtCpuTopologyGenerator.h"

/** Define Local APIC Flags Masks
*/
#define LOCAL_APIC_FLAGS_ENABLED 0x1
#define LOCAL_APIC_FLAGS_ONLINE 0x2
#define LOCAL_APIC_FLAGS_MASK ( \
LOCAL_APIC_FLAGS_ENABLED | \
LOCAL_APIC_FLAGS_ONLINE)

/** This macro expands to a function that retrieves the
Local APIC or X2APIC information from the Configuration Manager.
*/
GET_OBJECT_LIST (
EObjNameSpaceX64,
EX64ObjLocalApicX2ApicInfo,
CM_X64_LOCAL_APIC_X2APIC_INFO
);

/**
Create the processor hierarchy AML tree from arch specific CM objects.
Expand All @@ -43,7 +71,44 @@ CreateTopologyFromIntC (
IN AML_OBJECT_NODE_HANDLE ScopeNode
)
{
return EFI_UNSUPPORTED;
EFI_STATUS Status;
CM_X64_LOCAL_APIC_X2APIC_INFO *LocalApicX2ApicInfo;
UINT32 LocalApicX2ApicCount;
UINT32 Index;
AML_OBJECT_NODE_HANDLE CpuNode;

ASSERT (Generator != NULL);
ASSERT (CfgMgrProtocol != NULL);
ASSERT (ScopeNode != NULL);

LocalApicX2ApicCount = 0;
Status = GetEX64ObjLocalApicX2ApicInfo (
CfgMgrProtocol,
CM_NULL_TOKEN,
&LocalApicX2ApicInfo,
&LocalApicX2ApicCount
);
if (EFI_ERROR (Status)) {
ASSERT_EFI_ERROR (Status);
return Status;
}

/// for each processor object, create an AML node.
for (Index = 0; Index < LocalApicX2ApicCount; Index++) {
Status = CreateAmlCpu (
Generator,
ScopeNode,
LocalApicX2ApicInfo[Index].AcpiProcessorUid,
Index,
&CpuNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
break;
}
}

return Status;
}

/** Add arch specific information to a CPU node in the asl description.
Expand Down

0 comments on commit 93f3739

Please sign in to comment.