1 /** @file
2 
3 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution.  The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8 
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 
12 **/
13 
14 #ifndef _UDP4_DRIVER_H_
15 #define _UDP4_DRIVER_H_
16 
17 #include <Uefi.h>
18 #include <Library/BaseLib.h>
19 #include <Library/NetLib.h>
20 #include <Protocol/DriverBinding.h>
21 #include <Protocol/ServiceBinding.h>
22 
23 /**
24   Test to see if this driver supports ControllerHandle. This service
25   is called by the EFI boot service ConnectController(). In
26   order to make drivers as small as possible, there are a few calling
27   restrictions for this service. ConnectController() must
28   follow these calling restrictions. If any other agent wishes to call
29   Supported() it must also follow these calling restrictions.
30 
31   @param[in]  This                Protocol instance pointer.
32   @param[in]  ControllerHandle    Handle of device to test
33   @param[in]  RemainingDevicePath Optional parameter use to pick a specific child
34                                   device to start.
35 
36   @retval EFI_SUCCESS         This driver supports this device
37   @retval EFI_ALREADY_STARTED This driver is already running on this device
38   @retval other               This driver does not support this device
39 
40 **/
41 EFI_STATUS
42 EFIAPI
43 Udp4DriverBindingSupported (
44   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
45   IN EFI_HANDLE                   ControllerHandle,
46   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath  OPTIONAL
47   );
48 
49 /**
50   Start this driver on ControllerHandle. This service is called by the
51   EFI boot service ConnectController(). In order to make
52   drivers as small as possible, there are a few calling restrictions for
53   this service. ConnectController() must follow these
54   calling restrictions. If any other agent wishes to call Start() it
55   must also follow these calling restrictions.
56 
57   @param[in]  This                 Protocol instance pointer.
58   @param[in]  ControllerHandle     Handle of device to bind driver to
59   @param[in]  RemainingDevicePath  Optional parameter use to pick a specific child
60                                    device to start.
61 
62   @retval EFI_SUCCESS          This driver is added to ControllerHandle
63   @retval EFI_ALREADY_STARTED  This driver is already running on ControllerHandle
64   @retval other                This driver does not support this device
65 
66 **/
67 EFI_STATUS
68 EFIAPI
69 Udp4DriverBindingStart (
70   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
71   IN EFI_HANDLE                   ControllerHandle,
72   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath  OPTIONAL
73   );
74 
75 /**
76   Stop this driver on ControllerHandle. This service is called by the
77   EFI boot service DisconnectController(). In order to
78   make drivers as small as possible, there are a few calling
79   restrictions for this service. DisconnectController()
80   must follow these calling restrictions. If any other agent wishes
81   to call Stop() it must also follow these calling restrictions.
82 
83   @param[in]  This              Protocol instance pointer.
84   @param[in]  ControllerHandle  Handle of device to stop driver on
85   @param[in]  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of
86                                 children is zero stop the entire bus driver.
87   @param[in]  ChildHandleBuffer List of Child Handles to Stop.
88 
89   @retval EFI_SUCCESS       This driver is removed ControllerHandle
90   @retval other             This driver was not removed from this device
91 
92 **/
93 EFI_STATUS
94 EFIAPI
95 Udp4DriverBindingStop (
96   IN  EFI_DRIVER_BINDING_PROTOCOL  *This,
97   IN  EFI_HANDLE                   ControllerHandle,
98   IN  UINTN                        NumberOfChildren,
99   IN  EFI_HANDLE                   *ChildHandleBuffer
100   );
101 
102 /**
103   Creates a child handle and installs a protocol.
104 
105   The CreateChild() function installs a protocol on ChildHandle.
106   If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.
107   If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.
108 
109   @param[in] This        Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
110   @param[in] ChildHandle Pointer to the handle of the child to create. If it is NULL,
111                          then a new handle is created. If it is a pointer to an existing UEFI handle,
112                          then the protocol is added to the existing UEFI handle.
113 
114   @retval EFI_SUCCES            The protocol was added to ChildHandle.
115   @retval EFI_INVALID_PARAMETER ChildHandle is NULL.
116   @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to create
117                                 the child
118   @retval other                 The child handle was not created
119 
120 **/
121 EFI_STATUS
122 EFIAPI
123 Udp4ServiceBindingCreateChild (
124   IN EFI_SERVICE_BINDING_PROTOCOL  *This,
125   IN EFI_HANDLE                    *ChildHandle
126   );
127 
128 /**
129   Destroys a child handle with a protocol installed on it.
130 
131   The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
132   that was installed by CreateChild() from ChildHandle. If the removed protocol is the
133   last protocol on ChildHandle, then ChildHandle is destroyed.
134 
135   @param[in] This        Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
136   @param[in] ChildHandle Handle of the child to destroy
137 
138   @retval EFI_SUCCES            The protocol was removed from ChildHandle.
139   @retval EFI_UNSUPPORTED       ChildHandle does not support the protocol that is being removed.
140   @retval EFI_INVALID_PARAMETER Child handle is NULL.
141   @retval EFI_ACCESS_DENIED     The protocol could not be removed from the ChildHandle
142                                 because its services are being used.
143   @retval other                 The child handle was not destroyed
144 
145 **/
146 EFI_STATUS
147 EFIAPI
148 Udp4ServiceBindingDestroyChild (
149   IN EFI_SERVICE_BINDING_PROTOCOL  *This,
150   IN EFI_HANDLE                    ChildHandle
151   );
152 
153 #endif
154 
155