/** @file\r
\r
- Copyright (c) 2017-2018, Arm Limited. All rights reserved.\r
+ Copyright (c) 2017-2021, Arm Limited. All rights reserved.<BR>\r
\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
- System Control and Management Interface V1.0\r
- http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/\r
- DEN0056A_System_Control_and_Management_Interface.pdf\r
+ @par Specification Reference:\r
+ - Arm System Control and Management Interface - Platform Design Document\r
+ (https://developer.arm.com/documentation/den0056/)\r
**/\r
\r
#include <Base.h>\r
#include "ScmiDxe.h"\r
#include "ScmiPrivate.h"\r
\r
-STATIC CONST SCMI_PROTOCOL_ENTRY Protocols[] = {\r
- { SCMI_PROTOCOL_ID_BASE, ScmiBaseProtocolInit },\r
- { SCMI_PROTOCOL_ID_PERFORMANCE, ScmiPerformanceProtocolInit },\r
- { SCMI_PROTOCOL_ID_CLOCK, ScmiClockProtocolInit }\r
+STATIC CONST SCMI_PROTOCOL_ENTRY Protocols[] = {\r
+ { ScmiProtocolIdBase, ScmiBaseProtocolInit },\r
+ { ScmiProtocolIdPerformance, ScmiPerformanceProtocolInit },\r
+ { ScmiProtocolIdClock, ScmiClockProtocolInit }\r
};\r
\r
/** ARM SCMI driver entry point function.\r
EFI_STATUS\r
EFIAPI\r
ArmScmiDxeEntryPoint (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
EFI_STATUS Status;\r
UINT32 Index;\r
UINT32 NumProtocols;\r
UINT32 ProtocolIndex;\r
- UINT8 SupportedList[MAX_PROTOCOLS];\r
- UINT32 SupportedListSize = sizeof (SupportedList);\r
+ UINT8 *SupportedList;\r
+ UINT32 SupportedListSize;\r
\r
// Every SCMI implementation must implement the base protocol.\r
- ASSERT (Protocols[0].Id == SCMI_PROTOCOL_ID_BASE);\r
+ ASSERT (Protocols[0].Id == ScmiProtocolIdBase);\r
\r
Status = ScmiBaseProtocolInit (&ImageHandle);\r
if (EFI_ERROR (Status)) {\r
Status = gBS->LocateProtocol (\r
&gArmScmiBaseProtocolGuid,\r
NULL,\r
- (VOID**)&BaseProtocol\r
+ (VOID **)&BaseProtocol\r
);\r
if (EFI_ERROR (Status)) {\r
ASSERT (FALSE);\r
return Status;\r
}\r
\r
- if (Version != BASE_PROTOCOL_VERSION) {\r
+ // Accept any version between SCMI v1.0 and SCMI v2.0\r
+ if ((Version < BASE_PROTOCOL_VERSION_V1) ||\r
+ (Version > BASE_PROTOCOL_VERSION_V2))\r
+ {\r
ASSERT (FALSE);\r
return EFI_UNSUPPORTED;\r
}\r
// Apart from Base protocol, SCMI may implement various other protocols,\r
// query total protocols implemented by the SCP firmware.\r
NumProtocols = 0;\r
- Status = BaseProtocol->GetTotalProtocols (BaseProtocol, &NumProtocols);\r
+ Status = BaseProtocol->GetTotalProtocols (BaseProtocol, &NumProtocols);\r
if (EFI_ERROR (Status)) {\r
ASSERT (FALSE);\r
return Status;\r
\r
ASSERT (NumProtocols != 0);\r
\r
+ SupportedListSize = (NumProtocols * sizeof (*SupportedList));\r
+\r
+ Status = gBS->AllocatePool (\r
+ EfiBootServicesData,\r
+ SupportedListSize,\r
+ (VOID **)&SupportedList\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ ASSERT (FALSE);\r
+ return Status;\r
+ }\r
+\r
// Get the list of protocols supported by SCP firmware on the platform.\r
Status = BaseProtocol->DiscoverListProtocols (\r
- BaseProtocol,\r
- &SupportedListSize,\r
- SupportedList\r
- );\r
+ BaseProtocol,\r
+ &SupportedListSize,\r
+ SupportedList\r
+ );\r
if (EFI_ERROR (Status)) {\r
+ gBS->FreePool (SupportedList);\r
ASSERT (FALSE);\r
return Status;\r
}\r
\r
// Install supported protocol on ImageHandle.\r
for (ProtocolIndex = 1; ProtocolIndex < ARRAY_SIZE (Protocols);\r
- ProtocolIndex++) {\r
+ ProtocolIndex++)\r
+ {\r
for (Index = 0; Index < NumProtocols; Index++) {\r
if (Protocols[ProtocolIndex].Id == SupportedList[Index]) {\r
Status = Protocols[ProtocolIndex].InitFn (&ImageHandle);\r
ASSERT_EFI_ERROR (Status);\r
return Status;\r
}\r
+\r
break;\r
}\r
}\r
}\r
\r
+ gBS->FreePool (SupportedList);\r
+\r
return EFI_SUCCESS;\r
}\r