49 UINTN NumberOfChildren;
52 if ((Entry ==
NULL) || (Context ==
NULL)) {
53 return EFI_INVALID_PARAMETER;
56 Instance = NET_LIST_USER_STRUCT_S (Entry,
RESTEX_INSTANCE, Link, RESTEX_INSTANCE_SIGNATURE);
66 return ServiceBinding->DestroyChild (ServiceBinding, Instance->ChildHandle);
108 if (RestExIns ==
NULL) {
109 return EFI_OUT_OF_RESOURCES;
112 RestExIns->Signature = RESTEX_INSTANCE_SIGNATURE;
114 RestExIns->InDestroy =
FALSE;
115 RestExIns->Service = Service;
117 CopyMem (&RestExIns->RestEx, &mRedfishRestExProtocol, sizeof (RestExIns->RestEx));
123 RestExIns->Service->ImageHandle,
124 RestExIns->Service->ControllerHandle,
131 if (EFI_ERROR (Status)) {
136 *Instance = RestExIns;
152 if (RestExSb->HttpChildHandle !=
NULL) {
154 RestExSb->HttpChildHandle,
155 &gEfiHttpProtocolGuid,
156 RestExSb->ImageHandle,
157 RestExSb->ControllerHandle
161 RestExSb->ControllerHandle,
162 RestExSb->ImageHandle,
163 &gEfiHttpServiceBindingProtocolGuid,
164 RestExSb->HttpChildHandle
167 RestExSb->HttpChildHandle =
NULL;
170 gBS->UninstallProtocolInterface (
171 RestExSb->ControllerHandle,
188EFI_REST_EX_SERVICE_ACCESS_MODE
198 return EfiRestExServiceInBandAccess;
200 return EfiRestExServiceOutOfBandAccess;
233 if (RestExSb ==
NULL) {
234 return EFI_OUT_OF_RESOURCES;
237 RestExSb->Signature = RESTEX_SERVICE_SIGNATURE;
239 RestExSb->ServiceBinding = mRedfishRestExServiceBinding;
241 RestExSb->RestExChildrenNum = 0;
244 RestExSb->ControllerHandle = Controller;
245 RestExSb->ImageHandle = Image;
247 RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.EfiRestExServiceInfoHeader.Length =
sizeof (
EFI_REST_EX_SERVICE_INFO);
248 RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.EfiRestExServiceInfoHeader.RestServiceInfoVer.Major = 1;
249 RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.EfiRestExServiceInfoHeader.RestServiceInfoVer.Minor = 0;
250 RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.RestServiceType = EfiRestExServiceRedfish;
251 RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.RestServiceAccessMode =
RestExServiceAccessMode (Controller);
252 RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.RestExConfigType = EfiRestExConfigHttp;
255 Status =
gBS->InstallProtocolInterface (
261 if (EFI_ERROR (Status)) {
298 &gRedfishRestExDriverBinding,
303 if (EFI_ERROR (Status)) {
363 Status =
gBS->OpenProtocol (
367 This->DriverBindingHandle,
369 EFI_OPEN_PROTOCOL_GET_PROTOCOL
371 if (!EFI_ERROR (Status)) {
372 return EFI_ALREADY_STARTED;
378 return gBS->OpenProtocol (
380 &gEfiHttpServiceBindingProtocolGuid,
382 This->DriverBindingHandle,
384 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
436 Status =
gBS->OpenProtocol (
440 This->DriverBindingHandle,
442 EFI_OPEN_PROTOCOL_GET_PROTOCOL
444 if (!EFI_ERROR (Status)) {
445 return EFI_ALREADY_STARTED;
449 if (EFI_ERROR (Status)) {
453 ASSERT (RestExSb !=
NULL);
461 This->DriverBindingHandle,
462 &gEfiHttpServiceBindingProtocolGuid,
463 &RestExSb->HttpChildHandle
465 if (EFI_ERROR (Status)) {
469 Status =
gBS->OpenProtocol (
470 RestExSb->HttpChildHandle,
471 &gEfiHttpProtocolGuid,
473 This->DriverBindingHandle,
475 EFI_OPEN_PROTOCOL_BY_DRIVER
477 if (EFI_ERROR (Status)) {
484 Status =
gBS->InstallMultipleProtocolInterfaces (
486 &gEfiRestExServiceBindingProtocolGuid,
487 &RestExSb->ServiceBinding,
490 if (EFI_ERROR (Status)) {
550 if (NicHandle ==
NULL) {
554 Status =
gBS->OpenProtocol (
556 &gEfiRestExServiceBindingProtocolGuid,
557 (VOID **)&ServiceBinding,
558 This->DriverBindingHandle,
560 EFI_OPEN_PROTOCOL_GET_PROTOCOL
562 if (EFI_ERROR (Status)) {
563 return EFI_DEVICE_ERROR;
566 RestExSb = RESTEX_SERVICE_FROM_THIS (ServiceBinding);
568 if (!
IsListEmpty (&RestExSb->RestExChildrenList)) {
572 List = &RestExSb->RestExChildrenList;
573 Context.ServiceBinding = ServiceBinding;
574 Context.NumberOfChildren = NumberOfChildren;
575 Context.ChildHandleBuffer = ChildHandleBuffer;
585 gBS->UninstallProtocolInterface (
587 &gEfiRestExServiceBindingProtocolGuid,
593 if (gRedfishRestExControllerNameTable !=
NULL) {
595 gRedfishRestExControllerNameTable =
NULL;
626 Instance = RESTEX_INSTANCE_FROM_HTTP_CALLBACK (This);
627 Status =
gBS->HandleProtocol (
628 Instance->HttpIo.Handle,
629 &gEfiTlsProtocolGuid,
630 (VOID **)&TlsProtocol
632 if (EFI_ERROR (Status)) {
637 Status = TlsProtocol->SetSessionData (
643 if (!EFI_ERROR (Status)) {
644 DEBUG ((DEBUG_MANAGEABILITY,
"%a: REST EX reconfigures TLS verify method.\n", __func__));
683 if ((This ==
NULL) || (ChildHandle ==
NULL)) {
684 return EFI_INVALID_PARAMETER;
687 RestExSb = RESTEX_SERVICE_FROM_THIS (This);
690 if (EFI_ERROR (Status)) {
694 ASSERT (Instance !=
NULL);
699 Status =
gBS->InstallMultipleProtocolInterfaces (
701 &gEfiRestExProtocolGuid,
705 if (EFI_ERROR (Status)) {
709 Instance->ChildHandle = *ChildHandle;
714 Status =
gBS->OpenProtocol (
715 RestExSb->HttpChildHandle,
716 &gEfiHttpProtocolGuid,
719 Instance->ChildHandle,
720 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
722 if (EFI_ERROR (Status)) {
723 gBS->UninstallMultipleProtocolInterfaces (
724 Instance->ChildHandle,
725 &gEfiRestExProtocolGuid,
736 Status =
gBS->OpenProtocol (
737 Instance->HttpIo.Handle,
738 &gEfiHttpProtocolGuid,
741 Instance->ChildHandle,
742 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
744 if (EFI_ERROR (Status)) {
749 RestExSb->HttpChildHandle,
750 &gEfiHttpProtocolGuid,
755 gBS->UninstallMultipleProtocolInterfaces (
756 Instance->ChildHandle,
757 &gEfiRestExProtocolGuid,
767 Status =
gBS->InstallProtocolInterface (
768 &Instance->HttpIo.Handle,
769 &gEdkiiHttpCallbackProtocolGuid,
771 &Instance->HttpCallbakFunction
773 if (EFI_ERROR (Status)) {
774 DEBUG ((DEBUG_ERROR,
"%a: Fail to install HttpCallbackFunction.\n", __func__));
781 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
784 RestExSb->RestExChildrenNum++;
786 gBS->RestoreTPL (OldTpl);
828 if ((This ==
NULL) || (ChildHandle ==
NULL)) {
829 return EFI_INVALID_PARAMETER;
835 Status =
gBS->OpenProtocol (
837 &gEfiRestExProtocolGuid,
841 EFI_OPEN_PROTOCOL_GET_PROTOCOL
844 if (EFI_ERROR (Status)) {
845 return EFI_UNSUPPORTED;
848 Instance = RESTEX_INSTANCE_FROM_THIS (RestEx);
849 RestExSb = RESTEX_SERVICE_FROM_THIS (This);
851 if (Instance->Service != RestExSb) {
852 return EFI_INVALID_PARAMETER;
855 if (Instance->InDestroy) {
859 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
861 Instance->InDestroy =
TRUE;
867 RestExSb->HttpChildHandle,
868 &gEfiHttpProtocolGuid,
874 Instance->HttpIo.Handle,
875 &gEfiHttpProtocolGuid,
880 gBS->RestoreTPL (OldTpl);
885 Status =
gBS->UninstallProtocolInterface (
887 &gEfiRestExProtocolGuid,
894 Status =
gBS->UninstallProtocolInterface (
895 Instance->HttpIo.Handle,
896 &gEdkiiHttpCallbackProtocolGuid,
897 &Instance->HttpCallbakFunction
900 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
902 if (EFI_ERROR (Status)) {
903 Instance->InDestroy =
FALSE;
904 gBS->RestoreTPL (OldTpl);
909 RestExSb->RestExChildrenNum--;
911 gBS->RestoreTPL (OldTpl);
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EDKII_HTTP_CALLBACK_EVENT
EFI_STATUS HttpIoCreateIo(IN EFI_HANDLE Image, IN EFI_HANDLE Controller, IN UINT8 IpVersion, IN HTTP_IO_CONFIG_DATA *ConfigData, IN HTTP_IO_CALLBACK Callback, IN VOID *Context, OUT HTTP_IO *HttpIo)
VOID HttpIoDestroyIo(IN HTTP_IO *HttpIo)
#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)
BOOLEAN EFIAPI NetIsInHandleBuffer(IN EFI_HANDLE Handle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
EFI_HANDLE EFIAPI NetLibGetNicHandle(IN EFI_HANDLE Controller, IN EFI_GUID *ProtocolGuid)
EFI_STATUS EFIAPI NetDestroyLinkList(IN LIST_ENTRY *List, IN NET_DESTROY_LINK_LIST_CALLBACK CallBack, IN VOID *Context OPTIONAL, OUT UINTN *ListLength OPTIONAL)
#define FixedPcdGetBool(TokenName)
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gRedfishRestExComponentName2
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gRedfishRestExComponentName
EFI_STATUS RestExCreateService(IN EFI_HANDLE Controller, IN EFI_HANDLE Image, OUT RESTEX_SERVICE **Service)
EFI_STATUS EFIAPI RedfishRestExDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
EFI_STATUS RestExCreateInstance(IN RESTEX_SERVICE *Service, OUT RESTEX_INSTANCE **Instance)
EFI_STATUS EFIAPI RedfishRestExDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
EFI_STATUS EFIAPI RedfishRestExServiceBindingCreateChild(IN EFI_SERVICE_BINDING_PROTOCOL *This, IN EFI_HANDLE *ChildHandle)
EFI_STATUS EFIAPI RestExDestroyChildEntryInHandleBuffer(IN LIST_ENTRY *Entry, IN VOID *Context)
EFI_REST_EX_SERVICE_ACCESS_MODE RestExServiceAccessMode(IN EFI_HANDLE Controller)
VOID RestExDestroyService(IN RESTEX_SERVICE *RestExSb)
EFI_STATUS EFIAPI RedfishRestExDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID RestExDestroyInstance(IN RESTEX_INSTANCE *Instance)
EFI_STATUS EFIAPI RedfishRestExServiceBindingDestroyChild(IN EFI_SERVICE_BINDING_PROTOCOL *This, IN EFI_HANDLE ChildHandle)
VOID EFIAPI RestExHttpCallback(IN EDKII_HTTP_CALLBACK_PROTOCOL *This, IN EDKII_HTTP_CALLBACK_EVENT Event, IN EFI_STATUS EventStatus)
EFI_STATUS EFIAPI RedfishRestExDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
#define REDFISH_RESTEX_DRIVER_VERSION
#define EFI_TLS_VERIFY_NONE
EFI_STATUS EFIAPI EfiLibInstallDriverBindingComponentName2(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)
EFI_STATUS EFIAPI FreeUnicodeStringTable(IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable)
EFI_HANDLE DriverBindingHandle