1/** @file
2  Driver Binding functions and Service Binding functions for the Network driver module.
3
4  Copyright (c) 2009 - 2011, 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 _UDP6_DRIVER_H_
17#define _UDP6_DRIVER_H_
18
19#include <Protocol/DriverBinding.h>
20#include <Protocol/ServiceBinding.h>
21#include <Protocol/DevicePath.h>
22
23/**
24  Tests to see if this driver supports a given controller. If a child device is provided,
25  it further tests to see if this driver supports creating a handle for the specified child device.
26
27  This function checks to see if the driver specified by This supports the device specified by
28  ControllerHandle. Drivers typically use the device path attached to
29  ControllerHandle and/or the services from the bus I/O abstraction attached to
30  ControllerHandle to determine if the driver supports ControllerHandle. This function
31  may be called many times during platform initialization. In order to reduce boot times, the tests
32  performed by this function must be very small, and take as little time as possible to execute. This
33  function must not change the state of any hardware devices, and this function must be aware that the
34  device specified by ControllerHandle may already be managed by the same driver or a
35  different driver. This function must match its calls to AllocatePages() with FreePages(),
36  AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
37  Since ControllerHandle may have been previously started by the same driver, if a protocol is
38  already in the opened state, then it must not be closed with CloseProtocol(). This is required
39  to guarantee the state of ControllerHandle is not modified by this function.
40
41  @param[in]  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
42  @param[in]  ControllerHandle     The handle of the controller to test. This handle
43                                   must support a protocol interface that supplies
44                                   an I/O abstraction to the driver.
45  @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This
46                                   parameter is ignored by device drivers, and is optional for bus
47                                   drivers. For bus drivers, if this parameter is not NULL, then
48                                   the bus driver must determine if the bus controller specified
49                                   by ControllerHandle and the child controller specified
50                                   by RemainingDevicePath are both supported by this
51                                   bus driver.
52
53  @retval EFI_SUCCESS              The device specified by ControllerHandle and
54                                   RemainingDevicePath is supported by the driver specified by This.
55  @retval EFI_ALREADY_STARTED      The device specified by ControllerHandle and
56                                   RemainingDevicePath is already being managed by the driver
57                                   specified by This.
58  @retval EFI_ACCESS_DENIED        The device specified by ControllerHandle and
59                                   RemainingDevicePath is already being managed by a different
60                                   driver or an application that requires exclusive access.
61                                   Currently not implemented.
62  @retval EFI_UNSUPPORTED          The device specified by ControllerHandle and
63                                   RemainingDevicePath is not supported by the driver specified by This.
64**/
65EFI_STATUS
66EFIAPI
67Udp6DriverBindingSupported (
68  IN EFI_DRIVER_BINDING_PROTOCOL  *This,
69  IN EFI_HANDLE                   ControllerHandle,
70  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath  OPTIONAL
71  );
72
73/**
74  Start this driver on ControllerHandle.
75
76  This service is called by the  EFI boot service ConnectController(). In order to make
77  drivers as small as possible, there are a few calling restrictions for
78  this service. ConnectController() must follow these
79  calling restrictions. If any other agent wishes to call Start() it
80  must also follow these calling restrictions.
81
82  @param[in]  This                   Protocol instance pointer.
83  @param[in]  ControllerHandle       Handle of device to bind a driver to.
84  @param[in]  RemainingDevicePath    Optional parameter use to pick a specific child
85                                     device to start.
86
87  @retval EFI_SUCCES             This driver is added to ControllerHandle.
88  @retval EFI_OUT_OF_RESOURCES   The required system resource can't be allocated.
89  @retval other                  This driver does not support this device.
90
91**/
92EFI_STATUS
93EFIAPI
94Udp6DriverBindingStart (
95  IN EFI_DRIVER_BINDING_PROTOCOL  *This,
96  IN EFI_HANDLE                   ControllerHandle,
97  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath  OPTIONAL
98  );
99
100/**
101  Stop this driver on ControllerHandle.
102
103  This service is called by the  EFI boot service DisconnectController(). In order to
104  make drivers as small as possible, there are a few calling
105  restrictions for this service. DisconnectController()
106  must follow these calling restrictions. If any other agent wishes
107  to call Stop(), it must also follow these calling restrictions.
108
109  @param[in]  This                   Protocol instance pointer.
110  @param[in]  ControllerHandle       Handle of device to stop the driver on.
111  @param[in]  NumberOfChildren       Number of Handles in ChildHandleBuffer. If number
112                                     of children is zero, stop the entire bus driver.
113  @param[in]  ChildHandleBuffer      List of Child Handles to Stop. It is optional.
114
115  @retval EFI_SUCCESS            This driver removed ControllerHandle.
116  @retval EFI_DEVICE_ERROR       Can't find the NicHandle from the ControllerHandle and specified GUID.
117  @retval other                  This driver was not removed from this device.
118
119**/
120EFI_STATUS
121EFIAPI
122Udp6DriverBindingStop (
123  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,
124  IN  EFI_HANDLE                   ControllerHandle,
125  IN  UINTN                        NumberOfChildren,
126  IN  EFI_HANDLE                   *ChildHandleBuffer OPTIONAL
127  );
128
129/**
130  Creates a child handle and installs a protocol.
131
132  The CreateChild() function installs a protocol on ChildHandle.
133  If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.
134  If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.
135
136  @param[in]       This        Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
137  @param[in, out]  ChildHandle Pointer to the handle of the child to create. If it is NULL,
138                               then a new handle is created. If it is a pointer to an existing UEFI handle,
139                               then the protocol is added to the existing UEFI handle.
140
141  @retval EFI_SUCCES            The protocol was added to ChildHandle.
142  @retval EFI_INVALID_PARAMETER This is NULL or ChildHandle is NULL.
143  @retval EFI_OUT_OF_RESOURCES  There are not enough resources availabe to create
144                                the child.
145  @retval other                 The child handle was not created.
146
147**/
148EFI_STATUS
149EFIAPI
150Udp6ServiceBindingCreateChild (
151  IN EFI_SERVICE_BINDING_PROTOCOL  *This,
152  IN OUT EFI_HANDLE                *ChildHandle
153  );
154
155/**
156  Destroys a child handle with a set of I/O services.
157  The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
158  that was installed by CreateChild() from ChildHandle. If the removed protocol is the
159  last protocol on ChildHandle, then ChildHandle is destroyed.
160
161  @param[in]  This               Protocol instance pointer.
162  @param[in]  ChildHandle        Handle of the child to destroy.
163
164  @retval EFI_SUCCES             The I/O services were removed from the child
165                                 handle.
166  @retval EFI_UNSUPPORTED        The child handle does not support the I/O services
167                                 that are being removed.
168  @retval EFI_INVALID_PARAMETER  Child handle is NULL.
169  @retval EFI_ACCESS_DENIED      The child handle could not be destroyed because
170                                 its I/O services are being used.
171  @retval other                  The child handle was not destroyed.
172
173**/
174EFI_STATUS
175EFIAPI
176Udp6ServiceBindingDestroyChild (
177  IN EFI_SERVICE_BINDING_PROTOCOL  *This,
178  IN EFI_HANDLE                    ChildHandle
179  );
180
181#endif
182
183