2 The prototype of driver binding and service binding protocol for TCP driver.
4 Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef _TCP_DRIVER_H_
11 #define _TCP_DRIVER_H_
13 #define TCP_DRIVER_SIGNATURE SIGNATURE_32 ('T', 'C', 'P', 'D')
15 #define TCP_PORT_KNOWN 1024
16 #define TCP_PORT_USER_RESERVED 65535
18 typedef struct _TCP_HEARTBEAT_TIMER
{
21 } TCP_HEARTBEAT_TIMER
;
23 typedef struct _TCP_SERVICE_DATA
{
25 EFI_HANDLE ControllerHandle
;
26 EFI_HANDLE DriverBindingHandle
;
29 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding
;
30 LIST_ENTRY SocketList
;
33 typedef struct _TCP_PROTO_DATA
{
34 TCP_SERVICE_DATA
*TcpService
;
38 #define TCP_SERVICE_FROM_THIS(a) \
43 TCP_DRIVER_SIGNATURE \
47 // Function prototype for the driver's entry point
51 The entry point for Tcp driver, used to install Tcp driver on the ImageHandle.
53 @param[in] ImageHandle The firmware allocated handle for this driver image.
54 @param[in] SystemTable Pointer to the EFI system table.
56 @retval EFI_SUCCESS The driver loaded.
57 @retval other The driver did not load.
63 IN EFI_HANDLE ImageHandle
,
64 IN EFI_SYSTEM_TABLE
*SystemTable
68 // Function prototypes for the Driver Binding Protocol
72 Test to see if this driver supports ControllerHandle.
74 @param[in] This Protocol instance pointer.
75 @param[in] ControllerHandle Handle of the device to test.
76 @param[in] RemainingDevicePath Optional parameter use to pick a specific
77 child device to start.
79 @retval EFI_SUCCESS This driver supports this device.
80 @retval EFI_ALREADY_STARTED This driver is already running on this device.
81 @retval other This driver does not support this device.
86 Tcp4DriverBindingSupported (
87 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
88 IN EFI_HANDLE ControllerHandle
,
89 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
93 Start this driver on ControllerHandle.
95 @param[in] This Protocol instance pointer.
96 @param[in] ControllerHandle Handle of device to bind driver to.
97 @param[in] RemainingDevicePath Optional parameter use to pick a specific child
100 @retval EFI_SUCCESS The driver was added to ControllerHandle.
101 @retval EFI_OUT_OF_RESOURCES There are not enough resources to start the
103 @retval other The driver cannot be added to ControllerHandle.
108 Tcp4DriverBindingStart (
109 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
110 IN EFI_HANDLE ControllerHandle
,
111 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
115 Stop this driver on ControllerHandle.
117 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
118 @param[in] ControllerHandle A handle to the device being stopped. The handle must
119 support a bus specific I/O protocol for the driver
120 to use to stop the device.
121 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
122 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
123 if NumberOfChildren is 0.
125 @retval EFI_SUCCESS The device was stopped.
126 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
131 Tcp4DriverBindingStop (
132 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
133 IN EFI_HANDLE ControllerHandle
,
134 IN UINTN NumberOfChildren
,
135 IN EFI_HANDLE
*ChildHandleBuffer OPTIONAL
139 Test to see if this driver supports ControllerHandle.
141 @param[in] This Protocol instance pointer.
142 @param[in] ControllerHandle Handle of the device to test.
143 @param[in] RemainingDevicePath Optional parameter use to pick a specific
144 child device to start.
146 @retval EFI_SUCCESS This driver supports this device.
147 @retval EFI_ALREADY_STARTED This driver is already running on this device.
148 @retval other This driver does not support this device.
153 Tcp6DriverBindingSupported (
154 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
155 IN EFI_HANDLE ControllerHandle
,
156 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
160 Start this driver on ControllerHandle.
162 @param[in] This Protocol instance pointer.
163 @param[in] ControllerHandle Handle of device to bind driver to.
164 @param[in] RemainingDevicePath Optional parameter use to pick a specific child
167 @retval EFI_SUCCESS The driver was added to ControllerHandle.
168 @retval EFI_OUT_OF_RESOURCES There are not enough resources to start the
170 @retval other The driver cannot be added to ControllerHandle.
175 Tcp6DriverBindingStart (
176 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
177 IN EFI_HANDLE ControllerHandle
,
178 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
182 Stop this driver on ControllerHandle.
184 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
185 @param[in] ControllerHandle A handle to the device being stopped. The handle must
186 support a bus specific I/O protocol for the driver
187 to use to stop the device.
188 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
189 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
190 if NumberOfChildren is 0.
192 @retval EFI_SUCCESS The device was stopped.
193 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
198 Tcp6DriverBindingStop (
199 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
200 IN EFI_HANDLE ControllerHandle
,
201 IN UINTN NumberOfChildren
,
202 IN EFI_HANDLE
*ChildHandleBuffer OPTIONAL
206 The Callback funtion called after the TCP socket is created.
208 @param[in] This Pointer to the socket just created.
209 @param[in] Context The context of the socket.
211 @retval EFI_SUCCESS This protocol is installed successfully.
212 @retval other An error occured.
216 TcpCreateSocketCallback (
222 The callback function called before the TCP socket is to be destroyed.
224 @param[in] This The TCP socket to be destroyed.
225 @param[in] Context The context of the socket.
229 TcpDestroySocketCallback (
235 // Function prototypes for the ServiceBinding Protocol
239 Creates a child handle with a set of TCP services.
241 The CreateChild() function installs a protocol on ChildHandle.
242 If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.
243 If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.
245 @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
246 @param[in, out] ChildHandle Pointer to the handle of the child to create.
247 If it is NULL, then a new handle is created.
248 If it is a pointer to an existing UEFI handle,
249 then the protocol is added to the existing UEFI handle.
251 @retval EFI_SUCCES The protocol was added to ChildHandle.
252 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.
253 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create
255 @retval other The child handle was not created.
260 TcpServiceBindingCreateChild (
261 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
262 IN OUT EFI_HANDLE
*ChildHandle
266 Destroys a child handle with a set of TCP services.
268 The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
269 that was installed by CreateChild() from ChildHandle. If the removed protocol is the
270 last protocol on ChildHandle, then ChildHandle is destroyed.
272 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
273 @param ChildHandle Handle of the child to destroy.
275 @retval EFI_SUCCES The protocol was removed from ChildHandle.
276 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.
277 @retval EFI_INVALID_PARAMETER The child handle is NULL.
278 @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle
279 because its services are being used.
280 @retval other The child handle was not destroyed.
285 TcpServiceBindingDestroyChild (
286 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
287 IN EFI_HANDLE ChildHandle