]> git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/TcpDxe/TcpDriver.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / NetworkPkg / TcpDxe / TcpDriver.h
1 /** @file
2 The prototype of driver binding and service binding protocol for TCP driver.
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 _TCP_DRIVER_H_
11 #define _TCP_DRIVER_H_
12
13 #define TCP_DRIVER_SIGNATURE SIGNATURE_32 ('T', 'C', 'P', 'D')
14
15 #define TCP_PORT_KNOWN 1024
16 #define TCP_PORT_USER_RESERVED 65535
17
18 typedef struct _TCP_HEARTBEAT_TIMER {
19 EFI_EVENT TimerEvent;
20 INTN RefCnt;
21 } TCP_HEARTBEAT_TIMER;
22
23 typedef struct _TCP_SERVICE_DATA {
24 UINT32 Signature;
25 EFI_HANDLE ControllerHandle;
26 EFI_HANDLE DriverBindingHandle;
27 UINT8 IpVersion;
28 IP_IO *IpIo;
29 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
30 LIST_ENTRY SocketList;
31 } TCP_SERVICE_DATA;
32
33 typedef struct _TCP_PROTO_DATA {
34 TCP_SERVICE_DATA *TcpService;
35 TCP_CB *TcpPcb;
36 } TCP_PROTO_DATA;
37
38 #define TCP_SERVICE_FROM_THIS(a) \
39 CR ( \
40 (a), \
41 TCP_SERVICE_DATA, \
42 ServiceBinding, \
43 TCP_DRIVER_SIGNATURE \
44 )
45
46 //
47 // Function prototype for the driver's entry point
48 //
49
50 /**
51 The entry point for Tcp driver, used to install Tcp driver on the ImageHandle.
52
53 @param[in] ImageHandle The firmware allocated handle for this driver image.
54 @param[in] SystemTable Pointer to the EFI system table.
55
56 @retval EFI_SUCCESS The driver loaded.
57 @retval other The driver did not load.
58
59 **/
60 EFI_STATUS
61 EFIAPI
62 TcpDriverEntryPoint (
63 IN EFI_HANDLE ImageHandle,
64 IN EFI_SYSTEM_TABLE *SystemTable
65 );
66
67 //
68 // Function prototypes for the Driver Binding Protocol
69 //
70
71 /**
72 Test to see if this driver supports ControllerHandle.
73
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.
78
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.
82
83 **/
84 EFI_STATUS
85 EFIAPI
86 Tcp4DriverBindingSupported (
87 IN EFI_DRIVER_BINDING_PROTOCOL *This,
88 IN EFI_HANDLE ControllerHandle,
89 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
90 );
91
92 /**
93 Start this driver on ControllerHandle.
94
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
98 device to start.
99
100 @retval EFI_SUCCESS The driver was added to ControllerHandle.
101 @retval EFI_OUT_OF_RESOURCES There are not enough resources to start the
102 driver.
103 @retval other The driver cannot be added to ControllerHandle.
104
105 **/
106 EFI_STATUS
107 EFIAPI
108 Tcp4DriverBindingStart (
109 IN EFI_DRIVER_BINDING_PROTOCOL *This,
110 IN EFI_HANDLE ControllerHandle,
111 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
112 );
113
114 /**
115 Stop this driver on ControllerHandle.
116
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.
124
125 @retval EFI_SUCCESS The device was stopped.
126 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
127
128 **/
129 EFI_STATUS
130 EFIAPI
131 Tcp4DriverBindingStop (
132 IN EFI_DRIVER_BINDING_PROTOCOL *This,
133 IN EFI_HANDLE ControllerHandle,
134 IN UINTN NumberOfChildren,
135 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
136 );
137
138 /**
139 Test to see if this driver supports ControllerHandle.
140
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.
145
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.
149
150 **/
151 EFI_STATUS
152 EFIAPI
153 Tcp6DriverBindingSupported (
154 IN EFI_DRIVER_BINDING_PROTOCOL *This,
155 IN EFI_HANDLE ControllerHandle,
156 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
157 );
158
159 /**
160 Start this driver on ControllerHandle.
161
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
165 device to start.
166
167 @retval EFI_SUCCESS The driver was added to ControllerHandle.
168 @retval EFI_OUT_OF_RESOURCES There are not enough resources to start the
169 driver.
170 @retval other The driver cannot be added to ControllerHandle.
171
172 **/
173 EFI_STATUS
174 EFIAPI
175 Tcp6DriverBindingStart (
176 IN EFI_DRIVER_BINDING_PROTOCOL *This,
177 IN EFI_HANDLE ControllerHandle,
178 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
179 );
180
181 /**
182 Stop this driver on ControllerHandle.
183
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.
191
192 @retval EFI_SUCCESS The device was stopped.
193 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
194
195 **/
196 EFI_STATUS
197 EFIAPI
198 Tcp6DriverBindingStop (
199 IN EFI_DRIVER_BINDING_PROTOCOL *This,
200 IN EFI_HANDLE ControllerHandle,
201 IN UINTN NumberOfChildren,
202 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
203 );
204
205 /**
206 The Callback function called after the TCP socket is created.
207
208 @param[in] This Pointer to the socket just created.
209 @param[in] Context The context of the socket.
210
211 @retval EFI_SUCCESS This protocol is installed successfully.
212 @retval other An error occurred.
213
214 **/
215 EFI_STATUS
216 TcpCreateSocketCallback (
217 IN SOCKET *This,
218 IN VOID *Context
219 );
220
221 /**
222 The callback function called before the TCP socket is to be destroyed.
223
224 @param[in] This The TCP socket to be destroyed.
225 @param[in] Context The context of the socket.
226
227 **/
228 VOID
229 TcpDestroySocketCallback (
230 IN SOCKET *This,
231 IN VOID *Context
232 );
233
234 //
235 // Function prototypes for the ServiceBinding Protocol
236 //
237
238 /**
239 Creates a child handle with a set of TCP services.
240
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.
244
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.
250
251 @retval EFI_SUCCESS 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
254 the child.
255 @retval other The child handle was not created.
256
257 **/
258 EFI_STATUS
259 EFIAPI
260 TcpServiceBindingCreateChild (
261 IN EFI_SERVICE_BINDING_PROTOCOL *This,
262 IN OUT EFI_HANDLE *ChildHandle
263 );
264
265 /**
266 Destroys a child handle with a set of TCP services.
267
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.
271
272 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
273 @param ChildHandle Handle of the child to destroy.
274
275 @retval EFI_SUCCESS 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.
281
282 **/
283 EFI_STATUS
284 EFIAPI
285 TcpServiceBindingDestroyChild (
286 IN EFI_SERVICE_BINDING_PROTOCOL *This,
287 IN EFI_HANDLE ChildHandle
288 );
289
290 #endif