25#define ARM_FFH_DELIVERED_PERF_COUNTER_REGISTER 0x0
26#define ARM_FFH_REFERENCE_PERF_COUNTER_REGISTER 0x1
53 Status =
gBS->LocateProtocol (
54 &gArmScmiPerformanceProtocolGuid,
58 if (EFI_ERROR (Status)) {
63 if (EFI_ERROR (Status)) {
68 if (Version < PERFORMANCE_PROTOCOL_VERSION_V2) {
71 "DynamicTablesScmiInfoLib requires SCMI version > 2.0\n"
73 return EFI_UNSUPPORTED;
104 OUT UINT32 *LevelArrayCount
113 (LevelArray ==
NULL) ||
114 (LevelArrayCount ==
NULL))
116 return EFI_INVALID_PARAMETER;
128 if (Status != EFI_BUFFER_TOO_SMALL) {
131 return EFI_INVALID_PARAMETER;
139 return EFI_OUT_OF_RESOURCES;
150 if (EFI_ERROR (Status)) {
155 *LevelArrayCount = Count;
187 UINT64 FcLevelGetAddr;
188 UINT64 FcLimitsMaxSetAddr;
189 UINT64 FcLimitsMinSetAddr;
194 return EFI_INVALID_PARAMETER;
200 ScmiMessageIdPerformanceLevelSet,
203 if (EFI_ERROR (Status)) {
210 ScmiMessageIdPerformanceLimitsSet,
213 if (EFI_ERROR (Status)) {
222 if (EFI_ERROR (Status)) {
227 if (EFI_ERROR (Status)) {
237 if ((FcLevelGet.
ChanSize != sizeof (UINT32)) ||
240 (FcLimitsSet.
ChanSize != 2 * sizeof (UINT32)) ||
244 Status = EFI_INVALID_PARAMETER;
248 FcLevelGetAddr = ((UINT64)FcLevelGet.
ChanAddrHigh << 32) |
250 FcLimitsMaxSetAddr = ((UINT64)FcLimitsSet.
ChanAddrHigh << 32) |
252 FcLimitsMinSetAddr = FcLimitsMaxSetAddr + 0x4;
255 CpcInfo->HighestPerformanceInteger = LevelArray[LevelCount - 1].Level;
256 CpcInfo->NominalPerformanceInteger = DomainAttributes.SustainedPerfLevel;
257 CpcInfo->LowestNonlinearPerformanceInteger = LevelArray[0].Level;
258 CpcInfo->LowestPerformanceInteger = LevelArray[0].Level;
260 CpcInfo->DesiredPerformanceRegister.AddressSpaceId = EFI_ACPI_6_5_SYSTEM_MEMORY;
261 CpcInfo->DesiredPerformanceRegister.RegisterBitWidth = 32;
262 CpcInfo->DesiredPerformanceRegister.RegisterBitOffset = 0;
263 CpcInfo->DesiredPerformanceRegister.AccessSize = EFI_ACPI_6_5_DWORD;
264 CpcInfo->DesiredPerformanceRegister.Address = FcLevelGetAddr;
266 CpcInfo->MinimumPerformanceRegister.AddressSpaceId = EFI_ACPI_6_5_SYSTEM_MEMORY;
267 CpcInfo->MinimumPerformanceRegister.RegisterBitWidth = 32;
268 CpcInfo->MinimumPerformanceRegister.RegisterBitOffset = 0;
269 CpcInfo->MinimumPerformanceRegister.AccessSize = EFI_ACPI_6_5_DWORD;
270 CpcInfo->MinimumPerformanceRegister.Address = FcLimitsMinSetAddr;
272 CpcInfo->MaximumPerformanceRegister.AddressSpaceId = EFI_ACPI_6_5_SYSTEM_MEMORY;
273 CpcInfo->MaximumPerformanceRegister.RegisterBitWidth = 32;
274 CpcInfo->MaximumPerformanceRegister.RegisterBitOffset = 0;
275 CpcInfo->MaximumPerformanceRegister.AccessSize = EFI_ACPI_6_5_DWORD;
276 CpcInfo->MaximumPerformanceRegister.Address = FcLimitsMaxSetAddr;
278 CpcInfo->ReferencePerformanceCounterRegister.AddressSpaceId = EFI_ACPI_6_5_FUNCTIONAL_FIXED_HARDWARE;
279 CpcInfo->ReferencePerformanceCounterRegister.RegisterBitWidth = 0x40;
280 CpcInfo->ReferencePerformanceCounterRegister.RegisterBitOffset = 0;
281 CpcInfo->ReferencePerformanceCounterRegister.AccessSize = ARM_FFH_REFERENCE_PERF_COUNTER_REGISTER;
282 CpcInfo->ReferencePerformanceCounterRegister.Address = 0x4;
284 CpcInfo->DeliveredPerformanceCounterRegister.AddressSpaceId = EFI_ACPI_6_5_FUNCTIONAL_FIXED_HARDWARE;
285 CpcInfo->DeliveredPerformanceCounterRegister.RegisterBitWidth = 0x40;
286 CpcInfo->DeliveredPerformanceCounterRegister.RegisterBitOffset = 0;
288 CpcInfo->DeliveredPerformanceCounterRegister.Address = 0x4;
#define EFI_ACPI_6_5_AML_CPC_REVISION
STATIC EFI_STATUS EFIAPI DynamicTablesScmiInfoDescribeLevels(IN UINT32 DomainId, OUT SCMI_PERFORMANCE_LEVEL **LevelArray, OUT UINT32 *LevelArrayCount)
EFI_STATUS EFIAPI DynamicTablesScmiInfoGetFastChannel(IN UINT32 DomainId, OUT AML_CPC_INFO *CpcInfo)
STATIC SCMI_PERFORMANCE_PROTOCOL * ScmiPerfProtocol
Arm SCMI performance protocol.
#define ARM_FFH_DELIVERED_PERF_COUNTER_REGISTER
EFI_STATUS EFIAPI DynamicTablesScmiInfoLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define DEBUG(Expression)
Performance protocol describe fastchannel.
UINT32 Attributes
Attributes.
UINT32 ChanAddrHigh
Higher 32 bits of the FastChannel address.
UINT32 ChanAddrLow
Lower 32 bits of the FastChannel address.
UINT32 ChanSize
Size of the FastChannel in bytes.