Skip to content

Commit 6a3c816

Browse files
Platform/ARM: VExpressPkg: Implement Platform Configuration menu
Implement ArmVExpressPlatformConfigDxe driver, to allow VExpress platform configuration via UEFI menus. Currently CPU enable/disable is supported. ACPI tables are updated to reflect the chosen configuration. Signed-off-by: Sarah Walker <[email protected]>
1 parent bbc7f6b commit 6a3c816

File tree

13 files changed

+821
-13
lines changed

13 files changed

+821
-13
lines changed

Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@
400400
NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
401401
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
402402
}
403+
Platform/ARM/VExpressPkg/Drivers/ArmVExpressPlatformConfigDxe/ArmVExpressPlatformConfigDxe.inf
403404

404405
!if $(DT_SUPPORT) == TRUE
405406
#

Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.fdf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ FvNameGuid = 87940482-fc81-41c3-87e6-399cf85ac8a0
173173
INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
174174
INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
175175
INF MdeModulePkg/Application/UiApp/UiApp.inf
176+
INF Platform/ARM/VExpressPkg/Drivers/ArmVExpressPlatformConfigDxe/ArmVExpressPlatformConfigDxe.inf
176177

177178
!if $(ENABLE_STMM) == TRUE
178179
INF ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf

Platform/ARM/VExpressPkg/ArmVExpressPkg.dec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
[Guids.common]
3232
gArmVExpressTokenSpaceGuid = { 0xD8D68B8E, 0x0ACE, 0x4942, { 0xA4, 0xB9, 0x36, 0xEE, 0x9E, 0x80, 0x80, 0x9D } }
33+
gArmVExpressPlatformConfigGuid = { 0xF97637D5, 0xA725, 0x4DBD, { 0xA1, 0x80, 0xD9, 0x55, 0x49, 0x20, 0x54, 0x5D } }
3334

3435
[PcdsFeatureFlag.common]
3536

Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c

Lines changed: 62 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,27 @@
1919
#include <Library/IoLib.h>
2020
#include <Library/PcdLib.h>
2121
#include <Library/UefiBootServicesTableLib.h>
22+
#include <Library/UefiRuntimeServicesTableLib.h>
2223
#include <Protocol/AcpiTable.h>
2324
#include <Protocol/ConfigurationManagerProtocol.h>
25+
#include <Guid/ArmVExpressPlatformConfig.h>
26+
#include <PlatformConfigStructs.h>
2427

2528
#include "ArmPlatform.h"
2629
#include "ConfigurationManager.h"
2730
#include "Platform.h"
2831

