20VOID *gEfiRedfishDiscoverRegistration;
23BOOLEAN gRedfishDiscoverActivated =
FALSE;
24BOOLEAN gRedfishServiceDiscovered =
FALSE;
26UINTN mNumberOfNetworkInterfaces;
27EFI_EVENT mEdkIIRedfishHostInterfaceReadyEvent;
28VOID *mEdkIIRedfishHostInterfaceRegistration;
37 REDFISH_CONFIG_VERSION,
51 if (gRedfishDiscoverActivated) {
55 if (gEfiRedfishDiscoverProtocolEvent !=
NULL) {
56 gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent);
59 gEfiRedfishDiscoverControllerHandle =
NULL;
60 gEfiRedfishDiscoverProtocol =
NULL;
61 gRedfishDiscoverActivated =
FALSE;
62 gRedfishServiceDiscovered =
FALSE;
80 if (!gRedfishDiscoverActivated) {
146 &gEfiRestExServiceBindingProtocolGuid,
149 if (EFI_ERROR (Status)) {
150 return EFI_UNSUPPORTED;
156 Status =
gBS->OpenProtocol (
158 &gEfiRestExProtocolGuid,
160 This->DriverBindingHandle,
162 EFI_OPEN_PROTOCOL_GET_PROTOCOL
164 if (EFI_ERROR (Status)) {
165 Status = EFI_UNSUPPORTED;
171 &gEfiRestExServiceBindingProtocolGuid,
218 VOID *ConfigHandlerRegistration;
221 return EFI_ALREADY_STARTED;
225 &gEdkIIRedfishConfigHandlerProtocolGuid,
228 (VOID *)&gRedfishConfigData,
229 &ConfigHandlerRegistration
271 if (ControllerHandle == gEfiRedfishDiscoverControllerHandle) {
277 &gEfiRedfishDiscoverProtocolGuid,
278 gRedfishConfigData.
Image,
279 gRedfishConfigData.
Image
283 if (EFI_ERROR (Status)) {
284 return EFI_DEVICE_ERROR;
288 gBS->CloseEvent (gRedfishConfigData.
Event);
313 gBS->CloseEvent (RedfishDiscoveredToken->
Event);
318 if (!gRedfishServiceDiscovered) {
333 gRedfishServiceDiscovered =
TRUE;
363 UINTN NetworkInterfaceIndex;
366 ThisNetworkInterface = mNetworkInterfaces;
370 for (NetworkInterfaceIndex = 0; NetworkInterfaceIndex < mNumberOfNetworkInterfaces; NetworkInterfaceIndex++) {
372 if (ThisRedfishDiscoveredToken ==
NULL) {
373 DEBUG ((DEBUG_ERROR,
"%a: Not enough memory for EFI_REDFISH_DISCOVERED_TOKEN.\n", __func__));
377 ThisRedfishDiscoveredToken->
Signature = REDFISH_DISCOVER_TOKEN_SIGNATURE;
382 Status =
gBS->CreateEvent (
386 (VOID *)ThisRedfishDiscoveredToken,
387 &ThisRedfishDiscoveredToken->
Event
389 if (EFI_ERROR (Status)) {
390 FreePool (ThisRedfishDiscoveredToken);
391 DEBUG ((DEBUG_ERROR,
"%a: Failed to create event for Redfish discovered token.\n", __func__));
399 Status = gEfiRedfishDiscoverProtocol->AcquireRedfishService (
400 gEfiRedfishDiscoverProtocol,
401 gRedfishConfigData.
Image,
402 ThisNetworkInterface,
404 ThisRedfishDiscoveredToken
411 if ((ThisRedfishDiscoveredToken->DiscoverList.NumberOfServiceFound == 0) ||
412 EFI_ERROR (ThisRedfishDiscoveredToken->DiscoverList.RedfishInstances->Status))
414 gBS->CloseEvent (ThisRedfishDiscoveredToken->Event);
415 DEBUG ((DEBUG_MANAGEABILITY,
"%a: Free Redfish discovered token - %x.\n", __func__, ThisRedfishDiscoveredToken));
416 FreePool (ThisRedfishDiscoveredToken);
419 ThisNetworkInterface++;
441 VOID *RedfishHostInterfaceReadyProtocol;
443 DEBUG ((DEBUG_MANAGEABILITY,
"%a: New network interface is installed on system by EFI Redfish discover driver.\n", __func__));
446 Status =
gBS->LocateHandle (
449 gEfiRedfishDiscoverRegistration,
453 if (EFI_ERROR (Status)) {
454 DEBUG ((DEBUG_ERROR,
"%a: Can't locate handle with EFI_REDFISH_DISCOVER_PROTOCOL installed.\n", __func__));
457 gRedfishDiscoverActivated =
TRUE;
458 if (gEfiRedfishDiscoverProtocol ==
NULL) {
459 gEfiRedfishDiscoverControllerHandle = HandleBuffer;
463 Status =
gBS->OpenProtocol (
464 gEfiRedfishDiscoverControllerHandle,
465 &gEfiRedfishDiscoverProtocolGuid,
466 (VOID **)&gEfiRedfishDiscoverProtocol,
467 gRedfishConfigData.
Image,
468 gRedfishConfigData.
Image,
469 EFI_OPEN_PROTOCOL_BY_DRIVER
471 if (EFI_ERROR (Status)) {
472 gEfiRedfishDiscoverProtocol =
NULL;
473 gRedfishDiscoverActivated =
FALSE;
474 DEBUG ((DEBUG_ERROR,
"%a: Can't locate EFI_REDFISH_DISCOVER_PROTOCOL.\n", __func__));
479 Status = gEfiRedfishDiscoverProtocol->GetNetworkInterfaceList (
480 gEfiRedfishDiscoverProtocol,
481 gRedfishConfigData.
Image,
482 &mNumberOfNetworkInterfaces,
485 if (EFI_ERROR (Status) || (mNumberOfNetworkInterfaces == 0)) {
486 DEBUG ((DEBUG_ERROR,
"%a: No network interfaces found on the handle.\n", __func__));
493 Status =
gBS->LocateProtocol (&gEdkIIRedfishHostInterfaceReadyProtocolGuid,
NULL, &RedfishHostInterfaceReadyProtocol);
494 if (!EFI_ERROR (Status)) {
498 Status =
gBS->CreateEvent (
503 &mEdkIIRedfishHostInterfaceReadyEvent
505 if (EFI_ERROR (Status)) {
506 DEBUG ((DEBUG_ERROR,
"%a: Failed to create event for gEdkIIRedfishHostInterfaceReadyProtocolGuid installation.", __func__));
510 Status =
gBS->RegisterProtocolNotify (
511 &gEdkIIRedfishHostInterfaceReadyProtocolGuid,
512 mEdkIIRedfishHostInterfaceReadyEvent,
513 &mEdkIIRedfishHostInterfaceRegistration
515 if (EFI_ERROR (Status)) {
516 DEBUG ((DEBUG_ERROR,
"%a: Fail to register event for the installation of gEdkIIRedfishHostInterfaceReadyProtocolGuid.", __func__));
566 gRedfishConfigData.
Image = ImageHandle;
571 Status =
gBS->CreateEventEx (
576 &gEfiRedfishDiscoverProtocolGuid,
577 &gEfiRedfishDiscoverProtocolEvent
579 if (EFI_ERROR (Status)) {
580 DEBUG ((DEBUG_ERROR,
"%a: Fail to create event for the installation of EFI_REDFISH_DISCOVER_PROTOCOL.", __func__));
584 Status =
gBS->RegisterProtocolNotify (
585 &gEfiRedfishDiscoverProtocolGuid,
586 gEfiRedfishDiscoverProtocolEvent,
587 &gEfiRedfishDiscoverRegistration
589 if (EFI_ERROR (Status)) {
590 DEBUG ((DEBUG_ERROR,
"%a: Fail to register event for the installation of EFI_REDFISH_DISCOVER_PROTOCOL.", __func__));
595 if (EFI_ERROR (Status)) {
596 gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent);
597 gEfiRedfishDiscoverProtocolEvent =
NULL;
616 if (EFI_ERROR (Status)) {
617 gBS->CloseEvent (gEndOfDxeEvent);
618 gEndOfDxeEvent =
NULL;
619 gBS->CloseEvent (gExitBootServiceEvent);
620 gExitBootServiceEvent =
NULL;
621 gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent);
622 gEfiRedfishDiscoverProtocolEvent =
NULL;
623 DEBUG ((DEBUG_ERROR,
"%a: Fail to install EFI Binding Protocol of EFI Redfish Config driver.", __func__));
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define DEBUG(Expression)
EFI_STATUS EFIAPI NetLibCreateServiceChild(IN EFI_HANDLE Controller, IN EFI_HANDLE Image, IN EFI_GUID *ServiceBindingGuid, IN OUT EFI_HANDLE *ChildHandle)
EFI_STATUS EFIAPI NetLibDestroyServiceChild(IN EFI_HANDLE Controller, IN EFI_HANDLE Image, IN EFI_GUID *ServiceBindingGuid, IN EFI_HANDLE ChildHandle)
VOID RedfishConfigHandlerInitialization(VOID)
EFI_STATUS RedfishConfigDriverCommonUnload(IN EFI_HANDLE ImageHandle)
EFI_STATUS RedfishConfigCommonInit(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS RedfishConfigCommonStop(VOID)
EFI_STATUS EFIAPI RedfishConfigDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
EFI_STATUS EFIAPI RedfishConfigDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
VOID EFIAPI RedfishServiceDiscoveredCallback(IN EFI_EVENT Event, OUT VOID *Context)
EFI_STATUS EFIAPI RedfishConfigHandlerDriverUnload(IN EFI_HANDLE ImageHandle)
VOID EFIAPI RedfishDiscoverProtocolInstalled(IN EFI_EVENT Event, IN VOID *Context)
VOID EFIAPI AcquireRedfishServiceOnNetworkInterfaceCallback(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI RedfishConfigDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
VOID EFIAPI RedfishConfigHandlerInstalledCallback(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI RedfishConfigHandlerDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID RedfishConfigStopRedfishDiscovery(VOID)
EFI_DRIVER_BINDING_PROTOCOL gRedfishConfigDriverBinding
#define EFI_REDFISH_DISCOVER_HOST_INTERFACE
Discover Redfish server reported in SMBIOS 42h.
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gRedfishConfigHandlerComponentName2
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gRedfishConfigHandlerComponentName
EFI_STATUS EFIAPI EfiLibInstallAllDriverProtocols2(IN CONST EFI_HANDLE ImageHandle, IN CONST EFI_SYSTEM_TABLE *SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN EFI_HANDLE DriverBindingHandle, IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL, IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL, IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration OPTIONAL, IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2 OPTIONAL, IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL, IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL)
EFI_EVENT EFIAPI EfiCreateProtocolNotifyEvent(IN EFI_GUID *ProtocolGuid, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN VOID *NotifyContext OPTIONAL, OUT VOID **Registration)
CHAR16 * Product
Redfish service product name.
CHAR16 * Location
Redfish service location.
CHAR16 * Os
Redfish service OS.
CHAR16 * OsVersion
Redfish service OS version.
CHAR16 * ProductVer
Redfish service product version.
BOOLEAN UseHttps
Using HTTPS.
UINTN RedfishVersion
Redfish service version.
CHAR16 * Uuid
Redfish service UUID.
EFI_HANDLE RedfishRestExHandle
REST EX EFI handle associated with this Redfish service.
EFI_REDFISH_DISCOVERED_INFORMATION Information
Redfish service discovered.
EFI_STATUS Status
Status of Redfish service discovery.
EFI_REDFISH_DISCOVERED_INSTANCE * RedfishInstances
Must be NULL when pass to Acquire ().
UINT32 Signature
Token signature.
EFI_REDFISH_DISCOVERED_LIST DiscoverList
EFI_EVENT Event
Event for the notification of EFI_REDFISH_CONFIG_HANDLER_PROTOCOL.
EFI_HANDLE Image
Image handle of Redfish Config Driver.
BOOLEAN RedfishServiceUseHttps
Redfish service uses HTTPS.
CHAR16 * RedfishServiceUuid
Redfish service UUID.
EFI_HANDLE RedfishServiceRestExHandle
REST EX EFI handle associated with this Redfish service.
CHAR16 * RedfishServiceLocation
Redfish service location.
CHAR16 * RedfishServiceProductVer
Redfish service product version.
UINTN RedfishServiceVersion
Redfish service version.
CHAR16 * RedfishServiceProduct
Redfish service product name.
CHAR16 * RedfishServiceOs
Redfish service OS.
CHAR16 * RedfishServiceOsVersion
Redfish service OS version.