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