]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Driver.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Udp4Dxe / Udp4Driver.c
CommitLineData
8a67d61d 1/** @file\r
2\r
d1102dba 3Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
e5eed7d3 4This program and the accompanying materials\r
8a67d61d 5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
8a67d61d 12**/\r
13\r
14\r
15#include "Udp4Impl.h"\r
16\r
17EFI_DRIVER_BINDING_PROTOCOL gUdp4DriverBinding = {\r
18 Udp4DriverBindingSupported,\r
19 Udp4DriverBindingStart,\r
20 Udp4DriverBindingStop,\r
21 0xa,\r
22 NULL,\r
23 NULL\r
24};\r
25\r
26EFI_SERVICE_BINDING_PROTOCOL mUdp4ServiceBinding = {\r
27 Udp4ServiceBindingCreateChild,\r
28 Udp4ServiceBindingDestroyChild\r
29};\r
30\r
216f7970 31/**\r
32 Callback function which provided by user to remove one node in NetDestroyLinkList process.\r
d1102dba 33\r
216f7970 34 @param[in] Entry The entry to be removed.\r
35 @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList.\r
36\r
37 @retval EFI_SUCCESS The entry has been removed successfully.\r
38 @retval Others Fail to remove the entry.\r
39\r
40**/\r
41EFI_STATUS\r
1f7eb561 42EFIAPI\r
216f7970 43Udp4DestroyChildEntryInHandleBuffer (\r
44 IN LIST_ENTRY *Entry,\r
45 IN VOID *Context\r
1f7eb561 46 )\r
216f7970 47{\r
48 UDP4_INSTANCE_DATA *Instance;\r
49 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;\r
50 UINTN NumberOfChildren;\r
51 EFI_HANDLE *ChildHandleBuffer;\r
52\r
53 if (Entry == NULL || Context == NULL) {\r
54 return EFI_INVALID_PARAMETER;\r
55 }\r
56\r
57 Instance = NET_LIST_USER_STRUCT_S (Entry, UDP4_INSTANCE_DATA, Link, UDP4_INSTANCE_DATA_SIGNATURE);\r
58 ServiceBinding = ((UDP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ServiceBinding;\r
59 NumberOfChildren = ((UDP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->NumberOfChildren;\r
60 ChildHandleBuffer = ((UDP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ChildHandleBuffer;\r
61\r
62 if (!NetIsInHandleBuffer (Instance->ChildHandle, NumberOfChildren, ChildHandleBuffer)) {\r
63 return EFI_SUCCESS;\r
64 }\r
65\r
66 return ServiceBinding->DestroyChild (ServiceBinding, Instance->ChildHandle);\r
67}\r
68\r
8a67d61d 69\r
70/**\r
bab52709 71 Test to see if this driver supports ControllerHandle. This service\r
72 is called by the EFI boot service ConnectController(). In\r
73 order to make drivers as small as possible, there are a few calling\r
74 restrictions for this service. ConnectController() must\r
75 follow these calling restrictions. If any other agent wishes to call\r
76 Supported() it must also follow these calling restrictions.\r
77\r
3e8c18da 78 @param[in] This Protocol instance pointer.\r
79 @param[in] ControllerHandle Handle of device to test\r
80 @param[in] RemainingDevicePath Optional parameter use to pick a specific child\r
81 device to start.\r
bab52709 82\r
83 @retval EFI_SUCCESS This driver supports this device\r
84 @retval EFI_ALREADY_STARTED This driver is already running on this device\r
85 @retval other This driver does not support this device\r
8a67d61d 86\r
87**/\r
88EFI_STATUS\r
89EFIAPI\r
90Udp4DriverBindingSupported (\r
91 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
92 IN EFI_HANDLE ControllerHandle,\r
93 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
94 )\r
95{\r
96 EFI_STATUS Status;\r
97\r
98 //\r
99 // Test for the Udp4ServiceBinding Protocol\r
100 //\r
101 Status = gBS->OpenProtocol (\r
102 ControllerHandle,\r
103 &gEfiUdp4ServiceBindingProtocolGuid,\r
104 NULL,\r
105 This->DriverBindingHandle,\r
106 ControllerHandle,\r
107 EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
108 );\r
109 if (!EFI_ERROR (Status)) {\r
110 return EFI_ALREADY_STARTED;\r
111 }\r
112\r
113 //\r
114 // Test for the Ip4 Protocol\r
115 //\r
116 Status = gBS->OpenProtocol (\r
117 ControllerHandle,\r
118 &gEfiIp4ServiceBindingProtocolGuid,\r
119 NULL,\r
120 This->DriverBindingHandle,\r
121 ControllerHandle,\r
122 EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
123 );\r
124\r
125 return Status;\r
126}\r
127\r
128\r
129/**\r
bab52709 130 Start this driver on ControllerHandle. This service is called by the\r
131 EFI boot service ConnectController(). In order to make\r
132 drivers as small as possible, there are a few calling restrictions for\r
133 this service. ConnectController() must follow these\r
134 calling restrictions. If any other agent wishes to call Start() it\r
135 must also follow these calling restrictions.\r
136\r
3e8c18da 137 @param[in] This Protocol instance pointer.\r
138 @param[in] ControllerHandle Handle of device to bind driver to\r
139 @param[in] RemainingDevicePath Optional parameter use to pick a specific child\r
140 device to start.\r
bab52709 141\r
142 @retval EFI_SUCCESS This driver is added to ControllerHandle\r
143 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r
144 @retval other This driver does not support this device\r
8a67d61d 145\r
146**/\r
147EFI_STATUS\r
148EFIAPI\r
149Udp4DriverBindingStart (\r
150 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
151 IN EFI_HANDLE ControllerHandle,\r
152 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
153 )\r
154{\r
155 EFI_STATUS Status;\r
156 UDP4_SERVICE_DATA *Udp4Service;\r
157\r
158 //\r
159 // Allocate Private Context Data Structure.\r
160 //\r
e48e37fc 161 Udp4Service = AllocatePool (sizeof (UDP4_SERVICE_DATA));\r
8a67d61d 162 if (Udp4Service == NULL) {\r
163 return EFI_OUT_OF_RESOURCES;\r
164 }\r
165\r
166 Status = Udp4CreateService (Udp4Service, This->DriverBindingHandle, ControllerHandle);\r
167 if (EFI_ERROR (Status)) {\r
766c7483 168 FreePool (Udp4Service);\r
c4a62a12 169 return Status;\r
8a67d61d 170 }\r
171\r
172 //\r
173 // Install the Udp4ServiceBindingProtocol on the ControllerHandle.\r
174 //\r
175 Status = gBS->InstallMultipleProtocolInterfaces (\r
176 &ControllerHandle,\r
177 &gEfiUdp4ServiceBindingProtocolGuid,\r
178 &Udp4Service->ServiceBinding,\r
179 NULL\r
180 );\r
181 if (EFI_ERROR (Status)) {\r
c4a62a12 182 Udp4CleanService (Udp4Service);\r
766c7483 183 FreePool (Udp4Service);\r
8a67d61d 184 }\r
185\r
8a67d61d 186 return Status;\r
187}\r
188\r
189\r
190/**\r
bab52709 191 Stop this driver on ControllerHandle. This service is called by the\r
192 EFI boot service DisconnectController(). In order to\r
193 make drivers as small as possible, there are a few calling\r
194 restrictions for this service. DisconnectController()\r
195 must follow these calling restrictions. If any other agent wishes\r
196 to call Stop() it must also follow these calling restrictions.\r
d1102dba 197\r
3e8c18da 198 @param[in] This Protocol instance pointer.\r
199 @param[in] ControllerHandle Handle of device to stop driver on\r
200 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
201 children is zero stop the entire bus driver.\r
202 @param[in] ChildHandleBuffer List of Child Handles to Stop.\r
bab52709 203\r
204 @retval EFI_SUCCESS This driver is removed ControllerHandle\r
205 @retval other This driver was not removed from this device\r
8a67d61d 206\r
207**/\r
208EFI_STATUS\r
209EFIAPI\r
210Udp4DriverBindingStop (\r
211 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
212 IN EFI_HANDLE ControllerHandle,\r
213 IN UINTN NumberOfChildren,\r
214 IN EFI_HANDLE *ChildHandleBuffer\r
215 )\r
216{\r
216f7970 217 EFI_STATUS Status;\r
218 EFI_HANDLE NicHandle;\r
219 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;\r
220 UDP4_SERVICE_DATA *Udp4Service;\r
221 UDP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context;\r
222 LIST_ENTRY *List;\r
8a67d61d 223\r
224 //\r
225 // Find the NicHandle where UDP4 ServiceBinding Protocol is installed.\r
226 //\r
227 NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiIp4ProtocolGuid);\r
228 if (NicHandle == NULL) {\r
216f7970 229 return EFI_SUCCESS;\r
8a67d61d 230 }\r
231\r
232 //\r
233 // Retrieve the UDP4 ServiceBinding Protocol.\r
234 //\r
235 Status = gBS->OpenProtocol (\r
236 NicHandle,\r
237 &gEfiUdp4ServiceBindingProtocolGuid,\r
238 (VOID **) &ServiceBinding,\r
239 This->DriverBindingHandle,\r
240 NicHandle,\r
241 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
242 );\r
243 if (EFI_ERROR (Status)) {\r
244 return EFI_DEVICE_ERROR;\r
245 }\r
246\r
247 Udp4Service = UDP4_SERVICE_DATA_FROM_THIS (ServiceBinding);\r
216f7970 248 if (NumberOfChildren != 0) {\r
249 //\r
250 // NumberOfChildren is not zero, destroy the children instances in ChildHandleBuffer.\r
251 //\r
252 List = &Udp4Service->ChildrenList;\r
253 Context.ServiceBinding = ServiceBinding;\r
254 Context.NumberOfChildren = NumberOfChildren;\r
255 Context.ChildHandleBuffer = ChildHandleBuffer;\r
256 Status = NetDestroyLinkList (\r
257 List,\r
258 Udp4DestroyChildEntryInHandleBuffer,\r
259 &Context,\r
260 NULL\r
261 );\r
262 } else {\r
c4a62a12 263 gBS->UninstallMultipleProtocolInterfaces (\r
264 NicHandle,\r
265 &gEfiUdp4ServiceBindingProtocolGuid,\r
266 &Udp4Service->ServiceBinding,\r
267 NULL\r
268 );\r
d1102dba 269\r
c4a62a12 270 Udp4CleanService (Udp4Service);\r
8a67d61d 271\r
216f7970 272 if (gUdpControllerNameTable != NULL) {\r
273 FreeUnicodeStringTable (gUdpControllerNameTable);\r
274 gUdpControllerNameTable = NULL;\r
c4a62a12 275 }\r
216f7970 276 FreePool (Udp4Service);\r
c4a62a12 277 }\r
278\r
279 return Status;\r
8a67d61d 280}\r
281\r
282\r
283/**\r
3e8c18da 284 Creates a child handle and installs a protocol.\r
d1102dba
LG
285\r
286 The CreateChild() function installs a protocol on ChildHandle.\r
287 If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.\r
3e8c18da 288 If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.\r
8a67d61d 289\r
47c75f64 290 @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
291 @param[in] ChildHandle Pointer to the handle of the child to create. If it is NULL,\r
d1102dba 292 then a new handle is created. If it is a pointer to an existing UEFI handle,\r
47c75f64 293 then the protocol is added to the existing UEFI handle.\r
8a67d61d 294\r
3e8c18da 295 @retval EFI_SUCCES The protocol was added to ChildHandle.\r
bab52709 296 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
2048c585 297 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create\r
bab52709 298 the child\r
299 @retval other The child handle was not created\r
8a67d61d 300\r
301**/\r
302EFI_STATUS\r
303EFIAPI\r
304Udp4ServiceBindingCreateChild (\r
305 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
306 IN EFI_HANDLE *ChildHandle\r
307 )\r
308{\r
309 EFI_STATUS Status;\r
310 UDP4_SERVICE_DATA *Udp4Service;\r
311 UDP4_INSTANCE_DATA *Instance;\r
312 EFI_TPL OldTpl;\r
313 VOID *Ip4;\r
314\r
315 if ((This == NULL) || (ChildHandle == NULL)) {\r
316 return EFI_INVALID_PARAMETER;\r
317 }\r
318\r
319 Udp4Service = UDP4_SERVICE_DATA_FROM_THIS (This);\r
320\r
321 //\r
322 // Allocate the instance private data structure.\r
323 //\r
e48e37fc 324 Instance = AllocateZeroPool (sizeof (UDP4_INSTANCE_DATA));\r
8a67d61d 325 if (Instance == NULL) {\r
326 return EFI_OUT_OF_RESOURCES;\r
327 }\r
328\r
329 Udp4InitInstance (Udp4Service, Instance);\r
330\r
331 //\r
332 // Add an IpInfo for this instance.\r
333 //\r
334 Instance->IpInfo = IpIoAddIp (Udp4Service->IpIo);\r
335 if (Instance->IpInfo == NULL) {\r
336 Status = EFI_OUT_OF_RESOURCES;\r
c4a62a12 337 goto ON_ERROR;\r
8a67d61d 338 }\r
339\r
340 //\r
341 // Install the Udp4Protocol for this instance.\r
342 //\r
343 Status = gBS->InstallMultipleProtocolInterfaces (\r
344 ChildHandle,\r
345 &gEfiUdp4ProtocolGuid,\r
346 &Instance->Udp4Proto,\r
347 NULL\r
348 );\r
349 if (EFI_ERROR (Status)) {\r
c4a62a12 350 goto ON_ERROR;\r
8a67d61d 351 }\r
352\r
353 Instance->ChildHandle = *ChildHandle;\r
354\r
355 //\r
356 // Open the default Ip4 protocol in the IP_IO BY_CHILD.\r
357 //\r
358 Status = gBS->OpenProtocol (\r
359 Udp4Service->IpIo->ChildHandle,\r
360 &gEfiIp4ProtocolGuid,\r
361 (VOID **) &Ip4,\r
362 gUdp4DriverBinding.DriverBindingHandle,\r
363 Instance->ChildHandle,\r
364 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
365 );\r
366 if (EFI_ERROR (Status)) {\r
c4a62a12 367 goto ON_ERROR;\r
8a67d61d 368 }\r
369\r
216f7970 370 //\r
371 // Open this instance's Ip4 protocol in the IpInfo BY_CHILD.\r
372 //\r
373 Status = gBS->OpenProtocol (\r
374 Instance->IpInfo->ChildHandle,\r
375 &gEfiIp4ProtocolGuid,\r
376 (VOID **) &Ip4,\r
377 gUdp4DriverBinding.DriverBindingHandle,\r
378 Instance->ChildHandle,\r
379 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
380 );\r
381 if (EFI_ERROR (Status)) {\r
382 goto ON_ERROR;\r
383 }\r
384\r
e48e37fc 385 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
8a67d61d 386\r
387 //\r
388 // Link this instance into the service context data and increase the ChildrenNumber.\r
389 //\r
e48e37fc 390 InsertTailList (&Udp4Service->ChildrenList, &Instance->Link);\r
8a67d61d 391 Udp4Service->ChildrenNumber++;\r
392\r
e48e37fc 393 gBS->RestoreTPL (OldTpl);\r
8a67d61d 394\r
c4a62a12 395 return EFI_SUCCESS;\r
8a67d61d 396\r
c4a62a12 397ON_ERROR:\r
8a67d61d 398\r
c4a62a12 399 if (Instance->ChildHandle != NULL) {\r
400 gBS->UninstallMultipleProtocolInterfaces (\r
401 Instance->ChildHandle,\r
402 &gEfiUdp4ProtocolGuid,\r
403 &Instance->Udp4Proto,\r
404 NULL\r
405 );\r
406 }\r
8a67d61d 407\r
c4a62a12 408 if (Instance->IpInfo != NULL) {\r
409 IpIoRemoveIp (Udp4Service->IpIo, Instance->IpInfo);\r
410 }\r
8a67d61d 411\r
412 Udp4CleanInstance (Instance);\r
413\r
766c7483 414 FreePool (Instance);\r
8a67d61d 415\r
416 return Status;\r
417}\r
418\r
419\r
420/**\r
3e8c18da 421 Destroys a child handle with a protocol installed on it.\r
d1102dba
LG
422\r
423 The DestroyChild() function does the opposite of CreateChild(). It removes a protocol\r
424 that was installed by CreateChild() from ChildHandle. If the removed protocol is the\r
3e8c18da 425 last protocol on ChildHandle, then ChildHandle is destroyed.\r
8a67d61d 426\r
47c75f64 427 @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
428 @param[in] ChildHandle Handle of the child to destroy\r
8a67d61d 429\r
3e8c18da 430 @retval EFI_SUCCES The protocol was removed from ChildHandle.\r
431 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.\r
284ee2e8 432 @retval EFI_INVALID_PARAMETER Child handle is NULL.\r
3e8c18da 433 @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle\r
434 because its services are being used.\r
bab52709 435 @retval other The child handle was not destroyed\r
8a67d61d 436\r
437**/\r
438EFI_STATUS\r
439EFIAPI\r
440Udp4ServiceBindingDestroyChild (\r
441 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
442 IN EFI_HANDLE ChildHandle\r
443 )\r
444{\r
445 EFI_STATUS Status;\r
446 UDP4_SERVICE_DATA *Udp4Service;\r
447 EFI_UDP4_PROTOCOL *Udp4Proto;\r
448 UDP4_INSTANCE_DATA *Instance;\r
449 EFI_TPL OldTpl;\r
450\r
451 if ((This == NULL) || (ChildHandle == NULL)) {\r
452 return EFI_INVALID_PARAMETER;\r
453 }\r
454\r
455 Udp4Service = UDP4_SERVICE_DATA_FROM_THIS (This);\r
456\r
457 //\r
458 // Try to get the Udp4 protocol from the ChildHandle.\r
459 //\r
460 Status = gBS->OpenProtocol (\r
461 ChildHandle,\r
462 &gEfiUdp4ProtocolGuid,\r
463 (VOID **) &Udp4Proto,\r
464 gUdp4DriverBinding.DriverBindingHandle,\r
465 ChildHandle,\r
466 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
467 );\r
468 if (EFI_ERROR (Status)) {\r
469 return EFI_UNSUPPORTED;\r
470 }\r
471\r
472 Instance = UDP4_INSTANCE_DATA_FROM_THIS (Udp4Proto);\r
473\r
216f7970 474 if (Instance->InDestroy) {\r
8a67d61d 475 return EFI_SUCCESS;\r
476 }\r
477\r
478 //\r
479 // Use the Destroyed flag to avoid the re-entering of the following code.\r
480 //\r
216f7970 481 Instance->InDestroy = TRUE;\r
8a67d61d 482\r
483 //\r
484 // Close the Ip4 protocol.\r
485 //\r
486 gBS->CloseProtocol (\r
487 Udp4Service->IpIo->ChildHandle,\r
488 &gEfiIp4ProtocolGuid,\r
489 gUdp4DriverBinding.DriverBindingHandle,\r
490 Instance->ChildHandle\r
491 );\r
216f7970 492 //\r
493 // Close the Ip4 protocol on this instance's IpInfo.\r
494 //\r
495 gBS->CloseProtocol (\r
496 Instance->IpInfo->ChildHandle,\r
497 &gEfiIp4ProtocolGuid,\r
498 gUdp4DriverBinding.DriverBindingHandle,\r
499 Instance->ChildHandle\r
d1102dba 500 );\r
8a67d61d 501\r
502 //\r
503 // Uninstall the Udp4Protocol previously installed on the ChildHandle.\r
504 //\r
505 Status = gBS->UninstallMultipleProtocolInterfaces (\r
506 ChildHandle,\r
507 &gEfiUdp4ProtocolGuid,\r
508 (VOID *) &Instance->Udp4Proto,\r
509 NULL\r
510 );\r
511 if (EFI_ERROR (Status)) {\r
216f7970 512 Instance->InDestroy = FALSE;\r
8a67d61d 513 return Status;\r
514 }\r
515\r
516 //\r
517 // Reset the configuration in case the instance's consumer forgets to do this.\r
518 //\r
519 Udp4Proto->Configure (Udp4Proto, NULL);\r
520\r
521 //\r
522 // Remove the IpInfo this instance consumes.\r
523 //\r
524 IpIoRemoveIp (Udp4Service->IpIo, Instance->IpInfo);\r
525\r
e48e37fc 526 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
8a67d61d 527\r
528 //\r
529 // Remove this instance from the service context data's ChildrenList.\r
530 //\r
e48e37fc 531 RemoveEntryList (&Instance->Link);\r
8a67d61d 532 Udp4Service->ChildrenNumber--;\r
533\r
534 //\r
535 // Clean the instance.\r
536 //\r
537 Udp4CleanInstance (Instance);\r
538\r
e48e37fc 539 gBS->RestoreTPL (OldTpl);\r
8a67d61d 540\r
766c7483 541 FreePool (Instance);\r
8a67d61d 542\r
543 return EFI_SUCCESS;\r
544}\r
545\r
bab52709 546/**\r
547 This is the declaration of an EFI image entry point. This entry point is\r
548 the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including\r
549 both device drivers and bus drivers.\r
d1102dba 550\r
bab52709 551 The entry point for Udp4 driver which installs the driver binding\r
552 and component name protocol on its ImageHandle.\r
553\r
3e8c18da 554 @param[in] ImageHandle The firmware allocated handle for the UEFI image.\r
555 @param[in] SystemTable A pointer to the EFI System Table.\r
bab52709 556\r
557 @retval EFI_SUCCESS The operation completed successfully.\r
558 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
8a67d61d 559\r
bab52709 560**/\r
8a67d61d 561EFI_STATUS\r
562EFIAPI\r
563Udp4DriverEntryPoint (\r
564 IN EFI_HANDLE ImageHandle,\r
565 IN EFI_SYSTEM_TABLE *SystemTable\r
566 )\r
8a67d61d 567{\r
568 EFI_STATUS Status;\r
569\r
570 //\r
571 // Install the Udp4DriverBinding and Udp4ComponentName protocols.\r
572 //\r
83cbd279 573 Status = EfiLibInstallDriverBindingComponentName2 (\r
8a67d61d 574 ImageHandle,\r
575 SystemTable,\r
576 &gUdp4DriverBinding,\r
577 ImageHandle,\r
578 &gUdp4ComponentName,\r
83cbd279 579 &gUdp4ComponentName2\r
8a67d61d 580 );\r
581 if (!EFI_ERROR (Status)) {\r
582 //\r
583 // Initialize the UDP random port.\r
584 //\r
687a2e5f 585 mUdp4RandomPort = (UINT16) (((UINT16) NetRandomInitSeed ()) % UDP4_PORT_KNOWN + UDP4_PORT_KNOWN);\r
8a67d61d 586 }\r
587\r
588 return Status;\r
589}\r
590\r