32+
#define STA_CPU_ENABLED ( \
33+
ACPI_AML_STA_DEVICE_STATUS_PRESET | \
34+
ACPI_AML_STA_DEVICE_STATUS_ENABLED | \
35+
ACPI_AML_STA_DEVICE_STATUS_UI | \
36+
ACPI_AML_STA_DEVICE_STATUS_FUNCTIONING)
37+
38+
#define STA_CPU_DISABLED ( \
39+
ACPI_AML_STA_DEVICE_STATUS_PRESET | \
40+
ACPI_AML_STA_DEVICE_STATUS_UI | \
41+
ACPI_AML_STA_DEVICE_STATUS_FUNCTIONING)
42+
2943
/** The platform configuration repository information.
3044
*/
3145
STATIC
@@ -128,20 +142,20 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositoryInfo = {
128142
{ EFI_ACPI_6_5_PM_PROFILE_ENTERPRISE_SERVER }, // PowerManagement Profile
129143

130144
/* GIC CPU Interface information
131-
GIC_ENTRY (CPUInterfaceNumber, Mpidr, PmuIrq, VGicIrq, EnergyEfficiency)
145+
GIC_ENTRY (CPUInterfaceNumber, Mpidr, PmuIrq, VGicIrq, EnergyEfficiency, StaToken)
132146
Note: The MPIDR is fixed up in InitializePlatformRepository() if the
133147
platform is FVP RevC.
134148
*/
135149
{
136-
GICC_ENTRY (0, GET_MPID (0, 0), 92, 25, 0),
137-
GICC_ENTRY (1, GET_MPID (0, 1), 93, 25, 0),
138-
GICC_ENTRY (2, GET_MPID (0, 2), 94, 25, 0),
139-
GICC_ENTRY (3, GET_MPID (0, 3), 95, 25, 0),
140-
141-
GICC_ENTRY (4, GET_MPID (1, 0), 96, 25, 0),
142-
GICC_ENTRY (5, GET_MPID (1, 1), 97, 25, 0),
143-
GICC_ENTRY (6, GET_MPID (1, 2), 98, 25, 0),
144-
GICC_ENTRY (7, GET_MPID (1, 3), 99, 25, 0)
150+
GICC_ENTRY (0, GET_MPID (0, 0), 92, 25, 0, REFERENCE_TOKEN (StaInfo[0])),
151+
GICC_ENTRY (1, GET_MPID (0, 1), 93, 25, 0, REFERENCE_TOKEN (StaInfo[1])),
152+
GICC_ENTRY (2, GET_MPID (0, 2), 94, 25, 0, REFERENCE_TOKEN (StaInfo[2])),
153+
GICC_ENTRY (3, GET_MPID (0, 3), 95, 25, 0, REFERENCE_TOKEN (StaInfo[3])),
154+
155+
GICC_ENTRY (4, GET_MPID (1, 0), 96, 25, 0, REFERENCE_TOKEN (StaInfo[4])),
156+
GICC_ENTRY (5, GET_MPID (1, 1), 97, 25, 0, REFERENCE_TOKEN (StaInfo[5])),
157+
GICC_ENTRY (6, GET_MPID (1, 2), 98, 25, 0, REFERENCE_TOKEN (StaInfo[6])),
158+
GICC_ENTRY (7, GET_MPID (1, 3), 99, 25, 0, REFERENCE_TOKEN (StaInfo[7]))
145159
},
146160

147161
// GIC Distributor Info
@@ -925,6 +939,17 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositoryInfo = {
925939
{
926940
{ REFERENCE_TOKEN (LpiInfo[1]) },
927941
{ REFERENCE_TOKEN (LpiInfo[2]) },
942+
},
943+
// StaInfo
944+
{
945+
{ STA_CPU_ENABLED },
946+
{ STA_CPU_ENABLED },
947+
{ STA_CPU_ENABLED },
948+
{ STA_CPU_ENABLED },
949+
{ STA_CPU_ENABLED },
950+
{ STA_CPU_ENABLED },
951+
{ STA_CPU_ENABLED },
952+
{ STA_CPU_ENABLED }
928953
}
929954
};
930955

@@ -1091,6 +1116,9 @@ InitializePlatformRepository (
10911116
UINTN Index;
10921117
UINT16 TrbeInterrupt;
10931118
CM_OBJECT_TOKEN EtToken;
1119+
PLATFORM_CONFIG_DATA PlatformConfig;
1120+
UINTN BufferSize;
1121+
EFI_STATUS Status;
10941122

10951123
PlatformRepo = This->PlatRepoInfo;
10961124

@@ -1137,6 +1165,20 @@ InitializePlatformRepository (
11371165
// Retrieve interrupts stored in PCDs
11381166
PlatformRepo->Watchdog.TimerGSIV = PcdGet32 (PcdGenericWatchdogEl2IntrNum);
11391167

1168+
BufferSize = sizeof(PLATFORM_CONFIG_DATA);
1169+
Status = gRT->GetVariable (L"PlatformConfig", &gArmVExpressPlatformConfigGuid, NULL, &BufferSize, &PlatformConfig);
1170+
if (!EFI_ERROR(Status)) {
1171+
for (Index = 0; Index < PLAT_CPU_COUNT; Index++) {
1172+
if (PlatformConfig.CpuEnable[Index]) {
1173+
PlatformRepo->GicCInfo[Index].Flags |= EFI_ACPI_6_2_GIC_ENABLED;
1174+
PlatformRepo->StaInfo[Index].DeviceStatus = STA_CPU_ENABLED;
1175+
} else {
1176+
PlatformRepo->GicCInfo[Index].Flags &= ~EFI_ACPI_6_2_GIC_ENABLED;
1177+
PlatformRepo->StaInfo[Index].DeviceStatus = STA_CPU_DISABLED;
1178+
}
1179+
}
1180+
}
1181+
11401182
return EFI_SUCCESS;
11411183
}
11421184

@@ -1801,6 +1843,16 @@ GetArchCommonNameSpaceObject (
18011843
);
18021844
break;
18031845

1846+
case EArchCommonObjStaInfo:
1847+
Status = HandleCmObject (
1848+
CmObjectId,
1849+
&PlatformRepo->StaInfo,
1850+
sizeof (PlatformRepo->StaInfo),
1851+
PLAT_CPU_COUNT,
1852+
CmObject
1853+
);
1854+
break;
1855+
18041856
case EArchCommonObjCacheInfo:
18051857
Status = HandleCmObject (
18061858
CmObjectId,

Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ extern CHAR8 dsdt_aml_code[];
3333
Mpidr, \
3434
PmuIrq, \
3535
VGicIrq, \
36-
EnergyEfficiency \
36+
EnergyEfficiency, \
37+
StaToken \
3738
) { \
3839
CPUInterfaceNumber, /* UINT32 CPUInterfaceNumber */ \
3940
CPUInterfaceNumber, /* UINT32 AcpiProcessorUid */ \
@@ -49,7 +50,16 @@ extern CHAR8 dsdt_aml_code[];
4950
VGicIrq, /* UINT32 VGICMaintenanceInterrupt */ \
5051
0, /* UINT64 GICRBaseAddress */ \
5152
Mpidr, /* UINT64 MPIDR */ \
52-
EnergyEfficiency /* UINT8 ProcessorPowerEfficiencyClass*/ \
53+
EnergyEfficiency, /* UINT8 ProcessorPowerEfficiencyClass*/ \
54+
0, /* UINT16 SpeOverflowInterrupt */ \
55+
0, /* UINT32 ProximityDomain */ \
56+
0, /* UINT32 ClockDomain */ \
57+
0, /* UINT32 AffinityFlags */ \
58+
CM_NULL_TOKEN, /* CM_OBJECT_TOKEN CpcToken */ \
59+
0, /* UINT16 TrbeInterrupt */ \
60+
CM_NULL_TOKEN, /* CM_OBJECT_TOKEN EtToken */ \
61+
CM_NULL_TOKEN, /* CM_OBJECT_TOKEN PsdToken */ \
62+
StaToken /* CM_OBJECT_TOKEN StaToken */ \
5363
}
5464

5565
/** A helper macro for populating the Processor Hierarchy Node flags
@@ -310,6 +320,8 @@ typedef struct PlatformRepositoryInfo {
310320
// Cores Low Power Idle state references (LPI)
311321
CM_ARCH_COMMON_OBJ_REF CoresLpiRef[CORES_LPI_STATE_COUNT];
312322

323+
CM_ARCH_COMMON_STA_INFO StaInfo[PLAT_CPU_COUNT];
324+
313325
/// System ID
314326
UINT32 SysId;
315327
} EDKII_PLATFORM_REPOSITORY_INFO;

Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,7 @@
7979
gArmTokenSpaceGuid.PcdGenericWatchdogEl2IntrNum
8080

8181
[Depex]
82-
gEfiTimerArchProtocolGuid
82+
gEfiTimerArchProtocolGuid AND gEfiVariableArchProtocolGuid
83+
84+
[Guids]
85+
gArmVExpressPlatformConfigGuid

0 commit comments

Comments
 (0)