summaryrefslogtreecommitdiff
path: root/MdePkg/Include/Protocol/ServiceBinding.h
blob: 5f37727d6e7907787768a6d27ba9b2c452855577 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/** @file

  The file defines the generic Service Binding Protocol functions.
  It provides services that are required to create and destroy child 
  handles that support a given set of protocols.

  Copyright (c) 2006 - 2008, Intel Corporation                                                         
  All rights reserved. This program and the accompanying materials                          
  are licensed and made available under the terms and conditions of the BSD License         
  which accompanies this distribution.  The full text of the license may be found at        
  http://opensource.org/licenses/bsd-license.php                                            

  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

**/

#ifndef __EFI_SERVICE_BINDING_H__
#define __EFI_SERVICE_BINDING_H__

///
/// Forward reference for pure ANSI compatability
///
typedef struct _EFI_SERVICE_BINDING_PROTOCOL EFI_SERVICE_BINDING_PROTOCOL;

/**
  Creates a child handle with a set of I/O services.

  @param  This        Protocol instance pointer.
  @param  ChildHandle Pointer to the handle of the child to create.  If it is NULL,
                      then a new handle is created.  If it is not NULL, then the
                      I/O services are added to the existing child handle.

  @retval EFI_SUCCES            The child handle was created with the I/O services
  @retval EFI_INVALID_PARAMETER ChildHandle is NULL.
  @retval EFI_OUT_OF_RESOURCES  There are not enough resources availabe to create
                                the child
  @retval other                 The child handle was not created

**/
typedef
EFI_STATUS
(EFIAPI *EFI_SERVICE_BINDING_CREATE_CHILD)(
  IN     EFI_SERVICE_BINDING_PROTOCOL  *This,
  IN OUT EFI_HANDLE                    *ChildHandle
  )
;

/**
  Destroys a child handle with a set of I/O services.

  @param  This        Protocol instance pointer.
  @param  ChildHandle Handle of the child to destroy

  @retval EFI_SUCCES            The I/O services were removed from the child handle
  @retval EFI_UNSUPPORTED       The child handle does not support the I/O services
                                that are being removed.
  @retval EFI_INVALID_PARAMETER Child handle is not a valid EFI Handle.
  @retval EFI_ACCESS_DENIED     The child handle could not be destroyed because its
                                I/O services are being used.
  @retval other                 The child handle was not destroyed

**/
typedef
EFI_STATUS
(EFIAPI *EFI_SERVICE_BINDING_DESTROY_CHILD)(
  IN EFI_SERVICE_BINDING_PROTOCOL          *This,
  IN EFI_HANDLE                            ChildHandle
  )
;

/**  
  @par Protocol Description:
  The EFI_SERVICE_BINDING_PROTOCOL provides member functions to create and destroy 
  child handles. A driver is responsible for adding protocols to the child handle 
  in CreateChild() and removing protocols in DestroyChild(). It is also required 
  that the CreateChild() function opens the parent protocol BY_CHILD_CONTROLLER 
  to establish the parent-child relationship, and closes the protocol in DestroyChild().
  The pseudo code for CreateChild() and DestroyChild() is provided to specify the 
  required behavior, not to specify the required implementation. Each consumer of 
  a software protocol is responsible for calling CreateChild() when it requires the 
  protocol and calling DestroyChild() when it is finished with that protocol.

  @param CreateChild
  Creates a child handle and installs a protocol.

  @param DestroyChild
  Destroys a child handle with a protocol installed on it.
**/
struct _EFI_SERVICE_BINDING_PROTOCOL {
  EFI_SERVICE_BINDING_CREATE_CHILD         CreateChild;
  EFI_SERVICE_BINDING_DESTROY_CHILD        DestroyChild;
};

#endif