1 /** @file
2   The driver binding and service binding protocol for IP6 driver.
3 
4   Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
5 
6   This program and the accompanying materials
7   are licensed and made available under the terms and conditions of the BSD License
8   which accompanies this distribution.  The full text of the license may be found at
9   http://opensource.org/licenses/bsd-license.php.
10 
11   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 **/
15 
16 #ifndef __EFI_IP6_DRIVER_H__
17 #define __EFI_IP6_DRIVER_H__
18 
19 extern EFI_DRIVER_BINDING_PROTOCOL  gIp6DriverBinding;
20 extern EFI_COMPONENT_NAME_PROTOCOL  gIp6ComponentName;
21 extern EFI_COMPONENT_NAME2_PROTOCOL gIp6ComponentName2;
22 extern EFI_UNICODE_STRING_TABLE     *gIp6ControllerNameTable;
23 
24 typedef struct {
25   EFI_SERVICE_BINDING_PROTOCOL  *ServiceBinding;
26   UINTN                         NumberOfChildren;
27   EFI_HANDLE                    *ChildHandleBuffer;
28 }IP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT;
29 
30 /**
31   Clean up an IP6 service binding instance. It releases all
32   the resource allocated by the instance. The instance may be
33   partly initialized, or partly destroyed. If a resource is
34   destroyed, it is marked as that in case the destroy failed and
35   being called again later.
36 
37   @param[in]  IpSb               The IP6 service binding instance to clean up.
38 
39   @retval EFI_SUCCESS            The resource used by the instance are cleaned up.
40   @retval Others                 Failed to clean up some of the resources.
41 
42 **/
43 EFI_STATUS
44 Ip6CleanService (
45   IN IP6_SERVICE            *IpSb
46   );
47 
48 //
49 // Function prototype for the driver's entry point
50 //
51 
52 /**
53   This is the declaration of an EFI image entry point. This entry point is
54   the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
55   both device drivers and bus drivers.
56 
57   The entry point for IP6 driver which installs the driver
58   binding and component name protocol on its image.
59 
60   @param[in]  ImageHandle           The firmware allocated handle for the UEFI image.
61   @param[in]  SystemTable           A pointer to the EFI System Table.
62 
63   @retval EFI_SUCCESS           The operation completed successfully.
64   @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.
65 
66 **/
67 EFI_STATUS
68 EFIAPI
69 Ip6DriverEntryPoint (
70   IN EFI_HANDLE             ImageHandle,
71   IN EFI_SYSTEM_TABLE       *SystemTable
72   );
73 
74 //
75 // Function prototypes for the Drivr Binding Protocol
76 //
77 
78 /**
79   Test to see if this driver supports ControllerHandle.
80 
81   @param[in]  This                   Protocol instance pointer.
82   @param[in]  ControllerHandle       Handle of device to test.
83   @param[in]  RemainingDevicePath    Optional parameter use to pick a specific child
84                                      device to start.
85 
86   @retval EFI_SUCCESS                This driver supports this device.
87   @retval EFI_ALREADY_STARTED        This driver is already running on this device.
88   @retval other                      This driver does not support this device.
89 
90 **/
91 EFI_STATUS
92 EFIAPI
93 Ip6DriverBindingSupported (
94   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
95   IN EFI_HANDLE                   ControllerHandle,
96   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL
97   );
98 
99 /**
100   Start this driver on ControllerHandle.
101 
102   @param[in]  This                Protocol instance pointer.
103   @param[in]  ControllerHandle    Handle of device to bind driver to.
104   @param[in]  RemainingDevicePath Optional parameter used to pick a specific child
105                                   device to start.
106 
107   @retval EFI_SUCCES              This driver is added to ControllerHandle.
108   @retval EFI_ALREADY_STARTED     This driver is already running on ControllerHandle.
109   @retval other                   This driver does not support this device.
110 
111 **/
112 EFI_STATUS
113 EFIAPI
114 Ip6DriverBindingStart (
115   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
116   IN EFI_HANDLE                   ControllerHandle,
117   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL
118   );
119 
120 /**
121   Stop this driver on ControllerHandle.
122 
123   @param[in]  This               Protocol instance pointer.
124   @param[in]  ControllerHandle   Handle of device to stop driver on.
125   @param[in]  NumberOfChildren   Number of Handles in ChildHandleBuffer. If number
126                                  of children is zero, stop the entire  bus driver.
127   @param[in]  ChildHandleBuffer  An array of child handles to be freed. May be NULL
128                                  if NumberOfChildren is 0.
129 
130   @retval EFI_SUCCESS           The device was stopped.
131   @retval EFI_DEVICE_ERROR      The device could not be stopped due to a device error.
132 
133 **/
134 EFI_STATUS
135 EFIAPI
136 Ip6DriverBindingStop (
137   IN  EFI_DRIVER_BINDING_PROTOCOL  *This,
138   IN  EFI_HANDLE                   ControllerHandle,
139   IN  UINTN                        NumberOfChildren,
140   IN  EFI_HANDLE                   *ChildHandleBuffer OPTIONAL
141   );
142 
143 //
144 // Function ptototypes for the ServiceBinding Prococol
145 //
146 
147 /**
148   Creates a child handle with a set of I/O services.
149 
150   @param[in]  This               Protocol instance pointer.
151   @param[in]  ChildHandle        Pointer to the handle of the child to create.   If
152                                  it is NULL, then a new handle is created.   If it
153                                  is not NULL, then the I/O services are added to
154                                  the existing child handle.
155 
156   @retval EFI_SUCCES             The child handle was created with the I/O services.
157   @retval EFI_OUT_OF_RESOURCES   There are not enough resources availabe to create
158                                  the child.
159   @retval other                  The child handle was not created.
160 
161 **/
162 EFI_STATUS
163 EFIAPI
164 Ip6ServiceBindingCreateChild (
165   IN EFI_SERVICE_BINDING_PROTOCOL  *This,
166   IN EFI_HANDLE                    *ChildHandle
167   );
168 
169 /**
170   Destroys a child handle with a set of I/O services.
171 
172   @param[in]  This               Protocol instance pointer.
173   @param[in]  ChildHandle        Handle of the child to destroy.
174 
175   @retval EFI_SUCCES             The I/O services were removed from the child
176                                  handle.
177   @retval EFI_UNSUPPORTED        The child handle does not support the I/O services
178                                   that are being removed.
179   @retval EFI_INVALID_PARAMETER  Child handle is NULL.
180   @retval EFI_ACCESS_DENIED      The child handle could not be destroyed because
181                                  its  I/O services are being used.
182   @retval other                  The child handle was not destroyed.
183 
184 **/
185 EFI_STATUS
186 EFIAPI
187 Ip6ServiceBindingDestroyChild (
188   IN EFI_SERVICE_BINDING_PROTOCOL  *This,
189   IN EFI_HANDLE                    ChildHandle
190   );
191 
192 #endif
193