61 UINT32 SupportedListSize;
64 ASSERT (Protocols[0].Id == ScmiProtocolIdBase);
67 if (EFI_ERROR (Status)) {
72 Status =
gBS->LocateProtocol (
73 &gArmScmiBaseProtocolGuid,
75 (VOID **)&BaseProtocol
77 if (EFI_ERROR (Status)) {
83 Status = BaseProtocol->GetVersion (BaseProtocol, &Version);
84 if (EFI_ERROR (Status)) {
90 if ((Version < BASE_PROTOCOL_VERSION_V1) ||
91 (Version > BASE_PROTOCOL_VERSION_V2))
94 return EFI_UNSUPPORTED;
100 Status = BaseProtocol->GetTotalProtocols (BaseProtocol, &NumProtocols);
101 if (EFI_ERROR (Status)) {
106 ASSERT (NumProtocols != 0);
108 SupportedListSize = (NumProtocols *
sizeof (*SupportedList));
110 Status =
gBS->AllocatePool (
113 (VOID **)&SupportedList
115 if (EFI_ERROR (Status)) {
121 Status = BaseProtocol->DiscoverListProtocols (
126 if (EFI_ERROR (Status)) {
127 gBS->FreePool (SupportedList);
133 for (ProtocolIndex = 1; ProtocolIndex <
ARRAY_SIZE (Protocols);
136 for (Index = 0; Index < NumProtocols; Index++) {
137 if (Protocols[ProtocolIndex].Id == SupportedList[Index]) {
138 Status = Protocols[ProtocolIndex].InitFn (&ImageHandle);
139 if (EFI_ERROR (Status)) {
149 gBS->FreePool (SupportedList);
EFI_STATUS ScmiBaseProtocolInit(IN OUT EFI_HANDLE *Handle)
EFI_STATUS ScmiClockProtocolInit(IN EFI_HANDLE *Handle)
#define ARRAY_SIZE(Array)
#define ASSERT_EFI_ERROR(StatusParameter)
EFI_STATUS EFIAPI ArmScmiDxeEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)