本文整理汇总了C++中EFI_SERVICE_BINDING_PROTOCOL类的典型用法代码示例。如果您正苦于以下问题:C++ EFI_SERVICE_BINDING_PROTOCOL类的具体用法?C++ EFI_SERVICE_BINDING_PROTOCOL怎么用?C++ EFI_SERVICE_BINDING_PROTOCOL使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EFI_SERVICE_BINDING_PROTOCOL类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Mtftp4DestroyChildEntryInHandleBuffer
/**
Callback function which provided by user to remove one node in NetDestroyLinkList process.
@param[in] Entry The entry to be removed.
@param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList.
@retval EFI_SUCCESS The entry has been removed successfully.
@retval Others Fail to remove the entry.
**/
EFI_STATUS
EFIAPI
Mtftp4DestroyChildEntryInHandleBuffer (
IN LIST_ENTRY *Entry,
IN VOID *Context
)
{
MTFTP4_PROTOCOL *Instance;
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
UINTN NumberOfChildren;
EFI_HANDLE *ChildHandleBuffer;
if (Entry == NULL || Context == NULL) {
return EFI_INVALID_PARAMETER;
}
Instance = NET_LIST_USER_STRUCT_S (Entry, MTFTP4_PROTOCOL, Link, MTFTP4_PROTOCOL_SIGNATURE);
ServiceBinding = ((MTFTP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ServiceBinding;
NumberOfChildren = ((MTFTP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->NumberOfChildren;
ChildHandleBuffer = ((MTFTP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ChildHandleBuffer;
if (!NetIsInHandleBuffer (Instance->Handle, NumberOfChildren, ChildHandleBuffer)) {
return EFI_SUCCESS;
}
return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);
}
示例2: TcpDestroyChildEntryInHandleBuffer
/**
Callback function which provided by user to remove one node in NetDestroyLinkList process.
@param[in] Entry The entry to be removed.
@param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList.
@retval EFI_SUCCESS The entry has been removed successfully.
@retval Others Fail to remove the entry.
**/
EFI_STATUS
EFIAPI
TcpDestroyChildEntryInHandleBuffer (
IN LIST_ENTRY *Entry,
IN VOID *Context
)
{
SOCKET *Sock;
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
UINTN NumberOfChildren;
EFI_HANDLE *ChildHandleBuffer;
if (Entry == NULL || Context == NULL) {
return EFI_INVALID_PARAMETER;
}
Sock = NET_LIST_USER_STRUCT_S (Entry, SOCKET, Link, SOCK_SIGNATURE);
ServiceBinding = ((TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ServiceBinding;
NumberOfChildren = ((TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->NumberOfChildren;
ChildHandleBuffer = ((TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ChildHandleBuffer;
if (!NetIsInHandleBuffer (Sock->SockHandle, NumberOfChildren, ChildHandleBuffer)) {
return EFI_SUCCESS;
}
return ServiceBinding->DestroyChild (ServiceBinding, Sock->SockHandle);
}
示例3: TlsCreateChild
/**
Creates a Tls child handle, open EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURATION_PROTOCOL.
@param[in] ImageHandle The firmware allocated handle for the UEFI image.
@param[out] TlsProto Pointer to the EFI_TLS_PROTOCOL instance.
@param[out] TlsConfiguration Pointer to the EFI_TLS_CONFIGURATION_PROTOCOL instance.
@return The child handle with opened EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURATION_PROTOCOL.
**/
EFI_HANDLE
EFIAPI
TlsCreateChild (
IN EFI_HANDLE ImageHandle,
OUT EFI_TLS_PROTOCOL **TlsProto,
OUT EFI_TLS_CONFIGURATION_PROTOCOL **TlsConfiguration
)
{
EFI_STATUS Status;
EFI_SERVICE_BINDING_PROTOCOL *TlsSb;
EFI_HANDLE TlsChildHandle;
TlsSb = NULL;
TlsChildHandle = 0;
//
// Locate TlsServiceBinding protocol.
//
gBS->LocateProtocol (
&gEfiTlsServiceBindingProtocolGuid,
NULL,
(VOID **) &TlsSb
);
if (TlsSb == NULL) {
return NULL;
}
Status = TlsSb->CreateChild (TlsSb, &TlsChildHandle);
if (EFI_ERROR (Status)) {
return NULL;
}
Status = gBS->OpenProtocol (
TlsChildHandle,
&gEfiTlsProtocolGuid,
(VOID **) TlsProto,
ImageHandle,
TlsChildHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
TlsSb->DestroyChild (TlsSb, TlsChildHandle);
return NULL;
}
Status = gBS->OpenProtocol (
TlsChildHandle,
&gEfiTlsConfigurationProtocolGuid,
(VOID **) TlsConfiguration,
ImageHandle,
TlsChildHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
TlsSb->DestroyChild (TlsSb, TlsChildHandle);
return NULL;
}
return TlsChildHandle;
}
示例4: HSTestExistingShaImpl
BOOLEAN
EFIAPI
HSTestExistingShaImpl(BOOLEAN *ImplExists)
{
EFI_SERVICE_BINDING_PROTOCOL *BindingProto;
EFI_HASH_PROTOCOL *HashProto;
EFI_HASH_OUTPUT HashOut;
EFI_SHA1_HASH Sha1Hash;
EFI_STATUS Status;
EFI_HANDLE Child;
UINTN HashIter;
//
// Create binding.
//
Status = gBS->LocateProtocol(
&gEfiHashServiceBindingProtocolGuid,
NULL,
(VOID **)&BindingProto
);
if (EFI_ERROR(Status)) {
*ImplExists = FALSE;
return FALSE;
}
Child = NULL;
*ImplExists = TRUE;
Status = BindingProto->CreateChild(BindingProto, &Child);
if (EFI_ERROR(Status)) {
return FALSE;
}
//
// Obtain protocol.
//
HashProto = NULL;
Status = gBS->LocateProtocol(
&gEfiHashProtocolGuid,
NULL,
(VOID **)&HashProto
);
if (EFI_ERROR(Status)) {
BindingProto->DestroyChild(BindingProto, Child);
return FALSE;
}
//
// Do two iterations of test-hashing.
//
HashOut.Sha1Hash = &Sha1Hash;
for (HashIter = 0; HashIter < 2; ++HashIter) {
Status = HashProto->Hash(
HashProto,
&gEfiHashAlgorithmSha1Guid,
(BOOLEAN)HashIter,
(CONST UINT8 *)"ABCDEFGHIJKLMNOP",
16,
&HashOut
);
if (EFI_ERROR(Status)) {
BindingProto->DestroyChild(BindingProto, Child);
return FALSE;
}
}
BindingProto->DestroyChild(BindingProto, Child);
//
// Verify result.
//
if (CompareMem(
Sha1Hash,
"\x14\x80\x6E\x23\xB4\xCE\xB6\x5D\xDF\x01"
"\xE5\xEA\x7F\xBC\xDD\x03\xAA\xFA\xF5\xCD",
sizeof Sha1Hash
)) {
return FALSE;
}
return TRUE;
}
示例5: IsaBusDriverBindingStop
/**
Stops a device controller or a bus controller.
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
@param[in] ControllerHandle A handle to the device being stopped. The handle must
support a bus specific I/O protocol for the driver
to use to stop the device.
@param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
@param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
if NumberOfChildren is 0.
@retval EFI_SUCCESS The device was stopped.
@retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
**/
EFI_STATUS
EFIAPI
IsaBusDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
{
EFI_STATUS Status;
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
ISA_BUS_PRIVATE_DATA *Private;
UINTN Index;
BOOLEAN AllChildrenStopped;
Status = gBS->OpenProtocol (
Controller,
&gEfiIsaHcServiceBindingProtocolGuid,
(VOID **) &ServiceBinding,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return Status;
}
Private = ISA_BUS_PRIVATE_DATA_FROM_THIS (ServiceBinding);
if (NumberOfChildren == 0) {
Status = gBS->UninstallMultipleProtocolInterfaces (
Controller,
&gEfiIsaHcServiceBindingProtocolGuid, &Private->ServiceBinding,
NULL
);
if (!EFI_ERROR (Status)) {
gBS->CloseProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
Controller
);
gBS->CloseProtocol (
Controller,
&gEfiIsaHcProtocolGuid,
This->DriverBindingHandle,
Controller
);
FreePool (Private);
}
return Status;
}
AllChildrenStopped = TRUE;
for (Index = 0; Index < NumberOfChildren; Index++) {
Status = ServiceBinding->DestroyChild (ServiceBinding, ChildHandleBuffer[Index]);
if (EFI_ERROR (Status)) {
AllChildrenStopped = FALSE;
}
}
return AllChildrenStopped ? EFI_SUCCESS : EFI_DEVICE_ERROR;
}