Changeset 58459 in vbox for trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg
- Timestamp:
- Oct 28, 2015 8:17:18 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 103761
- Location:
- trunk/src/VBox/Devices/EFI/Firmware
- Files:
-
- 113 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware
-
Property svn:mergeinfo
set to (toggle deleted branches)
/vendor/edk2/current 103735-103757
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Application/IfConfig6/IfConfig6.c
r48674 r58459 2 2 The implementation for Shell application IfConfig6. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 137 137 Str = (CHAR16 *) AllocateZeroPool (StrSize (String)); 138 138 ASSERT (Str != NULL); 139 Str = Str Cpy (Str, String);139 Str = StrnCpy (Str, String, StrLen (String)); 140 140 ArgStr = Str; 141 141 … … 366 366 UINT8 AddrCnt; 367 367 368 Prefix = 0; 368 369 AddrCnt = 0; 369 370 *BufSize = 0; … … 1720 1721 ASSERT (Str != NULL); 1721 1722 1722 Str = Str Cpy (Str, ValueStr);1723 Str = StrnCpy (Str, ValueStr, StrLen (ValueStr)); 1723 1724 Private->IfName = Str; 1724 1725 } … … 1734 1735 ASSERT (Str != NULL); 1735 1736 1736 Str = Str Cpy (Str, ValueStr);1737 Str = StrnCpy (Str, ValueStr, StrLen (ValueStr)); 1737 1738 Private->IfName = Str; 1738 1739 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Application/IfConfig6/IfConfig6.inf
r48674 r58459 1 1 ## @file 2 # Component description file forShell application IfConfig6.2 # Shell application IfConfig6. 3 3 # 4 # Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> 4 # It is shell application which is used to set and get configurations for the 5 # EFI IPv6 network stack. 6 # 7 # Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 8 # 6 9 # This program and the accompanying materials … … 21 24 VERSION_STRING = 1.0 22 25 ENTRY_POINT = IfConfig6Initialize 26 MODULE_UNI_FILE = IfConfig6.uni 23 27 24 28 # … … 49 53 50 54 [Protocols] 51 gEfiIp6ServiceBindingProtocolGuid ## CONSUMS 52 gEfiIp6ConfigProtocolGuid ## CONSUMS 55 gEfiIp6ServiceBindingProtocolGuid ## CONSUMES 56 gEfiIp6ConfigProtocolGuid ## CONSUMES 57 58 [UserExtensions.TianoCore."ExtraFiles"] 59 IfConfig6Extra.uni -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Application/IpsecConfig/Indexer.c
r48674 r58459 2 2 The implementation of construct ENTRY_INDEXER in IpSecConfig application. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 235 235 236 236 Indexer->PadId.PeerIdValid = TRUE; 237 ZeroMem (Indexer->PadId.Id.PeerId, MAX_PEERID_LEN); 237 238 StrnCpy ((CHAR16 *) Indexer->PadId.Id.PeerId, ValueStr, ARRAY_SIZE (Indexer->PadId.Id.PeerId) - 1); 238 239 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Application/IpsecConfig/IpSecConfig.inf
r48674 r58459 1 1 ## @file 2 # Component description file for IpSecConfig6 application. 2 # Shell application IpSecConfig. 3 # 4 # This application is used to set and retrieve security and policy related information 5 # for the EFI IPsec protocol driver. 3 6 # 4 # Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>7 # Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 8 # 6 9 # This program and the accompanying materials … … 21 24 VERSION_STRING = 1.0 22 25 ENTRY_POINT = InitializeIpSecConfig 26 MODULE_UNI_FILE = IpSecConfig.uni 23 27 24 28 [Sources] … … 58 62 59 63 [Protocols] 60 gEfiIpSec2ProtocolGuid ##CONSUMS 61 gEfiIpSecConfigProtocolGuid ##CONSUMS 64 gEfiIpSec2ProtocolGuid ##CONSUMES 65 gEfiIpSecConfigProtocolGuid ##CONSUMES 66 67 [UserExtensions.TianoCore."ExtraFiles"] 68 IpSecConfigExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Application/Ping6/Ping6.c
r48674 r58459 2 2 The implementation for Ping6 application. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 803 803 804 804 /** 805 Dest ory the IP6 instance.805 Destroy the IP6 instance. 806 806 807 807 @param[in] Private The pointer of PING6_PRIVATE_DATA. … … 809 809 **/ 810 810 VOID 811 Ping6Dest oryIp6Instance (811 Ping6DestroyIp6Instance ( 812 812 IN PING6_PRIVATE_DATA *Private 813 813 ) … … 1020 1020 1021 1021 if (Private->Ip6ChildHandle != NULL) { 1022 Ping6Dest oryIp6Instance (Private);1022 Ping6DestroyIp6Instance (Private); 1023 1023 } 1024 1024 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Application/Ping6/Ping6.inf
r48674 r58459 1 1 ## @file 2 # Component description file for Ping6 application.2 # Shell application Ping6. 3 3 # 4 # Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> 4 # It is an shell application which is used to Ping the target host with IPv6 stack. 5 # 6 # Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 7 # 6 8 # This program and the accompanying materials … … 21 23 VERSION_STRING = 1.0 22 24 ENTRY_POINT = InitializePing6 25 MODULE_UNI_FILE = Ping6.uni 23 26 24 27 # … … 59 62 60 63 [Protocols] 61 gEfiCpuArchProtocolGuid ## CONSUMS 62 gEfiIp6ProtocolGuid ## CONSUMS 63 gEfiIp6ServiceBindingProtocolGuid ## CONSUMS 64 gEfiIp6ConfigProtocolGuid ## CONSUMS 64 gEfiCpuArchProtocolGuid ## CONSUMES 65 gEfiIp6ProtocolGuid ## CONSUMES 66 gEfiIp6ServiceBindingProtocolGuid ## CONSUMES 67 gEfiIp6ConfigProtocolGuid ## CONSUMES 68 69 [UserExtensions.TianoCore."ExtraFiles"] 70 Ping6Extra.uni -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Application/VConfig/VConfig.c
r48674 r58459 2 2 Shell application for VLAN configuration. 3 3 4 Copyright ( C) 2009 - 2011, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Application/VConfig/VConfig.inf
r48674 r58459 1 1 ## @file 2 # Component files for VLAN configuration shell application.2 # Shell application VLAN configuration. 3 3 # 4 # Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> 4 # It is shell application which is used to get and set VLAN configuration. 5 # 6 # Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 7 # 6 8 # This program and the accompanying materials … … 21 23 VERSION_STRING = 1.0 22 24 ENTRY_POINT = VlanConfigMain 25 MODULE_UNI_FILE = VConfig.uni 23 26 24 27 # … … 45 48 46 49 [Protocols] 47 gEfiVlanConfigProtocolGuid 50 gEfiVlanConfigProtocolGuid ## CONSUMES 51 52 [UserExtensions.TianoCore."ExtraFiles"] 53 VConfigExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Dhcp6Dxe/ComponentName.c
r48674 r58459 2 2 UEFI Component Name(2) protocol implementation for Dhcp6 driver. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 173 173 }; 174 174 175 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gDhcp6ControllerNameTable = NULL; 176 177 CHAR16 *mDhcp6ControllerName[] = { 178 L"DHCPv6 (State=0, Init)", 179 L"DHCPv6 (State=1, Selecting)", 180 L"DHCPv6 (State=2, Requesting)", 181 L"DHCPv6 (State=3, Declining)", 182 L"DHCPv6 (State=4, Confirming)", 183 L"DHCPv6 (State=5, Releasing)", 184 L"DHCPv6 (State=6, Bound)", 185 L"DHCPv6 (State=7, Renewing)", 186 L"DHCPv6 (State=8, Rebinding)" 187 }; 175 188 176 189 /** … … 230 243 } 231 244 245 /** 246 Update the component name for the Dhcp6 child handle. 247 248 @param Dhcp6[in] A pointer to the EFI_DHCP6_PROTOCOL. 249 250 251 @retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully. 252 @retval EFI_INVALID_PARAMETER The input parameter is invalid. 253 254 **/ 255 EFI_STATUS 256 UpdateName ( 257 IN EFI_DHCP6_PROTOCOL *Dhcp6 258 ) 259 { 260 EFI_STATUS Status; 261 EFI_DHCP6_MODE_DATA Dhcp6ModeData; 262 CHAR16 *HandleName; 263 264 if (Dhcp6 == NULL) { 265 return EFI_INVALID_PARAMETER; 266 } 267 268 // 269 // Format the child name into the string buffer. 270 // 271 Status = Dhcp6->GetModeData (Dhcp6, &Dhcp6ModeData, NULL); 272 if (EFI_ERROR (Status)) { 273 return Status; 274 } 275 276 if (gDhcp6ControllerNameTable != NULL) { 277 FreeUnicodeStringTable (gDhcp6ControllerNameTable); 278 gDhcp6ControllerNameTable = NULL; 279 } 280 281 if (Dhcp6ModeData.Ia == NULL) { 282 HandleName = L"DHCPv6 (No configured IA)"; 283 } else { 284 if (Dhcp6ModeData.Ia->State > Dhcp6Rebinding) { 285 return EFI_DEVICE_ERROR; 286 } 287 HandleName = mDhcp6ControllerName[Dhcp6ModeData.Ia->State]; 288 } 289 290 Status = AddUnicodeString2 ( 291 "eng", 292 gDhcp6ComponentName.SupportedLanguages, 293 &gDhcp6ControllerNameTable, 294 HandleName, 295 TRUE 296 ); 297 if (EFI_ERROR (Status)) { 298 return Status; 299 } 300 301 return AddUnicodeString2 ( 302 "en", 303 gDhcp6ComponentName2.SupportedLanguages, 304 &gDhcp6ControllerNameTable, 305 HandleName, 306 FALSE 307 ); 308 } 232 309 233 310 /** … … 309 386 ) 310 387 { 311 return EFI_UNSUPPORTED; 388 EFI_STATUS Status; 389 EFI_DHCP6_PROTOCOL *Dhcp6; 390 391 // 392 // Only provide names for child handles. 393 // 394 if (ChildHandle == NULL) { 395 return EFI_UNSUPPORTED; 396 } 397 398 // 399 // Make sure this driver produced ChildHandle 400 // 401 Status = EfiTestChildHandle ( 402 ControllerHandle, 403 ChildHandle, 404 &gEfiUdp6ProtocolGuid 405 ); 406 if (EFI_ERROR (Status)) { 407 return Status; 408 } 409 410 // 411 // Retrieve an instance of a produced protocol from ChildHandle 412 // 413 Status = gBS->OpenProtocol ( 414 ChildHandle, 415 &gEfiDhcp6ProtocolGuid, 416 (VOID **)&Dhcp6, 417 NULL, 418 NULL, 419 EFI_OPEN_PROTOCOL_GET_PROTOCOL 420 ); 421 if (EFI_ERROR (Status)) { 422 return Status; 423 } 424 425 // 426 // Update the component name for this child handle. 427 // 428 Status = UpdateName (Dhcp6); 429 if (EFI_ERROR (Status)) { 430 return Status; 431 } 432 433 return LookupUnicodeString2 ( 434 Language, 435 This->SupportedLanguages, 436 gDhcp6ControllerNameTable, 437 ControllerName, 438 (BOOLEAN)(This == &gDhcp6ComponentName) 439 ); 312 440 } 441 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Dhcp6Dxe/Dhcp6Driver.c
r48674 r58459 3 3 implementationfor for Dhcp6 Driver. 4 4 5 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>5 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 6 6 7 7 This program and the accompanying materials … … 32 32 }; 33 33 34 35 34 /** 36 35 Configure the default Udp6Io to receive all the DHCP6 traffic … … 83 82 84 83 /** 85 Dest ory the Dhcp6 service. The Dhcp6 service may be partly initialized,84 Destroy the Dhcp6 service. The Dhcp6 service may be partly initialized, 86 85 or partly destroyed. If a resource is destroyed, it is marked as such in 87 86 case the destroy failed and being called again later. … … 96 95 { 97 96 // 98 // All children instances should have been already dest oryed here.97 // All children instances should have been already destroyed here. 99 98 // 100 99 ASSERT (Service->NumOfChild == 0); … … 133 132 { 134 133 DHCP6_SERVICE *Dhcp6Srv; 134 EFI_STATUS Status; 135 135 136 136 *Service = NULL; … … 155 155 // 156 156 Dhcp6Srv->Signature = DHCP6_SERVICE_SIGNATURE; 157 Dhcp6Srv->InDestory = FALSE;158 157 Dhcp6Srv->Controller = Controller; 159 158 Dhcp6Srv->Image = ImageHandle; … … 165 164 sizeof (EFI_SERVICE_BINDING_PROTOCOL) 166 165 ); 166 167 // 168 // Locate Ip6->Ip6Config and store it for get IP6 Duplicate Address Detection transmits. 169 // 170 Status = gBS->HandleProtocol ( 171 Controller, 172 &gEfiIp6ConfigProtocolGuid, 173 (VOID **) &Dhcp6Srv->Ip6Cfg 174 ); 175 if (EFI_ERROR (Status)) { 176 FreePool (Dhcp6Srv); 177 return Status; 178 } 167 179 168 180 // … … 281 293 Dhcp6Ins->UdpSts = EFI_ALREADY_STARTED; 282 294 Dhcp6Ins->Service = Service; 283 Dhcp6Ins->InDest ory = FALSE;295 Dhcp6Ins->InDestroy = FALSE; 284 296 Dhcp6Ins->MediaPresent = TRUE; 285 297 … … 313 325 314 326 return EFI_SUCCESS; 327 } 328 329 /** 330 Callback function which provided by user to remove one node in NetDestroyLinkList process. 331 332 @param[in] Entry The entry to be removed. 333 @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList. 334 335 @retval EFI_SUCCESS The entry has been removed successfully. 336 @retval Others Fail to remove the entry. 337 338 **/ 339 EFI_STATUS 340 EFIAPI 341 Dhcp6DestroyChildEntry ( 342 IN LIST_ENTRY *Entry, 343 IN VOID *Context 344 ) 345 { 346 DHCP6_INSTANCE *Instance; 347 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 348 349 if (Entry == NULL || Context == NULL) { 350 return EFI_INVALID_PARAMETER; 351 } 352 353 Instance = NET_LIST_USER_STRUCT_S (Entry, DHCP6_INSTANCE, Link, DHCP6_INSTANCE_SIGNATURE); 354 ServiceBinding = (EFI_SERVICE_BINDING_PROTOCOL *) Context; 355 356 return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle); 315 357 } 316 358 … … 485 527 { 486 528 EFI_STATUS Status; 487 EFI_TPL OldTpl;488 529 EFI_HANDLE NicHandle; 489 530 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 490 531 DHCP6_SERVICE *Service; 491 DHCP6_INSTANCE *Instance; 532 LIST_ENTRY *List; 533 UINTN ListLength; 492 534 493 535 // … … 497 539 498 540 if (NicHandle == NULL) { 499 return EFI_ DEVICE_ERROR;541 return EFI_SUCCESS; 500 542 } 501 543 … … 514 556 515 557 Service = DHCP6_SERVICE_FROM_THIS (ServiceBinding); 516 517 if (Service->InDestory) { 518 return EFI_SUCCESS; 519 } 520 521 OldTpl = gBS->RaiseTPL (TPL_CALLBACK); 522 523 if (NumberOfChildren == 0) { 558 if (!IsListEmpty (&Service->Child)) { 524 559 // 525 // Destory the service itself if no child instance left. 560 // Destroy all the children instances before destory the service. 561 // 562 List = &Service->Child; 563 Status = NetDestroyLinkList ( 564 List, 565 Dhcp6DestroyChildEntry, 566 ServiceBinding, 567 &ListLength 568 ); 569 if (EFI_ERROR (Status) || ListLength != 0) { 570 Status = EFI_DEVICE_ERROR; 571 } 572 } 573 574 if (NumberOfChildren == 0 && !IsListEmpty (&Service->Child)) { 575 Status = EFI_DEVICE_ERROR; 576 } 577 578 if (NumberOfChildren == 0 && IsListEmpty (&Service->Child)) { 526 579 // 527 Service->InDestory = TRUE;528 580 // Destroy the service itself if no child instance left. 581 // 529 582 Status = gBS->UninstallProtocolInterface ( 530 583 NicHandle, … … 532 585 ServiceBinding 533 586 ); 534 535 587 if (EFI_ERROR (Status)) { 536 Service->InDestory = FALSE;537 588 goto ON_EXIT; 538 589 } 539 590 540 591 Dhcp6DestroyService (Service); 541 542 } else { 543 // 544 // Destory all the children instances before destory the service. 545 // 546 while (!IsListEmpty (&Service->Child)) { 547 Instance = NET_LIST_HEAD (&Service->Child, DHCP6_INSTANCE, Link); 548 ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle); 549 } 550 // 551 // Any of child failed to be destroyed. 552 // 553 if (Service->NumOfChild != 0) { 554 Status = EFI_DEVICE_ERROR; 555 } 556 } 557 592 Status = EFI_SUCCESS; 593 } 594 558 595 ON_EXIT: 559 gBS->RestoreTPL (OldTpl);560 596 return Status; 561 597 } … … 734 770 } 735 771 736 if (Instance->InDest ory) {772 if (Instance->InDestroy) { 737 773 return EFI_SUCCESS; 738 774 } … … 740 776 OldTpl = gBS->RaiseTPL (TPL_CALLBACK); 741 777 742 Instance->InDest ory = TRUE;778 Instance->InDestroy = TRUE; 743 779 744 780 Status = gBS->CloseProtocol ( … … 750 786 751 787 if (EFI_ERROR (Status)) { 752 Instance->InDest ory = FALSE;788 Instance->InDestroy = FALSE; 753 789 gBS->RestoreTPL (OldTpl); 754 790 return Status; … … 758 794 // Uninstall the MTFTP6 protocol first to enable a top down destruction. 759 795 // 796 gBS->RestoreTPL (OldTpl); 760 797 Status = gBS->UninstallProtocolInterface ( 761 798 ChildHandle, … … 763 800 Dhcp6 764 801 ); 765 766 if (EFI_ERROR (Status)) { 767 Instance->InDest ory = FALSE;802 OldTpl = gBS->RaiseTPL (TPL_CALLBACK); 803 if (EFI_ERROR (Status)) { 804 Instance->InDestroy = FALSE; 768 805 gBS->RestoreTPL (OldTpl); 769 806 return Status; … … 776 813 Service->NumOfChild--; 777 814 815 gBS->RestoreTPL (OldTpl); 816 778 817 Dhcp6DestroyInstance (Instance); 779 780 gBS->RestoreTPL (OldTpl);781 782 818 return EFI_SUCCESS; 783 819 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Dhcp6Dxe/Dhcp6Driver.h
r48674 r58459 3 3 declaration for Dhcp6 Driver. 4 4 5 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>5 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 6 6 7 7 This program and the accompanying materials … … 22 22 extern EFI_COMPONENT_NAME_PROTOCOL gDhcp6ComponentName; 23 23 extern EFI_COMPONENT_NAME2_PROTOCOL gDhcp6ComponentName2; 24 extern EFI_UNICODE_STRING_TABLE *gDhcp6ControllerNameTable; 24 25 25 26 /** -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
r48674 r58459 1 1 ## @file 2 # Component description file for Dhcp6 module. 2 # Client-side DHCPv6 services. 3 # 4 # This driver produces EFI DHCPv6 Protocol which is used to get IPv6 addresses 5 # and other configuration parameters from DHCPv6 servers. 3 6 # 4 # Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>7 # Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 8 # 6 9 # This program and the accompanying materials … … 22 25 ENTRY_POINT = Dhcp6DriverEntryPoint 23 26 UNLOAD_IMAGE = NetLibDefaultUnload 27 MODULE_UNI_FILE = Dhcp6Dxe.uni 28 24 29 # 25 30 # The following information is for reference only and not required by the build tools. … … 63 68 64 69 [Protocols] 65 gEfiUdp6ServiceBindingProtocolGuid 66 gEfiUdp6ProtocolGuid 67 gEfiDhcp6ServiceBindingProtocolGuid 68 gEfiDhcp6ProtocolGuid 70 gEfiUdp6ServiceBindingProtocolGuid ## TO_START 71 gEfiUdp6ProtocolGuid ## TO_START 72 gEfiDhcp6ServiceBindingProtocolGuid ## BY_START 73 gEfiDhcp6ProtocolGuid ## BY_START 74 gEfiIp6ConfigProtocolGuid ## TO_START 69 75 76 [UserExtensions.TianoCore."ExtraFiles"] 77 Dhcp6DxeExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
r48674 r58459 2 2 This EFI_DHCP6_PROTOCOL interface implementation. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 105 105 106 106 // 107 // Need to clear initial time to make sure that elapsed-time108 // is set to 0 for first Solicit.109 //110 Instance->StartTime = 0;111 112 //113 107 // Send the solicit message to start S.A.R.R process. 114 108 // … … 201 195 202 196 // 203 // The instance has already been stopped.197 // No valid REPLY message received yet, cleanup this instance directly. 204 198 // 205 199 if (Instance->IaCb.Ia->State == Dhcp6Init || … … 207 201 Instance->IaCb.Ia->State == Dhcp6Requesting 208 202 ) { 209 return Status;203 goto ON_EXIT; 210 204 } 211 205 … … 216 210 217 211 Instance->UdpSts = EFI_ALREADY_STARTED; 218 Dhcp6SendReleaseMsg (Instance, Instance->IaCb.Ia); 219 212 Status = Dhcp6SendReleaseMsg (Instance, Instance->IaCb.Ia); 220 213 gBS->RestoreTPL (OldTpl); 214 if (EFI_ERROR (Status)) { 215 goto ON_EXIT; 216 } 221 217 222 218 // … … 230 226 Status = Instance->UdpSts; 231 227 } 232 228 229 ON_EXIT: 233 230 // 234 231 // Clean up the session data for the released Ia. … … 605 602 { 606 603 EFI_STATUS Status; 607 EFI_TPL OldTpl;608 604 DHCP6_INSTANCE *Instance; 609 605 DHCP6_SERVICE *Service; 610 DHCP6_INF_CB *InfCb;611 606 UINTN Index; 607 EFI_EVENT Timer; 608 EFI_STATUS TimerStatus; 609 UINTN GetMappingTimeOut; 612 610 613 611 if (This == NULL || OptionRequest == NULL || Retransmission == NULL || ReplyCallback == NULL) { … … 634 632 Service = Instance->Service; 635 633 636 OldTpl = gBS->RaiseTPL (TPL_CALLBACK); 637 Instance->UdpSts = EFI_ALREADY_STARTED; 638 639 // 640 // Create and initialize the control block for the info-request. 641 // 642 InfCb = AllocateZeroPool (sizeof(DHCP6_INF_CB)); 643 644 if (InfCb == NULL) { 645 gBS->RestoreTPL (OldTpl); 646 return EFI_OUT_OF_RESOURCES; 647 } 648 649 InfCb->ReplyCallback = ReplyCallback; 650 InfCb->CallbackContext = CallbackContext; 651 InfCb->TimeoutEvent = TimeoutEvent; 652 653 InsertTailList (&Instance->InfList, &InfCb->Link); 654 655 // 656 // Send the info-request message to start exchange process. 657 // 658 Status = Dhcp6SendInfoRequestMsg ( 634 Status = Dhcp6StartInfoRequest ( 659 635 Instance, 660 InfCb,661 636 SendClientId, 662 637 OptionRequest, 663 638 OptionCount, 664 639 OptionList, 665 Retransmission 640 Retransmission, 641 TimeoutEvent, 642 ReplyCallback, 643 CallbackContext 666 644 ); 667 645 if (Status == EFI_NO_MAPPING) { 646 // 647 // The link local address is not ready, wait for some time and restart 648 // the DHCP6 information request process. 649 // 650 Status = Dhcp6GetMappingTimeOut(Service->Ip6Cfg, &GetMappingTimeOut); 651 if (EFI_ERROR(Status)) { 652 return Status; 653 } 654 655 Status = gBS->CreateEvent (EVT_TIMER, TPL_CALLBACK, NULL, NULL, &Timer); 656 if (EFI_ERROR (Status)) { 657 return Status; 658 } 659 660 // 661 // Start the timer, wait for link local address DAD to finish. 662 // 663 Status = gBS->SetTimer (Timer, TimerRelative, GetMappingTimeOut); 664 if (EFI_ERROR (Status)) { 665 gBS->CloseEvent (Timer); 666 return Status; 667 } 668 669 do { 670 TimerStatus = gBS->CheckEvent (Timer); 671 if (!EFI_ERROR (TimerStatus)) { 672 Status = Dhcp6StartInfoRequest ( 673 Instance, 674 SendClientId, 675 OptionRequest, 676 OptionCount, 677 OptionList, 678 Retransmission, 679 TimeoutEvent, 680 ReplyCallback, 681 CallbackContext 682 ); 683 } 684 } while (TimerStatus == EFI_NOT_READY); 685 686 gBS->CloseEvent (Timer); 687 } 668 688 if (EFI_ERROR (Status)) { 669 goto ON_ERROR; 670 } 671 672 // 673 // Register receive callback for the stateless exchange process. 674 // 675 Status = UdpIoRecvDatagram( 676 Service->UdpIo, 677 Dhcp6ReceivePacket, 678 Service, 679 0 680 ); 681 682 if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) { 683 goto ON_ERROR; 684 } 685 686 gBS->RestoreTPL (OldTpl); 689 return Status; 690 } 687 691 688 692 // … … 698 702 699 703 return EFI_SUCCESS; 700 701 ON_ERROR:702 703 RemoveEntryList (&InfCb->Link);704 FreePool (InfCb);705 gBS->RestoreTPL (OldTpl);706 707 return Status;708 704 } 709 705 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h
r48674 r58459 2 2 Dhcp6 internal data structure and definition declaration. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 22 22 #include <Protocol/Dhcp6.h> 23 23 #include <Protocol/Udp6.h> 24 #include <Protocol/Ip6Config.h> 24 25 #include <Protocol/ServiceBinding.h> 25 26 #include <Protocol/DriverBinding.h> … … 34 35 #include <Library/BaseLib.h> 35 36 #include <Library/NetLib.h> 37 #include <Library/PrintLib.h> 36 38 37 39 … … 245 247 UINT8 AdPref; 246 248 EFI_IPv6_ADDRESS *Unicast; 247 EFI_STATUSUdpSts;248 BOOLEAN InDest ory;249 volatile EFI_STATUS UdpSts; 250 BOOLEAN InDestroy; 249 251 BOOLEAN MediaPresent; 252 // 253 // StartTime is used to calculate the 'elapsed-time' option. Refer to RFC3315, 254 // the elapsed-time is amount of time since the client began its current DHCP transaction. 255 // 250 256 UINT64 StartTime; 251 257 }; … … 260 266 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding; 261 267 EFI_SIMPLE_NETWORK_PROTOCOL *Snp; 268 EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg; 262 269 EFI_DHCP6_DUID *ClientId; 263 270 UDP_IO *UdpIo; … … 265 272 LIST_ENTRY Child; 266 273 UINTN NumOfChild; 267 BOOLEAN InDestory;268 274 }; 269 275 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
r48674 r58459 2 2 Dhcp6 internal functions implementation. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 53 53 54 54 // 55 // Save tx packet pointer, and it will be dest oryed when reply received.55 // Save tx packet pointer, and it will be destroyed when reply received. 56 56 // 57 57 TxCb->TxPacket = Packet; … … 364 364 } 365 365 366 /** 367 Check whether the TxCb is still a valid control block in the instance's retry list. 368 369 @param[in] Instance The pointer to DHCP6_INSTANCE. 370 @param[in] TxCb The control block for a transmitted message. 371 372 @retval TRUE The control block is in Instance's retry list. 373 @retval FALSE The control block is NOT in Instance's retry list. 374 375 **/ 376 BOOLEAN 377 Dhcp6IsValidTxCb ( 378 IN DHCP6_INSTANCE *Instance, 379 IN DHCP6_TX_CB *TxCb 380 ) 381 { 382 LIST_ENTRY *Entry; 383 384 NET_LIST_FOR_EACH (Entry, &Instance->TxList) { 385 if (TxCb == NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link)) { 386 return TRUE; 387 } 388 } 389 390 return FALSE; 391 } 366 392 367 393 /** … … 594 620 T1 = NTOHL (ReadUnaligned32 ((UINT32 *) (Option + 8))); 595 621 T2 = NTOHL (ReadUnaligned32 ((UINT32 *) (Option + 12))); 622 // 623 // Refer to RFC3155 Chapter 22.4. If a client receives an IA_NA with T1 greater than T2, 624 // and both T1 and T2 are greater than 0, the client discards the IA_NA option and processes 625 // the remainder of the message as though the server had not included the invalid IA_NA option. 626 // 627 if (T1 > T2 && T2 > 0) { 628 return EFI_DEVICE_ERROR; 629 } 596 630 IaInnerOpt = Option + 16; 597 631 IaInnerLen = (UINT16) (NTOHS (ReadUnaligned16 ((UINT16 *) (Option + 2))) - 12); … … 698 732 ); 699 733 if (*Option == NULL) { 700 return EFI_ DEVICE_ERROR;734 return EFI_SUCCESS; 701 735 } 702 736 … … 950 984 Instance->IaCb.Ia, 951 985 Instance->IaCb.T1, 952 Instance->IaCb.T2 986 Instance->IaCb.T2, 987 Packet->Dhcp6.Header.MessageType 953 988 ); 954 989 … … 988 1023 // 989 1024 Instance->IaCb.Ia->State = Dhcp6Selecting; 1025 // 1026 // Clear initial time for current transaction. 1027 // 1028 Instance->StartTime = 0; 990 1029 991 1030 Status = Dhcp6TransmitPacket (Instance, Packet, Elapsed); … … 1134 1173 Instance->IaCb.Ia, 1135 1174 Instance->IaCb.T1, 1136 Instance->IaCb.T2 1175 Instance->IaCb.T2, 1176 Packet->Dhcp6.Header.MessageType 1137 1177 ); 1138 1178 … … 1172 1212 // 1173 1213 Instance->IaCb.Ia->State = Dhcp6Requesting; 1214 // 1215 // Clear initial time for current transaction. 1216 // 1217 Instance->StartTime = 0; 1174 1218 1175 1219 Status = Dhcp6TransmitPacket (Instance, Packet, Elapsed); … … 1283 1327 ); 1284 1328 1285 Cursor = Dhcp6AppendIaOption (Cursor, DecIa, 0, 0 );1329 Cursor = Dhcp6AppendIaOption (Cursor, DecIa, 0, 0, Packet->Dhcp6.Header.MessageType); 1286 1330 1287 1331 // … … 1306 1350 // 1307 1351 Instance->IaCb.Ia->State = Dhcp6Declining; 1352 // 1353 // Clear initial time for current transaction. 1354 // 1355 Instance->StartTime = 0; 1308 1356 1309 1357 Status = Dhcp6TransmitPacket (Instance, Packet, Elapsed); … … 1416 1464 ); 1417 1465 1418 Cursor = Dhcp6AppendIaOption (Cursor, RelIa, 0, 0 );1466 Cursor = Dhcp6AppendIaOption (Cursor, RelIa, 0, 0, Packet->Dhcp6.Header.MessageType); 1419 1467 1420 1468 // … … 1541 1589 Instance->IaCb.Ia, 1542 1590 Instance->IaCb.T1, 1543 Instance->IaCb.T2 1591 Instance->IaCb.T2, 1592 Packet->Dhcp6.Header.MessageType 1544 1593 ); 1545 1594 … … 1613 1662 Instance->IaCb.Ia->State = State; 1614 1663 Instance->IaCb.LeaseTime = (RebindRequest) ? Instance->IaCb.T2 : Instance->IaCb.T1; 1664 // 1665 // Clear initial time for current transaction. 1666 // 1667 Instance->StartTime = 0; 1615 1668 1616 1669 Status = Dhcp6TransmitPacket (Instance, Packet, Elapsed); … … 1627 1680 } 1628 1681 1682 /** 1683 Start the information request process. 1684 1685 @param[in] Instance The pointer to the Dhcp6 instance. 1686 @param[in] SendClientId If TRUE, the client identifier option will be included in 1687 information request message. Otherwise, the client identifier 1688 option will not be included. 1689 @param[in] OptionRequest The pointer to the option request option. 1690 @param[in] OptionCount The number options in the OptionList. 1691 @param[in] OptionList The array pointers to the appended options. 1692 @param[in] Retransmission The pointer to the retransmission control. 1693 @param[in] TimeoutEvent The event of timeout. 1694 @param[in] ReplyCallback The callback function when the reply was received. 1695 @param[in] CallbackContext The pointer to the parameter passed to the callback. 1696 1697 @retval EFI_SUCCESS Start the info-request process successfully. 1698 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. 1699 @retval EFI_NO_MAPPING No source address is available for use. 1700 @retval Others Failed to start the info-request process. 1701 1702 **/ 1703 EFI_STATUS 1704 Dhcp6StartInfoRequest ( 1705 IN DHCP6_INSTANCE *Instance, 1706 IN BOOLEAN SendClientId, 1707 IN EFI_DHCP6_PACKET_OPTION *OptionRequest, 1708 IN UINT32 OptionCount, 1709 IN EFI_DHCP6_PACKET_OPTION *OptionList[] OPTIONAL, 1710 IN EFI_DHCP6_RETRANSMISSION *Retransmission, 1711 IN EFI_EVENT TimeoutEvent OPTIONAL, 1712 IN EFI_DHCP6_INFO_CALLBACK ReplyCallback, 1713 IN VOID *CallbackContext OPTIONAL 1714 ) 1715 { 1716 EFI_STATUS Status; 1717 DHCP6_INF_CB *InfCb; 1718 DHCP6_SERVICE *Service; 1719 EFI_TPL OldTpl; 1720 1721 Service = Instance->Service; 1722 1723 OldTpl = gBS->RaiseTPL (TPL_CALLBACK); 1724 Instance->UdpSts = EFI_ALREADY_STARTED; 1725 // 1726 // Create and initialize the control block for the info-request. 1727 // 1728 InfCb = AllocateZeroPool (sizeof(DHCP6_INF_CB)); 1729 1730 if (InfCb == NULL) { 1731 gBS->RestoreTPL (OldTpl); 1732 return EFI_OUT_OF_RESOURCES; 1733 } 1734 1735 InfCb->ReplyCallback = ReplyCallback; 1736 InfCb->CallbackContext = CallbackContext; 1737 InfCb->TimeoutEvent = TimeoutEvent; 1738 1739 InsertTailList (&Instance->InfList, &InfCb->Link); 1740 1741 // 1742 // Send the info-request message to start exchange process. 1743 // 1744 Status = Dhcp6SendInfoRequestMsg ( 1745 Instance, 1746 InfCb, 1747 SendClientId, 1748 OptionRequest, 1749 OptionCount, 1750 OptionList, 1751 Retransmission 1752 ); 1753 1754 if (EFI_ERROR (Status)) { 1755 goto ON_ERROR; 1756 } 1757 1758 // 1759 // Register receive callback for the stateless exchange process. 1760 // 1761 Status = UdpIoRecvDatagram( 1762 Service->UdpIo, 1763 Dhcp6ReceivePacket, 1764 Service, 1765 0 1766 ); 1767 1768 if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) { 1769 goto ON_ERROR; 1770 } 1771 1772 gBS->RestoreTPL (OldTpl); 1773 return EFI_SUCCESS; 1774 1775 ON_ERROR: 1776 gBS->RestoreTPL (OldTpl); 1777 RemoveEntryList (&InfCb->Link); 1778 FreePool (InfCb); 1779 1780 return Status; 1781 } 1629 1782 1630 1783 /** … … 1745 1898 Packet->Length += (UINT32) (Cursor - Packet->Dhcp6.Option); 1746 1899 ASSERT (Packet->Size > Packet->Length + 8); 1900 1901 // 1902 // Clear initial time for current transaction. 1903 // 1904 Instance->StartTime = 0; 1747 1905 1748 1906 // … … 1842 2000 Instance->IaCb.Ia, 1843 2001 Instance->IaCb.T1, 1844 Instance->IaCb.T2 2002 Instance->IaCb.T2, 2003 Packet->Dhcp6.Header.MessageType 1845 2004 ); 1846 2005 … … 1879 2038 // 1880 2039 Instance->IaCb.Ia->State = Dhcp6Confirming; 2040 // 2041 // Clear initial time for current transaction. 2042 // 2043 Instance->StartTime = 0; 1881 2044 1882 2045 Status = Dhcp6TransmitPacket (Instance, Packet, Elapsed); … … 1921 2084 ASSERT (Packet != NULL); 1922 2085 2086 Status = EFI_SUCCESS; 2087 1923 2088 if (Packet->Dhcp6.Header.MessageType != Dhcp6MsgReply) { 1924 2089 return EFI_DEVICE_ERROR; … … 1957 2122 ); 1958 2123 if (Option == NULL) { 1959 return EFI_ DEVICE_ERROR;2124 return EFI_SUCCESS; 1960 2125 } 1961 2126 } … … 1965 2130 // 1966 2131 Status = Dhcp6CallbackUser (Instance, Dhcp6RcvdReply, &Packet); 1967 1968 if (EFI_ERROR (Status)) {1969 return Status;1970 }1971 1972 //1973 // Dequeue the sent packet from retransmit list since reply received.1974 //1975 Status = Dhcp6DequeueRetry (1976 Instance,1977 Packet->Dhcp6.Header.TransactionId,1978 FALSE1979 );1980 2132 1981 2133 if (EFI_ERROR (Status)) { … … 2016 2168 Instance->StartTime = 0; 2017 2169 2018 return EFI_SUCCESS; 2170 Status = EFI_SUCCESS; 2171 goto ON_EXIT; 2019 2172 } 2020 2173 … … 2033 2186 if (!EFI_ERROR (Status)) { 2034 2187 // 2035 // Reset start time for next exchange.2036 //2037 Instance->StartTime = 0;2038 2039 //2040 2188 // No status code or no error status code means succeed to reply. 2041 2189 // 2042 2190 Status = Dhcp6UpdateIaInfo (Instance, Packet); 2043 2044 if (EFI_ERROR (Status)) { 2045 return Status; 2191 if (!EFI_ERROR (Status)) { 2192 // 2193 // Reset start time for next exchange. 2194 // 2195 Instance->StartTime = 0; 2196 2197 // 2198 // Set bound state and store the reply packet. 2199 // 2200 if (Instance->IaCb.Ia->ReplyPacket != NULL) { 2201 FreePool (Instance->IaCb.Ia->ReplyPacket); 2202 } 2203 2204 Instance->IaCb.Ia->ReplyPacket = AllocateZeroPool (Packet->Size); 2205 2206 if (Instance->IaCb.Ia->ReplyPacket == NULL) { 2207 Status = EFI_OUT_OF_RESOURCES; 2208 goto ON_EXIT; 2209 } 2210 2211 CopyMem (Instance->IaCb.Ia->ReplyPacket, Packet, Packet->Size); 2212 2213 Instance->IaCb.Ia->State = Dhcp6Bound; 2214 2215 // 2216 // For sync, set the success flag out of polling in start/renewrebind. 2217 // 2218 Instance->UdpSts = EFI_SUCCESS; 2219 2220 // 2221 // Maybe this is a new round DHCP process due to some reason, such as NotOnLink 2222 // ReplyMsg for ConfirmMsg should triger new round to acquire new address. In that 2223 // case, clear old address.ValidLifetime and append to new address. Therefore, DHCP 2224 // consumers can be notified to flush old address. 2225 // 2226 Dhcp6AppendCacheIa (Instance); 2227 2228 // 2229 // For async, signal the Ia event to inform Ia infomation update. 2230 // 2231 if (Instance->Config->IaInfoEvent != NULL) { 2232 gBS->SignalEvent (Instance->Config->IaInfoEvent); 2233 } 2234 } else if (Status == EFI_NOT_FOUND) { 2235 // 2236 // Refer to RFC3315 Chapter 18.1.8, for each IA in the original Renew or Rebind message, 2237 // the client sends a Renew or Rebind if the IA is not in the Reply message. 2238 // Return EFI_SUCCESS so we can continue to restart the Renew/Rebind process. 2239 // 2240 return EFI_SUCCESS; 2046 2241 } 2047 2048 // 2049 // Set bound state and store the reply packet. 2050 // 2051 if (Instance->IaCb.Ia->ReplyPacket != NULL) { 2052 FreePool (Instance->IaCb.Ia->ReplyPacket); 2053 } 2054 2055 Instance->IaCb.Ia->ReplyPacket = AllocateZeroPool (Packet->Size); 2056 2057 if (Instance->IaCb.Ia->ReplyPacket == NULL) { 2058 return EFI_OUT_OF_RESOURCES; 2059 } 2060 2061 CopyMem (Instance->IaCb.Ia->ReplyPacket, Packet, Packet->Size); 2062 2063 Instance->IaCb.Ia->State = Dhcp6Bound; 2064 2065 // 2066 // For sync, set the success flag out of polling in start/renewrebind. 2067 // 2068 Instance->UdpSts = EFI_SUCCESS; 2069 2070 // 2071 // Maybe this is a new round DHCP process due to some reason, such as NotOnLink 2072 // ReplyMsg for ConfirmMsg should triger new round to acquire new address. In that 2073 // case, clear old address.ValidLifetime and append to new address. Therefore, DHCP 2074 // consumers can be notified to flush old address. 2075 // 2076 Dhcp6AppendCacheIa (Instance); 2077 2078 // 2079 // For async, signal the Ia event to inform Ia infomation update. 2080 // 2081 if (Instance->Config->IaInfoEvent != NULL) { 2082 gBS->SignalEvent (Instance->Config->IaInfoEvent); 2083 } 2242 2243 goto ON_EXIT; 2244 2084 2245 } else if (Option != NULL) { 2085 2246 // … … 2127 2288 break; 2128 2289 2290 case Dhcp6StsNoBinding: 2291 if (Instance->IaCb.Ia->State == Dhcp6Renewing || Instance->IaCb.Ia->State == Dhcp6Rebinding) { 2292 // 2293 // Refer to RFC3315 Chapter 18.1.8, for each IA in the original Renew or Rebind message, the client 2294 // sends a Request message if the IA contained a Status Code option with the NoBinding status. 2295 // 2296 Status = Dhcp6SendRequestMsg(Instance); 2297 if (EFI_ERROR (Status)) { 2298 return Status; 2299 } 2300 } 2301 break; 2302 2129 2303 default: 2130 2304 // … … 2136 2310 2137 2311 return EFI_SUCCESS; 2312 2313 ON_EXIT: 2314 2315 if (!EFI_ERROR(Status)) { 2316 Status = Dhcp6DequeueRetry ( 2317 Instance, 2318 Packet->Dhcp6.Header.TransactionId, 2319 FALSE 2320 ); 2321 } 2322 2323 return Status; 2138 2324 } 2139 2325 … … 2279 2465 // See the details in the section-17.1.3 of rfc-3315. 2280 2466 // 2281 Option = Dhcp6SeekOption( 2282 Packet->Dhcp6.Option, 2283 Packet->Length - 4, 2284 Dhcp6OptStatusCode 2285 ); 2286 2287 if (Option != NULL) { 2288 StsCode = NTOHS (ReadUnaligned16 ((UINT16 *) (Option + 4))); 2289 if (StsCode != Dhcp6StsSuccess) { 2290 return EFI_DEVICE_ERROR; 2291 } 2467 Status = Dhcp6SeekStsOption ( 2468 Instance, 2469 Packet, 2470 &Option 2471 ); 2472 if (EFI_ERROR (Status)) { 2473 return EFI_DEVICE_ERROR; 2292 2474 } 2293 2475 … … 2411 2593 Status = EFI_SUCCESS; 2412 2594 2413 if (Instance-> InDestory || Instance->Config == NULL) {2595 if (Instance->Config == NULL) { 2414 2596 goto ON_CONTINUE; 2415 2597 } … … 2524 2706 IsMatched = FALSE; 2525 2707 InfCb = NULL; 2526 2527 if (Instance->InDestory) {2528 goto ON_EXIT;2529 }2530 2708 2531 2709 if (Packet->Dhcp6.Header.MessageType != Dhcp6MsgReply) { … … 2830 3008 // 2831 3009 Status = Dhcp6SelectAdvertiseMsg (Instance, Instance->AdSelect); 2832 if (EFI_ERROR (Status)) { 3010 if (Status == EFI_ABORTED) { 3011 goto ON_CLOSE; 3012 } else if (EFI_ERROR (Status)) { 2833 3013 TxCb->RetryCnt++; 2834 3014 } … … 2846 3026 // 2847 3027 if (TxCb->RetryCtl.Mrc != 0 && TxCb->RetryCtl.Mrc < TxCb->RetryCnt) { 3028 Status = EFI_NO_RESPONSE; 2848 3029 goto ON_CLOSE; 2849 3030 } … … 2853 3034 // 2854 3035 if (TxCb->RetryCtl.Mrd != 0 && TxCb->RetryCtl.Mrd <= TxCb->RetryLos) { 3036 Status = EFI_NO_RESPONSE; 2855 3037 goto ON_CLOSE; 2856 3038 } … … 2942 3124 ON_CLOSE: 2943 3125 2944 if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest || 3126 if (Dhcp6IsValidTxCb (Instance, TxCb) && 3127 TxCb->TxPacket != NULL && 3128 (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest || 2945 3129 TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgRenew || 2946 TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm 3130 TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm) 2947 3131 ) { 2948 3132 // … … 2969 3153 // The failure of the others will terminate current state machine if timeout. 2970 3154 // 2971 Dhcp6CleanupSession (Instance, EFI_NO_RESPONSE);3155 Dhcp6CleanupSession (Instance, Status); 2972 3156 } 2973 3157 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Dhcp6Dxe/Dhcp6Io.h
r48674 r58459 2 2 Dhcp6 internal functions declaration. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 128 128 IN DHCP6_INSTANCE *Instance, 129 129 IN EFI_DHCP6_IA *RelIa 130 ); 131 132 /** 133 Start the information request process. 134 135 @param[in] Instance The pointer to the Dhcp6 instance. 136 @param[in] SendClientId If TRUE, the client identifier option will be included in 137 information request message. Otherwise, the client identifier 138 option will not be included. 139 @param[in] OptionRequest The pointer to the option request option. 140 @param[in] OptionCount The number options in the OptionList. 141 @param[in] OptionList The array pointers to the appended options. 142 @param[in] Retransmission The pointer to the retransmission control. 143 @param[in] TimeoutEvent The event of timeout. 144 @param[in] ReplyCallback The callback function when the reply was received. 145 @param[in] CallbackContext The pointer to the parameter passed to the callback. 146 147 @retval EFI_SUCCESS Start the info-request process successfully. 148 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. 149 @retval EFI_NO_MAPPING No source address is available for use. 150 @retval Others Failed to start the info-request process. 151 152 **/ 153 EFI_STATUS 154 Dhcp6StartInfoRequest ( 155 IN DHCP6_INSTANCE *Instance, 156 IN BOOLEAN SendClientId, 157 IN EFI_DHCP6_PACKET_OPTION *OptionRequest, 158 IN UINT32 OptionCount, 159 IN EFI_DHCP6_PACKET_OPTION *OptionList[] OPTIONAL, 160 IN EFI_DHCP6_RETRANSMISSION *Retransmission, 161 IN EFI_EVENT TimeoutEvent OPTIONAL, 162 IN EFI_DHCP6_INFO_CALLBACK ReplyCallback, 163 IN VOID *CallbackContext OPTIONAL 130 164 ); 131 165 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
r48674 r58459 2 2 Dhcp6 support functions implementation. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 42 42 // See details in section-9 of rfc-3315. 43 43 // 44 Duid = GetVariable (L"ClientId", &gEfiDhcp6ServiceBindingProtocolGuid);44 GetVariable2 (L"ClientId", &gEfiDhcp6ServiceBindingProtocolGuid, (VOID**)&Duid, NULL); 45 45 if (Duid != NULL) { 46 46 return Duid; … … 144 144 // Set the Duid-type, hardware-type, time and copy the hardware address. 145 145 // 146 WriteUnaligned16 ((UINT16 *) ( Duid->Duid), HTONS (Dhcp6DuidTypeLlt));147 WriteUnaligned16 ((UINT16 *) ( Duid->Duid+ 2), HTONS (NET_IFTYPE_ETHERNET));148 WriteUnaligned32 ((UINT32 *) ( Duid->Duid+ 4), HTONL (Stamp));149 146 WriteUnaligned16 ((UINT16 *) ((UINT8 *) Duid + OFFSET_OF (EFI_DHCP6_DUID, Duid)), HTONS (Dhcp6DuidTypeLlt)); 147 WriteUnaligned16 ((UINT16 *) ((UINT8 *) Duid + OFFSET_OF (EFI_DHCP6_DUID, Duid) + 2), HTONS (NET_IFTYPE_ETHERNET)); 148 WriteUnaligned32 ((UINT32 *) ((UINT8 *) Duid + OFFSET_OF (EFI_DHCP6_DUID, Duid) + 4), HTONL (Stamp)); 149 150 150 CopyMem (Duid->Duid + 8, &Mode->CurrentAddress, Mode->HwAddressSize); 151 151 } … … 158 158 (VOID *) Duid 159 159 ); 160 ASSERT_EFI_ERROR (Status); 160 if (EFI_ERROR (Status)) { 161 FreePool (Duid); 162 return NULL; 163 } 161 164 162 165 return Duid; … … 384 387 ) 385 388 { 386 EFI_DHCP6_IA_ADDRESS *IaAddr;387 389 UINT32 MinLt; 388 390 UINT32 MaxLt; … … 399 401 // 400 402 for (Index = 0; Index < IaCb->Ia->IaAddressCount; Index++) { 401 IaAddr = IaCb->Ia->IaAddress + Index * sizeof (EFI_DHCP6_IA_ADDRESS); 402 MinLt = MIN (MinLt, IaAddr->ValidLifetime); 403 MaxLt = MAX (MinLt, IaAddr->ValidLifetime); 403 MinLt = MIN (MinLt, IaCb->Ia->IaAddress[Index].ValidLifetime); 404 MaxLt = MAX (MinLt, IaCb->Ia->IaAddress[Index].ValidLifetime); 404 405 } 405 406 … … 648 649 } 649 650 651 /** 652 Append the appointed IA Address option to Buf, and move Buf to the end. 653 654 @param[in, out] Buf The pointer to the position to append. 655 @param[in] IaAddr The pointer to the IA Address. 656 @param[in] MessageType Message type of DHCP6 package. 657 658 @return Buf The position to append the next option. 659 660 **/ 661 UINT8 * 662 Dhcp6AppendIaAddrOption ( 663 IN OUT UINT8 *Buf, 664 IN EFI_DHCP6_IA_ADDRESS *IaAddr, 665 IN UINT32 MessageType 666 ) 667 { 668 669 // The format of the IA Address option is: 670 // 671 // 0 1 2 3 672 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 673 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 674 // | OPTION_IAADDR | option-len | 675 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 676 // | | 677 // | IPv6 address | 678 // | | 679 // | | 680 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 681 // | preferred-lifetime | 682 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 683 // | valid-lifetime | 684 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 685 // . . 686 // . IAaddr-options . 687 // . . 688 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 689 690 // 691 // Fill the value of Ia Address option type 692 // 693 WriteUnaligned16 ((UINT16 *) Buf, HTONS (Dhcp6OptIaAddr)); 694 Buf += 2; 695 696 WriteUnaligned16 ((UINT16 *) Buf, HTONS (sizeof (EFI_DHCP6_IA_ADDRESS))); 697 Buf += 2; 698 699 CopyMem (Buf, &IaAddr->IpAddress, sizeof(EFI_IPv6_ADDRESS)); 700 Buf += sizeof(EFI_IPv6_ADDRESS); 701 702 // 703 // Fill the value of preferred-lifetime and valid-lifetime. 704 // According to RFC3315 Chapter 18.1.2, the preferred-lifetime and valid-lifetime fields 705 // should set to 0 when initiate a Confirm message. 706 // 707 if (MessageType != Dhcp6MsgConfirm) { 708 WriteUnaligned32 ((UINT32 *) Buf, HTONL (IaAddr->PreferredLifetime)); 709 } 710 Buf += 4; 711 712 if (MessageType != Dhcp6MsgConfirm) { 713 WriteUnaligned32 ((UINT32 *) Buf, HTONL (IaAddr->ValidLifetime)); 714 } 715 Buf += 4; 716 717 return Buf; 718 } 719 650 720 651 721 /** … … 656 726 @param[in] T1 The time of T1. 657 727 @param[in] T2 The time of T2. 728 @param[in] MessageType Message type of DHCP6 package. 658 729 659 730 @return Buf The position to append the next Ia option. … … 665 736 IN EFI_DHCP6_IA *Ia, 666 737 IN UINT32 T1, 667 IN UINT32 T2 738 IN UINT32 T2, 739 IN UINT32 MessageType 668 740 ) 669 741 { … … 671 743 UINT16 *Len; 672 744 UINTN Index; 673 UINT16 Length;674 745 675 746 // … … 714 785 // 715 786 if (Ia->Descriptor.Type == Dhcp6OptIana) { 716 WriteUnaligned32 ((UINT32 *) Buf, ((T1 != 0) ? T1 : 0xffffffff));787 WriteUnaligned32 ((UINT32 *) Buf, HTONL ((T1 != 0) ? T1 : 0xffffffff)); 717 788 Buf += 4; 718 WriteUnaligned32 ((UINT32 *) Buf, ((T2 != 0) ? T2 : 0xffffffff));789 WriteUnaligned32 ((UINT32 *) Buf, HTONL ((T2 != 0) ? T2 : 0xffffffff)); 719 790 Buf += 4; 720 791 } … … 724 795 // 725 796 for (Index = 0; Index < Ia->IaAddressCount; Index++) { 726 727 AddrOpt = (UINT8 *) Ia->IaAddress + Index * sizeof (EFI_DHCP6_IA_ADDRESS); 728 Length = HTONS ((UINT16) sizeof (EFI_DHCP6_IA_ADDRESS)); 729 Buf = Dhcp6AppendOption ( 730 Buf, 731 HTONS (Dhcp6OptIaAddr), 732 Length, 733 AddrOpt 734 ); 797 AddrOpt = (UINT8 *) Ia->IaAddress + Index * sizeof (EFI_DHCP6_IA_ADDRESS); 798 Buf = Dhcp6AppendIaAddrOption (Buf, (EFI_DHCP6_IA_ADDRESS *) AddrOpt, MessageType); 735 799 } 736 800 … … 828 892 // 829 893 // Sentinel value of 0 means that this is the first DHCP packet that we are 830 // sending and that we need to initialize the value. First DHCP Solicit894 // sending and that we need to initialize the value. First DHCP message 831 895 // gets 0 elapsed-time. Otherwise, calculate based on StartTime. 832 896 // … … 935 999 } 936 1000 1001 /** 1002 Check whether the incoming IPv6 address in IaAddr is one of the maintained 1003 addresses in the IA control blcok. 1004 1005 @param[in] IaAddr The pointer to the IA Address to be checked. 1006 @param[in] CurrentIa The pointer to the IA in IA control block. 1007 1008 @retval TRUE Yes, this Address is already in IA control block. 1009 @retval FALSE No, this Address is NOT in IA control block. 1010 1011 **/ 1012 BOOLEAN 1013 Dhcp6AddrIsInCurrentIa ( 1014 IN EFI_DHCP6_IA_ADDRESS *IaAddr, 1015 IN EFI_DHCP6_IA *CurrentIa 1016 ) 1017 { 1018 UINT32 Index; 1019 1020 ASSERT (IaAddr != NULL && CurrentIa != NULL); 1021 1022 for (Index = 0; Index < CurrentIa->IaAddressCount; Index++) { 1023 if (EFI_IP6_EQUAL(&IaAddr->IpAddress, &CurrentIa->IaAddress[Index].IpAddress)) { 1024 return TRUE; 1025 } 1026 } 1027 return FALSE; 1028 } 937 1029 938 1030 /** 939 1031 Parse the address option and update the address infomation. 940 1032 1033 @param[in] CurrentIa The pointer to the Ia Address in control blcok. 941 1034 @param[in] IaInnerOpt The pointer to the buffer. 942 1035 @param[in] IaInnerLen The length to parse. … … 947 1040 VOID 948 1041 Dhcp6ParseAddrOption ( 1042 IN EFI_DHCP6_IA *CurrentIa, 949 1043 IN UINT8 *IaInnerOpt, 950 1044 IN UINT16 IaInnerLen, … … 957 1051 UINT16 OpCode; 958 1052 UINT32 ValidLt; 1053 UINT32 PreferredLt; 1054 EFI_DHCP6_IA_ADDRESS *IaAddr; 959 1055 960 1056 // … … 993 1089 while (Cursor < IaInnerOpt + IaInnerLen) { 994 1090 // 995 // Count the Ia address option with non-0 valid time. 1091 // Refer to RFC3315 Chapter 18.1.8, we need to update lifetimes for any addresses in the IA option 1092 // that the client already has recorded in the IA, and discard the Ia address option with 0 valid time. 996 1093 // 997 1094 OpCode = ReadUnaligned16 ((UINT16 *) Cursor); 998 ValidLt = ReadUnaligned32 ((UINT32 *) (Cursor + 24)); 999 if (OpCode == HTONS (Dhcp6OptIaAddr) && ValidLt != 0) { 1000 1095 PreferredLt = NTOHL (ReadUnaligned32 ((UINT32 *) (Cursor + 20))); 1096 ValidLt = NTOHL (ReadUnaligned32 ((UINT32 *) (Cursor + 24))); 1097 IaAddr = (EFI_DHCP6_IA_ADDRESS *) (Cursor + 4); 1098 if (OpCode == HTONS (Dhcp6OptIaAddr) && ValidLt >= PreferredLt && 1099 (Dhcp6AddrIsInCurrentIa(IaAddr, CurrentIa) || ValidLt !=0)) { 1001 1100 if (AddrBuf != NULL) { 1002 CopyMem (AddrBuf, Cursor + 4, sizeof (EFI_DHCP6_IA_ADDRESS));1003 AddrBuf->PreferredLifetime = NTOHL (AddrBuf->PreferredLifetime);1004 AddrBuf->ValidLifetime = NTOHL (AddrBuf->ValidLifetime);1101 CopyMem (AddrBuf, IaAddr, sizeof (EFI_DHCP6_IA_ADDRESS)); 1102 AddrBuf->PreferredLifetime = PreferredLt; 1103 AddrBuf->ValidLifetime = ValidLt; 1005 1104 AddrBuf = (EFI_DHCP6_IA_ADDRESS *) ((UINT8 *) AddrBuf + sizeof (EFI_DHCP6_IA_ADDRESS)); 1006 1105 } 1007 1008 1106 (*AddrNum)++; 1009 1107 } … … 1026 1124 @retval EFI_SUCCESS Create an IA control block successfully. 1027 1125 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. 1126 @retval EFI_DEVICE_ERROR An unexpected error. 1028 1127 1029 1128 **/ … … 1042 1141 1043 1142 if (Instance->IaCb.Ia == NULL) { 1044 return EFI_ NOT_FOUND;1143 return EFI_DEVICE_ERROR; 1045 1144 } 1046 1145 … … 1049 1148 // the value 0 of valid lifetime. 1050 1149 // 1051 Dhcp6ParseAddrOption (I aInnerOpt, IaInnerLen, &AddrNum, NULL);1150 Dhcp6ParseAddrOption (Instance->IaCb.Ia, IaInnerOpt, IaInnerLen, &AddrNum, NULL); 1052 1151 1053 1152 if (AddrNum == 0) { … … 1071 1170 Ia->IaAddressCount = AddrNum; 1072 1171 CopyMem (&Ia->Descriptor, &Instance->Config->IaDescriptor, sizeof (EFI_DHCP6_IA_DESCRIPTOR)); 1073 Dhcp6ParseAddrOption (I aInnerOpt, IaInnerLen, &AddrNum, Ia->IaAddress);1172 Dhcp6ParseAddrOption (Instance->IaCb.Ia, IaInnerOpt, IaInnerLen, &AddrNum, Ia->IaAddress); 1074 1173 1075 1174 // … … 1190 1289 } 1191 1290 } 1291 1292 /** 1293 Calculate the Dhcp6 get mapping timeout by adding additinal delay to the IP6 DAD transmits count. 1294 1295 @param[in] Ip6Cfg The pointer to Ip6 config protocol. 1296 @param[out] TimeOut The time out value in 100ns units. 1297 1298 @retval EFI_INVALID_PARAMETER Input parameters are invalid. 1299 @retval EFI_SUCCESS Calculate the time out value successfully. 1300 **/ 1301 EFI_STATUS 1302 Dhcp6GetMappingTimeOut ( 1303 IN EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg, 1304 OUT UINTN *TimeOut 1305 ) 1306 { 1307 EFI_STATUS Status; 1308 UINTN DataSize; 1309 EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadXmits; 1310 1311 if (Ip6Cfg == NULL || TimeOut == NULL) { 1312 return EFI_INVALID_PARAMETER; 1313 } 1314 1315 DataSize = sizeof (EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS); 1316 Status = Ip6Cfg->GetData ( 1317 Ip6Cfg, 1318 Ip6ConfigDataTypeDupAddrDetectTransmits, 1319 &DataSize, 1320 &DadXmits 1321 ); 1322 if (EFI_ERROR (Status)) { 1323 return Status; 1324 } 1325 1326 *TimeOut = TICKS_PER_SECOND * DadXmits.DupAddrDetectTransmits + DHCP6_DAD_ADDITIONAL_DELAY; 1327 1328 return EFI_SUCCESS; 1329 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h
r48674 r58459 2 2 Dhcp6 support functions declaration. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 18 18 19 19 20 #define DHCP6_10_BIT_MASK 0x3ff 20 #define DHCP6_10_BIT_MASK 0x3ff 21 #define DHCP6_DAD_ADDITIONAL_DELAY 30000000 // 3 seconds 21 22 22 23 /** … … 192 193 @param[in] T1 The time of T1. 193 194 @param[in] T2 The time of T2. 195 @param[in] MessageType Message type of DHCP6 package. 194 196 195 197 @return Buf The position to append the next Ia option. … … 201 203 IN EFI_DHCP6_IA *Ia, 202 204 IN UINT32 T1, 203 IN UINT32 T2 205 IN UINT32 T2, 206 IN UINT32 MessageType 204 207 ); 205 208 … … 274 277 Parse the address option and update the address info. 275 278 279 @param[in] CurrentIa The pointer to the Ia Address in control blcok. 276 280 @param[in] IaInnerOpt The pointer to the buffer. 277 281 @param[in] IaInnerLen The length to parse. … … 282 286 VOID 283 287 Dhcp6ParseAddrOption ( 288 IN EFI_DHCP6_IA *CurrentIa, 284 289 IN UINT8 *IaInnerOpt, 285 290 IN UINT16 IaInnerLen, … … 300 305 @retval EFI_SUCCESS Create an IA control block successfully. 301 306 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. 307 @retval EFI_DEVICE_ERROR An unexpected error. 302 308 303 309 **/ … … 338 344 ); 339 345 346 /** 347 Calculate the Dhcp6 get mapping timeout by adding additinal delay to the IP6 DAD transmits count. 348 349 @param[in] Ip6Cfg The pointer to Ip6 config protocol. 350 @param[out] TimeOut The time out value in 100ns units. 351 352 @retval EFI_INVALID_PARAMETER Input parameters are invalid. 353 @retval EFI_SUCCESS Calculate the time out value successfully. 354 **/ 355 EFI_STATUS 356 Dhcp6GetMappingTimeOut ( 357 IN EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg, 358 OUT UINTN *TimeOut 359 ); 340 360 #endif -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/ComponentName.c
r48674 r58459 2 2 UEFI Component Name(2) protocol implementation for iSCSI. 3 3 4 Copyright (c) 2004 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 43 43 } 44 44 }; 45 46 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gIScsiControllerNameTable = NULL; 45 47 46 48 /** … … 101 103 102 104 /** 105 Update the component name for the iSCSI instance. 106 107 @param[in] IScsiExtScsiPassThru A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance. 108 @param[in] Ipv6Flag TRUE if IP6 network stack is used. 109 110 @retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully. 111 @retval EFI_INVALID_PARAMETER The input parameter is invalid. 112 @retval EFI_UNSUPPORTED Can't get the corresponding NIC info from the Controller handle. 113 114 **/ 115 EFI_STATUS 116 UpdateName ( 117 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *IScsiExtScsiPassThru, 118 IN BOOLEAN Ipv6Flag 119 ) 120 { 121 EFI_STATUS Status; 122 CHAR16 HandleName[80]; 123 ISCSI_DRIVER_DATA *Private; 124 UINT8 NicIndex; 125 126 if (IScsiExtScsiPassThru == NULL) { 127 return EFI_INVALID_PARAMETER; 128 } 129 130 Private = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (IScsiExtScsiPassThru); 131 NicIndex = Private->Session->ConfigData->NicIndex; 132 133 UnicodeSPrint ( 134 HandleName, 135 sizeof (HandleName), 136 L"iSCSI (%s, NicIndex=%d)", 137 Ipv6Flag ? L"IPv6" : L"IPv4", 138 NicIndex 139 ); 140 141 if (gIScsiControllerNameTable != NULL) { 142 FreeUnicodeStringTable (gIScsiControllerNameTable); 143 gIScsiControllerNameTable = NULL; 144 } 145 146 Status = AddUnicodeString2 ( 147 "eng", 148 gIScsiComponentName.SupportedLanguages, 149 &gIScsiControllerNameTable, 150 HandleName, 151 TRUE 152 ); 153 if (EFI_ERROR (Status)) { 154 return Status; 155 } 156 157 return AddUnicodeString2 ( 158 "en", 159 gIScsiComponentName2.SupportedLanguages, 160 &gIScsiControllerNameTable, 161 HandleName, 162 FALSE 163 ); 164 } 165 166 /** 103 167 Retrieves a Unicode string that is the user readable name of the controller 104 168 that is being managed by a driver. … … 178 242 ) 179 243 { 180 return EFI_UNSUPPORTED; 244 EFI_STATUS Status; 245 246 EFI_HANDLE IScsiController; 247 BOOLEAN Ipv6Flag; 248 EFI_GUID *IScsiPrivateGuid; 249 ISCSI_PRIVATE_PROTOCOL *IScsiIdentifier; 250 251 EFI_EXT_SCSI_PASS_THRU_PROTOCOL *IScsiExtScsiPassThru; 252 253 if (ControllerHandle == NULL) { 254 return EFI_UNSUPPORTED; 255 } 256 257 // 258 // Get the handle of the controller we are controling. 259 // 260 IScsiController = NetLibGetNicHandle (ControllerHandle, &gEfiTcp4ProtocolGuid); 261 if (IScsiController != NULL) { 262 IScsiPrivateGuid = &gIScsiV4PrivateGuid; 263 Ipv6Flag = FALSE; 264 } else { 265 IScsiController = NetLibGetNicHandle (ControllerHandle, &gEfiTcp6ProtocolGuid); 266 if (IScsiController != NULL) { 267 IScsiPrivateGuid = &gIScsiV6PrivateGuid; 268 Ipv6Flag = TRUE; 269 } else { 270 return EFI_UNSUPPORTED; 271 } 272 } 273 274 Status = gBS->OpenProtocol ( 275 IScsiController, 276 IScsiPrivateGuid, 277 (VOID **) &IScsiIdentifier, 278 NULL, 279 NULL, 280 EFI_OPEN_PROTOCOL_GET_PROTOCOL 281 ); 282 if (EFI_ERROR (Status)) { 283 return Status; 284 } 285 286 if(ChildHandle != NULL) { 287 if(!Ipv6Flag) { 288 // 289 // Make sure this driver produced ChildHandle 290 // 291 Status = EfiTestChildHandle ( 292 ControllerHandle, 293 ChildHandle, 294 &gEfiTcp4ProtocolGuid 295 ); 296 if (EFI_ERROR (Status)) { 297 return Status; 298 } 299 } else { 300 // 301 // Make sure this driver produced ChildHandle 302 // 303 Status = EfiTestChildHandle ( 304 ControllerHandle, 305 ChildHandle, 306 &gEfiTcp6ProtocolGuid 307 ); 308 if (EFI_ERROR (Status)) { 309 return Status; 310 } 311 } 312 313 // 314 // Retrieve an instance of a produced protocol from ChildHandle 315 // 316 Status = gBS->OpenProtocol ( 317 ChildHandle, 318 &gEfiExtScsiPassThruProtocolGuid, 319 (VOID **)&IScsiExtScsiPassThru, 320 NULL, 321 NULL, 322 EFI_OPEN_PROTOCOL_GET_PROTOCOL 323 ); 324 if (EFI_ERROR (Status)) { 325 return Status; 326 } 327 328 // 329 // Update the component name for this child handle. 330 // 331 Status = UpdateName (IScsiExtScsiPassThru, Ipv6Flag); 332 if (EFI_ERROR (Status)) { 333 return Status; 334 } 335 } 336 337 return LookupUnicodeString2 ( 338 Language, 339 This->SupportedLanguages, 340 gIScsiControllerNameTable, 341 ControllerName, 342 (BOOLEAN)(This == &gIScsiComponentName) 343 ); 181 344 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiConfig.c
r48674 r58459 2 2 Helper functions for configuring or getting the parameters relating to iSCSI. 3 3 4 Copyright (c) 2004 - 201 2, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 785 785 L"AttemptOrder", 786 786 &gIScsiConfigGuid, 787 EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_ RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,787 EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, 788 788 AttemptConfigOrderSize, 789 789 AttemptConfigOrder … … 1247 1247 } 1248 1248 1249 Attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS 1250 | EFI_VARIABLE_NON_VOLATILE; 1249 Attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE; 1251 1250 1252 1251 // … … 1559 1558 L"AttemptOrder", 1560 1559 &gIScsiConfigGuid, 1561 EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_ RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,1560 EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, 1562 1561 AttemptConfigOrderSize, 1563 1562 AttemptConfigOrderTmp -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiConfigNVDataStruc.h
r48674 r58459 2 2 Define NVData structures used by the iSCSI configuration component. 3 3 4 Copyright (c) 2004 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 69 69 #define LUN_MAX_SIZE 20 70 70 71 #define ISCSI_CHAP_UNI 172 #define ISCSI_CHAP_MUTUAL 271 #define ISCSI_CHAP_UNI 0 72 #define ISCSI_CHAP_MUTUAL 1 73 73 74 74 #define TARGET_PORT_MIN_NUM 0 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiConfigVfr.vfr
r48674 r58459 89 89 help = STRING_TOKEN (STR_SAVE_AND_EXIT), 90 90 text = STRING_TOKEN (STR_SAVE_AND_EXIT), 91 text = STRING_TOKEN (STR_SAVE_AND_EXIT),92 91 flags = INTERACTIVE, 93 92 key = KEY_SAVE_ORDER_CHANGES; … … 96 95 help = STRING_TOKEN (STR_NO_SAVE_AND_EXIT), 97 96 text = STRING_TOKEN (STR_NO_SAVE_AND_EXIT), 98 text = STRING_TOKEN (STR_NO_SAVE_AND_EXIT),99 97 flags = INTERACTIVE, 100 98 key = KEY_IGNORE_ORDER_CHANGES; … … 110 108 help = STRING_TOKEN (STR_SAVE_AND_EXIT), 111 109 text = STRING_TOKEN (STR_SAVE_AND_EXIT), 112 text = STRING_TOKEN (STR_SAVE_AND_EXIT),113 110 flags = INTERACTIVE, 114 111 key = KEY_SAVE_DELETE_ATTEMPT; … … 117 114 help = STRING_TOKEN (STR_NO_SAVE_AND_EXIT), 118 115 text = STRING_TOKEN (STR_NO_SAVE_AND_EXIT), 119 text = STRING_TOKEN (STR_NO_SAVE_AND_EXIT),120 116 flags = INTERACTIVE, 121 117 key = KEY_IGNORE_DELETE_ATTEMPT; … … 354 350 help = STRING_TOKEN (STR_SAVE_CHANGES_HELP), 355 351 text = STRING_TOKEN (STR_SAVE_CHANGES), 356 text = STRING_TOKEN (STR_SAVE_CHANGES),357 352 flags = INTERACTIVE, 358 353 key = KEY_SAVE_ATTEMPT_CONFIG; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiDhcp6.c
r48674 r58459 2 2 iSCSI DHCP6 related configuration routines. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 251 251 EFI_DHCP6_PACKET_OPTION **OptionList; 252 252 ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData; 253 UINT16 ParaLen; 253 254 254 255 OptionCount = 0; … … 283 284 284 285 if (((OptionList[Index]->OpLen & 0xf) != 0) || (OptionList[Index]->OpLen == 0)) { 285 Status = EFI_ INVALID_PARAMETER;286 Status = EFI_UNSUPPORTED; 286 287 goto Exit; 287 288 } … … 303 304 // 304 305 BootFileOpt = OptionList[Index]; 306 } else if (OptionList[Index]->OpCode == DHCP6_OPT_BOOT_FILE_PARA) { 307 // 308 // The server sends this option to inform the client about DHCP6 server address. 309 // 310 if (OptionList[Index]->OpLen < 18) { 311 Status = EFI_UNSUPPORTED; 312 goto Exit; 313 } 314 // 315 // Check param-len 1, should be 16 bytes. 316 // 317 CopyMem (&ParaLen, &OptionList[Index]->Data[0], sizeof (UINT16)); 318 if (NTOHS (ParaLen) != 16) { 319 Status = EFI_UNSUPPORTED; 320 goto Exit; 321 } 322 323 CopyMem (&ConfigData->DhcpServer, &OptionList[Index]->Data[2], sizeof (EFI_IPv6_ADDRESS)); 305 324 } 306 325 } … … 406 425 } 407 426 408 Oro = AllocateZeroPool (sizeof (EFI_DHCP6_PACKET_OPTION) + 3);427 Oro = AllocateZeroPool (sizeof (EFI_DHCP6_PACKET_OPTION) + 5); 409 428 if (Oro == NULL) { 410 429 Status = EFI_OUT_OF_RESOURCES; … … 417 436 // 418 437 Oro->OpCode = HTONS (DHCP6_OPT_REQUEST_OPTION); 419 Oro->OpLen = HTONS (2 * 2);438 Oro->OpLen = HTONS (2 * 3); 420 439 Oro->Data[1] = DHCP6_OPT_DNS_SERVERS; 421 440 Oro->Data[3] = DHCP6_OPT_BOOT_FILE_URL; 441 Oro->Data[5] = DHCP6_OPT_BOOT_FILE_PARA; 422 442 423 443 InfoReqReXmit.Irt = 4; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiDhcp6.h
r48674 r58459 2 2 The header file of iSCSI DHCP6 related configuration routines. 3 3 4 Copyright (c) 2004 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 23 23 /// 24 24 #define DHCP6_OPT_BOOT_FILE_URL 59 25 #define DHCP6_OPT_BOOT_FILE_PARA 60 25 26 26 27 #define ISCSI_ROOT_PATH_ID "iscsi:" -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiDriver.c
r48674 r58459 2 2 The entry point of IScsi driver. 3 3 4 Copyright (c) 2004 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 15 15 #include "IScsiImpl.h" 16 16 17 EFI_DRIVER_BINDING_PROTOCOL gIScsi DriverBinding = {18 IScsi DriverBindingSupported,19 IScsi DriverBindingStart,20 IScsi DriverBindingStop,17 EFI_DRIVER_BINDING_PROTOCOL gIScsiIp4DriverBinding = { 18 IScsiIp4DriverBindingSupported, 19 IScsiIp4DriverBindingStart, 20 IScsiIp4DriverBindingStop, 21 21 0xa, 22 22 NULL, … … 24 24 }; 25 25 26 EFI_GUID mIScsiV4PrivateGuid = ISCSI_V4_PRIVATE_GUID; 27 EFI_GUID mIScsiV6PrivateGuid = ISCSI_V6_PRIVATE_GUID; 26 EFI_DRIVER_BINDING_PROTOCOL gIScsiIp6DriverBinding = { 27 IScsiIp6DriverBindingSupported, 28 IScsiIp6DriverBindingStart, 29 IScsiIp6DriverBindingStop, 30 0xa, 31 NULL, 32 NULL 33 }; 34 35 EFI_GUID gIScsiV4PrivateGuid = ISCSI_V4_PRIVATE_GUID; 36 EFI_GUID gIScsiV6PrivateGuid = ISCSI_V6_PRIVATE_GUID; 28 37 ISCSI_PRIVATE_DATA *mPrivate = NULL; 29 38 30 39 /** 31 Tests to see if this driver supports the RemainingDevicePath. 40 Tests to see if this driver supports the RemainingDevicePath. 32 41 33 42 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This … … 68 77 69 78 /** 70 Tests to see if this driver supports a given controller. If a child device is provided, 71 it further tests to see if this driver supports creating a handle for the specified child device. 72 73 This function checks to see if the driver specified by This supports the device specified by 74 ControllerHandle. Drivers typically use the device path attached to 75 ControllerHandle and/or the services from the bus I/O abstraction attached to 76 ControllerHandle to determine if the driver supports ControllerHandle. This function 77 may be called many times during platform initialization. In order to reduce boot times, the tests 78 performed by this function must be very small and take as little time as possible to execute. This 79 function must not change the state of any hardware devices, and this function must be aware that the 80 device specified by ControllerHandle may already be managed by the same driver or a 81 different driver. This function must match its calls to AllocatePages() with FreePages(), 82 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). 83 Since ControllerHandle may have been previously started by the same driver, if a protocol is 84 already in the opened state, then it must not be closed with CloseProtocol(). This is required 85 to guarantee the state of ControllerHandle is not modified by this function. 79 Tests to see if this driver supports a given controller. This is the worker function for 80 IScsiIp4(6)DriverBindingSupported. 86 81 87 82 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. … … 96 91 by RemainingDevicePath are both supported by this 97 92 bus driver. 93 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. 98 94 99 95 @retval EFI_SUCCESS The device specified by ControllerHandle and … … 102 98 RemainingDevicePath is already being managed by the driver 103 99 specified by This. 104 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and105 RemainingDevicePath is already being managed by a different106 driver or an application that requires exclusive access.107 Currently not implemented.108 100 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and 109 101 RemainingDevicePath is not supported by the driver specified by This. … … 111 103 EFI_STATUS 112 104 EFIAPI 113 IScsi DriverBindingSupported (105 IScsiSupported ( 114 106 IN EFI_DRIVER_BINDING_PROTOCOL *This, 115 107 IN EFI_HANDLE ControllerHandle, 116 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 108 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL, 109 IN UINT8 IpVersion 117 110 ) 118 111 { 119 112 EFI_STATUS Status; 120 BOOLEAN IsIscsi4Started; 113 EFI_GUID *IScsiServiceBindingGuid; 114 EFI_GUID *TcpServiceBindingGuid; 115 EFI_GUID *DhcpServiceBindingGuid; 116 117 if (IpVersion == IP_VERSION_4) { 118 IScsiServiceBindingGuid = &gIScsiV4PrivateGuid; 119 TcpServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid; 120 DhcpServiceBindingGuid = &gEfiDhcp4ServiceBindingProtocolGuid; 121 } else { 122 IScsiServiceBindingGuid = &gIScsiV6PrivateGuid; 123 TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid; 124 DhcpServiceBindingGuid = &gEfiDhcp6ServiceBindingProtocolGuid; 125 } 121 126 122 127 Status = gBS->OpenProtocol ( 123 128 ControllerHandle, 124 &mIScsiV4PrivateGuid,129 IScsiServiceBindingGuid, 125 130 NULL, 126 131 This->DriverBindingHandle, … … 129 134 ); 130 135 if (!EFI_ERROR (Status)) { 131 IsIscsi4Started = TRUE; 132 } else { 136 return EFI_ALREADY_STARTED; 137 } 138 139 Status = gBS->OpenProtocol ( 140 ControllerHandle, 141 TcpServiceBindingGuid, 142 NULL, 143 This->DriverBindingHandle, 144 ControllerHandle, 145 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 146 ); 147 if (EFI_ERROR (Status)) { 148 return EFI_UNSUPPORTED; 149 } 150 151 Status = IScsiIsDevicePathSupported (RemainingDevicePath); 152 if (EFI_ERROR (Status)) { 153 return EFI_UNSUPPORTED; 154 } 155 156 if (IScsiDhcpIsConfigured (ControllerHandle, IpVersion)) { 133 157 Status = gBS->OpenProtocol ( 134 158 ControllerHandle, 135 &gEfiTcp4ServiceBindingProtocolGuid,159 DhcpServiceBindingGuid, 136 160 NULL, 137 161 This->DriverBindingHandle, … … 139 163 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 140 164 ); 141 if (!EFI_ERROR (Status)) { 142 Status = IScsiIsDevicePathSupported (RemainingDevicePath); 143 if (!EFI_ERROR (Status)) { 144 return EFI_SUCCESS; 145 } 146 } 147 148 IsIscsi4Started = FALSE; 149 } 150 151 Status = gBS->OpenProtocol ( 152 ControllerHandle, 153 &mIScsiV6PrivateGuid, 154 NULL, 155 This->DriverBindingHandle, 156 ControllerHandle, 157 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 158 ); 159 if (!EFI_ERROR (Status)) { 160 if (IsIscsi4Started) { 161 return EFI_ALREADY_STARTED; 162 } 163 } else { 164 Status = gBS->OpenProtocol ( 165 ControllerHandle, 166 &gEfiTcp6ServiceBindingProtocolGuid, 167 NULL, 168 This->DriverBindingHandle, 169 ControllerHandle, 170 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 171 ); 172 if (!EFI_ERROR (Status)) { 173 Status = IScsiIsDevicePathSupported (RemainingDevicePath); 174 if (!EFI_ERROR (Status)) { 175 return EFI_SUCCESS; 176 } 177 } 178 } 179 180 return EFI_UNSUPPORTED; 165 if (EFI_ERROR (Status)) { 166 return EFI_UNSUPPORTED; 167 } 168 } 169 170 return EFI_SUCCESS; 181 171 } 182 172 … … 184 174 /** 185 175 Start to manage the controller. This is the worker function for 186 IScsi DriverBindingStart.176 IScsiIp4(6)DriverBindingStart. 187 177 188 178 @param[in] Image Handle of the image. 189 179 @param[in] ControllerHandle Handle of the controller. 190 @param[in] IpVersion I p4 or Ip6191 192 @retval EFI_SUCCES This driver supports this device.180 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. 181 182 @retval EFI_SUCCES This driver was started. 193 183 @retval EFI_ALREADY_STARTED This driver is already running on this device. 194 184 @retval EFI_INVALID_PARAMETER Any input parameter is invalid. … … 232 222 233 223 if (IpVersion == IP_VERSION_4) { 234 IScsiPrivateGuid = & mIScsiV4PrivateGuid;224 IScsiPrivateGuid = &gIScsiV4PrivateGuid; 235 225 TcpServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid; 236 226 ProtocolGuid = &gEfiTcp4ProtocolGuid; 237 227 } else if (IpVersion == IP_VERSION_6) { 238 IScsiPrivateGuid = & mIScsiV6PrivateGuid;228 IScsiPrivateGuid = &gIScsiV6PrivateGuid; 239 229 TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid; 240 230 ProtocolGuid = &gEfiTcp6ProtocolGuid; … … 301 291 302 292 Status = gBS->OpenProtocol ( 303 Private->ChildHandle, 293 Private->ChildHandle, /// Default Tcp child 304 294 ProtocolGuid, 305 295 &Interface, … … 662 652 &AttemptConfigOrderSize 663 653 ); 664 ASSERT (AttemptConfigOrder != NULL); 654 if (AttemptConfigOrder == NULL) { 655 goto ON_ERROR; 656 } 665 657 for (Index = 0; Index < AttemptConfigOrderSize / sizeof (UINT8); Index++) { 666 658 if (AttemptConfigOrder[Index] == mPrivate->BootSelectedIndex || … … 700 692 goto ON_EXIT; 701 693 } else { 702 ASSERT (AttemptConfigOrder[Index] == BootSelected); 694 if (AttemptConfigOrder[Index] != BootSelected) { 695 goto ON_ERROR; 696 } 703 697 mPrivate->BootSelectedIndex = BootSelected; 704 698 // … … 757 751 } 758 752 753 // 754 // ISCSI children should share the default Tcp child, just open the default Tcp child via BY_CHILD_CONTROLLER. 755 // 756 Status = gBS->OpenProtocol ( 757 Private->ChildHandle, /// Default Tcp child 758 ProtocolGuid, 759 &Interface, 760 Image, 761 Private->ExtScsiPassThruHandle, 762 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 763 ); 764 if (EFI_ERROR (Status)) { 765 gBS->UninstallMultipleProtocolInterfaces ( 766 Private->ExtScsiPassThruHandle, 767 &gEfiExtScsiPassThruProtocolGuid, 768 &Private->IScsiExtScsiPassThru, 769 &gEfiDevicePathProtocolGuid, 770 Private->DevicePath, 771 NULL 772 ); 773 774 goto ON_ERROR; 775 } 776 759 777 ON_EXIT: 760 778 … … 775 793 776 794 return Status; 795 } 796 797 /** 798 Stops a device controller or a bus controller. This is the worker function for 799 IScsiIp4(6)DriverBindingStop. 800 801 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 802 @param[in] ControllerHandle A handle to the device being stopped. The handle must 803 support a bus specific I/O protocol for the driver 804 to use to stop the device. 805 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer. 806 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 807 if NumberOfChildren is 0. 808 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. 809 810 @retval EFI_SUCCESS The device was stopped. 811 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error. 812 813 **/ 814 EFI_STATUS 815 EFIAPI 816 IScsiStop ( 817 IN EFI_DRIVER_BINDING_PROTOCOL *This, 818 IN EFI_HANDLE ControllerHandle, 819 IN UINTN NumberOfChildren, 820 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL, 821 IN UINT8 IpVersion 822 ) 823 { 824 EFI_HANDLE IScsiController; 825 EFI_STATUS Status; 826 ISCSI_PRIVATE_PROTOCOL *IScsiIdentifier; 827 ISCSI_DRIVER_DATA *Private; 828 EFI_EXT_SCSI_PASS_THRU_PROTOCOL *PassThru; 829 ISCSI_CONNECTION *Conn; 830 EFI_GUID *ProtocolGuid; 831 EFI_GUID *TcpServiceBindingGuid; 832 EFI_GUID *TcpProtocolGuid; 833 834 835 if (NumberOfChildren != 0) { 836 // 837 // We should have only one child. 838 // 839 Status = gBS->OpenProtocol ( 840 ChildHandleBuffer[0], 841 &gEfiExtScsiPassThruProtocolGuid, 842 (VOID **) &PassThru, 843 This->DriverBindingHandle, 844 ControllerHandle, 845 EFI_OPEN_PROTOCOL_GET_PROTOCOL 846 ); 847 if (EFI_ERROR (Status)) { 848 return EFI_DEVICE_ERROR; 849 } 850 851 Private = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (PassThru); 852 Conn = NET_LIST_HEAD (&Private->Session->Conns, ISCSI_CONNECTION, Link); 853 854 // 855 // Previously the TCP protocol is opened BY_CHILD_CONTROLLER. Just close 856 // the protocol here, but do not uninstall the device path protocol and 857 // EXT SCSI PASS THRU protocol installed on ExtScsiPassThruHandle. 858 // 859 if (IpVersion == IP_VERSION_4) { 860 ProtocolGuid = &gEfiTcp4ProtocolGuid; 861 } else { 862 ProtocolGuid = &gEfiTcp6ProtocolGuid; 863 } 864 865 gBS->CloseProtocol ( 866 Private->ChildHandle, 867 ProtocolGuid, 868 Private->Image, 869 Private->ExtScsiPassThruHandle 870 ); 871 872 gBS->CloseProtocol ( 873 Conn->TcpIo.Handle, 874 ProtocolGuid, 875 Private->Image, 876 Private->ExtScsiPassThruHandle 877 ); 878 879 return EFI_SUCCESS; 880 } 881 882 // 883 // Get the handle of the controller we are controling. 884 // 885 if (IpVersion == IP_VERSION_4) { 886 ProtocolGuid = &gIScsiV4PrivateGuid; 887 TcpProtocolGuid = &gEfiTcp4ProtocolGuid; 888 TcpServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid; 889 } else { 890 ProtocolGuid = &gIScsiV6PrivateGuid; 891 TcpProtocolGuid = &gEfiTcp6ProtocolGuid; 892 TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid; 893 } 894 IScsiController = NetLibGetNicHandle (ControllerHandle, TcpProtocolGuid); 895 if (IScsiController == NULL) { 896 return EFI_SUCCESS; 897 } 898 899 Status = gBS->OpenProtocol ( 900 IScsiController, 901 ProtocolGuid, 902 (VOID **) &IScsiIdentifier, 903 This->DriverBindingHandle, 904 ControllerHandle, 905 EFI_OPEN_PROTOCOL_GET_PROTOCOL 906 ); 907 if (EFI_ERROR (Status)) { 908 return EFI_DEVICE_ERROR; 909 } 910 911 Private = ISCSI_DRIVER_DATA_FROM_IDENTIFIER (IScsiIdentifier); 912 ASSERT (Private != NULL); 913 914 if (Private->ChildHandle != NULL) { 915 Status = gBS->CloseProtocol ( 916 Private->ChildHandle, 917 TcpProtocolGuid, 918 This->DriverBindingHandle, 919 IScsiController 920 ); 921 922 ASSERT (!EFI_ERROR (Status)); 923 924 Status = NetLibDestroyServiceChild ( 925 IScsiController, 926 This->DriverBindingHandle, 927 TcpServiceBindingGuid, 928 Private->ChildHandle 929 ); 930 931 ASSERT (!EFI_ERROR (Status)); 932 } 933 934 gBS->UninstallProtocolInterface ( 935 IScsiController, 936 ProtocolGuid, 937 &Private->IScsiIdentifier 938 ); 939 940 // 941 // Remove this NIC. 942 // 943 IScsiRemoveNic (IScsiController); 944 945 // 946 // Update the iSCSI Boot Firware Table. 947 // 948 IScsiPublishIbft (); 949 950 if (Private->Session != NULL) { 951 IScsiSessionAbort (Private->Session); 952 } 953 954 IScsiCleanDriverData (Private); 955 956 return EFI_SUCCESS; 957 } 958 959 /** 960 Tests to see if this driver supports a given controller. If a child device is provided, 961 it tests to see if this driver supports creating a handle for the specified child device. 962 963 This function checks to see if the driver specified by This supports the device specified by 964 ControllerHandle. Drivers typically use the device path attached to 965 ControllerHandle and/or the services from the bus I/O abstraction attached to 966 ControllerHandle to determine if the driver supports ControllerHandle. This function 967 may be called many times during platform initialization. In order to reduce boot times, the tests 968 performed by this function must be very small and take as little time as possible to execute. This 969 function must not change the state of any hardware devices, and this function must be aware that the 970 device specified by ControllerHandle may already be managed by the same driver or a 971 different driver. This function must match its calls to AllocatePages() with FreePages(), 972 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). 973 Since ControllerHandle may have been previously started by the same driver, if a protocol is 974 already in the opened state, then it must not be closed with CloseProtocol(). This is required 975 to guarantee the state of ControllerHandle is not modified by this function. 976 977 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 978 @param[in] ControllerHandle The handle of the controller to test. This handle 979 must support a protocol interface that supplies 980 an I/O abstraction to the driver. 981 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 982 parameter is ignored by device drivers, and is optional for bus 983 drivers. For bus drivers, if this parameter is not NULL, then 984 the bus driver must determine if the bus controller specified 985 by ControllerHandle and the child controller specified 986 by RemainingDevicePath are both supported by this 987 bus driver. 988 989 @retval EFI_SUCCESS The device specified by ControllerHandle and 990 RemainingDevicePath is supported by the driver specified by This. 991 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and 992 RemainingDevicePath is already managed by the driver 993 specified by This. 994 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and 995 RemainingDevicePath is already managed by a different 996 driver or an application that requires exclusive access. 997 Currently not implemented. 998 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and 999 RemainingDevicePath is not supported by the driver specified by This. 1000 **/ 1001 EFI_STATUS 1002 EFIAPI 1003 IScsiIp4DriverBindingSupported ( 1004 IN EFI_DRIVER_BINDING_PROTOCOL *This, 1005 IN EFI_HANDLE ControllerHandle, 1006 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 1007 ) 1008 { 1009 return IScsiSupported ( 1010 This, 1011 ControllerHandle, 1012 RemainingDevicePath, 1013 IP_VERSION_4 1014 ); 777 1015 } 778 1016 … … 807 1045 808 1046 @retval EFI_SUCCESS The device was started. 809 @retval EFI_DEVICE_ERROR The device could not be started due to a device error. Currently not implemented.1047 @retval EFI_DEVICE_ERROR The device could not be started due to a device error. Currently not implemented. 810 1048 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. 811 1049 @retval Others The driver failed to start the device. … … 814 1052 EFI_STATUS 815 1053 EFIAPI 816 IScsi DriverBindingStart (1054 IScsiIp4DriverBindingStart ( 817 1055 IN EFI_DRIVER_BINDING_PROTOCOL *This, 818 1056 IN EFI_HANDLE ControllerHandle, … … 820 1058 ) 821 1059 { 822 EFI_STATUS V4Status; 823 EFI_STATUS V6Status; 824 825 V4Status = IScsiStart (This->DriverBindingHandle, ControllerHandle, IP_VERSION_4); 826 if (V4Status == EFI_ALREADY_STARTED) { 827 V4Status = EFI_SUCCESS; 828 } 829 830 V6Status = IScsiStart (This->DriverBindingHandle, ControllerHandle, IP_VERSION_6); 831 if (V6Status == EFI_ALREADY_STARTED) { 832 V6Status = EFI_SUCCESS; 833 } 834 835 if (!EFI_ERROR (V4Status) || !EFI_ERROR (V6Status)) { 836 return EFI_SUCCESS; 837 } else if (EFI_ERROR (V4Status)) { 838 return V4Status; 839 } else { 840 return V6Status; 841 } 1060 EFI_STATUS Status; 1061 1062 Status = IScsiStart (This->DriverBindingHandle, ControllerHandle, IP_VERSION_4); 1063 if (Status == EFI_ALREADY_STARTED) { 1064 Status = EFI_SUCCESS; 1065 } 1066 1067 return Status; 842 1068 } 843 1069 … … 870 1096 EFI_STATUS 871 1097 EFIAPI 872 IScsi DriverBindingStop (1098 IScsiIp4DriverBindingStop ( 873 1099 IN EFI_DRIVER_BINDING_PROTOCOL *This, 874 1100 IN EFI_HANDLE ControllerHandle, … … 877 1103 ) 878 1104 { 879 EFI_HANDLE IScsiController; 880 EFI_STATUS Status; 881 ISCSI_PRIVATE_PROTOCOL *IScsiIdentifier; 882 ISCSI_DRIVER_DATA *Private; 883 EFI_EXT_SCSI_PASS_THRU_PROTOCOL *PassThru; 884 ISCSI_CONNECTION *Conn; 885 EFI_GUID *ProtocolGuid; 886 EFI_GUID *TcpServiceBindingGuid; 887 EFI_GUID *TcpProtocolGuid; 888 889 890 if (NumberOfChildren != 0) { 891 // 892 // We should have only one child. 893 // 894 Status = gBS->OpenProtocol ( 895 ChildHandleBuffer[0], 896 &gEfiExtScsiPassThruProtocolGuid, 897 (VOID **) &PassThru, 898 This->DriverBindingHandle, 899 ControllerHandle, 900 EFI_OPEN_PROTOCOL_GET_PROTOCOL 901 ); 902 if (EFI_ERROR (Status)) { 903 return EFI_DEVICE_ERROR; 904 } 905 906 Private = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (PassThru); 907 Conn = NET_LIST_HEAD (&Private->Session->Conns, ISCSI_CONNECTION, Link); 908 909 // 910 // Previously the TCP protocol is opened BY_CHILD_CONTROLLER. Just close 911 // the protocol here, but do not uninstall the device path protocol and 912 // EXT SCSI PASS THRU protocol installed on ExtScsiPassThruHandle. 913 // 914 if (!Conn->Ipv6Flag) { 915 ProtocolGuid = &gEfiTcp4ProtocolGuid; 916 } else { 917 ProtocolGuid = &gEfiTcp6ProtocolGuid; 918 } 919 920 gBS->CloseProtocol ( 921 Conn->TcpIo.Handle, 922 ProtocolGuid, 923 Private->Image, 924 Private->ExtScsiPassThruHandle 1105 return IScsiStop ( 1106 This, 1107 ControllerHandle, 1108 NumberOfChildren, 1109 ChildHandleBuffer, 1110 IP_VERSION_4 925 1111 ); 926 927 return EFI_SUCCESS;928 }929 //930 // Get the handle of the controller we are controling.931 //932 IScsiController = NetLibGetNicHandle (ControllerHandle, &gEfiTcp4ProtocolGuid);933 if (IScsiController != NULL) {934 ProtocolGuid = &mIScsiV4PrivateGuid;935 TcpProtocolGuid = &gEfiTcp4ProtocolGuid;936 TcpServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;937 } else {938 IScsiController = NetLibGetNicHandle (ControllerHandle, &gEfiTcp6ProtocolGuid);939 ASSERT (IScsiController != NULL);940 ProtocolGuid = &mIScsiV6PrivateGuid;941 TcpProtocolGuid = &gEfiTcp6ProtocolGuid;942 TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;943 }944 945 Status = gBS->OpenProtocol (946 IScsiController,947 ProtocolGuid,948 (VOID **) &IScsiIdentifier,949 This->DriverBindingHandle,950 ControllerHandle,951 EFI_OPEN_PROTOCOL_GET_PROTOCOL952 );953 if (EFI_ERROR (Status)) {954 return EFI_DEVICE_ERROR;955 }956 957 Private = ISCSI_DRIVER_DATA_FROM_IDENTIFIER (IScsiIdentifier);958 ASSERT (Private != NULL);959 960 if (Private->ChildHandle != NULL) {961 Status = gBS->CloseProtocol (962 Private->ChildHandle,963 TcpProtocolGuid,964 This->DriverBindingHandle,965 IScsiController966 );967 968 ASSERT (!EFI_ERROR (Status));969 970 Status = NetLibDestroyServiceChild (971 IScsiController,972 This->DriverBindingHandle,973 TcpServiceBindingGuid,974 Private->ChildHandle975 );976 977 ASSERT (!EFI_ERROR (Status));978 }979 980 gBS->UninstallProtocolInterface (981 IScsiController,982 ProtocolGuid,983 &Private->IScsiIdentifier984 );985 986 //987 // Remove this NIC.988 //989 IScsiRemoveNic (IScsiController);990 991 //992 // Update the iSCSI Boot Firware Table.993 //994 IScsiPublishIbft ();995 996 if (Private->Session != NULL) {997 IScsiSessionAbort (Private->Session);998 }999 1000 IScsiCleanDriverData (Private);1001 1002 return EFI_SUCCESS;1003 1112 } 1004 1113 1114 /** 1115 Tests to see if this driver supports a given controller. If a child device is provided, 1116 it tests to see if this driver supports creating a handle for the specified child device. 1117 1118 This function checks to see if the driver specified by This supports the device specified by 1119 ControllerHandle. Drivers typically use the device path attached to 1120 ControllerHandle and/or the services from the bus I/O abstraction attached to 1121 ControllerHandle to determine if the driver supports ControllerHandle. This function 1122 may be called many times during platform initialization. In order to reduce boot times, the tests 1123 performed by this function must be very small and take as little time as possible to execute. This 1124 function must not change the state of any hardware devices, and this function must be aware that the 1125 device specified by ControllerHandle may already be managed by the same driver or a 1126 different driver. This function must match its calls to AllocatePages() with FreePages(), 1127 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). 1128 Since ControllerHandle may have been previously started by the same driver, if a protocol is 1129 already in the opened state, then it must not be closed with CloseProtocol(). This is required 1130 to guarantee the state of ControllerHandle is not modified by this function. 1131 1132 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 1133 @param[in] ControllerHandle The handle of the controller to test. This handle 1134 must support a protocol interface that supplies 1135 an I/O abstraction to the driver. 1136 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 1137 parameter is ignored by device drivers, and is optional for bus 1138 drivers. For bus drivers, if this parameter is not NULL, then 1139 the bus driver must determine if the bus controller specified 1140 by ControllerHandle and the child controller specified 1141 by RemainingDevicePath are both supported by this 1142 bus driver. 1143 1144 @retval EFI_SUCCESS The device specified by ControllerHandle and 1145 RemainingDevicePath is supported by the driver specified by This. 1146 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and 1147 RemainingDevicePath is already managed by the driver 1148 specified by This. 1149 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and 1150 RemainingDevicePath is already managed by a different 1151 driver or an application that requires exclusive access. 1152 Currently not implemented. 1153 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and 1154 RemainingDevicePath is not supported by the driver specified by This. 1155 **/ 1156 EFI_STATUS 1157 EFIAPI 1158 IScsiIp6DriverBindingSupported ( 1159 IN EFI_DRIVER_BINDING_PROTOCOL *This, 1160 IN EFI_HANDLE ControllerHandle, 1161 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 1162 ) 1163 { 1164 return IScsiSupported ( 1165 This, 1166 ControllerHandle, 1167 RemainingDevicePath, 1168 IP_VERSION_6 1169 ); 1170 } 1171 1172 /** 1173 Starts a device controller or a bus controller. 1174 1175 The Start() function is designed to be invoked from the EFI boot service ConnectController(). 1176 As a result, much of the error checking on the parameters to Start() has been moved into this 1177 common boot service. It is legal to call Start() from other locations, 1178 but the following calling restrictions must be followed or the system behavior will not be deterministic. 1179 1. ControllerHandle must be a valid EFI_HANDLE. 1180 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned 1181 EFI_DEVICE_PATH_PROTOCOL. 1182 3. Prior to calling Start(), the Supported() function for the driver specified by This must 1183 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. 1184 1185 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 1186 @param[in] ControllerHandle The handle of the controller to start. This handle 1187 must support a protocol interface that supplies 1188 an I/O abstraction to the driver. 1189 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 1190 parameter is ignored by device drivers, and is optional for bus 1191 drivers. For a bus driver, if this parameter is NULL, then handles 1192 for all the children of Controller are created by this driver. 1193 If this parameter is not NULL and the first Device Path Node is 1194 not the End of Device Path Node, then only the handle for the 1195 child device specified by the first Device Path Node of 1196 RemainingDevicePath is created by this driver. 1197 If the first Device Path Node of RemainingDevicePath is 1198 the End of Device Path Node, no child handle is created by this 1199 driver. 1200 1201 @retval EFI_SUCCESS The device was started. 1202 @retval EFI_DEVICE_ERROR The device could not be started due to a device error. Currently not implemented. 1203 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. 1204 @retval Others The driver failed to start the device. 1205 1206 **/ 1207 EFI_STATUS 1208 EFIAPI 1209 IScsiIp6DriverBindingStart ( 1210 IN EFI_DRIVER_BINDING_PROTOCOL *This, 1211 IN EFI_HANDLE ControllerHandle, 1212 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 1213 ) 1214 { 1215 EFI_STATUS Status; 1216 1217 Status = IScsiStart (This->DriverBindingHandle, ControllerHandle, IP_VERSION_6); 1218 if (Status == EFI_ALREADY_STARTED) { 1219 Status = EFI_SUCCESS; 1220 } 1221 1222 return Status; 1223 } 1224 1225 /** 1226 Stops a device controller or a bus controller. 1227 1228 The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). 1229 As a result, much of the error checking on the parameters to Stop() has been moved 1230 into this common boot service. It is legal to call Stop() from other locations, 1231 but the following calling restrictions must be followed or the system behavior will not be deterministic. 1232 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this 1233 same driver's Start() function. 1234 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid 1235 EFI_HANDLE. In addition, all of these handles must have been created in this driver's 1236 Start() function, and the Start() function must have called OpenProtocol() on 1237 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. 1238 1239 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 1240 @param[in] ControllerHandle A handle to the device being stopped. The handle must 1241 support a bus specific I/O protocol for the driver 1242 to use to stop the device. 1243 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer. 1244 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 1245 if NumberOfChildren is 0. 1246 1247 @retval EFI_SUCCESS The device was stopped. 1248 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error. 1249 1250 **/ 1251 EFI_STATUS 1252 EFIAPI 1253 IScsiIp6DriverBindingStop ( 1254 IN EFI_DRIVER_BINDING_PROTOCOL *This, 1255 IN EFI_HANDLE ControllerHandle, 1256 IN UINTN NumberOfChildren, 1257 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL 1258 ) 1259 { 1260 return IScsiStop ( 1261 This, 1262 ControllerHandle, 1263 NumberOfChildren, 1264 ChildHandleBuffer, 1265 IP_VERSION_6 1266 ); 1267 } 1005 1268 1006 1269 /** … … 1019 1282 ) 1020 1283 { 1021 EFI_STATUS Status; 1022 UINTN DeviceHandleCount; 1023 EFI_HANDLE *DeviceHandleBuffer; 1024 UINTN Index; 1284 EFI_STATUS Status; 1285 UINTN DeviceHandleCount; 1286 EFI_HANDLE *DeviceHandleBuffer; 1287 UINTN Index; 1288 EFI_COMPONENT_NAME_PROTOCOL *ComponentName; 1289 EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2; 1025 1290 1026 1291 // … … 1034 1299 &DeviceHandleBuffer 1035 1300 ); 1301 if (EFI_ERROR (Status)) { 1302 return Status; 1303 } 1304 1305 // 1306 // Disconnect the iSCSI4 driver from the controlled device. 1307 // 1308 for (Index = 0; Index < DeviceHandleCount; Index++) { 1309 Status = IScsiTestManagedDevice ( 1310 DeviceHandleBuffer[Index], 1311 gIScsiIp4DriverBinding.DriverBindingHandle, 1312 &gEfiTcp4ProtocolGuid) 1313 ; 1314 if (EFI_ERROR (Status)) { 1315 continue; 1316 } 1317 Status = gBS->DisconnectController ( 1318 DeviceHandleBuffer[Index], 1319 gIScsiIp4DriverBinding.DriverBindingHandle, 1320 NULL 1321 ); 1322 if (EFI_ERROR (Status)) { 1323 goto ON_EXIT; 1324 } 1325 } 1326 1327 // 1328 // Disconnect the iSCSI6 driver from the controlled device. 1329 // 1330 for (Index = 0; Index < DeviceHandleCount; Index++) { 1331 Status = IScsiTestManagedDevice ( 1332 DeviceHandleBuffer[Index], 1333 gIScsiIp6DriverBinding.DriverBindingHandle, 1334 &gEfiTcp6ProtocolGuid 1335 ); 1336 if (EFI_ERROR (Status)) { 1337 continue; 1338 } 1339 Status = gBS->DisconnectController ( 1340 DeviceHandleBuffer[Index], 1341 gIScsiIp6DriverBinding.DriverBindingHandle, 1342 NULL 1343 ); 1344 if (EFI_ERROR (Status)) { 1345 goto ON_EXIT; 1346 } 1347 } 1348 1349 // 1350 // Unload the iSCSI configuration form. 1351 // 1352 Status = IScsiConfigFormUnload (gIScsiIp4DriverBinding.DriverBindingHandle); 1353 if (EFI_ERROR (Status)) { 1354 goto ON_EXIT; 1355 } 1356 1357 // 1358 // Uninstall the protocols installed by iSCSI driver. 1359 // 1360 Status = gBS->UninstallMultipleProtocolInterfaces ( 1361 ImageHandle, 1362 &gEfiAuthenticationInfoProtocolGuid, 1363 &gIScsiAuthenticationInfo, 1364 NULL 1365 ); 1366 if (EFI_ERROR (Status)) { 1367 goto ON_EXIT; 1368 } 1369 1370 if (gIScsiControllerNameTable!= NULL) { 1371 Status = FreeUnicodeStringTable (gIScsiControllerNameTable); 1372 if (EFI_ERROR (Status)) { 1373 goto ON_EXIT; 1374 } 1375 gIScsiControllerNameTable = NULL; 1376 } 1377 1378 // 1379 // Uninstall the ComponentName and ComponentName2 protocol from iSCSI4 driver binding handle 1380 // if it has been installed. 1381 // 1382 Status = gBS->HandleProtocol ( 1383 gIScsiIp4DriverBinding.DriverBindingHandle, 1384 &gEfiComponentNameProtocolGuid, 1385 (VOID **) &ComponentName 1386 ); 1036 1387 if (!EFI_ERROR (Status)) { 1037 for (Index = 0; Index < DeviceHandleCount; Index++) { 1038 Status = gBS->DisconnectController ( 1039 DeviceHandleBuffer[Index], 1040 ImageHandle, 1041 NULL 1042 ); 1043 } 1044 1045 if (DeviceHandleBuffer != NULL) { 1046 FreePool (DeviceHandleBuffer); 1047 } 1048 } 1049 // 1050 // Unload the iSCSI configuration form. 1051 // 1052 IScsiConfigFormUnload (gIScsiDriverBinding.DriverBindingHandle); 1053 1054 // 1055 // Uninstall the protocols installed by iSCSI driver. 1056 // 1057 gBS->UninstallMultipleProtocolInterfaces ( 1058 ImageHandle, 1059 &gEfiAuthenticationInfoProtocolGuid, 1060 &gIScsiAuthenticationInfo, 1061 NULL 1062 ); 1388 Status = gBS->UninstallMultipleProtocolInterfaces ( 1389 gIScsiIp4DriverBinding.DriverBindingHandle, 1390 &gEfiComponentNameProtocolGuid, 1391 ComponentName, 1392 NULL 1393 ); 1394 if (EFI_ERROR (Status)) { 1395 goto ON_EXIT; 1396 } 1397 } 1063 1398 1064 return gBS->UninstallMultipleProtocolInterfaces ( 1065 ImageHandle, 1066 &gEfiDriverBindingProtocolGuid, 1067 &gIScsiDriverBinding, 1068 &gEfiComponentName2ProtocolGuid, 1069 &gIScsiComponentName2, 1070 &gEfiComponentNameProtocolGuid, 1071 &gIScsiComponentName, 1072 &gEfiIScsiInitiatorNameProtocolGuid, 1073 &gIScsiInitiatorName, 1074 NULL 1075 ); 1399 Status = gBS->HandleProtocol ( 1400 gIScsiIp4DriverBinding.DriverBindingHandle, 1401 &gEfiComponentName2ProtocolGuid, 1402 (VOID **) &ComponentName2 1403 ); 1404 if (!EFI_ERROR (Status)) { 1405 gBS->UninstallMultipleProtocolInterfaces ( 1406 gIScsiIp4DriverBinding.DriverBindingHandle, 1407 &gEfiComponentName2ProtocolGuid, 1408 ComponentName2, 1409 NULL 1410 ); 1411 if (EFI_ERROR (Status)) { 1412 goto ON_EXIT; 1413 } 1414 } 1415 1416 // 1417 // Uninstall the ComponentName and ComponentName2 protocol from iSCSI6 driver binding handle 1418 // if it has been installed. 1419 // 1420 Status = gBS->HandleProtocol ( 1421 gIScsiIp6DriverBinding.DriverBindingHandle, 1422 &gEfiComponentNameProtocolGuid, 1423 (VOID **) &ComponentName 1424 ); 1425 if (!EFI_ERROR (Status)) { 1426 Status = gBS->UninstallMultipleProtocolInterfaces ( 1427 gIScsiIp6DriverBinding.DriverBindingHandle, 1428 &gEfiComponentNameProtocolGuid, 1429 ComponentName, 1430 NULL 1431 ); 1432 if (EFI_ERROR (Status)) { 1433 goto ON_EXIT; 1434 } 1435 } 1436 1437 Status = gBS->HandleProtocol ( 1438 gIScsiIp6DriverBinding.DriverBindingHandle, 1439 &gEfiComponentName2ProtocolGuid, 1440 (VOID **) &ComponentName2 1441 ); 1442 if (!EFI_ERROR (Status)) { 1443 gBS->UninstallMultipleProtocolInterfaces ( 1444 gIScsiIp6DriverBinding.DriverBindingHandle, 1445 &gEfiComponentName2ProtocolGuid, 1446 ComponentName2, 1447 NULL 1448 ); 1449 if (EFI_ERROR (Status)) { 1450 goto ON_EXIT; 1451 } 1452 } 1453 1454 // 1455 // Uninstall the IScsiInitiatorNameProtocol and all the driver binding protocols. 1456 // 1457 Status = gBS->UninstallMultipleProtocolInterfaces ( 1458 gIScsiIp4DriverBinding.DriverBindingHandle, 1459 &gEfiDriverBindingProtocolGuid, 1460 &gIScsiIp4DriverBinding, 1461 &gEfiIScsiInitiatorNameProtocolGuid, 1462 &gIScsiInitiatorName, 1463 NULL 1464 ); 1465 if (EFI_ERROR (Status)) { 1466 goto ON_EXIT; 1467 } 1468 1469 Status = gBS->UninstallMultipleProtocolInterfaces ( 1470 gIScsiIp6DriverBinding.DriverBindingHandle, 1471 &gEfiDriverBindingProtocolGuid, 1472 &gIScsiIp6DriverBinding, 1473 NULL 1474 ); 1475 1476 ON_EXIT: 1477 1478 if (DeviceHandleBuffer != NULL) { 1479 FreePool (DeviceHandleBuffer); 1480 } 1481 1482 return Status; 1076 1483 } 1077 1484 … … 1121 1528 ImageHandle, 1122 1529 SystemTable, 1123 &gIScsi DriverBinding,1530 &gIScsiIp4DriverBinding, 1124 1531 ImageHandle, 1125 1532 &gIScsiComponentName, … … 1130 1537 } 1131 1538 1539 Status = EfiLibInstallDriverBindingComponentName2 ( 1540 ImageHandle, 1541 SystemTable, 1542 &gIScsiIp6DriverBinding, 1543 NULL, 1544 &gIScsiComponentName, 1545 &gIScsiComponentName2 1546 ); 1547 if (EFI_ERROR (Status)) { 1548 goto Error1; 1549 } 1550 1132 1551 // 1133 1552 // Install the iSCSI Initiator Name Protocol. … … 1140 1559 ); 1141 1560 if (EFI_ERROR (Status)) { 1142 goto Error 1;1561 goto Error2; 1143 1562 } 1144 1563 … … 1149 1568 if (mPrivate == NULL) { 1150 1569 Status = EFI_OUT_OF_RESOURCES; 1151 goto Error 2;1570 goto Error3; 1152 1571 } 1153 1572 … … 1158 1577 // Initialize the configuration form of iSCSI. 1159 1578 // 1160 Status = IScsiConfigFormInit (gIScsi DriverBinding.DriverBindingHandle);1161 if (EFI_ERROR (Status)) { 1162 goto Error 3;1579 Status = IScsiConfigFormInit (gIScsiIp4DriverBinding.DriverBindingHandle); 1580 if (EFI_ERROR (Status)) { 1581 goto Error4; 1163 1582 } 1164 1583 … … 1180 1599 ); 1181 1600 if (EFI_ERROR (Status)) { 1182 goto Error 4;1601 goto Error5; 1183 1602 } 1184 1603 } … … 1186 1605 return EFI_SUCCESS; 1187 1606 1607 Error5: 1608 IScsiConfigFormUnload (gIScsiIp4DriverBinding.DriverBindingHandle); 1609 1188 1610 Error4: 1189 IScsiConfigFormUnload (gIScsiDriverBinding.DriverBindingHandle);1611 FreePool (mPrivate); 1190 1612 1191 1613 Error3: 1192 FreePool (mPrivate);1193 1194 Error2:1195 1614 gBS->UninstallMultipleProtocolInterfaces ( 1196 1615 ImageHandle, … … 1200 1619 ); 1201 1620 1202 Error 1:1621 Error2: 1203 1622 gBS->UninstallMultipleProtocolInterfaces ( 1204 ImageHandle,1623 gIScsiIp6DriverBinding.DriverBindingHandle, 1205 1624 &gEfiDriverBindingProtocolGuid, 1206 &gIScsi DriverBinding,1625 &gIScsiIp6DriverBinding, 1207 1626 &gEfiComponentName2ProtocolGuid, 1208 1627 &gIScsiComponentName2, … … 1212 1631 ); 1213 1632 1633 Error1: 1634 gBS->UninstallMultipleProtocolInterfaces ( 1635 ImageHandle, 1636 &gEfiDriverBindingProtocolGuid, 1637 &gIScsiIp4DriverBinding, 1638 &gEfiComponentName2ProtocolGuid, 1639 &gIScsiComponentName2, 1640 &gEfiComponentNameProtocolGuid, 1641 &gIScsiComponentName, 1642 NULL 1643 ); 1644 1214 1645 return Status; 1215 1646 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiDriver.h
r48674 r58459 2 2 The header file of IScsiDriver.c. 3 3 4 Copyright (c) 2004 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 34 34 extern EFI_COMPONENT_NAME2_PROTOCOL gIScsiComponentName2; 35 35 extern EFI_COMPONENT_NAME_PROTOCOL gIScsiComponentName; 36 extern EFI_UNICODE_STRING_TABLE *gIScsiControllerNameTable; 36 37 extern EFI_ISCSI_INITIATOR_NAME_PROTOCOL gIScsiInitiatorName; 37 38 extern EFI_AUTHENTICATION_INFO_PROTOCOL gIScsiAuthenticationInfo; 38 39 extern EFI_EXT_SCSI_PASS_THRU_PROTOCOL gIScsiExtScsiPassThruProtocolTemplate; 40 extern EFI_GUID gIScsiV4PrivateGuid; 41 extern EFI_GUID gIScsiV6PrivateGuid; 39 42 40 43 typedef struct { … … 124 127 EFI_STATUS 125 128 EFIAPI 126 IScsi DriverBindingSupported (129 IScsiIp4DriverBindingSupported ( 127 130 IN EFI_DRIVER_BINDING_PROTOCOL *This, 128 131 IN EFI_HANDLE ControllerHandle, … … 167 170 EFI_STATUS 168 171 EFIAPI 169 IScsi DriverBindingStart (172 IScsiIp4DriverBindingStart ( 170 173 IN EFI_DRIVER_BINDING_PROTOCOL *This, 171 174 IN EFI_HANDLE ControllerHandle, … … 201 204 EFI_STATUS 202 205 EFIAPI 203 IScsiDriverBindingStop ( 206 IScsiIp4DriverBindingStop ( 207 IN EFI_DRIVER_BINDING_PROTOCOL *This, 208 IN EFI_HANDLE ControllerHandle, 209 IN UINTN NumberOfChildren, 210 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL 211 ); 212 213 /** 214 Tests to see if this driver supports a given controller. If a child device is provided, 215 it tests to see if this driver supports creating a handle for the specified child device. 216 217 This function checks to see if the driver specified by This supports the device specified by 218 ControllerHandle. Drivers typically use the device path attached to 219 ControllerHandle and/or the services from the bus I/O abstraction attached to 220 ControllerHandle to determine if the driver supports ControllerHandle. This function 221 may be called many times during platform initialization. In order to reduce boot times, the tests 222 performed by this function must be very small and take as little time as possible to execute. This 223 function must not change the state of any hardware devices, and this function must be aware that the 224 device specified by ControllerHandle may already be managed by the same driver or a 225 different driver. This function must match its calls to AllocatePages() with FreePages(), 226 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). 227 Since ControllerHandle may have been previously started by the same driver, if a protocol is 228 already in the opened state, then it must not be closed with CloseProtocol(). This is required 229 to guarantee the state of ControllerHandle is not modified by this function. 230 231 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 232 @param[in] ControllerHandle The handle of the controller to test. This handle 233 must support a protocol interface that supplies 234 an I/O abstraction to the driver. 235 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 236 parameter is ignored by device drivers, and is optional for bus 237 drivers. For bus drivers, if this parameter is not NULL, then 238 the bus driver must determine if the bus controller specified 239 by ControllerHandle and the child controller specified 240 by RemainingDevicePath are both supported by this 241 bus driver. 242 243 @retval EFI_SUCCESS The device specified by ControllerHandle and 244 RemainingDevicePath is supported by the driver specified by This. 245 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and 246 RemainingDevicePath is already managed by the driver 247 specified by This. 248 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and 249 RemainingDevicePath is already managed by a different 250 driver or an application that requires exclusive access. 251 Currently not implemented. 252 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and 253 RemainingDevicePath is not supported by the driver specified by This. 254 **/ 255 EFI_STATUS 256 EFIAPI 257 IScsiIp6DriverBindingSupported ( 258 IN EFI_DRIVER_BINDING_PROTOCOL *This, 259 IN EFI_HANDLE ControllerHandle, 260 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 261 ); 262 263 /** 264 Starts a device controller or a bus controller. 265 266 The Start() function is designed to be invoked from the EFI boot service ConnectController(). 267 As a result, much of the error checking on the parameters to Start() has been moved into this 268 common boot service. It is legal to call Start() from other locations, 269 but the following calling restrictions must be followed or the system behavior will not be deterministic. 270 1. ControllerHandle must be a valid EFI_HANDLE. 271 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned 272 EFI_DEVICE_PATH_PROTOCOL. 273 3. Prior to calling Start(), the Supported() function for the driver specified by This must 274 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. 275 276 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 277 @param[in] ControllerHandle The handle of the controller to start. This handle 278 must support a protocol interface that supplies 279 an I/O abstraction to the driver. 280 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 281 parameter is ignored by device drivers, and is optional for bus 282 drivers. For a bus driver, if this parameter is NULL, then handles 283 for all the children of Controller are created by this driver. 284 If this parameter is not NULL and the first Device Path Node is 285 not the End of Device Path Node, then only the handle for the 286 child device specified by the first Device Path Node of 287 RemainingDevicePath is created by this driver. 288 If the first Device Path Node of RemainingDevicePath is 289 the End of Device Path Node, no child handle is created by this 290 driver. 291 292 @retval EFI_SUCCESS The device was started. 293 @retval EFI_DEVICE_ERROR The device could not be started due to a device error. Currently not implemented. 294 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. 295 @retval Others The driver failed to start the device. 296 297 **/ 298 EFI_STATUS 299 EFIAPI 300 IScsiIp6DriverBindingStart ( 301 IN EFI_DRIVER_BINDING_PROTOCOL *This, 302 IN EFI_HANDLE ControllerHandle, 303 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 304 ); 305 306 /** 307 Stops a device controller or a bus controller. 308 309 The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). 310 As a result, much of the error checking on the parameters to Stop() has been moved 311 into this common boot service. It is legal to call Stop() from other locations, 312 but the following calling restrictions must be followed or the system behavior will not be deterministic. 313 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this 314 same driver's Start() function. 315 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid 316 EFI_HANDLE. In addition, all of these handles must have been created in this driver's 317 Start() function, and the Start() function must have called OpenProtocol() on 318 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. 319 320 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 321 @param[in] ControllerHandle A handle to the device being stopped. The handle must 322 support a bus specific I/O protocol for the driver 323 to use to stop the device. 324 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer. 325 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 326 if NumberOfChildren is 0. 327 328 @retval EFI_SUCCESS The device was stopped. 329 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error. 330 331 **/ 332 EFI_STATUS 333 EFIAPI 334 IScsiIp6DriverBindingStop ( 204 335 IN EFI_DRIVER_BINDING_PROTOCOL *This, 205 336 IN EFI_HANDLE ControllerHandle, -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiDxe.inf
r48674 r58459 1 1 ## @file 2 # C omponent description file for IScsi module.2 # Client-side iSCSI service. 3 3 # 4 # Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR> 4 # The iSCSI driver provides iSCSI service in the preboot environment and supports 5 # booting over iSCSI. 6 # 7 # Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR> 5 8 # This program and the accompanying materials 6 9 # are licensed and made available under the terms and conditions of the BSD License … … 21 24 ENTRY_POINT = IScsiDriverEntryPoint 22 25 UNLOAD_IMAGE = IScsiUnload 26 MODULE_UNI_FILE = IScsiDxe.uni 23 27 24 28 # … … 83 87 84 88 [Protocols] 85 gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED 86 gEfiDriverBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED 87 gEfiPciIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED 88 gEfiDhcp4ProtocolGuid # PROTOCOL ALWAYS_CONSUMED 89 gEfiDhcp6ProtocolGuid # PROTOCOL ALWAYS_CONSUMED 90 gEfiDhcp4ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED 91 gEfiDhcp6ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED 92 gEfiTcp4ProtocolGuid # PROTOCOL ALWAYS_CONSUMED 93 gEfiTcp6ProtocolGuid # PROTOCOL ALWAYS_CONSUMED 94 gEfiTcp4ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED 95 gEfiTcp6ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED 96 gEfiExtScsiPassThruProtocolGuid # PROTOCOL ALWAYS_CONSUMED 97 gEfiHiiConfigAccessProtocolGuid # PROTOCOL ALWAYS_CONSUMED 98 gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED 99 gEfiIScsiInitiatorNameProtocolGuid # PROTOCOL ALWAYS_CONSUMED 100 gEfiAuthenticationInfoProtocolGuid # PROTOCOL ALWAYS_CONSUMED 89 gEfiAcpiTableProtocolGuid ## SOMETIMES_CONSUMES ## SystemTable 90 gEfiDriverBindingProtocolGuid ## SOMETIMES_PRODUCES 91 gEfiPciIoProtocolGuid ## SOMETIMES_CONSUMES 92 gEfiDhcp4ProtocolGuid ## TO_START 93 gEfiDhcp6ProtocolGuid ## TO_START 94 gEfiDhcp4ServiceBindingProtocolGuid ## TO_START 95 gEfiDhcp6ServiceBindingProtocolGuid ## TO_START 96 gEfiTcp4ProtocolGuid ## TO_START 97 gEfiTcp6ProtocolGuid ## TO_START 98 gEfiTcp4ServiceBindingProtocolGuid ## TO_START 99 gEfiTcp6ServiceBindingProtocolGuid ## TO_START 100 gEfiExtScsiPassThruProtocolGuid ## BY_START 101 gEfiHiiConfigAccessProtocolGuid ## PRODUCES 102 ## TO_START 103 ## PRODUCES 104 gEfiDevicePathProtocolGuid 105 ## PRODUCES 106 ## UNDEFINED # Variable 107 gEfiIScsiInitiatorNameProtocolGuid 108 ## PRODUCES 109 gEfiAuthenticationInfoProtocolGuid 101 110 102 111 [Guids] 103 gEfiEventExitBootServicesGuid 104 gEfiIfrTianoGuid ## CONSUMES ## GUID 105 gEfiAcpiTableGuid ## CONSUMES ## GUID 106 gEfiAcpi10TableGuid ## CONSUMES ## GUID 107 gEfiAcpi20TableGuid ## CONSUMES ## GUID 108 gIScsiConfigGuid ## PRODUCES ## GUID 112 gEfiEventExitBootServicesGuid ## SOMETIMES_CONSUMES ## Event 113 gEfiIfrTianoGuid ## SOMETIMES_PRODUCES ## UNDEFINED 114 gEfiAcpiTableGuid ## SOMETIMES_CONSUMES ## SystemTable 115 gEfiAcpi10TableGuid ## SOMETIMES_CONSUMES ## SystemTable 116 gEfiAcpi20TableGuid ## SOMETIMES_CONSUMES ## SystemTable 117 118 ## SOMETIMES_PRODUCES ## Variable:L"AttemptOrder" 119 ## SOMETIMES_CONSUMES ## Variable:L"AttemptOrder" 120 ## SOMETIMES_CONSUMES ## UNDEFINED # HiiIsConfigHdrMatch mVendorStorageName 121 ## SOMETIMES_PRODUCES ## UNDEFINED # HiiConstructConfigHdr mVendorStorageName 122 ## SOMETIMES_PRODUCES ## UNDEFINED # HiiGetBrowserData mVendorStorageName 123 ## SOMETIMES_CONSUMES ## UNDEFINED # HiiSetBrowserData mVendorStorageName 124 ## SOMETIMES_CONSUMES ## HII 125 gIScsiConfigGuid 126 127 [UserExtensions.TianoCore."ExtraFiles"] 128 IScsiDxeExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiExtScsiPassThru.c
r48674 r58459 2 2 The implementation of EFI_EXT_SCSI_PASS_THRU_PROTOCOL. 3 3 4 Copyright (c) 2004 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 87 87 ) 88 88 { 89 EFI_STATUS Status; 90 ISCSI_DRIVER_DATA *Private; 91 89 92 if (Target[0] != 0) { 90 93 return EFI_INVALID_PARAMETER; … … 95 98 } 96 99 97 return IScsiExecuteScsiCommand (This, Target, Lun, Packet); 100 Status = IScsiExecuteScsiCommand (This, Target, Lun, Packet); 101 if ((Status != EFI_SUCCESS) && (Status != EFI_NOT_READY)) { 102 // 103 // Try to reinstate the session and re-execute the Scsi command. 104 // 105 Private = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (This); 106 if (EFI_ERROR (IScsiSessionReinstatement (Private->Session))) { 107 return EFI_DEVICE_ERROR; 108 } 109 110 Status = IScsiExecuteScsiCommand (This, Target, Lun, Packet); 111 } 112 113 return Status; 98 114 } 99 115 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiIbft.c
r48674 r58459 2 2 Implementation for iSCSI Boot Firmware Table publication. 3 3 4 Copyright (c) 2004 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 311 311 // Map the various v4 addresses into v6 addresses. 312 312 // 313 IScsiMapV4ToV6Addr (&NvData->LocalIp , &Nic->Ip);314 IScsiMapV4ToV6Addr (&NvData->Gateway , &Nic->Gateway);313 IScsiMapV4ToV6Addr (&NvData->LocalIp.v4, &Nic->Ip); 314 IScsiMapV4ToV6Addr (&NvData->Gateway.v4, &Nic->Gateway); 315 315 IScsiMapV4ToV6Addr (&Attempt->PrimaryDns.v4, &Nic->PrimaryDns); 316 316 IScsiMapV4ToV6Addr (&Attempt->SecondaryDns.v4, &Nic->SecondaryDns); … … 318 318 319 319 } else if (NvData->IpMode == IP_MODE_IP6 || NvData->IpMode == IP_MODE_AUTOCONFIG) { 320 // 321 // TODO: The subnet mask/local ip/gateway/dhcpserver for iBFT-IPv6 needs to be 322 // confirmed with spec owner. 323 // 324 320 321 Nic->SubnetMaskPrefixLength = NvData->PrefixLength; 322 CopyMem (&Nic->Ip, &NvData->LocalIp, sizeof (EFI_IPv6_ADDRESS)); 323 CopyMem (&Nic->Gateway, &NvData->Gateway, sizeof (EFI_IPv6_ADDRESS)); 325 324 CopyMem (&Nic->PrimaryDns, &Attempt->PrimaryDns, sizeof (EFI_IPv6_ADDRESS)); 326 325 CopyMem (&Nic->SecondaryDns, &Attempt->SecondaryDns, sizeof (EFI_IPv6_ADDRESS)); 327 // 328 // TODO: DHCP server address cannot be retrieved by DHCPv6 process since 329 // DHCP server option is removed. 330 //CopyMem (&Nic->DhcpServer, &Attempt->DhcpServer, sizeof (EFI_IPv6_ADDRESS)); 331 // 326 CopyMem (&Nic->DhcpServer, &Attempt->DhcpServer, sizeof (EFI_IPv6_ADDRESS)); 327 332 328 } else { 333 329 ASSERT (FALSE); … … 364 360 365 361 if (Attempt->AuthenticationType == ISCSI_AUTH_TYPE_CHAP) { 366 Target->CHAPType = AuthConfig->CHAPType; 362 if (AuthConfig->CHAPType == ISCSI_CHAP_UNI) { 363 Target->CHAPType = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_CHAP; 364 } else if (AuthConfig->CHAPType == ISCSI_CHAP_MUTUAL) { 365 Target->CHAPType = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_MUTUAL_CHAP; 366 } 367 367 } else if (Attempt->AuthenticationType == ISCSI_AUTH_TYPE_NONE) { 368 Target->CHAPType = ISCSI_AUTH_TYPE_NONE;368 Target->CHAPType = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_NO_CHAP; 369 369 } 370 370 … … 407 407 Target->CHAPSecretOffset = (UINT16) ((UINTN) *Heap - (UINTN) Table); 408 408 409 if (Target->CHAPType == ISCSI_CHAP_MUTUAL) {409 if (Target->CHAPType == EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_MUTUAL_CHAP) { 410 410 // 411 411 // Reverse CHAP Name. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiImpl.h
r48674 r58459 2 2 The shared head file for iSCSI driver. 3 3 4 Copyright (c) 2004 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 24 24 #include <Protocol/HiiConfigAccess.h> 25 25 26 #include <Protocol/Ip6.h> 26 27 #include <Protocol/Dhcp4.h> 27 28 #include <Protocol/Dhcp6.h> -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiMisc.c
r48674 r58459 2 2 Miscellaneous routines for iSCSI driver. 3 3 4 Copyright (c) 2004 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 210 210 211 211 if ((Lun[2 * Index] | Lun[2 * Index + 1]) == 0) { 212 StrCpy (TempStr, L"0-");212 CopyMem (TempStr, L"0-", sizeof (L"0-")); 213 213 } else { 214 214 TempStr[0] = (CHAR16) IScsiHexString[Lun[2 * Index] >> 4]; … … 224 224 TempStr += StrLen (TempStr); 225 225 } 226 226 // 227 // Remove the last '-' 228 // 229 ASSERT (StrLen(Str) >= 1); 227 230 Str[StrLen (Str) - 1] = 0; 228 231 … … 891 894 } 892 895 896 /** 897 Check wheather the Controller handle is configured to use DHCP protocol. 898 899 @param[in] Controller The handle of the controller. 900 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. 901 902 @retval TRUE The handle of the controller need the Dhcp protocol. 903 @retval FALSE The handle of the controller does not need the Dhcp protocol. 904 905 **/ 906 BOOLEAN 907 IScsiDhcpIsConfigured ( 908 IN EFI_HANDLE Controller, 909 IN UINT8 IpVersion 910 ) 911 { 912 ISCSI_ATTEMPT_CONFIG_NVDATA *AttemptTmp; 913 UINT8 *AttemptConfigOrder; 914 UINTN AttemptConfigOrderSize; 915 UINTN Index; 916 EFI_STATUS Status; 917 EFI_MAC_ADDRESS MacAddr; 918 UINTN HwAddressSize; 919 UINT16 VlanId; 920 CHAR16 MacString[ISCSI_MAX_MAC_STRING_LEN]; 921 CHAR16 AttemptName[ISCSI_NAME_IFR_MAX_SIZE]; 922 923 AttemptConfigOrder = IScsiGetVariableAndSize ( 924 L"AttemptOrder", 925 &gIScsiConfigGuid, 926 &AttemptConfigOrderSize 927 ); 928 if (AttemptConfigOrder == NULL || AttemptConfigOrderSize == 0) { 929 return FALSE; 930 } 931 932 // 933 // Get MAC address of this network device. 934 // 935 Status = NetLibGetMacAddress (Controller, &MacAddr, &HwAddressSize); 936 if(EFI_ERROR (Status)) { 937 return FALSE; 938 } 939 // 940 // Get VLAN ID of this network device. 941 // 942 VlanId = NetLibGetVlanId (Controller); 943 IScsiMacAddrToStr (&MacAddr, (UINT32) HwAddressSize, VlanId, MacString); 944 945 for (Index = 0; Index < AttemptConfigOrderSize / sizeof (UINT8); Index++) { 946 UnicodeSPrint ( 947 AttemptName, 948 (UINTN) 128, 949 L"%s%d", 950 MacString, 951 (UINTN) AttemptConfigOrder[Index] 952 ); 953 Status = GetVariable2 ( 954 AttemptName, 955 &gEfiIScsiInitiatorNameProtocolGuid, 956 (VOID**)&AttemptTmp, 957 NULL 958 ); 959 if(AttemptTmp == NULL || EFI_ERROR (Status)) { 960 continue; 961 } 962 963 ASSERT (AttemptConfigOrder[Index] == AttemptTmp->AttemptConfigIndex); 964 965 if (AttemptTmp->SessionConfigData.Enabled == ISCSI_DISABLED) { 966 FreePool (AttemptTmp); 967 continue; 968 } 969 970 if (AttemptTmp->SessionConfigData.IpMode != IP_MODE_AUTOCONFIG && 971 AttemptTmp->SessionConfigData.IpMode != ((IpVersion == IP_VERSION_4) ? IP_MODE_IP4 : IP_MODE_IP6)) { 972 FreePool (AttemptTmp); 973 continue; 974 } 975 976 if(AttemptTmp->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG || 977 AttemptTmp->SessionConfigData.InitiatorInfoFromDhcp == TRUE || 978 AttemptTmp->SessionConfigData.TargetInfoFromDhcp == TRUE) { 979 FreePool (AttemptTmp); 980 FreePool (AttemptConfigOrder); 981 return TRUE; 982 } 983 984 FreePool (AttemptTmp); 985 } 986 987 FreePool (AttemptConfigOrder); 988 return FALSE; 989 } 893 990 894 991 /** … … 1077 1174 ); 1078 1175 1079 AttemptConfigData = (ISCSI_ATTEMPT_CONFIG_NVDATA *) GetVariable ( 1080 mPrivate->PortString, 1081 &gEfiIScsiInitiatorNameProtocolGuid 1082 ); 1176 GetVariable2 ( 1177 mPrivate->PortString, 1178 &gEfiIScsiInitiatorNameProtocolGuid, 1179 (VOID**)&AttemptConfigData, 1180 NULL 1181 ); 1083 1182 1084 1183 if (AttemptConfigData == NULL) { … … 1341 1440 } 1342 1441 } 1442 1443 /** 1444 Tests whether a controller handle is being managed by IScsi driver. 1445 1446 This function tests whether the driver specified by DriverBindingHandle is 1447 currently managing the controller specified by ControllerHandle. This test 1448 is performed by evaluating if the the protocol specified by ProtocolGuid is 1449 present on ControllerHandle and is was opened by DriverBindingHandle and Nic 1450 Device handle with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. 1451 If ProtocolGuid is NULL, then ASSERT(). 1452 1453 @param ControllerHandle A handle for a controller to test. 1454 @param DriverBindingHandle Specifies the driver binding handle for the 1455 driver. 1456 @param ProtocolGuid Specifies the protocol that the driver specified 1457 by DriverBindingHandle opens in its Start() 1458 function. 1459 1460 @retval EFI_SUCCESS ControllerHandle is managed by the driver 1461 specified by DriverBindingHandle. 1462 @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver 1463 specified by DriverBindingHandle. 1464 1465 **/ 1466 EFI_STATUS 1467 EFIAPI 1468 IScsiTestManagedDevice ( 1469 IN EFI_HANDLE ControllerHandle, 1470 IN EFI_HANDLE DriverBindingHandle, 1471 IN EFI_GUID *ProtocolGuid 1472 ) 1473 { 1474 EFI_STATUS Status; 1475 VOID *ManagedInterface; 1476 EFI_HANDLE NicControllerHandle; 1477 1478 ASSERT (ProtocolGuid != NULL); 1479 1480 NicControllerHandle = NetLibGetNicHandle (ControllerHandle, ProtocolGuid); 1481 if (NicControllerHandle == NULL) { 1482 return EFI_UNSUPPORTED; 1483 } 1484 1485 Status = gBS->OpenProtocol ( 1486 ControllerHandle, 1487 (EFI_GUID *) ProtocolGuid, 1488 &ManagedInterface, 1489 DriverBindingHandle, 1490 NicControllerHandle, 1491 EFI_OPEN_PROTOCOL_BY_DRIVER 1492 ); 1493 if (!EFI_ERROR (Status)) { 1494 gBS->CloseProtocol ( 1495 ControllerHandle, 1496 (EFI_GUID *) ProtocolGuid, 1497 DriverBindingHandle, 1498 NicControllerHandle 1499 ); 1500 return EFI_UNSUPPORTED; 1501 } 1502 1503 if (Status != EFI_ALREADY_STARTED) { 1504 return EFI_UNSUPPORTED; 1505 } 1506 1507 return EFI_SUCCESS; 1508 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiMisc.h
r48674 r58459 2 2 Miscellaneous definitions for iSCSI driver. 3 3 4 Copyright (c) 2004 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 24 24 UINT8 IpMode; 25 25 26 EFI_IP v4_ADDRESSLocalIp;26 EFI_IP_ADDRESS LocalIp; 27 27 EFI_IPv4_ADDRESS SubnetMask; 28 EFI_IP v4_ADDRESSGateway;28 EFI_IP_ADDRESS Gateway; 29 29 30 30 BOOLEAN InitiatorInfoFromDhcp; … … 32 32 CHAR8 TargetName[ISCSI_NAME_MAX_SIZE]; 33 33 EFI_IP_ADDRESS TargetIp; 34 UINT8 PrefixLength; 34 35 UINT8 BootLun[8]; 35 36 … … 299 300 300 301 /** 302 Check wheather the Controller handle is configured to use DHCP protocol. 303 304 @param[in] Controller The handle of the controller. 305 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. 306 307 @retval TRUE The handle of the controller need the Dhcp protocol. 308 @retval FALSE The handle of the controller does not need the Dhcp protocol. 309 310 **/ 311 BOOLEAN 312 IScsiDhcpIsConfigured ( 313 IN EFI_HANDLE Controller, 314 IN UINT8 IpVersion 315 ); 316 317 /** 301 318 Get the various configuration data of this iSCSI instance. 302 319 … … 341 358 ); 342 359 360 /** 361 Tests whether a controller handle is being managed by IScsi driver. 362 363 This function tests whether the driver specified by DriverBindingHandle is 364 currently managing the controller specified by ControllerHandle. This test 365 is performed by evaluating if the the protocol specified by ProtocolGuid is 366 present on ControllerHandle and is was opened by DriverBindingHandle and Nic 367 Device handle with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. 368 If ProtocolGuid is NULL, then ASSERT(). 369 370 @param ControllerHandle A handle for a controller to test. 371 @param DriverBindingHandle Specifies the driver binding handle for the 372 driver. 373 @param ProtocolGuid Specifies the protocol that the driver specified 374 by DriverBindingHandle opens in its Start() 375 function. 376 377 @retval EFI_SUCCESS ControllerHandle is managed by the driver 378 specified by DriverBindingHandle. 379 @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver 380 specified by DriverBindingHandle. 381 382 **/ 383 EFI_STATUS 384 EFIAPI 385 IScsiTestManagedDevice ( 386 IN EFI_HANDLE ControllerHandle, 387 IN EFI_HANDLE DriverBindingHandle, 388 IN EFI_GUID *ProtocolGuid 389 ); 343 390 #endif -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiProto.c
r48674 r58459 2 2 The implementation of iSCSI protocol based on RFC3720. 3 3 4 Copyright (c) 2004 - 201 2, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 229 229 Conn->ParamNegotiated = FALSE; 230 230 Conn->Cid = Session->NextCid++; 231 Conn->Ipv6Flag = mPrivate->Ipv6Flag;231 Conn->Ipv6Flag = NvData->IpMode == IP_MODE_IP6 || Session->ConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP6; 232 232 233 233 Status = gBS->CreateEvent ( … … 260 260 CopyMem (&Tcp4IoConfig->RemoteIp, &NvData->TargetIp, sizeof (EFI_IPv4_ADDRESS)); 261 261 262 Tcp4IoConfig->RemotePort = NvData->TargetPort;263 Tcp4IoConfig->ActiveFlag = TRUE;264 262 Tcp4IoConfig->RemotePort = NvData->TargetPort; 263 Tcp4IoConfig->ActiveFlag = TRUE; 264 Tcp4IoConfig->StationPort = 0; 265 265 } else { 266 266 Tcp6IoConfig = &TcpIoConfig.Tcp6IoConfigData; 267 267 268 268 CopyMem (&Tcp6IoConfig->RemoteIp, &NvData->TargetIp, sizeof (EFI_IPv6_ADDRESS)); 269 Tcp6IoConfig->RemotePort = NvData->TargetPort; 270 Tcp6IoConfig->ActiveFlag = TRUE; 269 Tcp6IoConfig->RemotePort = NvData->TargetPort; 270 Tcp6IoConfig->ActiveFlag = TRUE; 271 Tcp6IoConfig->StationPort = 0; 271 272 } 272 273 … … 309 310 } 310 311 312 /** 313 Retrieve the IPv6 Address/Prefix/Gateway from the established TCP connection, these informations 314 will be filled in the iSCSI Boot Firmware Table. 315 316 @param[in] Conn The connection used in the iSCSI login phase. 317 318 @retval EFI_SUCCESS Get the NIC information successfully. 319 @retval Others Other errors as indicated. 320 321 **/ 322 EFI_STATUS 323 IScsiGetIp6NicInfo ( 324 IN ISCSI_CONNECTION *Conn 325 ) 326 { 327 ISCSI_SESSION_CONFIG_NVDATA *NvData; 328 EFI_TCP6_PROTOCOL *Tcp6; 329 EFI_IP6_MODE_DATA Ip6ModeData; 330 EFI_STATUS Status; 331 EFI_IPv6_ADDRESS *TargetIp; 332 UINTN Index; 333 UINT8 SubnetPrefixLength; 334 UINTN RouteEntry; 335 336 NvData = &Conn->Session->ConfigData->SessionConfigData; 337 TargetIp = &NvData->TargetIp.v6; 338 Tcp6 = Conn->TcpIo.Tcp.Tcp6; 339 340 ZeroMem (&Ip6ModeData, sizeof (EFI_IP6_MODE_DATA)); 341 Status = Tcp6->GetModeData ( 342 Tcp6, 343 NULL, 344 NULL, 345 &Ip6ModeData, 346 NULL, 347 NULL 348 ); 349 if (EFI_ERROR (Status)) { 350 return Status; 351 } 352 353 if (!Ip6ModeData.IsConfigured) { 354 Status = EFI_ABORTED; 355 goto ON_EXIT; 356 } 357 358 IP6_COPY_ADDRESS (&NvData->LocalIp, &Ip6ModeData.ConfigData.StationAddress); 359 360 NvData->PrefixLength = 0; 361 for (Index = 0; Index < Ip6ModeData.AddressCount; Index++) { 362 if (EFI_IP6_EQUAL (&NvData->LocalIp.v6, &Ip6ModeData.AddressList[Index].Address)) { 363 NvData->PrefixLength = Ip6ModeData.AddressList[Index].PrefixLength; 364 break; 365 } 366 } 367 368 SubnetPrefixLength = 0; 369 RouteEntry = Ip6ModeData.RouteCount; 370 for (Index = 0; Index < Ip6ModeData.RouteCount; Index++) { 371 if (NetIp6IsNetEqual (TargetIp, &Ip6ModeData.RouteTable[Index].Destination, Ip6ModeData.RouteTable[Index].PrefixLength)) { 372 if (SubnetPrefixLength < Ip6ModeData.RouteTable[Index].PrefixLength) { 373 SubnetPrefixLength = Ip6ModeData.RouteTable[Index].PrefixLength; 374 RouteEntry = Index; 375 } 376 } 377 } 378 if (RouteEntry != Ip6ModeData.RouteCount) { 379 IP6_COPY_ADDRESS (&NvData->Gateway, &Ip6ModeData.RouteTable[RouteEntry].Gateway); 380 } 381 382 ON_EXIT: 383 if (Ip6ModeData.AddressList != NULL) { 384 FreePool (Ip6ModeData.AddressList); 385 } 386 if (Ip6ModeData.GroupTable!= NULL) { 387 FreePool (Ip6ModeData.GroupTable); 388 } 389 if (Ip6ModeData.RouteTable!= NULL) { 390 FreePool (Ip6ModeData.RouteTable); 391 } 392 if (Ip6ModeData.NeighborCache!= NULL) { 393 FreePool (Ip6ModeData.NeighborCache); 394 } 395 if (Ip6ModeData.PrefixTable!= NULL) { 396 FreePool (Ip6ModeData.PrefixTable); 397 } 398 if (Ip6ModeData.IcmpTypeList!= NULL) { 399 FreePool (Ip6ModeData.IcmpTypeList); 400 } 401 402 return Status; 403 } 311 404 312 405 /** … … 380 473 Session->State = SESSION_STATE_LOGGED_IN; 381 474 382 if (! mPrivate->Ipv6Flag) {475 if (!Conn->Ipv6Flag) { 383 476 ProtocolGuid = &gEfiTcp4ProtocolGuid; 384 477 } else { … … 396 489 397 490 ASSERT_EFI_ERROR (Status); 491 492 if (Conn->Ipv6Flag) { 493 Status = IScsiGetIp6NicInfo (Conn); 494 } 398 495 } 399 496 … … 507 604 EFI_STATUS Status; 508 605 NET_BUF *Pdu; 606 607 Pdu = NULL; 509 608 510 609 // … … 2724 2823 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. 2725 2824 @retval EFI_PROTOCOL_ERROR There is no such data in the net buffer. 2825 @retval EFI_NOT_READY The target can not accept new commands. 2726 2826 @retval Others Other errors as indicated. 2727 2827 … … 2756 2856 2757 2857 if (Session->State != SESSION_STATE_LOGGED_IN) { 2758 return EFI_DEVICE_ERROR; 2858 Status = EFI_DEVICE_ERROR; 2859 goto ON_EXIT; 2759 2860 } 2760 2861 … … 2901 3002 } 2902 3003 2903 if ((Status != EFI_SUCCESS) && (Status != EFI_NOT_READY)) {2904 //2905 // Reinstate the session.2906 //2907 if (EFI_ERROR (IScsiSessionReinstatement (Session))) {2908 Status = EFI_DEVICE_ERROR;2909 }2910 }2911 2912 3004 return Status; 2913 3005 } … … 2930 3022 EFI_STATUS Status; 2931 3023 2932 ASSERT (Session->State == SESSION_STATE_LOGGED_IN);3024 ASSERT (Session->State != SESSION_STATE_FREE); 2933 3025 2934 3026 // -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiProto.h
r48674 r58459 2 2 The header file of iSCSI Protocol that defines many specific data structures. 3 3 4 Copyright (c) 2004 - 201 2, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 983 983 @retval EFI_DEVICE_ERROR Session state was not as required. 984 984 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. 985 @retval EFI_NOT_READY The target can not accept new commands. 985 986 @retval Others Other errors as indicated. 986 987 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/ComponentName.c
r48674 r58459 3 3 EFI_COMPONENT_NAME2_PROTOCOL protocol. 4 4 5 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>5 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 6 6 7 7 This program and the accompanying materials … … 174 174 } 175 175 }; 176 177 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gIp6ControllerNameTable = NULL; 176 178 177 179 /** … … 233 235 234 236 /** 237 Update the component name for the IP6 child handle. 238 239 @param Ip6[in] A pointer to the EFI_IP6_PROTOCOL. 240 241 242 @retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully. 243 @retval EFI_INVALID_PARAMETER The input parameter is invalid. 244 245 **/ 246 EFI_STATUS 247 UpdateName ( 248 IN EFI_IP6_PROTOCOL *Ip6 249 ) 250 { 251 EFI_STATUS Status; 252 CHAR16 HandleName[128]; 253 EFI_IP6_MODE_DATA Ip6ModeData; 254 UINTN Offset; 255 CHAR16 Address[sizeof"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"]; 256 257 if (Ip6 == NULL) { 258 return EFI_INVALID_PARAMETER; 259 } 260 261 // 262 // Format the child name into the string buffer. 263 // 264 Offset = 0; 265 Status = Ip6->GetModeData (Ip6, &Ip6ModeData, NULL, NULL); 266 if (!EFI_ERROR (Status) && Ip6ModeData.IsStarted) { 267 Status = NetLibIp6ToStr (&Ip6ModeData.ConfigData.StationAddress, Address, sizeof(Address)); 268 if (EFI_ERROR (Status)) { 269 return Status; 270 } 271 Offset += UnicodeSPrint ( 272 HandleName, 273 sizeof(HandleName), 274 L"IPv6(StationAddress=%s, ", 275 Address 276 ); 277 Status = NetLibIp6ToStr (&Ip6ModeData.ConfigData.DestinationAddress, Address, sizeof(Address)); 278 if (EFI_ERROR (Status)) { 279 return Status; 280 } 281 UnicodeSPrint ( 282 HandleName + Offset, 283 sizeof(HandleName) - Offset * sizeof (CHAR16), 284 L"DestinationAddress=%s)", 285 Address 286 ); 287 } else if (!Ip6ModeData.IsStarted) { 288 UnicodeSPrint (HandleName, sizeof(HandleName), L"IPv6(Not started)"); 289 } else { 290 UnicodeSPrint (HandleName, sizeof(HandleName), L"IPv6(%r)", Status); 291 } 292 293 if (gIp6ControllerNameTable != NULL) { 294 FreeUnicodeStringTable (gIp6ControllerNameTable); 295 gIp6ControllerNameTable = NULL; 296 } 297 298 Status = AddUnicodeString2 ( 299 "eng", 300 gIp6ComponentName.SupportedLanguages, 301 &gIp6ControllerNameTable, 302 HandleName, 303 TRUE 304 ); 305 if (EFI_ERROR (Status)) { 306 return Status; 307 } 308 309 return AddUnicodeString2 ( 310 "en", 311 gIp6ComponentName2.SupportedLanguages, 312 &gIp6ControllerNameTable, 313 HandleName, 314 FALSE 315 ); 316 } 317 318 /** 235 319 Retrieves a Unicode string that is the user-readable name of the controller 236 320 that is being managed by a driver. … … 310 394 ) 311 395 { 312 return EFI_UNSUPPORTED; 396 EFI_STATUS Status; 397 EFI_IP6_PROTOCOL *Ip6; 398 399 // 400 // Only provide names for child handles. 401 // 402 if (ChildHandle == NULL) { 403 return EFI_UNSUPPORTED; 404 } 405 406 // 407 // Make sure this driver produced ChildHandle 408 // 409 Status = EfiTestChildHandle ( 410 ControllerHandle, 411 ChildHandle, 412 &gEfiManagedNetworkProtocolGuid 413 ); 414 if (EFI_ERROR (Status)) { 415 return Status; 416 } 417 418 // 419 // Retrieve an instance of a produced protocol from ChildHandle 420 // 421 Status = gBS->OpenProtocol ( 422 ChildHandle, 423 &gEfiIp6ProtocolGuid, 424 (VOID **)&Ip6, 425 NULL, 426 NULL, 427 EFI_OPEN_PROTOCOL_GET_PROTOCOL 428 ); 429 if (EFI_ERROR (Status)) { 430 return Status; 431 } 432 433 // 434 // Update the component name for this child handle. 435 // 436 Status = UpdateName (Ip6); 437 if (EFI_ERROR (Status)) { 438 return Status; 439 } 440 441 return LookupUnicodeString2 ( 442 Language, 443 This->SupportedLanguages, 444 gIp6ControllerNameTable, 445 ControllerName, 446 (BOOLEAN)(This == &gIp6ComponentName) 447 ); 313 448 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Common.c
r48674 r58459 2 2 The implementation of common functions shared by IP6 driver. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 330 330 331 331 /** 332 Callback function which provided by user to remove one node in NetDestroyLinkList process. 333 334 @param[in] Entry The entry to be removed. 335 @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList. 336 337 @retval EFI_SUCCESS The entry has been removed successfully. 338 @retval Others Fail to remove the entry. 339 340 **/ 341 EFI_STATUS 342 EFIAPI 343 Ip6DestroyChildEntryByAddr ( 344 IN LIST_ENTRY *Entry, 345 IN VOID *Context 346 ) 347 { 348 IP6_PROTOCOL *Instance; 349 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 350 EFI_IPv6_ADDRESS *Address; 351 352 Instance = NET_LIST_USER_STRUCT_S (Entry, IP6_PROTOCOL, Link, IP6_PROTOCOL_SIGNATURE); 353 ServiceBinding = ((IP6_DESTROY_CHILD_BY_ADDR_CALLBACK_CONTEXT*) Context)->ServiceBinding; 354 Address = ((IP6_DESTROY_CHILD_BY_ADDR_CALLBACK_CONTEXT*) Context)->Address; 355 356 if ((Instance->State == IP6_STATE_CONFIGED) && EFI_IP6_EQUAL (&Instance->ConfigData.StationAddress, Address)) { 357 return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle); 358 } 359 360 return EFI_SUCCESS; 361 } 362 363 /** 332 364 Destroy the IP instance if its StationAddress is removed. It is the help function 333 365 for Ip6RemoveAddr(). … … 343 375 ) 344 376 { 345 BOOLEAN OneDestroyed; 346 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 347 LIST_ENTRY *Entry; 348 IP6_PROTOCOL *Instance; 377 LIST_ENTRY *List; 378 IP6_DESTROY_CHILD_BY_ADDR_CALLBACK_CONTEXT Context; 349 379 350 380 NET_CHECK_SIGNATURE (IpSb, IP6_SERVICE_SIGNATURE); 351 381 352 ServiceBinding = &IpSb->ServiceBinding; 353 354 // 355 // Upper layer IP protocol consumers may have tight relationship between several 356 // IP protocol instances, in other words, calling ServiceBinding->DestroyChild to 357 // destroy one IP child may cause other related IP children destroyed too. This 358 // will probably leave hole in the children list when we iterate it. So everytime 359 // we just destroy one child then back to the start point to iterate the list. 360 // 361 do { 362 OneDestroyed = FALSE; 363 364 NET_LIST_FOR_EACH (Entry, &IpSb->Children) { 365 Instance = NET_LIST_USER_STRUCT_S (Entry, IP6_PROTOCOL, Link, IP6_PROTOCOL_SIGNATURE); 366 367 if ((Instance->State == IP6_STATE_CONFIGED) && EFI_IP6_EQUAL (&Instance->ConfigData.StationAddress, Address)) { 368 ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle); 369 OneDestroyed = TRUE; 370 break; 371 } 372 } 373 } while (OneDestroyed); 382 List = &IpSb->Children; 383 Context.ServiceBinding = &IpSb->ServiceBinding; 384 Context.Address = Address; 385 NetDestroyLinkList ( 386 List, 387 Ip6DestroyChildEntryByAddr, 388 &Context, 389 NULL 390 ); 374 391 } 375 392 … … 635 652 636 653 /** 637 Set the Ip6 variable data.638 639 @param[in] IpSb Points to an IP6 service binding instance.640 641 @retval EFI_OUT_OF_RESOURCES There are not enough resources to set the variable.642 @retval other Set variable failed.643 644 **/645 EFI_STATUS646 Ip6SetVariableData (647 IN IP6_SERVICE *IpSb648 )649 {650 UINT32 NumConfiguredInstance;651 LIST_ENTRY *Entry;652 UINTN VariableDataSize;653 EFI_IP6_VARIABLE_DATA *Ip6VariableData;654 EFI_IP6_ADDRESS_PAIR *Ip6AddressPair;655 IP6_PROTOCOL *IpInstance;656 CHAR16 *NewMacString;657 EFI_STATUS Status;658 659 NumConfiguredInstance = 0;660 661 //662 // Go through the children list to count the configured children.663 //664 NET_LIST_FOR_EACH (Entry, &IpSb->Children) {665 IpInstance = NET_LIST_USER_STRUCT_S (Entry, IP6_PROTOCOL, Link, IP6_PROTOCOL_SIGNATURE);666 667 if (IpInstance->State == IP6_STATE_CONFIGED) {668 NumConfiguredInstance++;669 }670 }671 672 //673 // Calculate the size of the Ip6VariableData. As there may be no IP child,674 // we should add extra buffer for the address paris only if the number of configured675 // children is more than 1.676 //677 VariableDataSize = sizeof (EFI_IP6_VARIABLE_DATA);678 679 if (NumConfiguredInstance > 1) {680 VariableDataSize += sizeof (EFI_IP6_ADDRESS_PAIR) * (NumConfiguredInstance - 1);681 }682 683 Ip6VariableData = AllocatePool (VariableDataSize);684 if (Ip6VariableData == NULL) {685 return EFI_OUT_OF_RESOURCES;686 }687 688 Ip6VariableData->DriverHandle = IpSb->Image;689 Ip6VariableData->AddressCount = NumConfiguredInstance;690 691 Ip6AddressPair = &Ip6VariableData->AddressPairs[0];692 693 //694 // Go through the children list to fill the configured children's address pairs.695 //696 NET_LIST_FOR_EACH (Entry, &IpSb->Children) {697 IpInstance = NET_LIST_USER_STRUCT_S (Entry, IP6_PROTOCOL, Link, IP6_PROTOCOL_SIGNATURE);698 699 if (IpInstance->State == IP6_STATE_CONFIGED) {700 Ip6AddressPair->InstanceHandle = IpInstance->Handle;701 Ip6AddressPair->PrefixLength = IpInstance->PrefixLength;702 IP6_COPY_ADDRESS (&Ip6AddressPair->Ip6Address, &IpInstance->ConfigData.StationAddress);703 704 Ip6AddressPair++;705 }706 }707 708 //709 // Get the mac string.710 //711 Status = NetLibGetMacString (IpSb->Controller, IpSb->Image, &NewMacString);712 if (EFI_ERROR (Status)) {713 goto Exit;714 }715 716 if (IpSb->MacString != NULL) {717 //718 // The variable is set already, we're going to update it.719 //720 if (StrCmp (IpSb->MacString, NewMacString) != 0) {721 //722 // The mac address is changed, delete the previous variable first.723 //724 gRT->SetVariable (725 IpSb->MacString,726 &gEfiIp6ServiceBindingProtocolGuid,727 EFI_VARIABLE_BOOTSERVICE_ACCESS,728 0,729 NULL730 );731 }732 733 FreePool (IpSb->MacString);734 }735 736 IpSb->MacString = NewMacString;737 738 Status = gRT->SetVariable (739 IpSb->MacString,740 &gEfiIp6ServiceBindingProtocolGuid,741 EFI_VARIABLE_BOOTSERVICE_ACCESS,742 VariableDataSize,743 (VOID *) Ip6VariableData744 );745 746 Exit:747 FreePool (Ip6VariableData);748 return Status;749 }750 751 /**752 Clear the variable and free the resource.753 754 @param[in] IpSb Ip6 service binding instance.755 756 **/757 VOID758 Ip6ClearVariableData (759 IN IP6_SERVICE *IpSb760 )761 {762 ASSERT (IpSb->MacString != NULL);763 764 gRT->SetVariable (765 IpSb->MacString,766 &gEfiIp6ServiceBindingProtocolGuid,767 EFI_VARIABLE_BOOTSERVICE_ACCESS,768 0,769 NULL770 );771 772 FreePool (IpSb->MacString);773 IpSb->MacString = NULL;774 }775 776 /**777 654 Convert the multibyte field in IP header's byter order. 778 655 In spite of its name, it can also be used to convert from -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Common.h
r48674 r58459 2 2 Common definition and functions for IP6 driver. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 60 60 Ip6AnyCast 61 61 } IP6_ADDRESS_TYPE; 62 63 typedef struct { 64 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 65 EFI_IPv6_ADDRESS *Address; 66 } IP6_DESTROY_CHILD_BY_ADDR_CALLBACK_CONTEXT; 62 67 63 68 typedef struct _IP6_INTERFACE IP6_INTERFACE; … … 276 281 277 282 /** 278 Set the Ip6 variable data.279 280 @param[in] IpSb Points to an IP6 service binding instance281 282 @retval EFI_OUT_OF_RESOURCES There are not enough resources to set the variable.283 @retval other Set variable failed.284 285 **/286 EFI_STATUS287 Ip6SetVariableData (288 IN IP6_SERVICE *IpSb289 );290 291 /**292 Clear the variable and free the resource.293 294 @param[in] IpSb Ip6 service binding instance.295 296 **/297 VOID298 Ip6ClearVariableData (299 IN IP6_SERVICE *IpSb300 );301 302 /**303 283 Get the MAC address for a multicast IP address. Call 304 284 Mnp's McastIpToMac to find the MAC address instead of -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Config.vfr
r48674 r58459 128 128 help = STRING_TOKEN (STR_SAVE_CHANGES_HELP), 129 129 text = STRING_TOKEN (STR_SAVE_CHANGES), 130 text = STRING_TOKEN (STR_NULL),131 130 flags = INTERACTIVE, 132 131 key = KEY_SAVE_CHANGES; … … 167 166 help = STRING_TOKEN (STR_SAVE_AND_EXIT), 168 167 text = STRING_TOKEN (STR_SAVE_AND_EXIT), 169 text = STRING_TOKEN (STR_SAVE_AND_EXIT),170 168 flags = INTERACTIVE, 171 169 key = KEY_SAVE_CONFIG_CHANGES; … … 174 172 help = STRING_TOKEN (STR_NO_SAVE_AND_EXIT), 175 173 text = STRING_TOKEN (STR_NO_SAVE_AND_EXIT), 176 text = STRING_TOKEN (STR_NO_SAVE_AND_EXIT),177 174 flags = INTERACTIVE, 178 175 key = KEY_IGNORE_CONFIG_CHANGES; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c
r48674 r58459 2 2 The implementation of EFI IPv6 Configuration Protocol. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 474 474 DataRecord = &Variable->DataRecord[Variable->DataRecordCount]; 475 475 DataRecord->DataType = (EFI_IP6_CONFIG_DATA_TYPE) Index; 476 DataRecord->DataSize = DataItem->DataSize;476 DataRecord->DataSize = (UINT32) DataItem->DataSize; 477 477 DataRecord->Offset = (UINT16) (Heap - (CHAR8 *) Variable); 478 478 … … 2317 2317 2318 2318 /** 2319 Dest ory the Dhcp6 child in IP6_CONFIG_INSTANCE and release the resources.2319 Destroy the Dhcp6 child in IP6_CONFIG_INSTANCE and release the resources. 2320 2320 2321 2321 @param[in, out] Instance The buffer of IP6_CONFIG_INSTANCE to be freed. 2322 2322 2323 2323 @retval EFI_SUCCESS The child was successfully destroyed. 2324 @retval Others Failed to dest ory the child.2324 @retval Others Failed to destroy the child. 2325 2325 2326 2326 **/ -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.h
r48674 r58459 2 2 Definitions for EFI IPv6 Configuartion Protocol implementation. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 130 130 typedef struct { 131 131 UINT16 Offset; 132 UINT NDataSize;132 UINT32 DataSize; 133 133 EFI_IP6_CONFIG_DATA_TYPE DataType; 134 134 } IP6_CONFIG_DATA_RECORD; … … 280 280 281 281 /** 282 Dest ory the Dhcp6 child in IP6_CONFIG_INSTANCE and release the resources.282 Destroy the Dhcp6 child in IP6_CONFIG_INSTANCE and release the resources. 283 283 284 284 @param[in, out] Instance The buffer of IP6_CONFIG_INSTANCE to be freed. 285 285 286 286 @retval EFI_SUCCESS The child was successfully destroyed. 287 @retval Others Failed to dest ory the child.287 @retval Others Failed to destroy the child. 288 288 289 289 **/ -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c
r48674 r58459 2 2 Helper functions for configuring or obtaining the parameters relating to IP6. 3 3 4 Copyright (c) 2010 - 201 2, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 601 601 } 602 602 603 ZeroMem (&AddressInfo, sizeof (EFI_IP6_ADDRESS_INFO)); 603 604 LocalString = (CHAR16 *) AllocateCopyPool (StrSize (String), String); 604 605 if (LocalString == NULL) { … … 670 671 /** 671 672 This function converts the interface info to string and draws it to the IP6 UI. 672 The interface information includes interface name, interface type, hardware address, 673 address info, and route table information. The address information is also used as the 674 content of manual addresses in IP6 UI. 673 The interface information includes interface name, interface type, hardware 674 address and route table information. 675 675 676 676 @param[in] IfInfo The pointer of EFI_IP6_CONFIG_INTERFACE_INFO. … … 694 694 UINTN Number; 695 695 CHAR16 *String; 696 CHAR16 *LinkLocalStr;697 696 CHAR16 PortString[ADDRESS_STR_MAX_SIZE]; 698 697 CHAR16 FormatString[8]; 699 698 EFI_STRING_ID StringId; 700 EFI_STATUS Status;701 699 702 700 if ((IfInfo == NULL) || (HiiHandle == NULL) || (IfrNvData == NULL)) { … … 721 719 // 722 720 if (IfInfo->IfType == Ip6InterfaceTypeEthernet) { 723 StrCpy (PortString, IP6_ETHERNET);721 CopyMem (PortString, IP6_ETHERNET, sizeof (IP6_ETHERNET)); 724 722 } else if (IfInfo->IfType == Ip6InterfaceTypeExperimentalEthernet) { 725 StrCpy (PortString, IP6_EXPERIMENTAL_ETHERNET);723 CopyMem (PortString, IP6_EXPERIMENTAL_ETHERNET, sizeof (IP6_EXPERIMENTAL_ETHERNET)); 726 724 } else { 727 725 // … … 750 748 751 749 if (IfInfo->HwAddress.Addr[Index] < 0x10) { 752 StrCpy (FormatString, L"0%x-");750 CopyMem (FormatString, L"0%x-", sizeof (L"0%x-")); 753 751 } else { 754 StrCpy (FormatString, L"%x-");752 CopyMem (FormatString, L"%x-", sizeof (L"%x-")); 755 753 } 756 754 … … 783 781 } 784 782 785 // 786 // Print the host address Information. 787 // 788 Status = Ip6ConvertAddressListToString ( 789 PortString, 790 HiiHandle, 791 Ip6ConfigNvHostAddress, 792 IfInfo->AddressInfo, 793 IfInfo->AddressInfoCount 794 ); 795 if (EFI_ERROR (Status)) { 796 return Status; 797 } 798 799 // 800 // Copy the Host Address Info to manual address field. 801 // Do not copy the link local address. 802 // 803 LinkLocalStr = StrStr (PortString, IP6_LINK_LOCAL_PREFIX); 804 if (LinkLocalStr != NULL) { 805 Number = LinkLocalStr - PortString; 806 if (Number > 0) { 807 CopyMem (IfrNvData->ManualAddress, PortString, Number * sizeof (CHAR16)); 808 } 809 810 while ((*LinkLocalStr != L' ') && (*LinkLocalStr != L'\0')) { 811 LinkLocalStr++; 812 } 813 814 if (*LinkLocalStr != L'\0') { 815 LinkLocalStr++; 816 StrCat (IfrNvData->ManualAddress, LinkLocalStr); 817 } 818 } else { 819 StrCpy (IfrNvData->ManualAddress, PortString); 820 } 821 822 // 823 // Print the route table information. 824 // 825 Status = Ip6ConvertAddressListToString ( 826 PortString, 827 HiiHandle, 828 Ip6ConfigNvRouteTable, 829 IfInfo->RouteTable, 830 IfInfo->RouteCount 831 ); 832 return Status; 783 return EFI_SUCCESS; 833 784 } 834 785 … … 1034 985 IfrNvData->DadTransmitCount = DadXmits.DupAddrDetectTransmits; 1035 986 1036 //1037 // Get DNS server list.1038 //1039 FreePool (Data);1040 Data = NULL;1041 DataSize = 0;1042 Status = Ip6ConfigNvGetData (1043 Ip6Config,1044 Ip6ConfigDataTypeDnsServer,1045 &DataSize,1046 (VOID **) &Data1047 );1048 1049 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {1050 goto Exit;1051 }1052 1053 if (DataSize > 0) {1054 //1055 // Convert the DNS server address to string and draw it to UI.1056 //1057 Status = Ip6ConvertAddressListToString (1058 IfrNvData->DnsAddress,1059 HiiHandle,1060 Ip6ConfigNvDnsAddress,1061 Data,1062 DataSize / sizeof (EFI_IPv6_ADDRESS)1063 );1064 if (EFI_ERROR (Status)) {1065 goto Exit;1066 }1067 1068 FreePool (Data);1069 Data = NULL;1070 }1071 1072 //1073 // Get gateway adderss list.1074 //1075 DataSize = 0;1076 Status = Ip6ConfigNvGetData (1077 Ip6Config,1078 Ip6ConfigDataTypeGateway,1079 &DataSize,1080 (VOID **) &Data1081 );1082 1083 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {1084 goto Exit;1085 }1086 1087 if (DataSize > 0) {1088 //1089 // Convert the gateway address to string and draw it to UI.1090 //1091 Status = Ip6ConvertAddressListToString (1092 IfrNvData->GatewayAddress,1093 HiiHandle,1094 Ip6ConfigNvGatewayAddress,1095 Data,1096 DataSize / sizeof (EFI_IPv6_ADDRESS)1097 );1098 if (EFI_ERROR (Status)) {1099 goto Exit;1100 }1101 }1102 1103 Status = EFI_SUCCESS;1104 1105 987 Exit: 1106 988 if (Data != NULL) { … … 1113 995 /** 1114 996 Convert IFR data into IP6 configuration data. The policy, alternative interface 1115 ID, and DAD transmit counts, and will be saved. If under manual policy, the configured 1116 manual address, gateway address, and DNS server address will be saved. 997 ID, and DAD transmit counts, and will be saved. 1117 998 1118 999 @param[in] IfrNvData The IFR NV data. … … 1125 1006 **/ 1126 1007 EFI_STATUS 1127 Ip6ConvertIfrNvDataToConfigNvData ( 1008 Ip6ConvertIfrNvDataToConfigNvDataGeneral ( 1009 IN IP6_CONFIG_IFR_NVDATA *IfrNvData, 1010 IN OUT IP6_CONFIG_INSTANCE *Instance 1011 ) 1012 { 1013 IP6_CONFIG_NVDATA *Ip6NvData; 1014 EFI_IP6_CONFIG_PROTOCOL *Ip6Config; 1015 EFI_STATUS Status; 1016 1017 if ((IfrNvData == NULL) || (Instance == NULL)) { 1018 return EFI_INVALID_PARAMETER; 1019 } 1020 1021 NET_CHECK_SIGNATURE (Instance, IP6_CONFIG_INSTANCE_SIGNATURE); 1022 Ip6NvData = &Instance->Ip6NvData; 1023 Ip6Config = &Instance->Ip6Config; 1024 1025 // 1026 // Update those fields which don't have INTERACTIVE attribute. 1027 // 1028 if (IfrNvData->Policy == IP6_POLICY_AUTO) { 1029 Ip6NvData->Policy = Ip6ConfigPolicyAutomatic; 1030 } else if (IfrNvData->Policy == IP6_POLICY_MANUAL) { 1031 Ip6NvData->Policy = Ip6ConfigPolicyManual; 1032 } 1033 1034 Ip6NvData->DadTransmitCount.DupAddrDetectTransmits = IfrNvData->DadTransmitCount; 1035 1036 // 1037 // Set the configured policy. 1038 // 1039 Status = Ip6Config->SetData ( 1040 Ip6Config, 1041 Ip6ConfigDataTypePolicy, 1042 sizeof (EFI_IP6_CONFIG_POLICY), 1043 &Ip6NvData->Policy 1044 ); 1045 if (EFI_ERROR (Status)) { 1046 return Status; 1047 } 1048 1049 // 1050 // Set the duplicate address detection transmits count. 1051 // 1052 Status = Ip6Config->SetData ( 1053 Ip6Config, 1054 Ip6ConfigDataTypeDupAddrDetectTransmits, 1055 sizeof (EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS), 1056 &Ip6NvData->DadTransmitCount 1057 ); 1058 if (EFI_ERROR (Status)) { 1059 return Status; 1060 } 1061 1062 // 1063 // Set the alternative interface ID 1064 // 1065 Status = Ip6Config->SetData ( 1066 Ip6Config, 1067 Ip6ConfigDataTypeAltInterfaceId, 1068 sizeof (EFI_IP6_CONFIG_INTERFACE_ID), 1069 &Ip6NvData->InterfaceId 1070 ); 1071 if (EFI_ERROR (Status)) { 1072 return Status; 1073 } 1074 1075 return EFI_SUCCESS; 1076 } 1077 1078 /** 1079 Convert IFR data into IP6 configuration data. The policy, configured 1080 manual address, gateway address, and DNS server address will be saved. 1081 1082 @param[in] IfrNvData The IFR NV data. 1083 @param[in, out] Instance The IP6 config instance data. 1084 1085 @retval EFI_SUCCESS The operation finished successfully. 1086 @retval EFI_INVALID_PARAMETER Any input parameter is invalid. 1087 @retval Others Other errors as indicated. 1088 1089 **/ 1090 EFI_STATUS 1091 Ip6ConvertIfrNvDataToConfigNvDataAdvanced ( 1128 1092 IN IP6_CONFIG_IFR_NVDATA *IfrNvData, 1129 1093 IN OUT IP6_CONFIG_INSTANCE *Instance … … 1144 1108 } 1145 1109 1110 if (IfrNvData->Policy == IP6_POLICY_AUTO) { 1111 return EFI_SUCCESS; 1112 } 1113 1146 1114 NET_CHECK_SIGNATURE (Instance, IP6_CONFIG_INSTANCE_SIGNATURE); 1147 1115 Ip6NvData = &Instance->Ip6NvData; … … 1151 1119 // Update those fields which don't have INTERACTIVE attribute. 1152 1120 // 1153 if (IfrNvData->Policy == IP6_POLICY_AUTO) { 1154 Ip6NvData->Policy = Ip6ConfigPolicyAutomatic; 1155 } else if (IfrNvData->Policy == IP6_POLICY_MANUAL) { 1156 Ip6NvData->Policy = Ip6ConfigPolicyManual; 1157 } 1158 1159 Ip6NvData->DadTransmitCount.DupAddrDetectTransmits = IfrNvData->DadTransmitCount; 1121 Ip6NvData->Policy = Ip6ConfigPolicyManual; 1160 1122 1161 1123 // … … 1170 1132 if (EFI_ERROR (Status)) { 1171 1133 return Status; 1172 }1173 1174 //1175 // Set the duplicate address detection transmits count.1176 //1177 Status = Ip6Config->SetData (1178 Ip6Config,1179 Ip6ConfigDataTypeDupAddrDetectTransmits,1180 sizeof (EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS),1181 &Ip6NvData->DadTransmitCount1182 );1183 if (EFI_ERROR (Status)) {1184 return Status;1185 }1186 1187 //1188 // Set the alternative interface ID1189 //1190 Status = Ip6Config->SetData (1191 Ip6Config,1192 Ip6ConfigDataTypeAltInterfaceId,1193 sizeof (EFI_IP6_CONFIG_INTERFACE_ID),1194 &Ip6NvData->InterfaceId1195 );1196 if (EFI_ERROR (Status)) {1197 return Status;1198 }1199 1200 1201 if (Ip6NvData->Policy == Ip6ConfigPolicyAutomatic) {1202 return EFI_SUCCESS;1203 1134 } 1204 1135 … … 1358 1289 return Status; 1359 1290 } 1291 1360 1292 1361 1293 /** … … 1589 1521 1590 1522 /** 1523 Display host addresses, route table, DNS addresses and gateway addresses in 1524 "IPv6 Current Setting" page. 1525 1526 @param[in] Instance The IP6 config instance data. 1527 1528 @retval EFI_SUCCESS The operation finished successfully. 1529 @retval Others Other errors as indicated. 1530 1531 **/ 1532 EFI_STATUS 1533 Ip6GetCurrentSetting ( 1534 IN IP6_CONFIG_INSTANCE *Instance 1535 ) 1536 { 1537 EFI_IP6_CONFIG_PROTOCOL *Ip6Config; 1538 EFI_HII_HANDLE HiiHandle; 1539 EFI_IP6_CONFIG_INTERFACE_INFO *Data; 1540 UINTN DataSize; 1541 EFI_STATUS Status; 1542 CHAR16 PortString[ADDRESS_STR_MAX_SIZE]; 1543 EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo; 1544 1545 1546 Ip6Config = &Instance->Ip6Config; 1547 HiiHandle = Instance->CallbackInfo.RegisteredHandle; 1548 Data = NULL; 1549 1550 // 1551 // Get current interface info. 1552 // 1553 Status = Ip6ConfigNvGetData ( 1554 Ip6Config, 1555 Ip6ConfigDataTypeInterfaceInfo, 1556 &DataSize, 1557 (VOID **) &Data 1558 ); 1559 if (EFI_ERROR (Status)) { 1560 return Status; 1561 } 1562 1563 // 1564 // Generate dynamic text opcode for host address and draw it. 1565 // 1566 IfInfo = (EFI_IP6_CONFIG_INTERFACE_INFO *) Data; 1567 Status = Ip6ConvertAddressListToString ( 1568 PortString, 1569 HiiHandle, 1570 Ip6ConfigNvHostAddress, 1571 IfInfo->AddressInfo, 1572 IfInfo->AddressInfoCount 1573 ); 1574 if (EFI_ERROR (Status)) { 1575 FreePool (Data); 1576 return Status; 1577 } 1578 1579 // 1580 // Generate the dynamic text opcode for route table and draw it. 1581 // 1582 Status = Ip6ConvertAddressListToString ( 1583 PortString, 1584 HiiHandle, 1585 Ip6ConfigNvRouteTable, 1586 IfInfo->RouteTable, 1587 IfInfo->RouteCount 1588 ); 1589 if (EFI_ERROR (Status)) { 1590 FreePool (Data); 1591 return Status; 1592 } 1593 1594 // 1595 // Get DNS server list. 1596 // 1597 FreePool (Data); 1598 DataSize = 0; 1599 Data = NULL; 1600 Status = Ip6ConfigNvGetData ( 1601 Ip6Config, 1602 Ip6ConfigDataTypeDnsServer, 1603 &DataSize, 1604 (VOID **) &Data 1605 ); 1606 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { 1607 if (Data != NULL) { 1608 FreePool (Data); 1609 } 1610 return Status; 1611 } 1612 1613 if (DataSize > 0) { 1614 // 1615 // Generate the dynamic text opcode for DNS server and draw it. 1616 // 1617 Status = Ip6ConvertAddressListToString ( 1618 PortString, 1619 HiiHandle, 1620 Ip6ConfigNvDnsAddress, 1621 Data, 1622 DataSize / sizeof (EFI_IPv6_ADDRESS) 1623 ); 1624 if (EFI_ERROR (Status)) { 1625 FreePool (Data); 1626 return Status; 1627 } 1628 } 1629 1630 // 1631 // Get gateway adderss list. 1632 // 1633 if (Data != NULL) { 1634 FreePool (Data); 1635 } 1636 1637 DataSize = 0; 1638 Data = NULL; 1639 Status = Ip6ConfigNvGetData ( 1640 Ip6Config, 1641 Ip6ConfigDataTypeGateway, 1642 &DataSize, 1643 (VOID **) &Data 1644 ); 1645 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { 1646 if (Data != NULL) { 1647 FreePool (Data); 1648 } 1649 return Status; 1650 } 1651 1652 if (DataSize > 0) { 1653 // 1654 // Generate the dynamic text opcode for gateway and draw it. 1655 // 1656 Status = Ip6ConvertAddressListToString ( 1657 PortString, 1658 HiiHandle, 1659 Ip6ConfigNvGatewayAddress, 1660 Data, 1661 DataSize / sizeof (EFI_IPv6_ADDRESS) 1662 ); 1663 if (EFI_ERROR (Status)) { 1664 FreePool (Data); 1665 return Status; 1666 } 1667 } 1668 1669 if (Data != NULL) { 1670 FreePool (Data); 1671 } 1672 1673 return EFI_SUCCESS; 1674 } 1675 1676 /** 1591 1677 This function is called to provide results data to the driver. 1592 1678 This data consists of a unique key that is used to identify … … 1633 1719 IP6_CONFIG_INSTANCE *Instance; 1634 1720 IP6_CONFIG_NVDATA *Ip6NvData; 1635 EFI_IP6_CONFIG_PROTOCOL *Ip6Config;1636 EFI_IP6_CONFIG_INTERFACE_INFO *Data;1637 UINTN DataSize;1638 CHAR16 PortString[ADDRESS_STR_MAX_SIZE];1639 EFI_HII_HANDLE HiiHandle;1640 EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo;1641 1721 1642 1722 if (This == NULL) { … … 1677 1757 switch (QuestionId) { 1678 1758 case KEY_GET_CURRENT_SETTING: 1679 Ip6Config = &Instance->Ip6Config; 1680 HiiHandle = Instance->CallbackInfo.RegisteredHandle; 1681 Data = NULL; 1682 1683 // 1684 // Get current interface info. 1685 // 1686 Status = Ip6ConfigNvGetData ( 1687 Ip6Config, 1688 Ip6ConfigDataTypeInterfaceInfo, 1689 &DataSize, 1690 (VOID **) &Data 1691 ); 1692 if (EFI_ERROR (Status)) { 1693 return Status; 1694 } 1695 1696 // 1697 // Generate dynamic text opcode for host address and draw it. 1698 // 1699 IfInfo = (EFI_IP6_CONFIG_INTERFACE_INFO *) Data; 1700 Status = Ip6ConvertAddressListToString ( 1701 PortString, 1702 HiiHandle, 1703 Ip6ConfigNvHostAddress, 1704 IfInfo->AddressInfo, 1705 IfInfo->AddressInfoCount 1706 ); 1707 if (EFI_ERROR (Status)) { 1708 FreePool (Data); 1709 return Status; 1710 } 1711 1712 // 1713 // Generate the dynamic text opcode for route table and draw it. 1714 // 1715 Status = Ip6ConvertAddressListToString ( 1716 PortString, 1717 HiiHandle, 1718 Ip6ConfigNvRouteTable, 1719 IfInfo->RouteTable, 1720 IfInfo->RouteCount 1721 ); 1722 if (EFI_ERROR (Status)) { 1723 FreePool (Data); 1724 return Status; 1725 } 1726 1727 // 1728 // Get DNS server list. 1729 // 1730 FreePool (Data); 1731 DataSize = 0; 1732 Data = NULL; 1733 Status = Ip6ConfigNvGetData ( 1734 Ip6Config, 1735 Ip6ConfigDataTypeDnsServer, 1736 &DataSize, 1737 (VOID **) &Data 1738 ); 1739 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { 1740 if (Data != NULL) { 1741 FreePool (Data); 1742 } 1743 return Status; 1744 } 1745 1746 if (DataSize > 0) { 1747 // 1748 // Generate the dynamic text opcode for DNS server and draw it. 1749 // 1750 Status = Ip6ConvertAddressListToString ( 1751 PortString, 1752 HiiHandle, 1753 Ip6ConfigNvDnsAddress, 1754 Data, 1755 DataSize / sizeof (EFI_IPv6_ADDRESS) 1756 ); 1757 if (EFI_ERROR (Status)) { 1758 FreePool (Data); 1759 return Status; 1760 } 1761 } 1762 1763 // 1764 // Get gateway adderss list. 1765 // 1766 if (Data != NULL) { 1767 FreePool (Data); 1768 } 1769 1770 DataSize = 0; 1771 Data = NULL; 1772 Status = Ip6ConfigNvGetData ( 1773 Ip6Config, 1774 Ip6ConfigDataTypeGateway, 1775 &DataSize, 1776 (VOID **) &Data 1777 ); 1778 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { 1779 if (Data != NULL) { 1780 FreePool (Data); 1781 } 1782 return Status; 1783 } 1784 1785 if (DataSize > 0) { 1786 // 1787 // Generate the dynamic text opcode for gateway and draw it. 1788 // 1789 Status = Ip6ConvertAddressListToString ( 1790 PortString, 1791 HiiHandle, 1792 Ip6ConfigNvGatewayAddress, 1793 Data, 1794 DataSize / sizeof (EFI_IPv6_ADDRESS) 1795 ); 1796 if (EFI_ERROR (Status)) { 1797 FreePool (Data); 1798 return Status; 1799 } 1800 } 1801 1802 if (Data != NULL) { 1803 FreePool (Data); 1804 } 1805 1806 Status = EFI_SUCCESS; 1807 1759 Status = Ip6GetCurrentSetting (Instance); 1808 1760 break; 1809 1761 … … 1814 1766 switch (QuestionId) { 1815 1767 case KEY_SAVE_CONFIG_CHANGES: 1768 Status = Ip6ConvertIfrNvDataToConfigNvDataAdvanced (IfrNvData, Instance); 1769 if (EFI_ERROR (Status)) { 1770 break; 1771 } 1772 1773 Status = Ip6GetCurrentSetting (Instance); 1774 1816 1775 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT; 1817 1776 break; … … 1830 1789 1831 1790 case KEY_SAVE_CHANGES: 1832 Status = Ip6ConvertIfrNvDataToConfigNvData (IfrNvData, Instance);1791 Status = Ip6ConvertIfrNvDataToConfigNvDataGeneral (IfrNvData, Instance); 1833 1792 if (EFI_ERROR (Status)) { 1834 1793 break; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Driver.c
r48674 r58459 2 2 The driver binding and service binding protocol for IP6 driver. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 95 95 the resource allocated by the instance. The instance may be 96 96 partly initialized, or partly destroyed. If a resource is 97 destroyed, it is marked as that in case the dest ory failed and97 destroyed, it is marked as that in case the destroy failed and 98 98 being called again later. 99 99 … … 115 115 Ip6ConfigCleanInstance (&IpSb->Ip6ConfigInstance); 116 116 117 // 118 // Leave link-scope all-nodes multicast address (FF02::1) 119 // 120 Ip6SetToAllNodeMulticast (FALSE, IP6_LINK_LOCAL_SCOPE, &AllNodes); 121 122 Status = Ip6LeaveGroup (IpSb, &AllNodes); 123 if (EFI_ERROR (Status)) { 124 return Status; 117 if (!IpSb->LinkLocalDadFail) { 118 // 119 // Leave link-scope all-nodes multicast address (FF02::1) 120 // 121 Ip6SetToAllNodeMulticast (FALSE, IP6_LINK_LOCAL_SCOPE, &AllNodes); 122 123 Status = Ip6LeaveGroup (IpSb, &AllNodes); 124 if (EFI_ERROR (Status)) { 125 return Status; 126 } 125 127 } 126 128 … … 245 247 IpSb->ServiceBinding.DestroyChild = Ip6ServiceBindingDestroyChild; 246 248 IpSb->State = IP6_SERVICE_UNSTARTED; 247 IpSb->InDestroy = FALSE;248 249 249 250 IpSb->NumChildren = 0; … … 412 413 } 413 414 414 // 415 // The timer expires every 100 (IP6_TIMER_INTERVAL_IN_MS) milliseconds. 416 // 417 Status = gBS->SetTimer (IpSb->FasterTimer, TimerPeriodic, TICKS_PER_MS * IP6_TIMER_INTERVAL_IN_MS); 418 if (EFI_ERROR (Status)) { 419 goto ON_ERROR; 420 } 421 422 // 423 // The timer expires every 1000 (IP6_ONE_SECOND_IN_MS) milliseconds. 424 // 425 Status = gBS->SetTimer (IpSb->Timer, TimerPeriodic, TICKS_PER_MS * IP6_ONE_SECOND_IN_MS); 426 if (EFI_ERROR (Status)) { 427 goto ON_ERROR; 428 } 429 415 Status = NetLibGetMacString (IpSb->Controller, IpSb->Image, &IpSb->MacString); 416 if (EFI_ERROR (Status)) { 417 goto ON_ERROR; 418 } 419 420 Status = Ip6ConfigInitInstance (&IpSb->Ip6ConfigInstance); 421 if (EFI_ERROR (Status)) { 422 goto ON_ERROR; 423 } 424 425 IpSb->DefaultInterface = Ip6CreateInterface (IpSb, TRUE); 426 if (IpSb->DefaultInterface == NULL) { 427 Status = EFI_DEVICE_ERROR; 428 goto ON_ERROR; 429 } 430 430 431 431 Status = gBS->CreateEvent ( … … 440 440 } 441 441 442 Status = Ip6ReceiveFrame (Ip6AcceptFrame, IpSb);443 if (EFI_ERROR (Status)) {444 goto ON_ERROR;445 }446 447 Status = NetLibGetMacString (IpSb->Controller, IpSb->Image, &IpSb->MacString);448 if (EFI_ERROR (Status)) {449 goto ON_ERROR;450 }451 452 Status = Ip6ConfigInitInstance (&IpSb->Ip6ConfigInstance);453 if (EFI_ERROR (Status)) {454 goto ON_ERROR;455 }456 457 IpSb->DefaultInterface = Ip6CreateInterface (IpSb, TRUE);458 if (IpSb->DefaultInterface == NULL) {459 Status = EFI_DEVICE_ERROR;460 goto ON_ERROR;461 }462 463 442 // 464 443 // If there is any manual address, set it. 465 444 // 466 445 DataItem = &IpSb->Ip6ConfigInstance.DataItem[Ip6ConfigDataTypeManualAddress]; 446 if (DataItem->Data.Ptr != NULL) { 447 DataItem->SetData ( 448 &IpSb->Ip6ConfigInstance, 449 DataItem->DataSize, 450 DataItem->Data.Ptr 451 ); 452 } 453 454 // 455 // If there is any gateway address, set it. 456 // 457 DataItem = &IpSb->Ip6ConfigInstance.DataItem[Ip6ConfigDataTypeGateway]; 467 458 if (DataItem->Data.Ptr != NULL) { 468 459 DataItem->SetData ( … … 545 536 ); 546 537 547 if (EFI_ERROR (Status)) { 548 549 Ip6CleanService (IpSb); 550 FreePool (IpSb); 551 } else { 538 if (!EFI_ERROR (Status)) { 539 // 540 // ready to go: start the receiving and timer 541 // 542 Status = Ip6ReceiveFrame (Ip6AcceptFrame, IpSb); 543 if (EFI_ERROR (Status)) { 544 goto ON_ERROR; 545 } 546 547 // 548 // The timer expires every 100 (IP6_TIMER_INTERVAL_IN_MS) milliseconds. 549 // 550 Status = gBS->SetTimer ( 551 IpSb->FasterTimer, 552 TimerPeriodic, 553 TICKS_PER_MS * IP6_TIMER_INTERVAL_IN_MS 554 ); 555 if (EFI_ERROR (Status)) { 556 goto ON_ERROR; 557 } 558 559 // 560 // The timer expires every 1000 (IP6_ONE_SECOND_IN_MS) milliseconds. 561 // 562 Status = gBS->SetTimer ( 563 IpSb->Timer, 564 TimerPeriodic, 565 TICKS_PER_MS * IP6_ONE_SECOND_IN_MS 566 ); 567 if (EFI_ERROR (Status)) { 568 goto ON_ERROR; 569 } 570 552 571 // 553 572 // Initialize the IP6 ID … … 555 574 mIp6Id = NET_RANDOM (NetRandomInitSeed ()); 556 575 557 Ip6SetVariableData (IpSb); 558 } 559 576 return EFI_SUCCESS; 577 } 578 579 ON_ERROR: 580 Ip6CleanService (IpSb); 581 FreePool (IpSb); 560 582 return Status; 583 } 584 585 /** 586 Callback function which provided by user to remove one node in NetDestroyLinkList process. 587 588 @param[in] Entry The entry to be removed. 589 @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList. 590 591 @retval EFI_SUCCESS The entry has been removed successfully. 592 @retval Others Fail to remove the entry. 593 594 **/ 595 EFI_STATUS 596 EFIAPI 597 Ip6DestroyChildEntryInHandleBuffer ( 598 IN LIST_ENTRY *Entry, 599 IN VOID *Context 600 ) 601 { 602 IP6_PROTOCOL *IpInstance; 603 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 604 UINTN NumberOfChildren; 605 EFI_HANDLE *ChildHandleBuffer; 606 607 if (Entry == NULL || Context == NULL) { 608 return EFI_INVALID_PARAMETER; 609 } 610 611 IpInstance = NET_LIST_USER_STRUCT_S (Entry, IP6_PROTOCOL, Link, IP6_PROTOCOL_SIGNATURE); 612 ServiceBinding = ((IP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ServiceBinding; 613 NumberOfChildren = ((IP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->NumberOfChildren; 614 ChildHandleBuffer = ((IP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ChildHandleBuffer; 615 616 if (!NetIsInHandleBuffer (IpInstance->Handle, NumberOfChildren, ChildHandleBuffer)) { 617 return EFI_SUCCESS; 618 } 619 620 return ServiceBinding->DestroyChild (ServiceBinding, IpInstance->Handle); 561 621 } 562 622 … … 584 644 ) 585 645 { 586 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;587 IP6_SERVICE *IpSb;588 IP6_PROTOCOL *IpInstance;589 EFI_ HANDLE NicHandle;590 EFI_STATUS Status;591 BOOLEAN IsDhcp6;592 EFI_TPL OldTpl;593 I NTN State;646 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 647 IP6_SERVICE *IpSb; 648 EFI_HANDLE NicHandle; 649 EFI_STATUS Status; 650 LIST_ENTRY *List; 651 INTN State; 652 BOOLEAN IsDhcp6; 653 IP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context; 594 654 595 655 IsDhcp6 = FALSE; 596 NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiDhcp6ProtocolGuid); 597 598 if (NicHandle != NULL) { 599 // 600 // DriverBindingStop is triggered by the uninstallation of the EFI DHCPv6 601 // Protocol used by Ip6Config. 602 // 603 IsDhcp6 = TRUE; 604 } else { 605 606 NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiManagedNetworkProtocolGuid); 607 608 if (NicHandle == NULL) { 609 return EFI_DEVICE_ERROR; 656 NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiManagedNetworkProtocolGuid); 657 if (NicHandle == NULL) { 658 NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiDhcp6ProtocolGuid); 659 if (NicHandle != NULL) { 660 IsDhcp6 = TRUE; 661 } else { 662 return EFI_SUCCESS; 610 663 } 611 664 } … … 625 678 IpSb = IP6_SERVICE_FROM_PROTOCOL (ServiceBinding); 626 679 627 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);628 629 if (IpSb->InDestroy) {630 Status = EFI_SUCCESS;631 goto Exit;632 }633 634 680 if (IsDhcp6) { 635 636 681 Status = Ip6ConfigDestroyDhcp6 (&IpSb->Ip6ConfigInstance); 637 682 gBS->CloseEvent (IpSb->Ip6ConfigInstance.Dhcp6Event); 638 683 IpSb->Ip6ConfigInstance.Dhcp6Event = NULL; 639 } else if (NumberOfChildren == 0) { 640 641 IpSb->InDestroy = TRUE; 684 } else if (NumberOfChildren != 0) { 685 // 686 // NumberOfChildren is not zero, destroy the IP6 children instances in ChildHandleBuffer. 687 // 688 List = &IpSb->Children; 689 Context.ServiceBinding = ServiceBinding; 690 Context.NumberOfChildren = NumberOfChildren; 691 Context.ChildHandleBuffer = ChildHandleBuffer; 692 Status = NetDestroyLinkList ( 693 List, 694 Ip6DestroyChildEntryInHandleBuffer, 695 &Context, 696 NULL 697 ); 698 } else if (IsListEmpty (&IpSb->Children)) { 642 699 State = IpSb->State; 643 700 IpSb->State = IP6_SERVICE_DESTROY; 644 645 //646 // Clear the variable data.647 //648 Ip6ClearVariableData (IpSb);649 701 650 702 Status = Ip6CleanService (IpSb); … … 664 716 ASSERT_EFI_ERROR (Status); 665 717 FreePool (IpSb); 666 } else { 667 // 668 // NumberOfChildren is not zero, destroy all IP6 children instances. 669 // 670 while (!IsListEmpty (&IpSb->Children)) { 671 IpInstance = NET_LIST_HEAD (&IpSb->Children, IP6_PROTOCOL, Link); 672 ServiceBinding->DestroyChild (ServiceBinding, IpInstance->Handle); 673 } 674 675 if (IpSb->NumChildren != 0) { 676 Status = EFI_DEVICE_ERROR; 677 } 678 } 679 718 Status = EFI_SUCCESS; 719 } 720 680 721 Exit: 681 682 gBS->RestoreTPL (OldTpl);683 684 722 return Status; 685 723 } … … 819 857 EFI_IP6_PROTOCOL *Ip6; 820 858 EFI_TPL OldTpl; 821 INTN State;822 859 823 860 if ((This == NULL) || (ChildHandle == NULL)) { … … 853 890 // 854 891 // A child can be destroyed more than once. For example, 855 // Ip6DriverBindingStop will dest ory all of its children.856 // when UDP driver is being stopped, it will dest ory all892 // Ip6DriverBindingStop will destroy all of its children. 893 // when UDP driver is being stopped, it will destroy all 857 894 // the IP child it opens. 858 895 // 859 if (IpInstance-> State == IP6_STATE_DESTROY) {896 if (IpInstance->InDestroy) { 860 897 gBS->RestoreTPL (OldTpl); 861 898 return EFI_SUCCESS; 862 899 } 863 900 864 State = IpInstance->State; 865 IpInstance->State = IP6_STATE_DESTROY; 901 IpInstance->InDestroy = TRUE; 866 902 867 903 // … … 889 925 // that means there is a resource leak. 890 926 // 927 gBS->RestoreTPL (OldTpl); 891 928 Status = gBS->UninstallProtocolInterface ( 892 929 ChildHandle, … … 894 931 &IpInstance->Ip6Proto 895 932 ); 896 933 OldTpl = gBS->RaiseTPL (TPL_CALLBACK); 897 934 if (EFI_ERROR (Status)) { 898 935 goto ON_ERROR; … … 900 937 901 938 Status = Ip6CleanProtocol (IpInstance); 902 903 Ip6SetVariableData (IpSb);904 905 939 if (EFI_ERROR (Status)) { 906 940 gBS->InstallMultipleProtocolInterfaces ( … … 924 958 925 959 ON_ERROR: 926 IpInstance->State = State;927 960 gBS->RestoreTPL (OldTpl); 928 961 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Driver.h
r48674 r58459 2 2 The driver binding and service binding protocol for IP6 driver. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 20 20 extern EFI_COMPONENT_NAME_PROTOCOL gIp6ComponentName; 21 21 extern EFI_COMPONENT_NAME2_PROTOCOL gIp6ComponentName2; 22 extern EFI_UNICODE_STRING_TABLE *gIp6ControllerNameTable; 23 24 typedef struct { 25 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 26 UINTN NumberOfChildren; 27 EFI_HANDLE *ChildHandleBuffer; 28 }IP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT; 22 29 23 30 /** … … 25 32 the resource allocated by the instance. The instance may be 26 33 partly initialized, or partly destroyed. If a resource is 27 destroyed, it is marked as that in case the dest ory failed and34 destroyed, it is marked as that in case the destroy failed and 28 35 being called again later. 29 36 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Dxe.inf
r48674 r58459 1 1 ## @file 2 # Component description file for Ip6 module. 2 # Basic IPv6 packet I/O Service. 3 # 4 # This module provides basic network IPv6 packet I/O services which includes support for 5 # Neighbor Discovery Protocol (ND), Multicast Listener Discovery Protocol (MLD), 6 # and a subset of the Internet Control Message Protocol (ICMPv6). This driver 7 # also provides the mechanism to set and get various types of configurations for 8 # the EFI IPv6 network stack. 3 9 # 4 # Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>10 # Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 11 # 6 12 # This program and the accompanying materials … … 22 28 ENTRY_POINT = Ip6DriverEntryPoint 23 29 UNLOAD_IMAGE = NetLibDefaultUnload 30 MODULE_UNI_FILE = Ip6Dxe.uni 24 31 25 32 # … … 87 94 88 95 [Protocols] 89 gEfiManagedNetworkServiceBindingProtocolGuid 90 gEfiManagedNetworkProtocolGuid 91 gEfiIp6ServiceBindingProtocolGuid 92 gEfiIp6ProtocolGuid 93 gEfiIp6ConfigProtocolGuid 94 gEfiDhcp6ServiceBindingProtocolGuid 95 gEfiDhcp6ProtocolGuid 96 gEfiIpSec2ProtocolGuid 97 gEfiHiiConfigAccessProtocolGuid 96 gEfiManagedNetworkServiceBindingProtocolGuid ## TO_START 97 gEfiManagedNetworkProtocolGuid ## TO_START 98 gEfiIp6ServiceBindingProtocolGuid ## BY_START 99 gEfiIp6ProtocolGuid ## BY_START 100 gEfiIp6ConfigProtocolGuid ## BY_START 101 gEfiDhcp6ServiceBindingProtocolGuid ## SOMETIMES_CONSUMES 102 gEfiDhcp6ProtocolGuid ## SOMETIMES_CONSUMES 103 gEfiIpSec2ProtocolGuid ## SOMETIMES_CONSUMES 104 gEfiHiiConfigAccessProtocolGuid ## SOMETIMES_CONSUMES 98 105 99 106 [Guids] 100 gEfiIfrTianoGuid ## CONSUMES ## GUID 101 gIp6ConfigNvDataGuid ## PRODUCES ## GUID 107 ## SOMETIMES_CONSUMES ## HII 108 gEfiIfrTianoGuid 109 ## SOMETIMES_CONSUMES ## UNDEFINED # HiiIsConfigHdrMatch mIp6ConfigStorageName 110 ## SOMETIMES_PRODUCES ## UNDEFINED # HiiConstructConfigHdr mIp6ConfigStorageName 111 ## SOMETIMES_PRODUCES ## UNDEFINED # HiiAddPackages Ip6DxeStrings Ip6ConfigBin 112 ## SOMETIMES_CONSUMES ## UNDEFINED # HiiUpdateForm 113 ## SOMETIMES_CONSUMES ## HII 114 gIp6ConfigNvDataGuid 115 [UserExtensions.TianoCore."ExtraFiles"] 116 Ip6DxeExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6If.c
r48674 r58459 2 2 Implement IP6 pesudo interface. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 315 315 316 316 // 317 // Dest ory the interface if this is the last IP instance.317 // Destroy the interface if this is the last IP instance. 318 318 // Remove all the system transmitted packets 319 319 // from this interface, cancel the receive request if exists. … … 566 566 EFI_STATUS Status; 567 567 IP6_LINK_RX_TOKEN *Token; 568 569 if (IpSb->InDestroy) { 570 return EFI_INVALID_PARAMETER; 571 } 572 568 573 569 NET_CHECK_SIGNATURE (IpSb, IP6_SERVICE_SIGNATURE); 574 570 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Impl.c
r48674 r58459 2 2 Implementation of EFI_IP6_PROTOCOL protocol interfaces. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 636 636 IpSb = IpInstance->Service; 637 637 638 if (IpSb->LinkLocalDadFail ) {638 if (IpSb->LinkLocalDadFail && Ip6ConfigData != NULL) { 639 639 return EFI_DEVICE_ERROR; 640 640 } … … 690 690 691 691 // 692 // Don't change the state if it is DEST ORY, consider the following692 // Don't change the state if it is DESTROY, consider the following 693 693 // valid sequence: Mnp is unloaded-->Ip Stopped-->Udp Stopped, 694 694 // Configure (ThisIp, NULL). If the state is changed to UNCONFIGED, … … 705 705 // 706 706 Ip6ServiceConfigMnp (IpInstance->Service, FALSE); 707 708 //709 // Update the variable data.710 //711 Ip6SetVariableData (IpInstance->Service);712 707 713 708 Exit: … … 1778 1773 IpSb = IpInstance->Service; 1779 1774 1780 if (IpSb->LinkLocalDadFail) {1781 return EFI_DEVICE_ERROR;1782 }1783 1784 1775 OldTpl = gBS->RaiseTPL (TPL_CALLBACK); 1785 1776 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Impl.h
r48674 r58459 2 2 Implementation of EFI_IP6_PROTOCOL protocol interfaces and type definitions. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 69 69 #define IP6_STATE_UNCONFIGED 0 70 70 #define IP6_STATE_CONFIGED 1 71 #define IP6_STATE_DESTROY 272 71 73 72 // … … 158 157 159 158 EFI_IP6_CONFIG_DATA ConfigData; 159 BOOLEAN InDestroy; 160 160 }; 161 161 … … 164 164 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding; 165 165 INTN State; 166 BOOLEAN InDestroy;167 166 168 167 // -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Input.c
r48674 r58459 2 2 IP6 internal functions to process the incoming packets. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 244 244 // overlaps, trim the overlapped part off THIS fragment. 245 245 // 246 if (( Cur != ListHead) && ((Prev = Cur->BackLink) != ListHead)) {246 if ((Prev = Cur->BackLink) != ListHead) { 247 247 Fragment = NET_LIST_USER_STRUCT (Prev, NET_BUF, List); 248 248 Node = IP6_GET_CLIP_INFO (Fragment); -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Nd.c
r48674 r58459 2 2 Implementation of Neighbor Discovery support routines. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 262 262 263 263 /** 264 Dest ory a IP6 prefix list entry.264 Destroy a IP6 prefix list entry. 265 265 266 266 @param[in] IpSb The pointer to IP6_SERVICE instance. … … 822 822 EFI_DHCP6_PACKET_OPTION *Oro; 823 823 EFI_DHCP6_RETRANSMISSION InfoReqReXmit; 824 824 EFI_IPv6_ADDRESS AllNodes; 825 825 826 IpSb = IpIf->Service; 826 827 AddrInfo = DadEntry->AddressInfo; … … 922 923 RemoveEntryList (&DadEntry->Link); 923 924 FreePool (DadEntry); 925 // 926 // Leave link-scope all-nodes multicast address (FF02::1) 927 // 928 Ip6SetToAllNodeMulticast (FALSE, IP6_LINK_LOCAL_SCOPE, &AllNodes); 929 Ip6LeaveGroup (IpSb, &AllNodes); 924 930 // 925 931 // Disable IP operation since link-local address is a duplicate address. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Nd.h
r48674 r58459 2 2 Definition of Neighbor Discovery support routines. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 337 337 338 338 /** 339 Dest ory a IP6 prefix list entry.339 Destroy a IP6 prefix list entry. 340 340 341 341 @param[in] IpSb The pointer to IP6_SERVICE instance. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6NvData.h
r48674 r58459 2 2 NVData structure used by the IP6 configuration component. 3 3 4 Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 44 44 #define INTERFACE_ID_STR_MIN_SIZE 1 45 45 #define INTERFACE_ID_STR_MAX_SIZE 23 46 #define INTERFACE_ID_STR_STORAGE 2 446 #define INTERFACE_ID_STR_STORAGE 25 47 47 #define IP6_STR_MAX_SIZE 40 48 48 #define ADDRESS_STR_MIN_SIZE 2 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Output.c
r48674 r58459 2 2 The internal functions and routines to transmit the IP6 packet. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 388 388 EFI_STATUS Status; 389 389 UINT8 NextHeader; 390 391 UpdatedExtHdrs = NULL; 390 392 391 393 // -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/ComponentName.c
r48674 r58459 2 2 UEFI Component Name(2) protocol implementation for IPsec driver. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 166 166 "eng;en", 167 167 L"IpSec Driver" 168 }, 169 { 170 NULL, 171 NULL 172 } 173 }; 174 175 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIpSecControllerNameTable[] = { 176 { 177 "eng;en", 178 L"IPsec Controller" 168 179 }, 169 180 { … … 307 318 ) 308 319 { 309 return EFI_UNSUPPORTED; 320 EFI_STATUS Status; 321 322 // 323 // ChildHandle must be NULL for a Device Driver 324 // 325 if (ChildHandle != NULL) { 326 return EFI_UNSUPPORTED; 327 } 328 329 // 330 // Make sure this driver is currently managing ControllerHandle 331 // 332 Status = gBS->OpenProtocol ( 333 ControllerHandle, 334 &gEfiIpSec2ProtocolGuid, 335 NULL, 336 NULL, 337 NULL, 338 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 339 ); 340 if (EFI_ERROR (Status)) { 341 return Status; 342 } 343 344 return LookupUnicodeString2 ( 345 Language, 346 This->SupportedLanguages, 347 mIpSecControllerNameTable, 348 ControllerName, 349 (BOOLEAN) (This == &gIpSecComponentName) 350 ); 310 351 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IkeCommon.c
r48674 r58459 2 2 Common operation of the IKE 3 3 4 Copyright (c) 2010 , Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 23 23 // 24 24 UINT32 mNextSpi = IKE_SPI_BASE; 25 EFI_GUID mZeroGuid = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};25 EFI_GUID mZeroGuid = { 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 } }; 26 26 27 27 /** -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IkeService.c
r48674 r58459 2 2 Provide IPsec Key Exchange (IKE) service general interfaces. 3 3 4 Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 37 37 1000000, 38 38 FALSE, 39 { 0,0,0,0},40 { 0,0,0,0},39 {{0,0,0,0}}, 40 {{0,0,0,0}}, 41 41 IKE_DEFAULT_PORT, 42 { 0,0,0,0},42 {{0,0,0,0}}, 43 43 0 44 44 }; … … 56 56 1000000, 57 57 //Access Point 58 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},58 {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}, 59 59 IKE_DEFAULT_PORT, 60 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},60 {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}, 61 61 0 62 62 }; … … 347 347 @param[in] Private Point to IPSEC_PRIVATE_DATA 348 348 @param[in] Controller Handler for NIC card. 349 @param[in] ImageHandle The handle that contains the EFI_DRIVER_BINDING_PROTOCOL instance. 349 350 350 351 @retval EFI_SUCCESS The Operation is successful. … … 355 356 IkeOpenInputUdp4 ( 356 357 IN IPSEC_PRIVATE_DATA *Private, 357 IN EFI_HANDLE Controller 358 IN EFI_HANDLE Controller, 359 IN EFI_HANDLE ImageHandle 358 360 ) 359 361 { … … 379 381 Udp4Srv->Input = UdpIoCreateIo ( 380 382 Controller, 381 Private->ImageHandle,383 ImageHandle, 382 384 IkeConfigUdp4, 383 385 UDP_IO_UDP4_VERSION, … … 391 393 392 394 Udp4Srv->NicHandle = Controller; 393 Udp4Srv->ImageHandle = Private->ImageHandle;395 Udp4Srv->ImageHandle = ImageHandle; 394 396 Udp4Srv->ListHead = &(Private->Udp4List); 395 397 Udp4Srv->IpVersion = UDP_IO_UDP4_VERSION; … … 418 420 @param[in] Private Point to IPSEC_PRIVATE_DATA 419 421 @param[in] Controller Handler for NIC card. 422 @param[in] ImageHandle The handle that contains the EFI_DRIVER_BINDING_PROTOCOL instance. 420 423 421 424 @retval EFI_SUCCESS The Operation is successful. … … 426 429 IkeOpenInputUdp6 ( 427 430 IN IPSEC_PRIVATE_DATA *Private, 428 IN EFI_HANDLE Controller 431 IN EFI_HANDLE Controller, 432 IN EFI_HANDLE ImageHandle 429 433 ) 430 434 { … … 447 451 Udp6Srv->Input = UdpIoCreateIo ( 448 452 Controller, 449 Private->ImageHandle,453 ImageHandle, 450 454 IkeConfigUdp6, 451 455 UDP_IO_UDP6_VERSION, … … 459 463 460 464 Udp6Srv->NicHandle = Controller; 461 Udp6Srv->ImageHandle = Private->ImageHandle;465 Udp6Srv->ImageHandle = ImageHandle; 462 466 Udp6Srv->ListHead = &(Private->Udp6List); 463 467 Udp6Srv->IpVersion = UDP_IO_UDP6_VERSION; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IkeService.h
r48674 r58459 2 2 Prototypes definitions of IKE service. 3 3 4 Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 144 144 @param[in] Private Point to IPSEC_PRIVATE_DATA 145 145 @param[in] Controller Handler for NIC card. 146 @param[in] ImageHandle The handle that contains the EFI_DRIVER_BINDING_PROTOCOL instance. 146 147 147 148 @retval EFI_SUCCESS The Operation is successful. … … 152 153 IkeOpenInputUdp4 ( 153 154 IN IPSEC_PRIVATE_DATA *Private, 154 IN EFI_HANDLE Controller 155 IN EFI_HANDLE Controller, 156 IN EFI_HANDLE ImageHandle 155 157 ); 156 158 … … 163 165 @param[in] Private Point to IPSEC_PRIVATE_DATA 164 166 @param[in] Controller Handler for NIC card. 167 @param[in] ImageHandle The handle that contains the EFI_DRIVER_BINDING_PROTOCOL instance. 165 168 166 169 @retval EFI_SUCCESS The Operation is successful. … … 171 174 IkeOpenInputUdp6 ( 172 175 IN IPSEC_PRIVATE_DATA *Private, 173 IN EFI_HANDLE Controller 176 IN EFI_HANDLE Controller, 177 IN EFI_HANDLE ImageHandle 174 178 ); 175 179 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/Ikev2/Exchange.c
r48674 r58459 2 2 The general interfaces of the IKEv2. 3 3 4 Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 468 468 // Validate the IKE packet header. 469 469 // 470 Status = Ikev2ValidateHeader (IkeSaSession, IkePacket->Header); 471 if (EFI_ERROR (Status)) { 470 if (!Ikev2ValidateHeader (IkeSaSession, IkePacket->Header)) { 472 471 // 473 472 // Drop the packet if invalid IKE header. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/Ikev2/Payload.c
r48674 r58459 2 2 The implementation of Payloads Creation. 3 3 4 Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 1394 1394 CopyMem ( 1395 1395 IkeSaSession->NCookie, 1396 NotifyPayload + sizeof (IKEV2_NOTIFY),1396 (UINT8 *)NotifyPayload + sizeof (IKEV2_NOTIFY), 1397 1397 NotifyDataSize 1398 1398 ); -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/Ikev2/Utility.c
r48674 r58459 2 2 The Common operations used by IKE Exchange Process. 3 3 4 Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 929 929 930 930 Selector = AllocateZeroPool (SelectorSize); 931 ASSERT (Selector != NULL); 931 932 Status = EfiIpSecConfigGetNextSelector ( 932 933 &Private->IpSecConfig, -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IpSecCryptIo.c
r48674 r58459 2 2 Common interfaces to call Security library. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 827 827 828 828 SigSize = 0; 829 RsaContext = NULL; 830 829 831 // 830 832 // Retrieve RSA Private Key from password-protected PEM data -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IpSecDebug.c
r48674 r58459 20 20 // The print title for IKEv1 variety phase. 21 21 // 22 CHAR8 *mIkev1StateStr[ ] = {22 CHAR8 *mIkev1StateStr[IKE_STATE_NUM] = { 23 23 "IKEv1_MAIN_1", 24 24 "IKEv1_MAIN_2", … … 33 33 // The print title for IKEv2 variety phase. 34 34 // 35 CHAR8 *mIkev2StateStr[ ] = {35 CHAR8 *mIkev2StateStr[IKE_STATE_NUM] = { 36 36 "IKEv2_STATE_INIT", 37 37 "IKEv2_STATE_AUTH", … … 167 167 ) 168 168 { 169 if (Previous >= IKE_STATE_NUM || Current >= IKE_STATE_NUM) { 170 return; 171 } 169 172 170 173 if (Previous == Current) { … … 173 176 } else if (IkeVersion == 2) { 174 177 DEBUG ((DEBUG_INFO, "\n****Current state is %a\n", mIkev2StateStr[Previous])); 175 } 176 178 } 177 179 } else { 178 180 if (IkeVersion == 1) { … … 180 182 } else { 181 183 DEBUG ((DEBUG_INFO, "\n****Change state from %a to %a\n", mIkev2StateStr[Previous], mIkev2StateStr[Current])); 182 } 183 184 } 185 184 } 185 } 186 186 } 187 187 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IpSecDebug.h
r48674 r58459 28 28 29 29 #define IPSEC_DEBUG_BYTE_PER_LINE 8 30 #define IKE_STATE_NUM 7 31 30 32 31 33 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IpSecDriver.c
r48674 r58459 2 2 Driver Binding Protocol for IPsec Driver. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 21 21 22 22 /** 23 Test to see if this driver supports ControllerHandle. 23 Test to see if this driver supports ControllerHandle. This is the worker function 24 for IpSec4(6)DriverbindingSupported. 24 25 25 26 @param[in] This Protocol instance pointer. … … 27 28 @param[in] RemainingDevicePath Optional parameter used to pick a specific child 28 29 device to start. 29 30 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. 31 30 32 @retval EFI_SUCCES This driver supports this device. 31 33 @retval EFI_ALREADY_STARTED This driver is already running on this device. … … 35 37 EFI_STATUS 36 38 EFIAPI 37 IpSecDriverBindingSupported ( 38 IN EFI_DRIVER_BINDING_PROTOCOL *This, 39 IN EFI_HANDLE ControllerHandle, 40 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 41 ) 42 { 43 EFI_STATUS Udp4Status; 44 EFI_STATUS Udp6Status; 45 46 Udp4Status = gBS->OpenProtocol ( 47 ControllerHandle, 48 &gEfiUdp4ServiceBindingProtocolGuid, 49 NULL, 50 This->DriverBindingHandle, 51 ControllerHandle, 52 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 53 ); 54 55 Udp6Status = gBS->OpenProtocol ( 56 ControllerHandle, 57 &gEfiUdp6ServiceBindingProtocolGuid, 58 NULL, 59 This->DriverBindingHandle, 60 ControllerHandle, 61 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 62 ); 63 64 // 65 // The controller with either Udp4Sb or Udp6Sb is supported. 66 // 67 if (!EFI_ERROR (Udp4Status) || !EFI_ERROR (Udp6Status)) { 68 return EFI_SUCCESS; 69 } 70 71 return EFI_UNSUPPORTED; 72 } 73 74 /** 75 Start this driver on ControllerHandle. 39 IpSecSupported ( 40 IN EFI_DRIVER_BINDING_PROTOCOL *This, 41 IN EFI_HANDLE ControllerHandle, 42 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL, 43 IN UINT8 IpVersion 44 ) 45 { 46 EFI_STATUS Status; 47 EFI_GUID *UdpServiceBindingGuid; 48 49 if (IpVersion == IP_VERSION_4) { 50 UdpServiceBindingGuid = &gEfiUdp4ServiceBindingProtocolGuid; 51 } else { 52 UdpServiceBindingGuid = &gEfiUdp6ServiceBindingProtocolGuid; 53 } 54 55 Status = gBS->OpenProtocol ( 56 ControllerHandle, 57 UdpServiceBindingGuid, 58 NULL, 59 This->DriverBindingHandle, 60 ControllerHandle, 61 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 62 ); 63 if (EFI_ERROR (Status)) { 64 return EFI_UNSUPPORTED; 65 } 66 return EFI_SUCCESS; 67 } 68 69 /** 70 Start this driver on ControllerHandle. This is the worker function 71 for IpSec4(6)DriverbindingStart. 76 72 77 73 @param[in] This Protocol instance pointer. … … 79 75 @param[in] RemainingDevicePath Optional parameter used to pick a specific child 80 76 device to start. 77 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. 81 78 82 79 @retval EFI_SUCCES This driver is added to ControllerHandle … … 89 86 EFI_STATUS 90 87 EFIAPI 91 IpSecDriverBindingStart ( 92 IN EFI_DRIVER_BINDING_PROTOCOL *This, 93 IN EFI_HANDLE ControllerHandle, 94 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 88 IpSecStart ( 89 IN EFI_DRIVER_BINDING_PROTOCOL *This, 90 IN EFI_HANDLE ControllerHandle, 91 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL, 92 IN UINT8 IpVersion 95 93 ) 96 94 { 97 95 EFI_IPSEC2_PROTOCOL *IpSec; 98 96 EFI_STATUS Status; 99 EFI_STATUS Udp4Status;100 EFI_STATUS Udp6Status;101 97 IPSEC_PRIVATE_DATA *Private; 102 98 … … 112 108 Private = IPSEC_PRIVATE_DATA_FROM_IPSEC (IpSec); 113 109 114 // 115 // If udp4 sb is on the controller, try to open a udp4 io for input. 116 // 117 Udp4Status = gBS->OpenProtocol ( 118 ControllerHandle, 119 &gEfiUdp4ServiceBindingProtocolGuid, 120 NULL, 121 This->DriverBindingHandle, 122 ControllerHandle, 123 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 124 ); 125 126 if (!EFI_ERROR (Udp4Status)) { 127 Udp4Status = IkeOpenInputUdp4 (Private, ControllerHandle); 128 } 129 // 130 // If udp6 sb is on the controller, try to open a udp6 io for input. 131 // 132 Udp6Status = gBS->OpenProtocol ( 133 ControllerHandle, 134 &gEfiUdp6ServiceBindingProtocolGuid, 135 NULL, 136 This->DriverBindingHandle, 137 ControllerHandle, 138 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 139 ); 140 141 if (!EFI_ERROR (Udp6Status)) { 142 Udp6Status = IkeOpenInputUdp6 (Private, ControllerHandle); 143 } 144 145 if (!EFI_ERROR (Udp4Status) || !EFI_ERROR (Udp6Status)) { 146 return EFI_SUCCESS; 147 } 148 149 return EFI_DEVICE_ERROR; 150 } 151 152 /** 153 Stop this driver on ControllerHandle. 110 if (IpVersion == IP_VERSION_4) { 111 // 112 // Try to open a udp4 io for input. 113 // 114 Status = gBS->OpenProtocol ( 115 ControllerHandle, 116 &gEfiUdp4ServiceBindingProtocolGuid, 117 NULL, 118 This->DriverBindingHandle, 119 ControllerHandle, 120 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 121 ); 122 123 if (!EFI_ERROR (Status)) { 124 Status = IkeOpenInputUdp4 (Private, ControllerHandle, This->DriverBindingHandle); 125 } 126 } else { 127 // 128 // Try to open a udp6 io for input. 129 // 130 Status = gBS->OpenProtocol ( 131 ControllerHandle, 132 &gEfiUdp6ServiceBindingProtocolGuid, 133 NULL, 134 This->DriverBindingHandle, 135 ControllerHandle, 136 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 137 ); 138 139 if (!EFI_ERROR (Status)) { 140 Status = IkeOpenInputUdp6 (Private, ControllerHandle, This->DriverBindingHandle); 141 } 142 } 143 144 if (EFI_ERROR (Status)) { 145 return EFI_DEVICE_ERROR; 146 } 147 return EFI_SUCCESS; 148 } 149 150 /** 151 Stop this driver on ControllerHandle. This is the worker function 152 for IpSec4(6)DriverbindingStop. 154 153 155 154 @param[in] This Protocol instance pointer. … … 158 157 children is zero, stop the entire bus driver. 159 158 @param[in] ChildHandleBuffer List of Child Handles to Stop. 159 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. 160 160 161 161 @retval EFI_SUCCES This driver removed ControllerHandle. … … 165 165 EFI_STATUS 166 166 EFIAPI 167 IpSec DriverBindingStop (167 IpSecStop ( 168 168 IN EFI_DRIVER_BINDING_PROTOCOL *This, 169 169 IN EFI_HANDLE ControllerHandle, 170 170 IN UINTN NumberOfChildren, 171 IN EFI_HANDLE *ChildHandleBuffer 171 IN EFI_HANDLE *ChildHandleBuffer, 172 IN UINT8 IpVersion 172 173 ) 173 174 { … … 191 192 192 193 // 193 // Delete all SAs before stop Ipsec. 194 // 195 IkeDeleteAllSas (Private, FALSE); 196 // 197 // If has udp4 io opened on the controller, close and free it. 198 // 199 NET_LIST_FOR_EACH_SAFE (Entry, Next, &Private->Udp4List) { 200 201 UdpSrv = IPSEC_UDP_SERVICE_FROM_LIST (Entry); 202 // 203 // Find the right udp service which installed on the appointed nic handle. 204 // 205 if (UdpSrv->Input != NULL && ControllerHandle == UdpSrv->Input->UdpHandle) { 206 UdpIoFreeIo (UdpSrv->Input); 207 UdpSrv->Input = NULL; 194 // The SAs are shared by both IP4 and IP6 stack. So we skip the cleanup 195 // and leave the SAs unchanged if the other IP stack is still running. 196 // 197 if ((IpVersion == IP_VERSION_4 && Private->Udp6Num ==0) || 198 (IpVersion == IP_VERSION_6 && Private->Udp4Num ==0)) { 199 IkeDeleteAllSas (Private, FALSE); 200 } 201 202 if (IpVersion == IP_VERSION_4) { 203 // 204 // If has udp4 io opened on the controller, close and free it. 205 // 206 NET_LIST_FOR_EACH_SAFE (Entry, Next, &Private->Udp4List) { 207 208 UdpSrv = IPSEC_UDP_SERVICE_FROM_LIST (Entry); 209 // 210 // Find the right udp service which installed on the appointed nic handle. 211 // 212 if (UdpSrv->Input != NULL && ControllerHandle == UdpSrv->Input->UdpHandle) { 213 UdpIoFreeIo (UdpSrv->Input); 214 UdpSrv->Input = NULL; 215 } 216 217 if (UdpSrv->Output != NULL && ControllerHandle == UdpSrv->Output->UdpHandle) { 218 UdpIoFreeIo (UdpSrv->Output); 219 UdpSrv->Output = NULL; 220 } 221 222 if (UdpSrv->Input == NULL && UdpSrv->Output == NULL) { 223 RemoveEntryList (&UdpSrv->List); 224 FreePool (UdpSrv); 225 ASSERT (Private->Udp4Num > 0); 226 Private->Udp4Num--; 227 } 208 228 } 209 210 if (UdpSrv->Output != NULL && ControllerHandle == UdpSrv->Output->UdpHandle) { 211 UdpIoFreeIo (UdpSrv->Output); 212 UdpSrv->Output = NULL; 229 } else { 230 // 231 // If has udp6 io opened on the controller, close and free it. 232 // 233 NET_LIST_FOR_EACH_SAFE (Entry, Next, &Private->Udp6List) { 234 235 UdpSrv = IPSEC_UDP_SERVICE_FROM_LIST (Entry); 236 // 237 // Find the right udp service which installed on the appointed nic handle. 238 // 239 if (UdpSrv->Input != NULL && ControllerHandle == UdpSrv->Input->UdpHandle) { 240 UdpIoFreeIo (UdpSrv->Input); 241 UdpSrv->Input = NULL; 242 } 243 244 if (UdpSrv->Output != NULL && ControllerHandle == UdpSrv->Output->UdpHandle) { 245 UdpIoFreeIo (UdpSrv->Output); 246 UdpSrv->Output = NULL; 247 } 248 249 if (UdpSrv->Input == NULL && UdpSrv->Output == NULL) { 250 RemoveEntryList (&UdpSrv->List); 251 FreePool (UdpSrv); 252 ASSERT (Private->Udp6Num > 0); 253 Private->Udp6Num--; 254 } 213 255 } 214 215 if (UdpSrv->Input == NULL && UdpSrv->Output == NULL) {216 RemoveEntryList (&UdpSrv->List);217 FreePool (UdpSrv);218 ASSERT (Private->Udp4Num > 0);219 Private->Udp4Num--;220 }221 }222 //223 // If has udp6 io opened on the controller, close and free it.224 //225 NET_LIST_FOR_EACH_SAFE (Entry, Next, &Private->Udp6List) {226 227 UdpSrv = IPSEC_UDP_SERVICE_FROM_LIST (Entry);228 //229 // Find the right udp service which installed on the appointed nic handle.230 //231 if (UdpSrv->Input != NULL && ControllerHandle == UdpSrv->Input->UdpHandle) {232 UdpIoFreeIo (UdpSrv->Input);233 UdpSrv->Input = NULL;234 }235 236 if (UdpSrv->Output != NULL && ControllerHandle == UdpSrv->Output->UdpHandle) {237 UdpIoFreeIo (UdpSrv->Output);238 UdpSrv->Output = NULL;239 }240 241 if (UdpSrv->Input == NULL && UdpSrv->Output == NULL) {242 RemoveEntryList (&UdpSrv->List);243 FreePool (UdpSrv);244 ASSERT (Private->Udp6Num > 0);245 Private->Udp6Num--;246 }247 256 } 248 257 … … 250 259 } 251 260 252 EFI_DRIVER_BINDING_PROTOCOL gIpSecDriverBinding = { 253 IpSecDriverBindingSupported, 254 IpSecDriverBindingStart, 255 IpSecDriverBindingStop, 261 /** 262 Test to see if this driver supports ControllerHandle. 263 264 @param[in] This Protocol instance pointer. 265 @param[in] ControllerHandle Handle of device to test. 266 @param[in] RemainingDevicePath Optional parameter used to pick a specific child 267 device to start. 268 269 @retval EFI_SUCCES This driver supports this device. 270 @retval EFI_ALREADY_STARTED This driver is already running on this device. 271 @retval other This driver does not support this device. 272 273 **/ 274 EFI_STATUS 275 EFIAPI 276 IpSec4DriverBindingSupported ( 277 IN EFI_DRIVER_BINDING_PROTOCOL *This, 278 IN EFI_HANDLE ControllerHandle, 279 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 280 ) 281 { 282 return IpSecSupported ( 283 This, 284 ControllerHandle, 285 RemainingDevicePath, 286 IP_VERSION_4 287 ); 288 } 289 290 /** 291 Start this driver on ControllerHandle. 292 293 @param[in] This Protocol instance pointer. 294 @param[in] ControllerHandle Handle of device to bind driver to. 295 @param[in] RemainingDevicePath Optional parameter used to pick a specific child 296 device to start. 297 298 @retval EFI_SUCCES This driver is added to ControllerHandle 299 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle 300 @retval EFI_DEVICE_ERROR The device could not be started due to a device error. 301 Currently not implemented. 302 @retval other This driver does not support this device 303 304 **/ 305 EFI_STATUS 306 EFIAPI 307 IpSec4DriverBindingStart ( 308 IN EFI_DRIVER_BINDING_PROTOCOL *This, 309 IN EFI_HANDLE ControllerHandle, 310 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 311 ) 312 { 313 return IpSecStart ( 314 This, 315 ControllerHandle, 316 RemainingDevicePath, 317 IP_VERSION_4 318 ); 319 } 320 321 /** 322 Stop this driver on ControllerHandle. 323 324 @param[in] This Protocol instance pointer. 325 @param[in] ControllerHandle Handle of a device to stop the driver on. 326 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If the number of 327 children is zero, stop the entire bus driver. 328 @param[in] ChildHandleBuffer List of Child Handles to Stop. 329 330 @retval EFI_SUCCES This driver removed ControllerHandle. 331 @retval other This driver was not removed from this device. 332 333 **/ 334 EFI_STATUS 335 EFIAPI 336 IpSec4DriverBindingStop ( 337 IN EFI_DRIVER_BINDING_PROTOCOL *This, 338 IN EFI_HANDLE ControllerHandle, 339 IN UINTN NumberOfChildren, 340 IN EFI_HANDLE *ChildHandleBuffer 341 ) 342 { 343 return IpSecStop ( 344 This, 345 ControllerHandle, 346 NumberOfChildren, 347 ChildHandleBuffer, 348 IP_VERSION_4 349 ); 350 } 351 352 /** 353 Test to see if this driver supports ControllerHandle. 354 355 @param[in] This Protocol instance pointer. 356 @param[in] ControllerHandle Handle of device to test. 357 @param[in] RemainingDevicePath Optional parameter used to pick a specific child 358 device to start. 359 360 @retval EFI_SUCCES This driver supports this device. 361 @retval EFI_ALREADY_STARTED This driver is already running on this device. 362 @retval other This driver does not support this device. 363 364 **/ 365 EFI_STATUS 366 EFIAPI 367 IpSec6DriverBindingSupported ( 368 IN EFI_DRIVER_BINDING_PROTOCOL *This, 369 IN EFI_HANDLE ControllerHandle, 370 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 371 ) 372 { 373 return IpSecSupported ( 374 This, 375 ControllerHandle, 376 RemainingDevicePath, 377 IP_VERSION_6 378 ); 379 } 380 381 /** 382 Start this driver on ControllerHandle. 383 384 @param[in] This Protocol instance pointer. 385 @param[in] ControllerHandle Handle of device to bind driver to. 386 @param[in] RemainingDevicePath Optional parameter used to pick a specific child 387 device to start. 388 389 @retval EFI_SUCCES This driver is added to ControllerHandle 390 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle 391 @retval EFI_DEVICE_ERROR The device could not be started due to a device error. 392 Currently not implemented. 393 @retval other This driver does not support this device 394 395 **/ 396 EFI_STATUS 397 EFIAPI 398 IpSec6DriverBindingStart ( 399 IN EFI_DRIVER_BINDING_PROTOCOL *This, 400 IN EFI_HANDLE ControllerHandle, 401 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 402 ) 403 { 404 return IpSecStart ( 405 This, 406 ControllerHandle, 407 RemainingDevicePath, 408 IP_VERSION_6 409 ); 410 } 411 412 /** 413 Stop this driver on ControllerHandle. 414 415 @param[in] This Protocol instance pointer. 416 @param[in] ControllerHandle Handle of a device to stop the driver on. 417 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If the number of 418 children is zero, stop the entire bus driver. 419 @param[in] ChildHandleBuffer List of Child Handles to Stop. 420 421 @retval EFI_SUCCES This driver removed ControllerHandle. 422 @retval other This driver was not removed from this device. 423 424 **/ 425 EFI_STATUS 426 EFIAPI 427 IpSec6DriverBindingStop ( 428 IN EFI_DRIVER_BINDING_PROTOCOL *This, 429 IN EFI_HANDLE ControllerHandle, 430 IN UINTN NumberOfChildren, 431 IN EFI_HANDLE *ChildHandleBuffer 432 ) 433 { 434 return IpSecStop ( 435 This, 436 ControllerHandle, 437 NumberOfChildren, 438 ChildHandleBuffer, 439 IP_VERSION_6 440 ); 441 } 442 443 EFI_DRIVER_BINDING_PROTOCOL gIpSec4DriverBinding = { 444 IpSec4DriverBindingSupported, 445 IpSec4DriverBindingStart, 446 IpSec4DriverBindingStop, 447 0xa, 448 NULL, 449 NULL 450 }; 451 452 EFI_DRIVER_BINDING_PROTOCOL gIpSec6DriverBinding = { 453 IpSec6DriverBindingSupported, 454 IpSec6DriverBindingStart, 455 IpSec6DriverBindingStop, 256 456 0xa, 257 457 NULL, … … 387 587 ImageHandle, 388 588 SystemTable, 389 &gIpSec DriverBinding,589 &gIpSec4DriverBinding, 390 590 ImageHandle, 391 591 &gIpSecComponentName, … … 396 596 } 397 597 598 Status = EfiLibInstallDriverBindingComponentName2 ( 599 ImageHandle, 600 SystemTable, 601 &gIpSec6DriverBinding, 602 NULL, 603 &gIpSecComponentName, 604 &gIpSecComponentName2 605 ); 606 if (EFI_ERROR (Status)) { 607 goto ON_UNINSTALL_IPSEC4_DB; 608 } 609 398 610 return Status; 611 612 ON_UNINSTALL_IPSEC4_DB: 613 gBS->UninstallMultipleProtocolInterfaces ( 614 ImageHandle, 615 &gEfiDriverBindingProtocolGuid, 616 &gIpSec4DriverBinding, 617 &gEfiComponentName2ProtocolGuid, 618 &gIpSecComponentName2, 619 &gEfiComponentNameProtocolGuid, 620 &gIpSecComponentName, 621 NULL 622 ); 399 623 400 624 ON_UNINSTALL_IPSEC: -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IpSecDxe.inf
r48674 r58459 1 1 ## @file 2 # Component description file for IpSec module.2 # Packet-level security for IP datagram. 3 3 # 4 # Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 4 # This driver provides EFI IPsec2 Protocol which is used to abstract the ability 5 # to deal with the individual packets sent and received by the host and provide 6 # packet-level security for IP datagram. It provides the IP packet protection via 7 # ESP and it supports IKEv2 for key negotiation. 8 # 9 # Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 10 # 6 11 # This program and the accompanying materials … … 22 27 23 28 ENTRY_POINT = IpSecDriverEntryPoint 29 MODULE_UNI_FILE = IpSecDxe.uni 24 30 25 31 # … … 84 90 85 91 [Protocols] 86 gEfiIp4ConfigProtocolGuid # PROTOCOL ALWAYS_CONSUMED87 gEfiUdp4ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED88 gEfiUdp4ProtocolGuid # PROTOCOL ALWAYS_CONSUMED89 gEfiUdp6ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED90 gEfiUdp6ProtocolGuid # PROTOCOL ALWAYS_CONSUMED91 gEfiIpSecConfigProtocolGuid # PROTOCOL ALWAYS_PRODUCED92 gEfiIpSec2ProtocolGuid # PROTOCOL ALWAYS_PRODUCED92 gEfiIp4ConfigProtocolGuid ## SOMETIMES_CONSUMES 93 gEfiUdp4ServiceBindingProtocolGuid ## SOMETIMES_CONSUMES 94 gEfiUdp4ProtocolGuid ## SOMETIMES_CONSUMES 95 gEfiUdp6ServiceBindingProtocolGuid ## SOMETIMES_CONSUMES 96 gEfiUdp6ProtocolGuid ## SOMETIMES_CONSUMES 97 gEfiIpSecConfigProtocolGuid ## PRODUCES 98 gEfiIpSec2ProtocolGuid ## PRODUCES 93 99 94 100 [Pcd] 95 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecCertificateEnabled 96 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCaFile 97 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCaFileSize 98 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCertificate 99 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCertificateSize 100 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCertificateKey 101 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCertificateKeySize 101 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecCertificateEnabled ## SOMETIMES_CONSUMES 102 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCaFile ## SOMETIMES_CONSUMES 103 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCaFileSize ## SOMETIMES_CONSUMES 104 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCertificate ## SOMETIMES_CONSUMES 105 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCertificateSize ## SOMETIMES_CONSUMES 106 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCertificateKey ## SOMETIMES_CONSUMES 107 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCertificateKeySize ## SOMETIMES_CONSUMES 108 109 [UserExtensions.TianoCore."ExtraFiles"] 110 IpSecDxeExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Mtftp6Dxe/ComponentName.c
r48674 r58459 2 2 UEFI Component Name(2) protocol implementation for Mtftp6 driver. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 170 170 } 171 171 }; 172 173 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gMtftp6ControllerNameTable = NULL; 172 174 173 175 /** … … 228 230 229 231 /** 232 Update the component name for the Mtftp6 child handle. 233 234 @param Mtftp6[in] A pointer to the EFI_MTFTP6_PROTOCOL. 235 236 237 @retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully. 238 @retval EFI_INVALID_PARAMETER The input parameter is invalid. 239 240 **/ 241 EFI_STATUS 242 UpdateName ( 243 IN EFI_MTFTP6_PROTOCOL *Mtftp6 244 ) 245 { 246 EFI_STATUS Status; 247 CHAR16 HandleName[128]; 248 EFI_MTFTP6_MODE_DATA Mtftp6ModeData; 249 CHAR16 Address[sizeof"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"]; 250 251 if (Mtftp6 == NULL) { 252 return EFI_INVALID_PARAMETER; 253 } 254 255 // 256 // Format the child name into the string buffer. 257 // 258 Status = Mtftp6->GetModeData (Mtftp6, &Mtftp6ModeData); 259 if (!EFI_ERROR (Status)) { 260 Status = NetLibIp6ToStr (&Mtftp6ModeData.ConfigData.ServerIp, Address, sizeof(Address)); 261 if (EFI_ERROR (Status)) { 262 return Status; 263 } 264 UnicodeSPrint (HandleName, sizeof (HandleName), 265 L"MTFTPv6(ServerIp=%s, InitialServerPort=%d)", 266 Address, 267 Mtftp6ModeData.ConfigData.InitialServerPort 268 ); 269 } else { 270 UnicodeSPrint (HandleName, 0x100, L"MTFTPv6(%r)", Status); 271 } 272 273 if (gMtftp6ControllerNameTable != NULL) { 274 FreeUnicodeStringTable (gMtftp6ControllerNameTable); 275 gMtftp6ControllerNameTable = NULL; 276 } 277 278 Status = AddUnicodeString2 ( 279 "eng", 280 gMtftp6ComponentName.SupportedLanguages, 281 &gMtftp6ControllerNameTable, 282 HandleName, 283 TRUE 284 ); 285 if (EFI_ERROR (Status)) { 286 return Status; 287 } 288 289 return AddUnicodeString2 ( 290 "en", 291 gMtftp6ComponentName2.SupportedLanguages, 292 &gMtftp6ControllerNameTable, 293 HandleName, 294 FALSE 295 ); 296 } 297 298 299 /** 230 300 Retrieves a Unicode string that is the user-readable name of the controller 231 301 that is being managed by a driver. … … 305 375 ) 306 376 { 307 return EFI_UNSUPPORTED; 377 EFI_STATUS Status; 378 EFI_MTFTP6_PROTOCOL *Mtftp6; 379 380 // 381 // Only provide names for child handles. 382 // 383 if (ChildHandle == NULL) { 384 return EFI_UNSUPPORTED; 385 } 386 387 // 388 // Make sure this driver produced ChildHandle 389 // 390 Status = EfiTestChildHandle ( 391 ControllerHandle, 392 ChildHandle, 393 &gEfiUdp6ProtocolGuid 394 ); 395 if (EFI_ERROR (Status)) { 396 return Status; 397 } 398 399 // 400 // Retrieve an instance of a produced protocol from ChildHandle 401 // 402 Status = gBS->OpenProtocol ( 403 ChildHandle, 404 &gEfiMtftp6ProtocolGuid, 405 (VOID **)&Mtftp6, 406 NULL, 407 NULL, 408 EFI_OPEN_PROTOCOL_GET_PROTOCOL 409 ); 410 if (EFI_ERROR (Status)) { 411 return Status; 412 } 413 414 // 415 // Update the component name for this child handle. 416 // 417 Status = UpdateName (Mtftp6); 418 if (EFI_ERROR (Status)) { 419 return Status; 420 } 421 422 return LookupUnicodeString2 ( 423 Language, 424 This->SupportedLanguages, 425 gMtftp6ControllerNameTable, 426 ControllerName, 427 (BOOLEAN)(This == &gMtftp6ComponentName) 428 ); 308 429 } 430 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Mtftp6Dxe/Mtftp6Driver.c
r48674 r58459 3 3 implementation for Mtftp6 Driver. 4 4 5 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>5 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 6 6 7 7 This program and the accompanying materials … … 34 34 35 35 /** 36 Dest ory the MTFTP6 service. The MTFTP6 service may be partly initialized,36 Destroy the MTFTP6 service. The MTFTP6 service may be partly initialized, 37 37 or partly destroyed. If a resource is destroyed, it is marked as such in 38 38 case the destroy failed and is called again later. … … 47 47 { 48 48 // 49 // Make sure all children instances have been already dest oryed.49 // Make sure all children instances have been already destroyed. 50 50 // 51 51 ASSERT (Service->ChildrenNum == 0); … … 99 99 Mtftp6Srv->Controller = Controller; 100 100 Mtftp6Srv->Image = Image; 101 Mtftp6Srv->InDestory = FALSE;102 101 Mtftp6Srv->ChildrenNum = 0; 103 102 … … 220 219 221 220 Mtftp6Ins->Signature = MTFTP6_INSTANCE_SIGNATURE; 222 Mtftp6Ins->InDest ory = FALSE;221 Mtftp6Ins->InDestroy = FALSE; 223 222 Mtftp6Ins->Service = Service; 224 223 … … 235 234 236 235 return EFI_SUCCESS; 236 } 237 238 239 /** 240 Callback function which provided by user to remove one node in NetDestroyLinkList process. 241 242 @param[in] Entry The entry to be removed. 243 @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList. 244 245 @retval EFI_SUCCESS The entry has been removed successfully. 246 @retval Others Fail to remove the entry. 247 248 **/ 249 EFI_STATUS 250 EFIAPI 251 Mtftp6DestroyChildEntryInHandleBuffer ( 252 IN LIST_ENTRY *Entry, 253 IN VOID *Context 254 ) 255 { 256 MTFTP6_INSTANCE *Instance; 257 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 258 UINTN NumberOfChildren; 259 EFI_HANDLE *ChildHandleBuffer; 260 261 if (Entry == NULL || Context == NULL) { 262 return EFI_INVALID_PARAMETER; 263 } 264 265 Instance = NET_LIST_USER_STRUCT_S (Entry, MTFTP6_INSTANCE, Link, MTFTP6_INSTANCE_SIGNATURE); 266 ServiceBinding = ((MTFTP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ServiceBinding; 267 NumberOfChildren = ((MTFTP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->NumberOfChildren; 268 ChildHandleBuffer = ((MTFTP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ChildHandleBuffer; 269 270 if (!NetIsInHandleBuffer (Instance->Handle, NumberOfChildren, ChildHandleBuffer)) { 271 return EFI_SUCCESS; 272 } 273 274 return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle); 237 275 } 238 276 … … 430 468 ) 431 469 { 432 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;433 MTFTP6_SERVICE *Service;434 MTFTP6_INSTANCE *Instance;435 EFI_ HANDLE NicHandle;436 EFI_STATUS Status;437 EFI_TPL OldTpl;438 470 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 471 MTFTP6_SERVICE *Service; 472 EFI_HANDLE NicHandle; 473 EFI_STATUS Status; 474 LIST_ENTRY *List; 475 MTFTP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context; 476 439 477 // 440 478 // Locate the Nic handle to retrieve the Mtftp6 private data. … … 443 481 444 482 if (NicHandle == NULL) { 445 return EFI_ DEVICE_ERROR;483 return EFI_SUCCESS; 446 484 } 447 485 … … 461 499 Service = MTFTP6_SERVICE_FROM_THIS (ServiceBinding); 462 500 463 if (Service->InDestory) { 464 return EFI_SUCCESS; 465 } 466 467 OldTpl = gBS->RaiseTPL (TPL_CALLBACK); 468 469 if (NumberOfChildren == 0) { 501 if (!IsListEmpty (&Service->Children)) { 470 502 // 471 // Dest ory the Mtftp6 service if there is no Mtftp6 child instance left.503 // Destroy the Mtftp6 child instance in ChildHandleBuffer. 472 504 // 473 Service->InDestory = TRUE; 474 505 List = &Service->Children; 506 Context.ServiceBinding = ServiceBinding; 507 Context.NumberOfChildren = NumberOfChildren; 508 Context.ChildHandleBuffer = ChildHandleBuffer; 509 Status = NetDestroyLinkList ( 510 List, 511 Mtftp6DestroyChildEntryInHandleBuffer, 512 &Context, 513 NULL 514 ); 515 } 516 517 if (NumberOfChildren == 0 && IsListEmpty (&Service->Children)) { 518 // 519 // Destroy the Mtftp6 service if there is no Mtftp6 child instance left. 520 // 475 521 gBS->UninstallProtocolInterface ( 476 522 NicHandle, … … 480 526 481 527 Mtftp6DestroyService (Service); 482 483 } else { 484 // 485 // Destory the Mtftp6 child instance one by one. 486 // 487 while (!IsListEmpty (&Service->Children)) { 488 Instance = NET_LIST_HEAD (&Service->Children, MTFTP6_INSTANCE, Link); 489 Mtftp6ServiceBindingDestroyChild (ServiceBinding, Instance->Handle); 490 } 491 492 if (Service->ChildrenNum != 0) { 493 Status = EFI_DEVICE_ERROR; 494 } 495 } 496 497 gBS->RestoreTPL (OldTpl); 528 Status = EFI_SUCCESS; 529 } 530 498 531 return Status; 499 532 } … … 658 691 659 692 // 660 // Check whether the instance already in destory state.661 // 662 if (Instance->InDest ory) {693 // Check whether the instance already in Destroy state. 694 // 695 if (Instance->InDestroy) { 663 696 return EFI_SUCCESS; 664 697 } … … 666 699 OldTpl = gBS->RaiseTPL (TPL_CALLBACK); 667 700 668 Instance->InDest ory = TRUE;701 Instance->InDestroy = TRUE; 669 702 670 703 gBS->CloseProtocol ( … … 675 708 ); 676 709 710 if (Instance->UdpIo != NULL) { 711 gBS->CloseProtocol ( 712 Instance->UdpIo->UdpHandle, 713 &gEfiUdp6ProtocolGuid, 714 gMtftp6DriverBinding.DriverBindingHandle, 715 Instance->Handle 716 ); 717 } 718 719 if (Instance->McastUdpIo != NULL) { 720 gBS->CloseProtocol ( 721 Instance->McastUdpIo->UdpHandle, 722 &gEfiUdp6ProtocolGuid, 723 gMtftp6DriverBinding.DriverBindingHandle, 724 Instance->Handle 725 ); 726 } 727 677 728 // 678 729 // Uninstall the MTFTP6 protocol first to enable a top down destruction. 679 730 // 731 gBS->RestoreTPL (OldTpl); 680 732 Status = gBS->UninstallProtocolInterface ( 681 733 ChildHandle, … … 683 735 Mtftp6 684 736 ); 685 686 if (EFI_ERROR (Status)) { 687 Instance->InDest ory = FALSE;737 OldTpl = gBS->RaiseTPL (TPL_CALLBACK); 738 if (EFI_ERROR (Status)) { 739 Instance->InDestroy = FALSE; 688 740 gBS->RestoreTPL (OldTpl); 689 741 return Status; … … 696 748 Service->ChildrenNum --; 697 749 750 gBS->RestoreTPL (OldTpl); 751 698 752 Mtftp6DestroyInstance (Instance); 699 753 700 gBS->RestoreTPL (OldTpl);701 702 754 return EFI_SUCCESS; 703 755 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Mtftp6Dxe/Mtftp6Driver.h
r48674 r58459 3 3 declaration for Mtftp6 Driver. 4 4 5 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>5 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 6 6 7 7 This program and the accompanying materials … … 22 22 extern EFI_COMPONENT_NAME_PROTOCOL gMtftp6ComponentName; 23 23 extern EFI_COMPONENT_NAME2_PROTOCOL gMtftp6ComponentName2; 24 extern EFI_UNICODE_STRING_TABLE *gMtftp6ControllerNameTable; 24 25 25 26 /** -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
r48674 r58459 1 1 ## @file 2 # C omponent description file for Mtftp6 module.2 # Client-side Mtftp6 service. 3 3 # 4 # Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> 4 # This module produces EFI MTFTPv6 Protocol which provides basic services for 5 # client-side unicast and/or multicast TFTP. 6 # 7 # Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 8 # 6 9 # This program and the accompanying materials … … 22 25 ENTRY_POINT = Mtftp6DriverEntryPoint 23 26 UNLOAD_IMAGE = NetLibDefaultUnload 27 MODULE_UNI_FILE = Mtftp6Dxe.uni 28 24 29 # 25 30 # The following information is for reference only and not required by the build tools. … … 63 68 64 69 [Protocols] 65 gEfiUdp6ServiceBindingProtocolGuid 66 gEfiUdp6ProtocolGuid 67 gEfiMtftp6ServiceBindingProtocolGuid 68 gEfiMtftp6ProtocolGuid 70 gEfiUdp6ServiceBindingProtocolGuid ## TO_START 71 gEfiUdp6ProtocolGuid ## TO_START 72 gEfiMtftp6ServiceBindingProtocolGuid ## BY_START 73 gEfiMtftp6ProtocolGuid ## BY_START 69 74 75 [UserExtensions.TianoCore."ExtraFiles"] 76 Mtftp6DxeExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Mtftp6Dxe/Mtftp6Impl.c
r48674 r58459 9 9 RFC2349 - TFTP Timeout Interval and Transfer Size Options 10 10 11 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>11 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 12 12 13 13 This program and the accompanying materials … … 190 190 // the configuration, so delay udpio configuration in each operation. 191 191 // 192 Instance->UdpIo = UdpIoCreateIo ( 193 Service->Controller, 192 if (Instance->UdpIo == NULL) { 193 Instance->UdpIo = UdpIoCreateIo ( 194 Service->Controller, 195 Service->Image, 196 Mtftp6ConfigDummyUdpIo, 197 UDP_IO_UDP6_VERSION, 198 NULL 199 ); 200 if (Instance->UdpIo != NULL) { 201 Status = gBS->OpenProtocol ( 202 Instance->UdpIo->UdpHandle, 203 &gEfiUdp6ProtocolGuid, 204 (VOID **) &Udp6, 194 205 Service->Image, 195 Mtftp6ConfigDummyUdpIo, 196 UDP_IO_UDP6_VERSION, 197 NULL 206 Instance->Handle, 207 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 198 208 ); 209 if (EFI_ERROR (Status)) { 210 goto ON_EXIT; 211 } 212 } 213 } 199 214 200 215 if (Instance->UdpIo == NULL) { … … 621 636 622 637 // 623 // Check the instance whether configured or in dest ory.638 // Check the instance whether configured or in destroy. 624 639 // 625 640 if (Instance->Config == NULL) { 626 641 return EFI_NOT_STARTED; 627 } else if (Instance->InDestory) {628 return EFI_DEVICE_ERROR;629 642 } 630 643 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h
r48674 r58459 2 2 Mtftp6 internal data structure and definition declaration. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved. <BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved. <BR> 5 5 6 6 This program and the accompanying materials … … 30 30 #include <Library/BaseLib.h> 31 31 #include <Library/NetLib.h> 32 #include <Library/PrintLib.h> 32 33 33 34 typedef struct _MTFTP6_SERVICE MTFTP6_SERVICE; … … 95 96 BOOLEAN IsTransmitted; 96 97 BOOLEAN IsMaster; 97 BOOLEAN InDest ory;98 BOOLEAN InDestroy; 98 99 }; 99 100 … … 118 119 // 119 120 UDP_IO *DummyUdpIo; 120 BOOLEAN InDestory;121 121 }; 122 123 typedef struct { 124 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 125 UINTN NumberOfChildren; 126 EFI_HANDLE *ChildHandleBuffer; 127 } MTFTP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT; 122 128 123 129 /** -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Mtftp6Dxe/Mtftp6Rrq.c
r48674 r58459 2 2 Mtftp6 Rrq process functions implementation. 3 3 4 Copyright (c) 2009 - 201 2, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 60 60 // 61 61 Instance->CurRetry = 0; 62 Instance->LastPacket = Packet; 62 63 63 64 return Mtftp6TransmitPacket (Instance, Packet); … … 454 455 EFI_STATUS Status; 455 456 INTN Expected; 457 EFI_UDP6_PROTOCOL *Udp6; 456 458 457 459 *IsCompleted = FALSE; 460 Options = NULL; 458 461 459 462 // … … 548 551 549 552 Instance->McastPort = ExtInfo.McastPort; 550 Instance->McastUdpIo = UdpIoCreateIo ( 551 Instance->Service->Controller, 552 Instance->Service->Image, 553 Mtftp6RrqConfigMcastUdpIo, 554 UDP_IO_UDP6_VERSION, 555 Instance 556 ); 553 if (Instance->McastUdpIo == NULL) { 554 Instance->McastUdpIo = UdpIoCreateIo ( 555 Instance->Service->Controller, 556 Instance->Service->Image, 557 Mtftp6RrqConfigMcastUdpIo, 558 UDP_IO_UDP6_VERSION, 559 Instance 560 ); 561 if (Instance->McastUdpIo != NULL) { 562 Status = gBS->OpenProtocol ( 563 Instance->McastUdpIo->UdpHandle, 564 &gEfiUdp6ProtocolGuid, 565 (VOID **) &Udp6, 566 Instance->Service->Image, 567 Instance->Handle, 568 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 569 ); 570 if (EFI_ERROR (Status)) { 571 UdpIoFreeIo (Instance->McastUdpIo); 572 Instance->McastUdpIo = NULL; 573 return EFI_DEVICE_ERROR; 574 } 575 } 576 } 557 577 558 578 if (Instance->McastUdpIo == NULL) { -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Mtftp6Dxe/Mtftp6Support.c
r48674 r58459 2 2 Mtftp6 support functions implementation. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 904 904 905 905 if (Instance->McastUdpIo != NULL) { 906 gBS->CloseProtocol ( 907 Instance->McastUdpIo->UdpHandle, 908 &gEfiUdp6ProtocolGuid, 909 Instance->McastUdpIo->Image, 910 Instance->Handle 911 ); 906 912 UdpIoFreeIo (Instance->McastUdpIo); 907 913 Instance->McastUdpIo = NULL; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Mtftp6Dxe/Mtftp6Wrq.c
r48674 r58459 2 2 Mtftp6 Wrq process functions implementation. 3 3 4 Copyright (c) 2009 - 201 2, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 296 296 297 297 *IsCompleted = FALSE; 298 Options = NULL; 298 299 299 300 // -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/NetworkPkg.dec
r48674 r58459 1 1 ## @file 2 # Network Package. 2 3 # 3 # This package provides network modules that conform to UEFI 2. 2specification.4 # This package provides network modules that conform to UEFI 2.4 specification. 4 5 # 5 # Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>6 # Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR> 6 7 # 7 8 # This program and the accompanying materials are licensed and made available under … … 19 20 PACKAGE_NAME = NetworkPkg 20 21 PACKAGE_GUID = 947988BE-8D5C-471a-893D-AD181C46BEBB 21 PACKAGE_VERSION = 0.93 22 PACKAGE_VERSION = 0.95 23 PACKAGE_UNI_FILE = NetworkPkg.uni 22 24 23 25 [Includes] … … 36 38 37 39 [PcdsFeatureFlag] 38 ## If true, the IKEv2 Certificate Authentication feature is enabled. 40 ## Indicates if the IPsec IKEv2 Certificate Authentication feature is enabled or not.<BR><BR> 41 # TRUE - Certificate Authentication feature is enabled.<BR> 42 # FALSE - Does not support Certificate Authentication.<BR> 43 # @Prompt Enable IPsec IKEv2 Certificate Authentication. 39 44 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecCertificateEnabled|TRUE|BOOLEAN|0x00000007 40 45 41 [PcdsFixedAtBuild] 42 ## Indicates the CA certificate used by IPsec. 46 [PcdsFixedAtBuild, PcdsPatchableInModule] 47 ## CA certificate used by IPsec. 48 # @Prompt CA file. 43 49 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCaFile|{0x30, 0x82, 0x02, 0x76, 0x30, 0x82, 0x01, 0xDF, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0x80, 0x1D, 0xB9, 0x63, 0x93, 0x7C, 0x9D, 0xE0, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x30, 0x74, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0A, 0x4D, 0x79, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x41, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x02, 0x48, 0x5A, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x4E, 0x31, 0x1C, 0x30, 0x1A, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x0D, 0x74, 0x65, 0x73, 0x74, 0x40, 0x63, 0x65, 0x72, 0x74, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x25, 0x30, 0x23, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x1C, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x30, 0x31, 0x31, 0x30, 0x31, 0x30, 0x31, 0x35, 0x33, 0x33, 0x37, 0x5A, 0x17, 0x0D, 0x31, 0x31, 0x31, 0x31, 0x30, 0x31, 0x30, 0x31, 0x35, 0x33, 0x33, 0x37, 0x5A, 0x30, 0x74, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0A, 0x4D, 0x79, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x41, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x02, 0x48, 0x5A, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x4E, 0x31, 0x1C, 0x30, 0x1A, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x0D, 0x74, 0x65, 0x73, 0x74, 0x40, 0x63, 0x65, 0x72, 0x74, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x25, 0x30, 0x23, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x1C, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xFC, 0x80, 0x5D, 0x32, 0x55, 0xC7, 0x4C, 0xC6, 0xA8, 0x2F, 0xF7, 0xEC, 0x1F, 0x75, 0x48, 0x02, 0x79, 0xEB, 0xDF, 0x17, 0x1B, 0x08, 0xBA, 0x21, 0xDD, 0xE5, 0x43, 0x06, 0xE8, 0x81, 0xC5, 0x50, 0x3C, 0x18, 0xDD, 0x53, 0xF4, 0xC9, 0xC9, 0xE1, 0x7A, 0xD3, 0xB3, 0x99, 0xA7, 0xC6, 0x43, 0x2A, 0x51, 0x65, 0x10, 0x93, 0xBA, 0x5F, 0x48, 0xAC, 0x54, 0x12, 0x70, 0x9E, 0xF2, 0x9E, 0x7D, 0xF7, 0x22, 0xAA, 0xB7, 0x19, 0xDE, 0xA9, 0x4D, 0x55, 0xAA, 0x41, 0x8F, 0x08, 0xBD, 0x74, 0xFA, 0xE5, 0x57, 0x13, 0xB4, 0x30, 0x9A, 0xBA, 0x56, 0x01, 0x55, 0x8A, 0x9B, 0x5B, 0x50, 0x29, 0x82, 0xF9, 0x00, 0x69, 0x7E, 0x7B, 0x91, 0xA7, 0x2D, 0x48, 0x1A, 0x93, 0x7C, 0xA2, 0xF9, 0x06, 0x64, 0x4B, 0x80, 0xF8, 0x47, 0x58, 0x45, 0x90, 0x09, 0xEA, 0xD6, 0x7B, 0x85, 0x49, 0x2A, 0x4E, 0xB6, 0x71, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x10, 0x30, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0xEF, 0x38, 0x6A, 0x43, 0x1C, 0x1D, 0x37, 0xBD, 0xF7, 0xCF, 0x15, 0x6A, 0x99, 0x44, 0xE1, 0xFC, 0x68, 0x6E, 0x91, 0x31, 0x9C, 0x1E, 0x8C, 0x1F, 0x72, 0x4B, 0x93, 0x16, 0x1F, 0x06, 0xFE, 0x94, 0xA9, 0x41, 0x64, 0x81, 0xFD, 0xFF, 0xE7, 0x27, 0x4D, 0xE7, 0x59, 0x55, 0xE1, 0x20, 0x14, 0x07, 0x3C, 0x26, 0x78, 0xB0, 0x72, 0x48, 0x76, 0x0C, 0x8B, 0x3F, 0x08, 0xD0, 0x75, 0x7D, 0x76, 0xA4, 0xB5, 0x56, 0xA6, 0xC9, 0x88, 0x17, 0x27, 0x95, 0x85, 0xEE, 0x42, 0x1E, 0x15, 0x0B, 0x05, 0xDC, 0x2F, 0x97, 0x7B, 0x26, 0x82, 0x62, 0x23, 0xDF, 0xBF, 0x55, 0x09, 0xBF, 0x5E, 0x28, 0x1A, 0xCA, 0x1B, 0xEC, 0xA4, 0x81, 0xB7, 0x9D, 0x91, 0xC9, 0x60, 0x5B, 0x29, 0x2B, 0x4C, 0x6F, 0x8B, 0xCC, 0x17, 0xA8, 0xD6, 0x5D, 0x6B, 0xBC, 0x0D, 0x03, 0x31, 0xB0, 0x57, 0xC9, 0xF8, 0x59, 0x88, 0x3D}|VOID*|0x00000001 44 50 45 ## Indicates the CA certificate file's size. 51 ## CA certificate file's size. 52 # @Prompt CA file's size. 46 53 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCaFileSize|0x0000027A|UINT32|0x00000002 47 54 48 ## Indicates the X509 certificate as Public Key which is used by IPsec (DER format). 55 ## X509 certificate as Public Key which is used by IPsec (DER format) 56 # @Prompt Pubic Key for remote peer. 49 57 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCertificate|{0x30, 0x82, 0x02, 0x4D, 0x30, 0x82, 0x01, 0xB6, 0x02, 0x01, 0x01, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x30, 0x74, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0A, 0x4D, 0x79, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x41, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x02, 0x48, 0x5A, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x4E, 0x31, 0x1C, 0x30, 0x1A, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x0D, 0x74, 0x65, 0x73, 0x74, 0x40, 0x63, 0x65, 0x72, 0x74, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x25, 0x30, 0x23, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x1C, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x30, 0x31, 0x31, 0x30, 0x31, 0x30, 0x32, 0x30, 0x34, 0x35, 0x39, 0x5A, 0x17, 0x0D, 0x31, 0x31, 0x31, 0x31, 0x30, 0x31, 0x30, 0x32, 0x30, 0x34, 0x35, 0x39, 0x5A, 0x30, 0x6A, 0x31, 0x0D, 0x30, 0x0B, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x04, 0x55, 0x45, 0x46, 0x49, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x02, 0x53, 0x48, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x4E, 0x31, 0x23, 0x30, 0x21, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x14, 0x75, 0x65, 0x66, 0x69, 0x2E, 0x74, 0x69, 0x61, 0x6E, 0x6F, 0x40, 0x69, 0x6E, 0x74, 0x65, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x0C, 0x30, 0x0A, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x03, 0x53, 0x53, 0x47, 0x31, 0x0C, 0x30, 0x0A, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x03, 0x53, 0x53, 0x47, 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xE9, 0x90, 0x47, 0x0D, 0x79, 0x93, 0xED, 0xF5, 0xBD, 0xC9, 0x56, 0x03, 0xDF, 0xE2, 0x71, 0xA9, 0x42, 0x3B, 0x20, 0x1E, 0xAF, 0x88, 0x9D, 0x3F, 0xE1, 0xDE, 0x61, 0xEE, 0x83, 0xC4, 0x2E, 0x48, 0x7A, 0x1F, 0x86, 0x54, 0xD2, 0xD5, 0x61, 0x94, 0xE1, 0x15, 0x79, 0x65, 0xCB, 0x39, 0xEE, 0x78, 0x68, 0x3D, 0x2C, 0xEB, 0xE4, 0x7A, 0x8D, 0x98, 0x14, 0x28, 0x7E, 0x6B, 0xFD, 0xC5, 0xF5, 0x1B, 0x62, 0xB9, 0x86, 0x7C, 0xA1, 0x7C, 0xE9, 0x8F, 0xC8, 0xF4, 0xF3, 0x95, 0x5A, 0xAF, 0x0C, 0x21, 0x39, 0xEA, 0x47, 0x5A, 0x1E, 0xBD, 0xBE, 0x7F, 0x1B, 0x0F, 0x31, 0xFB, 0xBD, 0x57, 0xAE, 0xD7, 0xCB, 0x46, 0x83, 0x8B, 0x16, 0x19, 0x74, 0xD9, 0x9E, 0x2D, 0x18, 0xE6, 0xA4, 0x5F, 0x90, 0x90, 0x54, 0xE1, 0x4B, 0x7B, 0x57, 0x76, 0xBD, 0xF4, 0xC0, 0x4D, 0x79, 0x5F, 0x64, 0x6C, 0x0D, 0x2D, 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x5A, 0x80, 0x5F, 0xD3, 0x3C, 0x93, 0x81, 0xB9, 0x1B, 0xAA, 0x08, 0x1F, 0x47, 0x9C, 0x88, 0xF3, 0x1E, 0xE6, 0x6B, 0xBB, 0x99, 0xE6, 0x23, 0x1A, 0xCB, 0x25, 0x81, 0x54, 0x51, 0x88, 0xDF, 0x9B, 0xC6, 0xBF, 0x60, 0xDB, 0x6C, 0x5D, 0x69, 0xB1, 0x3A, 0xDE, 0x94, 0xEE, 0xD7, 0x6C, 0xF2, 0x2D, 0x63, 0xD3, 0xB3, 0xAB, 0xE6, 0xB5, 0x0A, 0xBF, 0xCE, 0x61, 0xC0, 0xD3, 0x73, 0x9E, 0x80, 0xB5, 0x0C, 0xC0, 0x03, 0x57, 0xA9, 0x56, 0x59, 0x1B, 0xA2, 0x99, 0x03, 0xA6, 0xA3, 0xC4, 0x59, 0xB3, 0xD9, 0x14, 0xA1, 0x34, 0x18, 0xF3, 0x73, 0xB8, 0x54, 0xAA, 0xED, 0x7D, 0x31, 0x3E, 0x23, 0xAD, 0xF1, 0x86, 0xF7, 0xE6, 0xD9, 0x01, 0x0D, 0x68, 0xC6, 0xC5, 0x95, 0x18, 0xD2, 0x89, 0xB7, 0x06, 0x96, 0xC9, 0x11, 0xB9, 0xF0, 0xDA, 0xD9, 0x02, 0x25, 0xC4, 0xB9, 0x72, 0xF8, 0x6D, 0xC5, 0x5B}|VOID*|0x00000003 50 58 51 ## Indicates the X509 certificate file's size. 59 ## X509 certificate as Public Key's size. 60 # @Prompt Pubic Key's size. 52 61 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCertificateSize|0x251|UINT32|0x00000004 53 62 54 ## Indicates the Private Key used by IPsec (PEM format). 63 ## Private Key used by IPsec (PEM format). 64 # @Prompt Private Key. 55 65 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCertificateKey|{0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x52, 0x53, 0x41, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x50, 0x72, 0x6F, 0x63, 0x2D, 0x54, 0x79, 0x70, 0x65, 0x3A, 0x20, 0x34, 0x2C, 0x45, 0x4E, 0x43, 0x52, 0x59, 0x50, 0x54, 0x45, 0x44, 0x0A, 0x44, 0x45, 0x4B, 0x2D, 0x49, 0x6E, 0x66, 0x6F, 0x3A, 0x20, 0x44, 0x45, 0x53, 0x2D, 0x45, 0x44, 0x45, 0x33, 0x2D, 0x43, 0x42, 0x43, 0x2C, 0x32, 0x42, 0x31, 0x46, 0x42, 0x41, 0x43, 0x41, 0x38, 0x36, 0x32, 0x36, 0x33, 0x34, 0x41, 0x37, 0x0A, 0x0A, 0x61, 0x52, 0x78, 0x49, 0x58, 0x33, 0x59, 0x4D, 0x68, 0x49, 0x50, 0x41, 0x73, 0x59, 0x79, 0x6F, 0x6A, 0x49, 0x76, 0x46, 0x7A, 0x42, 0x75, 0x6B, 0x74, 0x6B, 0x4A, 0x47, 0x5A, 0x38, 0x4D, 0x64, 0x33, 0x5A, 0x53, 0x73, 0x39, 0x41, 0x2B, 0x52, 0x2B, 0x57, 0x45, 0x59, 0x41, 0x70, 0x34, 0x63, 0x4F, 0x55, 0x43, 0x4A, 0x78, 0x51, 0x2F, 0x66, 0x4A, 0x38, 0x58, 0x4F, 0x45, 0x64, 0x58, 0x38, 0x0A, 0x31, 0x63, 0x4E, 0x66, 0x4B, 0x2B, 0x49, 0x62, 0x76, 0x4B, 0x4D, 0x68, 0x55, 0x67, 0x30, 0x4B, 0x4E, 0x35, 0x38, 0x37, 0x71, 0x66, 0x2F, 0x4C, 0x31, 0x76, 0x57, 0x58, 0x6F, 0x31, 0x74, 0x5A, 0x6B, 0x59, 0x2B, 0x5A, 0x53, 0x4E, 0x63, 0x46, 0x45, 0x41, 0x76, 0x37, 0x43, 0x43, 0x50, 0x51, 0x6B, 0x64, 0x4A, 0x42, 0x48, 0x35, 0x65, 0x6B, 0x35, 0x44, 0x51, 0x2F, 0x37, 0x6D, 0x71, 0x55, 0x0A, 0x6B, 0x76, 0x78, 0x48, 0x53, 0x50, 0x70, 0x34, 0x66, 0x41, 0x71, 0x47, 0x61, 0x68, 0x54, 0x31, 0x75, 0x37, 0x37, 0x56, 0x66, 0x4E, 0x66, 0x31, 0x53, 0x74, 0x61, 0x73, 0x31, 0x6E, 0x4F, 0x67, 0x6A, 0x50, 0x31, 0x41, 0x6C, 0x7A, 0x6E, 0x6B, 0x6A, 0x57, 0x61, 0x72, 0x6A, 0x51, 0x4F, 0x73, 0x48, 0x46, 0x33, 0x41, 0x46, 0x31, 0x62, 0x61, 0x51, 0x4A, 0x50, 0x5A, 0x31, 0x6A, 0x71, 0x4C, 0x0A, 0x61, 0x30, 0x49, 0x45, 0x6E, 0x30, 0x6C, 0x59, 0x6C, 0x78, 0x35, 0x79, 0x4D, 0x6D, 0x78, 0x54, 0x47, 0x57, 0x79, 0x52, 0x35, 0x70, 0x57, 0x51, 0x35, 0x71, 0x66, 0x78, 0x2B, 0x62, 0x37, 0x64, 0x37, 0x75, 0x71, 0x67, 0x47, 0x69, 0x66, 0x36, 0x6A, 0x44, 0x47, 0x4D, 0x37, 0x68, 0x38, 0x43, 0x78, 0x2F, 0x74, 0x67, 0x2B, 0x61, 0x62, 0x45, 0x31, 0x34, 0x30, 0x2F, 0x50, 0x66, 0x6C, 0x33, 0x0A, 0x33, 0x6A, 0x50, 0x6C, 0x52, 0x75, 0x73, 0x57, 0x6F, 0x6F, 0x63, 0x49, 0x41, 0x76, 0x49, 0x74, 0x79, 0x51, 0x6D, 0x39, 0x39, 0x71, 0x74, 0x34, 0x64, 0x6E, 0x74, 0x6E, 0x74, 0x6F, 0x4A, 0x43, 0x6D, 0x4F, 0x53, 0x79, 0x71, 0x67, 0x4D, 0x6E, 0x76, 0x2F, 0x76, 0x2B, 0x51, 0x48, 0x74, 0x79, 0x4D, 0x73, 0x42, 0x64, 0x38, 0x34, 0x78, 0x45, 0x57, 0x46, 0x36, 0x72, 0x58, 0x4D, 0x52, 0x63, 0x0A, 0x53, 0x2B, 0x66, 0x68, 0x54, 0x71, 0x58, 0x74, 0x54, 0x38, 0x44, 0x50, 0x65, 0x70, 0x2F, 0x56, 0x44, 0x66, 0x65, 0x78, 0x6B, 0x41, 0x63, 0x6D, 0x63, 0x75, 0x41, 0x69, 0x6F, 0x2B, 0x79, 0x64, 0x51, 0x75, 0x49, 0x31, 0x32, 0x7A, 0x50, 0x70, 0x45, 0x68, 0x50, 0x45, 0x68, 0x31, 0x44, 0x50, 0x58, 0x73, 0x64, 0x58, 0x67, 0x64, 0x77, 0x39, 0x75, 0x46, 0x47, 0x6D, 0x63, 0x35, 0x68, 0x52, 0x0A, 0x35, 0x31, 0x57, 0x41, 0x31, 0x65, 0x63, 0x44, 0x48, 0x6A, 0x31, 0x58, 0x32, 0x45, 0x72, 0x36, 0x39, 0x59, 0x70, 0x31, 0x50, 0x69, 0x43, 0x37, 0x49, 0x47, 0x79, 0x6F, 0x71, 0x57, 0x43, 0x37, 0x69, 0x2F, 0x71, 0x6D, 0x6D, 0x72, 0x49, 0x66, 0x6F, 0x41, 0x54, 0x74, 0x39, 0x58, 0x34, 0x30, 0x54, 0x56, 0x63, 0x37, 0x42, 0x63, 0x6A, 0x34, 0x63, 0x54, 0x31, 0x78, 0x37, 0x6B, 0x70, 0x4F, 0x0A, 0x4C, 0x71, 0x67, 0x33, 0x6C, 0x50, 0x78, 0x33, 0x2B, 0x4A, 0x63, 0x33, 0x43, 0x67, 0x34, 0x79, 0x5A, 0x54, 0x66, 0x6E, 0x4A, 0x5A, 0x37, 0x48, 0x76, 0x36, 0x64, 0x68, 0x67, 0x45, 0x6D, 0x70, 0x4D, 0x73, 0x74, 0x46, 0x65, 0x35, 0x34, 0x49, 0x53, 0x76, 0x74, 0x38, 0x37, 0x59, 0x4E, 0x77, 0x74, 0x4C, 0x65, 0x6C, 0x34, 0x67, 0x50, 0x4A, 0x79, 0x53, 0x42, 0x30, 0x4B, 0x76, 0x37, 0x69, 0x0A, 0x33, 0x32, 0x74, 0x37, 0x67, 0x4F, 0x30, 0x79, 0x6D, 0x73, 0x62, 0x71, 0x4A, 0x55, 0x75, 0x79, 0x41, 0x68, 0x47, 0x64, 0x33, 0x63, 0x2B, 0x78, 0x4C, 0x46, 0x2F, 0x63, 0x63, 0x4F, 0x57, 0x44, 0x52, 0x34, 0x79, 0x72, 0x30, 0x6A, 0x79, 0x64, 0x74, 0x70, 0x79, 0x69, 0x64, 0x52, 0x45, 0x66, 0x56, 0x46, 0x66, 0x53, 0x6C, 0x39, 0x54, 0x30, 0x6D, 0x53, 0x72, 0x4E, 0x76, 0x43, 0x71, 0x45, 0x0A, 0x52, 0x52, 0x5A, 0x6E, 0x42, 0x56, 0x76, 0x37, 0x50, 0x66, 0x6C, 0x75, 0x72, 0x31, 0x59, 0x35, 0x70, 0x2F, 0x65, 0x78, 0x54, 0x63, 0x56, 0x34, 0x72, 0x4B, 0x52, 0x69, 0x6C, 0x35, 0x58, 0x6A, 0x2F, 0x39, 0x59, 0x56, 0x31, 0x4E, 0x6E, 0x6D, 0x4E, 0x2B, 0x2F, 0x31, 0x31, 0x74, 0x36, 0x58, 0x74, 0x6A, 0x72, 0x75, 0x52, 0x62, 0x33, 0x79, 0x70, 0x38, 0x76, 0x64, 0x6C, 0x61, 0x65, 0x5A, 0x0A, 0x6C, 0x67, 0x45, 0x69, 0x73, 0x30, 0x42, 0x7A, 0x4B, 0x59, 0x39, 0x59, 0x64, 0x58, 0x48, 0x64, 0x46, 0x58, 0x57, 0x59, 0x4F, 0x41, 0x71, 0x50, 0x48, 0x45, 0x65, 0x4B, 0x57, 0x79, 0x61, 0x59, 0x5A, 0x56, 0x79, 0x43, 0x70, 0x51, 0x65, 0x43, 0x53, 0x71, 0x4F, 0x71, 0x48, 0x38, 0x67, 0x42, 0x6B, 0x4F, 0x62, 0x43, 0x69, 0x72, 0x41, 0x6A, 0x65, 0x56, 0x70, 0x35, 0x7A, 0x37, 0x6B, 0x31, 0x0A, 0x64, 0x4F, 0x2F, 0x6D, 0x56, 0x74, 0x49, 0x2B, 0x57, 0x47, 0x30, 0x48, 0x72, 0x37, 0x5A, 0x4C, 0x53, 0x52, 0x78, 0x6F, 0x61, 0x44, 0x47, 0x42, 0x33, 0x4E, 0x35, 0x38, 0x4B, 0x56, 0x45, 0x4F, 0x34, 0x65, 0x46, 0x56, 0x75, 0x6E, 0x59, 0x77, 0x51, 0x42, 0x54, 0x7A, 0x4F, 0x65, 0x57, 0x39, 0x6C, 0x4B, 0x79, 0x49, 0x38, 0x67, 0x4D, 0x45, 0x57, 0x6C, 0x62, 0x4B, 0x72, 0x41, 0x45, 0x49, 0x0A, 0x46, 0x4B, 0x38, 0x7A, 0x58, 0x6F, 0x44, 0x74, 0x39, 0x6A, 0x7A, 0x54, 0x37, 0x67, 0x68, 0x6A, 0x79, 0x45, 0x54, 0x67, 0x44, 0x6C, 0x69, 0x50, 0x53, 0x49, 0x46, 0x6A, 0x79, 0x31, 0x64, 0x6B, 0x6A, 0x6D, 0x68, 0x53, 0x78, 0x79, 0x6A, 0x67, 0x62, 0x71, 0x45, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x52, 0x53, 0x41, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A}|VOID*|0x00000005 56 66 57 ## Indicates the private key's size. 67 ## Private Key's size. 68 # @Prompt Private Key's size. 58 69 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecUefiCertificateKeySize|0x3d5|UINT32|0x00000006 70 71 [UserExtensions.TianoCore."ExtraFiles"] 72 NetworkPkgExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/NetworkPkg.dsc
r48674 r58459 1 1 ## @file 2 # UEFI 2. 2Network Module Package for All Architectures2 # UEFI 2.4 Network Module Package for All Architectures 3 3 # 4 # Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 # Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 # 6 6 # This program and the accompanying materials … … 17 17 PLATFORM_NAME = NetworkPkg 18 18 PLATFORM_GUID = 3FD34E9B-E90C-44e1-B510-1F632A509F10 19 PLATFORM_VERSION = 0.9 319 PLATFORM_VERSION = 0.95 20 20 DSC_SPECIFICATION = 0x00010005 21 21 OUTPUT_DIRECTORY = Build/NetworkPkg … … 86 86 87 87 [Components] 88 NetworkPkg/IpSecDxe/IpSecDxe.inf89 88 NetworkPkg/Ip6Dxe/Ip6Dxe.inf 90 89 NetworkPkg/TcpDxe/TcpDxe.inf … … 93 92 NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf 94 93 94 NetworkPkg/Application/IfConfig6/IfConfig6.inf 95 NetworkPkg/Application/IpsecConfig/IpSecConfig.inf 96 NetworkPkg/Application/VConfig/VConfig.inf 97 95 98 [Components.IA32, Components.X64, Components.IPF] 99 NetworkPkg/IpSecDxe/IpSecDxe.inf 96 100 NetworkPkg/IScsiDxe/IScsiDxe.inf 97 101 NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf 98 102 NetworkPkg/Application/Ping6/Ping6.inf 99 NetworkPkg/Application/IfConfig6/IfConfig6.inf100 NetworkPkg/Application/IpsecConfig/IpSecConfig.inf101 NetworkPkg/Application/VConfig/VConfig.inf -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/TcpDxe/ComponentName.c
r48674 r58459 3 3 EFI_COMPONENT_NAME2_PROTOCOL. 4 4 5 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>5 Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR> 6 6 7 7 This program and the accompanying materials … … 170 170 } 171 171 }; 172 173 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gTcpControllerNameTable = NULL; 172 174 173 175 /** … … 226 228 227 229 /** 230 Update the component name for the Tcp4 child handle. 231 232 @param Tcp4[in] A pointer to the EFI_TCP4_PROTOCOL. 233 234 235 @retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully. 236 @retval EFI_INVALID_PARAMETER The input parameter is invalid. 237 238 **/ 239 EFI_STATUS 240 UpdateTcp4Name ( 241 IN EFI_TCP4_PROTOCOL *Tcp4 242 ) 243 { 244 EFI_STATUS Status; 245 CHAR16 HandleName[80]; 246 EFI_TCP4_CONFIG_DATA Tcp4ConfigData; 247 248 if (Tcp4 == NULL) { 249 return EFI_INVALID_PARAMETER; 250 } 251 252 // 253 // Format the child name into the string buffer as: 254 // TCPv4 (SrcPort=59, DestPort=60, ActiveFlag=TRUE) 255 // 256 ZeroMem (&Tcp4ConfigData, sizeof (Tcp4ConfigData)); 257 Status = Tcp4->GetModeData (Tcp4, NULL, &Tcp4ConfigData, NULL, NULL, NULL); 258 if (!EFI_ERROR (Status)) { 259 UnicodeSPrint (HandleName, sizeof (HandleName), 260 L"TCPv4 (SrcPort=%d, DestPort=%d, ActiveFlag=%s)", 261 Tcp4ConfigData.AccessPoint.StationPort, 262 Tcp4ConfigData.AccessPoint.RemotePort, 263 (Tcp4ConfigData.AccessPoint.ActiveFlag ? L"TRUE" : L"FALSE") 264 ); 265 } else if (Status == EFI_NOT_STARTED) { 266 UnicodeSPrint ( 267 HandleName, 268 sizeof (HandleName), 269 L"TCPv4 (Not started)" 270 ); 271 } else { 272 return Status; 273 } 274 275 if (gTcpControllerNameTable != NULL) { 276 FreeUnicodeStringTable (gTcpControllerNameTable); 277 gTcpControllerNameTable = NULL; 278 } 279 280 Status = AddUnicodeString2 ( 281 "eng", 282 gTcpComponentName.SupportedLanguages, 283 &gTcpControllerNameTable, 284 HandleName, 285 TRUE 286 ); 287 if (EFI_ERROR (Status)) { 288 return Status; 289 } 290 291 return AddUnicodeString2 ( 292 "en", 293 gTcpComponentName2.SupportedLanguages, 294 &gTcpControllerNameTable, 295 HandleName, 296 FALSE 297 ); 298 } 299 300 /** 301 Update the component name for the Tcp6 child handle. 302 303 @param Tcp6[in] A pointer to the EFI_TCP6_PROTOCOL. 304 305 306 @retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully. 307 @retval EFI_INVALID_PARAMETER The input parameter is invalid. 308 309 **/ 310 EFI_STATUS 311 UpdateTcp6Name ( 312 IN EFI_TCP6_PROTOCOL *Tcp6 313 ) 314 { 315 EFI_STATUS Status; 316 CHAR16 HandleName[80]; 317 EFI_TCP6_CONFIG_DATA Tcp6ConfigData; 318 319 if (Tcp6 == NULL) { 320 return EFI_INVALID_PARAMETER; 321 } 322 323 // 324 // Format the child name into the string buffer. 325 // 326 ZeroMem (&Tcp6ConfigData, sizeof (Tcp6ConfigData)); 327 Status = Tcp6->GetModeData (Tcp6, NULL, &Tcp6ConfigData, NULL, NULL, NULL); 328 if (!EFI_ERROR (Status)) { 329 UnicodeSPrint (HandleName, sizeof (HandleName), 330 L"TCPv6(SrcPort=%d, DestPort=%d, ActiveFlag=%d)", 331 Tcp6ConfigData.AccessPoint.StationPort, 332 Tcp6ConfigData.AccessPoint.RemotePort, 333 Tcp6ConfigData.AccessPoint.ActiveFlag 334 ); 335 } else if (Status == EFI_NOT_STARTED) { 336 UnicodeSPrint (HandleName, sizeof (HandleName), L"TCPv6(Not started)"); 337 } else { 338 return Status; 339 } 340 341 342 if (gTcpControllerNameTable != NULL) { 343 FreeUnicodeStringTable (gTcpControllerNameTable); 344 gTcpControllerNameTable = NULL; 345 } 346 347 Status = AddUnicodeString2 ( 348 "eng", 349 gTcpComponentName.SupportedLanguages, 350 &gTcpControllerNameTable, 351 HandleName, 352 TRUE 353 ); 354 if (EFI_ERROR (Status)) { 355 return Status; 356 } 357 358 return AddUnicodeString2 ( 359 "en", 360 gTcpComponentName2.SupportedLanguages, 361 &gTcpControllerNameTable, 362 HandleName, 363 FALSE 364 ); 365 } 366 367 /** 228 368 Retrieves a Unicode string that is the user-readable name of the controller 229 369 that is being managed by a driver. … … 301 441 ) 302 442 { 303 return EFI_UNSUPPORTED; 443 EFI_STATUS Status; 444 EFI_TCP4_PROTOCOL *Tcp4; 445 EFI_TCP6_PROTOCOL *Tcp6; 446 447 // 448 // Only provide names for child handles. 449 // 450 if (ChildHandle == NULL) { 451 return EFI_UNSUPPORTED; 452 } 453 454 // 455 // Make sure this driver produced ChildHandle 456 // 457 Status = EfiTestChildHandle ( 458 ControllerHandle, 459 ChildHandle, 460 &gEfiIp6ProtocolGuid 461 ); 462 if (!EFI_ERROR (Status)) { 463 // 464 // Retrieve an instance of a produced protocol from ChildHandle 465 // 466 Status = gBS->OpenProtocol ( 467 ChildHandle, 468 &gEfiTcp6ProtocolGuid, 469 (VOID **)&Tcp6, 470 NULL, 471 NULL, 472 EFI_OPEN_PROTOCOL_GET_PROTOCOL 473 ); 474 if (EFI_ERROR (Status)) { 475 return Status; 476 } 477 478 // 479 // Update the component name for this child handle. 480 // 481 Status = UpdateTcp6Name (Tcp6); 482 if (EFI_ERROR (Status)) { 483 return Status; 484 } 485 } 486 487 // 488 // Make sure this driver is currently managing ControllHandle 489 // 490 Status = EfiTestChildHandle ( 491 ControllerHandle, 492 ChildHandle, 493 &gEfiIp4ProtocolGuid 494 ); 495 if (!EFI_ERROR (Status)) { 496 // 497 // Retrieve an instance of a produced protocol from ChildHandle 498 // 499 Status = gBS->OpenProtocol ( 500 ChildHandle, 501 &gEfiTcp4ProtocolGuid, 502 (VOID **)&Tcp4, 503 NULL, 504 NULL, 505 EFI_OPEN_PROTOCOL_GET_PROTOCOL 506 ); 507 if (EFI_ERROR (Status)) { 508 return Status; 509 } 510 511 // 512 // Update the component name for this child handle. 513 // 514 Status = UpdateTcp4Name (Tcp4); 515 if (EFI_ERROR (Status)) { 516 return Status; 517 } 518 } 519 520 return LookupUnicodeString2 ( 521 Language, 522 This->SupportedLanguages, 523 gTcpControllerNameTable, 524 ControllerName, 525 (BOOLEAN)(This == &gTcpComponentName) 526 ); 304 527 } 528 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/TcpDxe/SockImpl.c
r48674 r58459 2 2 Implementation of the Socket. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 788 788 } 789 789 // 790 // Dest ory the RcvBuffer Queue and SendBuffer Queue790 // Destroy the RcvBuffer Queue and SendBuffer Queue 791 791 // 792 792 NetbufQueFree (Sock->RcvBuffer.DataQueue); … … 803 803 DEBUG ( 804 804 (EFI_D_WARN, 805 "SockDest ory: Delete a unaccepted socket from parent now conncnt is %d\n",805 "SockDestroy: Delete a unaccepted socket from parent now conncnt is %d\n", 806 806 Sock->Parent->ConnCnt) 807 807 ); -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/TcpDxe/SockInterface.c
r48674 r58459 2 2 Interface function of the Socket. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 130 130 131 131 /** 132 Dest ory the socket Sock and its associated protocol control block.132 Destroy the socket Sock and its associated protocol control block. 133 133 134 134 @param[in, out] Sock The socket to be destroyed. … … 147 147 ASSERT ((Sock != NULL) && (Sock->ProtoHandler != NULL)); 148 148 149 if (Sock->I sDestroyed) {149 if (Sock->InDestroy) { 150 150 return EFI_SUCCESS; 151 151 } 152 152 153 Sock->I sDestroyed= TRUE;153 Sock->InDestroy = TRUE; 154 154 155 155 Status = EfiAcquireLockOrFail (&(Sock->Lock)); … … 178 178 ); 179 179 180 Sock->I sDestroyed= FALSE;180 Sock->InDestroy = FALSE; 181 181 } else if (SOCK_IS_CONFIGURED (Sock)) { 182 182 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/TcpDxe/Socket.h
r48674 r58459 2 2 Common head file for TCP socket. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 478 478 SOCK_BUFFER RcvBuffer; ///< Receive buffer of received data 479 479 EFI_STATUS SockError; ///< The error returned by low layer protocol 480 BOOLEAN I sDestroyed;480 BOOLEAN InDestroy; 481 481 482 482 // … … 697 697 698 698 /** 699 Dest ory the socket Sock and its associated protocol control block.699 Destroy the socket Sock and its associated protocol control block. 700 700 701 701 @param[in, out] Sock The socket to be destroyed. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/TcpDxe/TcpDispatcher.c
r48674 r58459 2 2 The implementation of a dispatch routine for processing TCP requests. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 305 305 { 306 306 SOCKET *Sock; 307 TCP_PROTO_DATA *TcpProto;308 307 309 308 IpIoConfigIp (Tcb->IpInfo, NULL); 310 309 311 310 Sock = Tcb->Sk; 312 TcpProto = (TCP_PROTO_DATA *) Sock->ProtoReserved;313 311 314 312 if (SOCK_IS_CONFIGURED (Sock)) { … … 328 326 Sock->DevicePath = NULL; 329 327 } 330 331 TcpSetVariableData (TcpProto->TcpService);332 328 } 333 329 … … 335 331 NetbufFreeList (&Tcb->RcvQue); 336 332 Tcb->State = TCP_CLOSED; 333 Tcb->RemoteIpZero = FALSE; 337 334 } 338 335 … … 354 351 TCP_PROTO_DATA *ProtoData; 355 352 IP_IO *IpIo; 356 353 EFI_STATUS Status; 354 VOID *Ip; 355 EFI_GUID *IpProtocolGuid; 356 357 if (Sk->IpVersion == IP_VERSION_4) { 358 IpProtocolGuid = &gEfiIp4ProtocolGuid; 359 } else { 360 IpProtocolGuid = &gEfiIp6ProtocolGuid; 361 } 362 357 363 Tcb = AllocateZeroPool (sizeof (TCP_CB)); 358 364 … … 377 383 } 378 384 385 // 386 // Open the new created IP instance BY_CHILD. 387 // 388 Status = gBS->OpenProtocol ( 389 Tcb->IpInfo->ChildHandle, 390 IpProtocolGuid, 391 &Ip, 392 IpIo->Image, 393 Sk->SockHandle, 394 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 395 ); 396 if (EFI_ERROR (Status)) { 397 IpIoRemoveIp (IpIo, Tcb->IpInfo); 398 return Status; 399 } 400 379 401 InitializeListHead (&Tcb->List); 380 402 InitializeListHead (&Tcb->SndQue); … … 401 423 TCP_PROTO_DATA *ProtoData; 402 424 TCP_CB *Tcb; 403 425 EFI_GUID *IpProtocolGuid; 426 427 if (Sk->IpVersion == IP_VERSION_4) { 428 IpProtocolGuid = &gEfiIp4ProtocolGuid; 429 } else { 430 IpProtocolGuid = &gEfiIp6ProtocolGuid; 431 } 432 404 433 ProtoData = (TCP_PROTO_DATA *) Sk->ProtoReserved; 405 434 Tcb = ProtoData->TcpPcb; … … 409 438 TcpFlushPcb (Tcb); 410 439 440 // 441 // Close the IP protocol. 442 // 443 gBS->CloseProtocol ( 444 Tcb->IpInfo->ChildHandle, 445 IpProtocolGuid, 446 ProtoData->TcpService->IpIo->Image, 447 Sk->SockHandle 448 ); 449 411 450 IpIoRemoveIp (ProtoData->TcpService->IpIo, Tcb->IpInfo); 412 451 … … 712 751 if (Sk->IpVersion == IP_VERSION_6) { 713 752 Tcb->Tick = TCP6_REFRESH_NEIGHBOR_TICK; 753 754 if (NetIp6IsUnspecifiedAddr (&Tcb->RemoteEnd.Ip.v6)) { 755 Tcb->RemoteIpZero = TRUE; 756 } 714 757 } 715 758 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/TcpDxe/TcpDriver.c
r48674 r58459 2 2 The driver binding and service binding protocol for the TCP driver. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 67 67 }; 68 68 69 EFI_DRIVER_BINDING_PROTOCOL gTcpDriverBinding = { 70 TcpDriverBindingSupported, 71 TcpDriverBindingStart, 72 TcpDriverBindingStop, 69 EFI_DRIVER_BINDING_PROTOCOL gTcp4DriverBinding = { 70 Tcp4DriverBindingSupported, 71 Tcp4DriverBindingStart, 72 Tcp4DriverBindingStop, 73 0xa, 74 NULL, 75 NULL 76 }; 77 78 EFI_DRIVER_BINDING_PROTOCOL gTcp6DriverBinding = { 79 Tcp6DriverBindingSupported, 80 Tcp6DriverBindingStart, 81 Tcp6DriverBindingStop, 73 82 0xa, 74 83 NULL, … … 173 182 ImageHandle, 174 183 SystemTable, 175 &gTcp DriverBinding,184 &gTcp4DriverBinding, 176 185 ImageHandle, 177 186 &gTcpComponentName, … … 179 188 ); 180 189 if (EFI_ERROR (Status)) { 190 return Status; 191 } 192 193 // 194 // Install the TCP Driver Binding Protocol 195 // 196 Status = EfiLibInstallDriverBindingComponentName2 ( 197 ImageHandle, 198 SystemTable, 199 &gTcp6DriverBinding, 200 NULL, 201 &gTcpComponentName, 202 &gTcpComponentName2 203 ); 204 if (EFI_ERROR (Status)) { 205 gBS->UninstallMultipleProtocolInterfaces ( 206 ImageHandle, 207 &gEfiDriverBindingProtocolGuid, 208 &gTcp4DriverBinding, 209 &gEfiComponentName2ProtocolGuid, 210 &gTcpComponentName2, 211 &gEfiComponentNameProtocolGuid, 212 &gTcpComponentName, 213 NULL 214 ); 181 215 return Status; 182 216 } … … 316 350 } 317 351 318 TcpSetVariableData (TcpServiceData);319 320 352 return EFI_SUCCESS; 321 353 … … 324 356 if (TcpServiceData->IpIo != NULL) { 325 357 IpIoDestroy (TcpServiceData->IpIo); 358 TcpServiceData->IpIo = NULL; 326 359 } 327 360 … … 329 362 330 363 return Status; 364 } 365 366 /** 367 Callback function which provided by user to remove one node in NetDestroyLinkList process. 368 369 @param[in] Entry The entry to be removed. 370 @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList. 371 372 @retval EFI_SUCCESS The entry has been removed successfully. 373 @retval Others Fail to remove the entry. 374 375 **/ 376 EFI_STATUS 377 EFIAPI 378 TcpDestroyChildEntryInHandleBuffer ( 379 IN LIST_ENTRY *Entry, 380 IN VOID *Context 381 ) 382 { 383 SOCKET *Sock; 384 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 385 UINTN NumberOfChildren; 386 EFI_HANDLE *ChildHandleBuffer; 387 388 if (Entry == NULL || Context == NULL) { 389 return EFI_INVALID_PARAMETER; 390 } 391 392 Sock = NET_LIST_USER_STRUCT_S (Entry, SOCKET, Link, SOCK_SIGNATURE); 393 ServiceBinding = ((TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ServiceBinding; 394 NumberOfChildren = ((TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->NumberOfChildren; 395 ChildHandleBuffer = ((TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ChildHandleBuffer; 396 397 if (!NetIsInHandleBuffer (Sock->SockHandle, NumberOfChildren, ChildHandleBuffer)) { 398 return EFI_SUCCESS; 399 } 400 401 return ServiceBinding->DestroyChild (ServiceBinding, Sock->SockHandle); 331 402 } 332 403 … … 337 408 @param[in] Controller Controller handle of device to bind driver to. 338 409 @param[in] ImageHandle The TCP driver's image handle. 339 @param[in] NumberOfChildren 410 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number 340 411 of children is zero stop the entire bus driver. 412 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 413 if NumberOfChildren is 0. 341 414 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6 342 415 … … 350 423 IN EFI_HANDLE ImageHandle, 351 424 IN UINTN NumberOfChildren, 425 IN EFI_HANDLE *ChildHandleBuffer, OPTIONAL 352 426 IN UINT8 IpVersion 353 427 ) … … 359 433 TCP_SERVICE_DATA *TcpServiceData; 360 434 EFI_STATUS Status; 361 SOCKET *Sock; 435 LIST_ENTRY *List; 436 TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context; 362 437 363 438 ASSERT ((IpVersion == IP_VERSION_4) || (IpVersion == IP_VERSION_6)); … … 373 448 NicHandle = NetLibGetNicHandle (Controller, IpProtocolGuid); 374 449 if (NicHandle == NULL) { 375 return EFI_ NOT_FOUND;450 return EFI_SUCCESS; 376 451 } 377 452 … … 390 465 TcpServiceData = TCP_SERVICE_FROM_THIS (ServiceBinding); 391 466 392 if (NumberOfChildren == 0) { 467 if (NumberOfChildren != 0) { 468 List = &TcpServiceData->SocketList; 469 Context.ServiceBinding = ServiceBinding; 470 Context.NumberOfChildren = NumberOfChildren; 471 Context.ChildHandleBuffer = ChildHandleBuffer; 472 Status = NetDestroyLinkList ( 473 List, 474 TcpDestroyChildEntryInHandleBuffer, 475 &Context, 476 NULL 477 ); 478 } else if (IsListEmpty (&TcpServiceData->SocketList)) { 393 479 // 394 480 // Uninstall TCP servicebinding protocol … … 405 491 // 406 492 IpIoDestroy (TcpServiceData->IpIo); 493 TcpServiceData->IpIo = NULL; 407 494 408 495 // … … 412 499 413 500 // 414 // Clear the variable.415 //416 TcpClearVariableData (TcpServiceData);417 418 //419 501 // Release the TCP service data 420 502 // 421 503 FreePool (TcpServiceData); 422 } else { 423 424 while (!IsListEmpty (&TcpServiceData->SocketList)) { 425 Sock = NET_LIST_HEAD (&TcpServiceData->SocketList, SOCKET, Link); 426 427 ServiceBinding->DestroyChild (ServiceBinding, Sock->SockHandle); 428 } 429 } 430 431 return EFI_SUCCESS; 504 505 Status = EFI_SUCCESS; 506 } 507 508 return Status; 432 509 } 433 510 … … 447 524 EFI_STATUS 448 525 EFIAPI 449 Tcp DriverBindingSupported (526 Tcp4DriverBindingSupported ( 450 527 IN EFI_DRIVER_BINDING_PROTOCOL *This, 451 528 IN EFI_HANDLE ControllerHandle, … … 454 531 { 455 532 EFI_STATUS Status; 456 BOOLEAN IsTcp4Started;457 533 458 534 // … … 467 543 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 468 544 ); 469 if (EFI_ERROR (Status)) { 470 // 471 // Test for the Ip4ServiceBinding Protocol 472 // 473 Status = gBS->OpenProtocol ( 474 ControllerHandle, 475 &gEfiIp4ServiceBindingProtocolGuid, 476 NULL, 477 This->DriverBindingHandle, 478 ControllerHandle, 479 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 480 ); 481 if (!EFI_ERROR (Status)) { 482 return EFI_SUCCESS; 483 } 484 485 IsTcp4Started = FALSE; 486 } else { 487 IsTcp4Started = TRUE; 488 } 489 490 // 491 // Check the Tcp6ServiceBinding Protocol 545 if (!EFI_ERROR (Status)) { 546 return EFI_ALREADY_STARTED; 547 } 548 549 // 550 // Test for the Ip4ServiceBinding Protocol 551 // 552 Status = gBS->OpenProtocol ( 553 ControllerHandle, 554 &gEfiIp4ServiceBindingProtocolGuid, 555 NULL, 556 This->DriverBindingHandle, 557 ControllerHandle, 558 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 559 ); 560 return Status; 561 } 562 563 /** 564 Start this driver on ControllerHandle. 565 566 @param[in] This Protocol instance pointer. 567 @param[in] ControllerHandle Handle of device to bind driver to. 568 @param[in] RemainingDevicePath Optional parameter use to pick a specific child 569 device to start. 570 571 @retval EFI_SUCCESS The driver is added to ControllerHandle. 572 @retval EFI_OUT_OF_RESOURCES There are not enough resources to start the 573 driver. 574 @retval other The driver cannot be added to ControllerHandle. 575 576 **/ 577 EFI_STATUS 578 EFIAPI 579 Tcp4DriverBindingStart ( 580 IN EFI_DRIVER_BINDING_PROTOCOL *This, 581 IN EFI_HANDLE ControllerHandle, 582 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 583 ) 584 { 585 EFI_STATUS Status; 586 587 Status = TcpCreateService (ControllerHandle, This->DriverBindingHandle, IP_VERSION_4); 588 if ((Status == EFI_ALREADY_STARTED) || (Status == EFI_UNSUPPORTED)) { 589 Status = EFI_SUCCESS; 590 } 591 592 return Status; 593 } 594 595 /** 596 Stop this driver on ControllerHandle. 597 598 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 599 @param[in] ControllerHandle A handle to the device being stopped. The handle must 600 support a bus specific I/O protocol for the driver 601 to use to stop the device. 602 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer. 603 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 604 if NumberOfChildren is 0. 605 606 @retval EFI_SUCCESS The device was stopped. 607 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error. 608 609 **/ 610 EFI_STATUS 611 EFIAPI 612 Tcp4DriverBindingStop ( 613 IN EFI_DRIVER_BINDING_PROTOCOL *This, 614 IN EFI_HANDLE ControllerHandle, 615 IN UINTN NumberOfChildren, 616 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL 617 ) 618 { 619 return TcpDestroyService ( 620 ControllerHandle, 621 This->DriverBindingHandle, 622 NumberOfChildren, 623 ChildHandleBuffer, 624 IP_VERSION_4 625 ); 626 } 627 628 /** 629 Test to see if this driver supports ControllerHandle. 630 631 @param[in] This Protocol instance pointer. 632 @param[in] ControllerHandle Handle of device to test. 633 @param[in] RemainingDevicePath Optional parameter use to pick a specific 634 child device to start. 635 636 @retval EFI_SUCCESS This driver supports this device. 637 @retval EFI_ALREADY_STARTED This driver is already running on this device. 638 @retval other This driver does not support this device. 639 640 **/ 641 EFI_STATUS 642 EFIAPI 643 Tcp6DriverBindingSupported ( 644 IN EFI_DRIVER_BINDING_PROTOCOL *This, 645 IN EFI_HANDLE ControllerHandle, 646 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 647 ) 648 { 649 EFI_STATUS Status; 650 651 // 652 // Test for the Tcp6ServiceBinding Protocol 492 653 // 493 654 Status = gBS->OpenProtocol ( … … 499 660 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 500 661 ); 501 if (EFI_ERROR (Status)) { 502 // 503 // Test for the Ip6ServiceBinding Protocol 504 // 505 Status = gBS->OpenProtocol ( 506 ControllerHandle, 507 &gEfiIp6ServiceBindingProtocolGuid, 508 NULL, 509 This->DriverBindingHandle, 510 ControllerHandle, 511 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 512 ); 513 if (!EFI_ERROR (Status)) { 514 return EFI_SUCCESS; 515 } 516 } else if (IsTcp4Started) { 662 if (!EFI_ERROR (Status)) { 517 663 return EFI_ALREADY_STARTED; 518 664 } 519 520 return EFI_UNSUPPORTED; 665 666 // 667 // Test for the Ip6ServiceBinding Protocol 668 // 669 Status = gBS->OpenProtocol ( 670 ControllerHandle, 671 &gEfiIp6ServiceBindingProtocolGuid, 672 NULL, 673 This->DriverBindingHandle, 674 ControllerHandle, 675 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 676 ); 677 return Status; 521 678 } 522 679 … … 537 694 EFI_STATUS 538 695 EFIAPI 539 Tcp DriverBindingStart (696 Tcp6DriverBindingStart ( 540 697 IN EFI_DRIVER_BINDING_PROTOCOL *This, 541 698 IN EFI_HANDLE ControllerHandle, … … 543 700 ) 544 701 { 545 EFI_STATUS Tcp4Status; 546 EFI_STATUS Tcp6Status; 547 548 Tcp4Status = TcpCreateService (ControllerHandle, This->DriverBindingHandle, IP_VERSION_4); 549 if ((Tcp4Status == EFI_ALREADY_STARTED) || (Tcp4Status == EFI_UNSUPPORTED)) { 550 Tcp4Status = EFI_SUCCESS; 551 } 552 553 Tcp6Status = TcpCreateService (ControllerHandle, This->DriverBindingHandle, IP_VERSION_6); 554 if ((Tcp6Status == EFI_ALREADY_STARTED) || (Tcp6Status == EFI_UNSUPPORTED)) { 555 Tcp6Status = EFI_SUCCESS; 556 } 557 558 if (!EFI_ERROR (Tcp4Status) || !EFI_ERROR (Tcp6Status)) { 559 return EFI_SUCCESS; 560 } else if (EFI_ERROR (Tcp4Status)) { 561 return Tcp4Status; 562 } else { 563 return Tcp6Status; 564 } 702 EFI_STATUS Status; 703 704 Status = TcpCreateService (ControllerHandle, This->DriverBindingHandle, IP_VERSION_6); 705 if ((Status == EFI_ALREADY_STARTED) || (Status == EFI_UNSUPPORTED)) { 706 Status = EFI_SUCCESS; 707 } 708 709 return Status; 565 710 } 566 711 … … 582 727 EFI_STATUS 583 728 EFIAPI 584 Tcp DriverBindingStop (729 Tcp6DriverBindingStop ( 585 730 IN EFI_DRIVER_BINDING_PROTOCOL *This, 586 731 IN EFI_HANDLE ControllerHandle, … … 589 734 ) 590 735 { 591 EFI_STATUS Tcp4Status; 592 EFI_STATUS Tcp6Status; 593 594 Tcp4Status = TcpDestroyService ( 595 ControllerHandle, 596 This->DriverBindingHandle, 597 NumberOfChildren, 598 IP_VERSION_4 599 ); 600 601 Tcp6Status = TcpDestroyService ( 602 ControllerHandle, 603 This->DriverBindingHandle, 604 NumberOfChildren, 605 IP_VERSION_6 606 ); 607 608 if (EFI_ERROR (Tcp4Status) && EFI_ERROR (Tcp6Status)) { 609 return EFI_DEVICE_ERROR; 610 } else { 611 return EFI_SUCCESS; 612 } 736 return TcpDestroyService ( 737 ControllerHandle, 738 This->DriverBindingHandle, 739 NumberOfChildren, 740 ChildHandleBuffer, 741 IP_VERSION_6 742 ); 613 743 } 614 744 … … 666 796 TcpServiceData->DriverBindingHandle, 667 797 This->SockHandle, 668 EFI_OPEN_PROTOCOL_ BY_CHILD_CONTROLLER798 EFI_OPEN_PROTOCOL_GET_PROTOCOL 669 799 ); 670 800 if (EFI_ERROR (Status)) { … … 715 845 716 846 // 717 // Close the device path protocol718 //719 gBS->CloseProtocol (720 TcpServiceData->ControllerHandle,721 &gEfiDevicePathProtocolGuid,722 TcpServiceData->DriverBindingHandle,723 This->SockHandle724 );725 726 //727 847 // Close the IP protocol. 728 848 // … … 840 960 VOID *Tcp; 841 961 SOCKET *Sock; 842 EFI_TPL OldTpl;843 962 844 963 if (NULL == This || NULL == ChildHandle) { 845 964 return EFI_INVALID_PARAMETER; 846 965 } 847 848 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);849 966 850 967 // … … 855 972 &gEfiTcp4ProtocolGuid, 856 973 &Tcp, 857 gTcp DriverBinding.DriverBindingHandle,974 gTcp4DriverBinding.DriverBindingHandle, 858 975 ChildHandle, 859 976 EFI_OPEN_PROTOCOL_GET_PROTOCOL … … 867 984 &gEfiTcp6ProtocolGuid, 868 985 &Tcp, 869 gTcp DriverBinding.DriverBindingHandle,986 gTcp6DriverBinding.DriverBindingHandle, 870 987 ChildHandle, 871 988 EFI_OPEN_PROTOCOL_GET_PROTOCOL … … 886 1003 } 887 1004 888 gBS->RestoreTPL (OldTpl);889 890 1005 return Status; 891 1006 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/TcpDxe/TcpDriver.h
r48674 r58459 2 2 The prototype of driver binding and service binding protocol for TCP driver. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 34 34 IP_IO *IpIo; 35 35 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding; 36 CHAR16 *MacString;37 36 LIST_ENTRY SocketList; 38 37 } TCP_SERVICE_DATA; … … 91 90 EFI_STATUS 92 91 EFIAPI 93 Tcp DriverBindingSupported (92 Tcp4DriverBindingSupported ( 94 93 IN EFI_DRIVER_BINDING_PROTOCOL *This, 95 94 IN EFI_HANDLE ControllerHandle, … … 113 112 EFI_STATUS 114 113 EFIAPI 115 Tcp DriverBindingStart (114 Tcp4DriverBindingStart ( 116 115 IN EFI_DRIVER_BINDING_PROTOCOL *This, 117 116 IN EFI_HANDLE ControllerHandle, … … 136 135 EFI_STATUS 137 136 EFIAPI 138 TcpDriverBindingStop ( 137 Tcp4DriverBindingStop ( 138 IN EFI_DRIVER_BINDING_PROTOCOL *This, 139 IN EFI_HANDLE ControllerHandle, 140 IN UINTN NumberOfChildren, 141 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL 142 ); 143 144 /** 145 Test to see if this driver supports ControllerHandle. 146 147 @param[in] This Protocol instance pointer. 148 @param[in] ControllerHandle Handle of the device to test. 149 @param[in] RemainingDevicePath Optional parameter use to pick a specific 150 child device to start. 151 152 @retval EFI_SUCCESS This driver supports this device. 153 @retval EFI_ALREADY_STARTED This driver is already running on this device. 154 @retval other This driver does not support this device. 155 156 **/ 157 EFI_STATUS 158 EFIAPI 159 Tcp6DriverBindingSupported ( 160 IN EFI_DRIVER_BINDING_PROTOCOL *This, 161 IN EFI_HANDLE ControllerHandle, 162 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 163 ); 164 165 /** 166 Start this driver on ControllerHandle. 167 168 @param[in] This Protocol instance pointer. 169 @param[in] ControllerHandle Handle of device to bind driver to. 170 @param[in] RemainingDevicePath Optional parameter use to pick a specific child 171 device to start. 172 173 @retval EFI_SUCCESS The driver was added to ControllerHandle. 174 @retval EFI_OUT_OF_RESOURCES There are not enough resources to start the 175 driver. 176 @retval other The driver cannot be added to ControllerHandle. 177 178 **/ 179 EFI_STATUS 180 EFIAPI 181 Tcp6DriverBindingStart ( 182 IN EFI_DRIVER_BINDING_PROTOCOL *This, 183 IN EFI_HANDLE ControllerHandle, 184 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 185 ); 186 187 /** 188 Stop this driver on ControllerHandle. 189 190 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 191 @param[in] ControllerHandle A handle to the device being stopped. The handle must 192 support a bus specific I/O protocol for the driver 193 to use to stop the device. 194 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer. 195 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 196 if NumberOfChildren is 0. 197 198 @retval EFI_SUCCESS The device was stopped. 199 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error. 200 201 **/ 202 EFI_STATUS 203 EFIAPI 204 Tcp6DriverBindingStop ( 139 205 IN EFI_DRIVER_BINDING_PROTOCOL *This, 140 206 IN EFI_HANDLE ControllerHandle, -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/TcpDxe/TcpDxe.inf
r48674 r58459 1 ## @file TcpDxe.inf2 # Component description file for Tcp module.1 ## @file 2 # TCPv4 I/O and TCPv6 I/O services. 3 3 # 4 # Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 4 # This module provides EFI TCPv4 Protocol and EFI TCPv6 Protocol to send and receive data stream. 5 # It might provide TCPv4 Protocol or TCPv6 Protocol or both of them that depends on 6 # which network stack has been loaded in system. 7 # 8 # 9 # Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 10 # 6 11 # This program and the accompanying materials … … 22 27 ENTRY_POINT = TcpDriverEntryPoint 23 28 UNLOAD_IMAGE = NetLibDefaultUnload 29 MODULE_UNI_FILE = TcpDxe.uni 24 30 25 31 # … … 72 78 73 79 [Protocols] 74 gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED 75 gEfiIp4ProtocolGuid # PROTOCOL ALWAYS_CONSUMED 76 gEfiIp4ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED 77 gEfiTcp4ProtocolGuid # PROTOCOL SOMETIMES_PRODUCED 78 gEfiTcp4ServiceBindingProtocolGuid # PROTOCOL ALWAYS_PRODUCED 79 gEfiIp6ProtocolGuid # PROTOCOL ALWAYS_CONSUMED 80 gEfiIp6ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED 81 gEfiTcp6ProtocolGuid # PROTOCOL SOMETIMES_PRODUCED 82 gEfiTcp6ServiceBindingProtocolGuid # PROTOCOL ALWAYS_PRODUCED 80 ## SOMETIMES_CONSUMES 81 ## SOMETIMES_PRODUCES 82 gEfiDevicePathProtocolGuid 83 gEfiIp4ProtocolGuid ## TO_START 84 gEfiIp4ServiceBindingProtocolGuid ## TO_START 85 gEfiTcp4ProtocolGuid ## BY_START 86 gEfiTcp4ServiceBindingProtocolGuid ## BY_START 87 gEfiIp6ProtocolGuid ## TO_START 88 gEfiIp6ServiceBindingProtocolGuid ## TO_START 89 gEfiTcp6ProtocolGuid ## BY_START 90 gEfiTcp6ServiceBindingProtocolGuid ## BY_START 83 91 92 [UserExtensions.TianoCore."ExtraFiles"] 93 TcpDxeExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/TcpDxe/TcpFunc.h
r48674 r58459 2 2 Declaration of external functions shared in TCP driver. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 278 278 279 279 /** 280 Set the Tcp variable data.281 282 @param[in] TcpService Tcp service data.283 284 @retval EFI_OUT_OF_RESOURCES There are not enough resources to set the variable.285 @retval other Set variable failed.286 287 **/288 EFI_STATUS289 TcpSetVariableData (290 IN TCP_SERVICE_DATA *TcpService291 );292 293 /**294 Clear the variable and free the resource.295 296 @param[in] TcpService Tcp service data.297 298 **/299 VOID300 TcpClearVariableData (301 IN TCP_SERVICE_DATA *TcpService302 );303 304 /**305 280 Install the device path protocol on the TCP instance. 306 281 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/TcpDxe/TcpIo.c
r48674 r58459 2 2 Implementation of I/O interfaces between TCP and IpIoLib. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 113 113 // the destination address can't be overridden, so reset the Dest to NULL. 114 114 // 115 Dest = NULL; 115 if (!Tcb->RemoteIpZero) { 116 Dest = NULL; 117 } 116 118 } 117 119 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/TcpDxe/TcpMain.h
r48674 r58459 3 3 It is the common head file for all Tcp*.c in TCP driver. 4 4 5 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>5 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 6 6 7 7 This program and the accompanying materials … … 22 22 #include <Library/IpIoLib.h> 23 23 #include <Library/DevicePathLib.h> 24 #include <Library/PrintLib.h> 24 25 25 26 #include "Socket.h" … … 33 34 extern EFI_COMPONENT_NAME_PROTOCOL gTcpComponentName; 34 35 extern EFI_COMPONENT_NAME2_PROTOCOL gTcpComponentName2; 36 extern EFI_UNICODE_STRING_TABLE *gTcpControllerNameTable; 35 37 36 38 extern LIST_ENTRY mTcpRunQue; … … 90 92 EFI_IPv4_ADDRESS *GatewayAddress; 91 93 } TCP4_ROUTE_INFO; 94 95 typedef struct { 96 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 97 UINTN NumberOfChildren; 98 EFI_HANDLE *ChildHandleBuffer; 99 } TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT; 92 100 93 101 // -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/TcpDxe/TcpMisc.c
r48674 r58459 2 2 Misc support routines for TCP driver. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 468 468 469 469 TcpProto = (TCP_PROTO_DATA *) Tcb->Sk->ProtoReserved; 470 TcpSetVariableData (TcpProto->TcpService);471 470 472 471 return 0; … … 942 941 943 942 NetbufFree (Nbuf); 944 }945 946 /**947 Set the Tcp variable data.948 949 @param[in] TcpService Tcp service data.950 951 @retval EFI_OUT_OF_RESOURCES There are not enough resources to set the variable.952 @retval other Set variable failed.953 954 **/955 EFI_STATUS956 TcpSetVariableData (957 IN TCP_SERVICE_DATA *TcpService958 )959 {960 EFI_GUID *ServiceBindingGuid;961 UINT32 NumConfiguredInstance;962 LIST_ENTRY *Entry;963 TCP_CB *TcpPcb;964 TCP_PROTO_DATA *TcpProto;965 UINTN VariableDataSize;966 EFI_TCP4_VARIABLE_DATA *Tcp4VariableData;967 EFI_TCP4_SERVICE_POINT *Tcp4ServicePoint;968 EFI_TCP6_VARIABLE_DATA *Tcp6VariableData;969 EFI_TCP6_SERVICE_POINT *Tcp6ServicePoint;970 VOID *VariableData;971 CHAR16 *NewMacString;972 EFI_STATUS Status;973 974 if (TcpService->IpVersion == IP_VERSION_4) {975 ServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;976 } else {977 ServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;978 }979 980 NumConfiguredInstance = 0;981 Tcp4VariableData = NULL;982 Tcp6VariableData = NULL;983 984 //985 // Go through the running queue to count the instances.986 //987 NET_LIST_FOR_EACH (Entry, &mTcpRunQue) {988 TcpPcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);989 990 TcpProto = (TCP_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;991 992 if (TcpProto->TcpService == TcpService) {993 //994 // This tcp instance belongs to the TcpService.995 //996 NumConfiguredInstance++;997 }998 }999 1000 //1001 // Go through the listening queue to count the instances.1002 //1003 NET_LIST_FOR_EACH (Entry, &mTcpListenQue) {1004 TcpPcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);1005 1006 TcpProto = (TCP_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;1007 1008 if (TcpProto->TcpService == TcpService) {1009 //1010 // This tcp instance belongs to the TcpService.1011 //1012 NumConfiguredInstance++;1013 }1014 }1015 1016 Tcp4ServicePoint = NULL;1017 Tcp6ServicePoint = NULL;1018 1019 //1020 // Calculate the size of the Tcp4VariableData. As there may be no Tcp4 child,1021 // we should add extra buffers for the service points only if the number of configured1022 // children is more than one.1023 //1024 if (TcpService->IpVersion == IP_VERSION_4) {1025 VariableDataSize = sizeof (EFI_TCP4_VARIABLE_DATA);1026 1027 if (NumConfiguredInstance > 1) {1028 VariableDataSize += sizeof (EFI_TCP4_SERVICE_POINT) * (NumConfiguredInstance - 1);1029 }1030 1031 Tcp4VariableData = AllocateZeroPool (VariableDataSize);1032 if (Tcp4VariableData == NULL) {1033 return EFI_OUT_OF_RESOURCES;1034 }1035 1036 Tcp4VariableData->DriverHandle = TcpService->DriverBindingHandle;1037 Tcp4VariableData->ServiceCount = NumConfiguredInstance;1038 1039 Tcp4ServicePoint = &Tcp4VariableData->Services[0];1040 VariableData = Tcp4VariableData;1041 } else {1042 VariableDataSize = sizeof (EFI_TCP6_VARIABLE_DATA);1043 1044 if (NumConfiguredInstance > 1) {1045 VariableDataSize += sizeof (EFI_TCP6_SERVICE_POINT) * (NumConfiguredInstance - 1);1046 }1047 1048 Tcp6VariableData = AllocateZeroPool (VariableDataSize);1049 if (Tcp6VariableData == NULL) {1050 return EFI_OUT_OF_RESOURCES;1051 }1052 1053 Tcp6VariableData->DriverHandle = TcpService->DriverBindingHandle;1054 Tcp6VariableData->ServiceCount = NumConfiguredInstance;1055 1056 Tcp6ServicePoint = &Tcp6VariableData->Services[0];1057 VariableData = Tcp6VariableData;1058 }1059 1060 //1061 // Go through the running queue to fill the service points.1062 //1063 NET_LIST_FOR_EACH (Entry, &mTcpRunQue) {1064 TcpPcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);1065 1066 TcpProto = (TCP_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;1067 1068 if (TcpProto->TcpService == TcpService) {1069 //1070 // This tcp instance belongs to the TcpService.1071 //1072 if (TcpService->IpVersion == IP_VERSION_4) {1073 Tcp4ServicePoint->InstanceHandle = TcpPcb->Sk->SockHandle;1074 CopyMem (&Tcp4ServicePoint->LocalAddress, &TcpPcb->LocalEnd.Ip, sizeof (EFI_IPv4_ADDRESS));1075 Tcp4ServicePoint->LocalPort = NTOHS (TcpPcb->LocalEnd.Port);1076 CopyMem (&Tcp4ServicePoint->RemoteAddress, &TcpPcb->RemoteEnd.Ip, sizeof (EFI_IPv4_ADDRESS));1077 Tcp4ServicePoint->RemotePort = NTOHS (TcpPcb->RemoteEnd.Port);1078 1079 Tcp4ServicePoint++;1080 } else {1081 Tcp6ServicePoint->InstanceHandle = TcpPcb->Sk->SockHandle;1082 IP6_COPY_ADDRESS (&Tcp6ServicePoint->LocalAddress, &TcpPcb->LocalEnd.Ip);1083 Tcp6ServicePoint->LocalPort = NTOHS (TcpPcb->LocalEnd.Port);1084 IP6_COPY_ADDRESS (&Tcp6ServicePoint->RemoteAddress, &TcpPcb->RemoteEnd.Ip);1085 Tcp6ServicePoint->RemotePort = NTOHS (TcpPcb->RemoteEnd.Port);1086 1087 Tcp6ServicePoint++;1088 }1089 }1090 }1091 1092 //1093 // Go through the listening queue to fill the service points.1094 //1095 NET_LIST_FOR_EACH (Entry, &mTcpListenQue) {1096 TcpPcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);1097 1098 TcpProto = (TCP_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;1099 1100 if (TcpProto->TcpService == TcpService) {1101 //1102 // This tcp instance belongs to the TcpService.1103 //1104 if (TcpService->IpVersion == IP_VERSION_4) {1105 Tcp4ServicePoint->InstanceHandle = TcpPcb->Sk->SockHandle;1106 CopyMem (&Tcp4ServicePoint->LocalAddress, &TcpPcb->LocalEnd.Ip, sizeof (EFI_IPv4_ADDRESS));1107 Tcp4ServicePoint->LocalPort = NTOHS (TcpPcb->LocalEnd.Port);1108 CopyMem (&Tcp4ServicePoint->RemoteAddress, &TcpPcb->RemoteEnd.Ip, sizeof (EFI_IPv4_ADDRESS));1109 Tcp4ServicePoint->RemotePort = NTOHS (TcpPcb->RemoteEnd.Port);1110 1111 Tcp4ServicePoint++;1112 } else {1113 Tcp6ServicePoint->InstanceHandle = TcpPcb->Sk->SockHandle;1114 IP6_COPY_ADDRESS (&Tcp6ServicePoint->LocalAddress, &TcpPcb->LocalEnd.Ip);1115 Tcp6ServicePoint->LocalPort = NTOHS (TcpPcb->LocalEnd.Port);1116 IP6_COPY_ADDRESS (&Tcp6ServicePoint->RemoteAddress, &TcpPcb->RemoteEnd.Ip);1117 Tcp6ServicePoint->RemotePort = NTOHS (TcpPcb->RemoteEnd.Port);1118 1119 Tcp6ServicePoint++;1120 }1121 }1122 }1123 1124 //1125 // Get the mac string.1126 //1127 Status = NetLibGetMacString (1128 TcpService->ControllerHandle,1129 TcpService->DriverBindingHandle,1130 &NewMacString1131 );1132 if (EFI_ERROR (Status)) {1133 goto ON_ERROR;1134 }1135 1136 if (TcpService->MacString != NULL) {1137 //1138 // The variable is set already. We're going to update it.1139 //1140 if (StrCmp (TcpService->MacString, NewMacString) != 0) {1141 //1142 // The mac address is changed. Delete the previous variable first.1143 //1144 gRT->SetVariable (1145 TcpService->MacString,1146 ServiceBindingGuid,1147 EFI_VARIABLE_BOOTSERVICE_ACCESS,1148 0,1149 NULL1150 );1151 }1152 1153 FreePool (TcpService->MacString);1154 }1155 1156 TcpService->MacString = NewMacString;1157 1158 Status = gRT->SetVariable (1159 TcpService->MacString,1160 ServiceBindingGuid,1161 EFI_VARIABLE_BOOTSERVICE_ACCESS,1162 VariableDataSize,1163 VariableData1164 );1165 1166 ON_ERROR:1167 1168 FreePool (VariableData);1169 1170 return Status;1171 }1172 1173 /**1174 Clear the variable and free the resource.1175 1176 @param[in] TcpService Tcp service data.1177 1178 **/1179 VOID1180 TcpClearVariableData (1181 IN TCP_SERVICE_DATA *TcpService1182 )1183 {1184 EFI_GUID *ServiceBindingGuid;1185 1186 ASSERT (TcpService->MacString != NULL);1187 1188 if (TcpService->IpVersion == IP_VERSION_4) {1189 ServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;1190 } else {1191 ServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;1192 }1193 1194 gRT->SetVariable (1195 TcpService->MacString,1196 ServiceBindingGuid,1197 EFI_VARIABLE_BOOTSERVICE_ACCESS,1198 0,1199 NULL1200 );1201 1202 FreePool (TcpService->MacString);1203 TcpService->MacString = NULL;1204 943 } 1205 944 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/TcpDxe/TcpProto.h
r48674 r58459 2 2 TCP protocol header file. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 336 336 EFI_IPv4_ADDRESS SubnetMask; 337 337 338 339 BOOLEAN RemoteIpZero; ///< RemoteEnd.Ip is ZERO when configured. 338 340 IP_IO_IP_INFO *IpInfo; ///< Pointer reference to Ip used to send pkt 339 341 UINT32 Tick; ///< 1 tick = 200ms -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Udp6Dxe/ComponentName.c
r48674 r58459 2 2 UEFI Component Name(2) protocol implementation for UDP6 driver. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 174 174 } 175 175 }; 176 177 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gUdp6ControllerNameTable = NULL; 176 178 177 179 /** … … 232 234 233 235 /** 236 Update the component name for the Udp6 child handle. 237 238 @param Udp6[in] A pointer to the EFI_UDP6_PROTOCOL. 239 240 241 @retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully. 242 @retval EFI_INVALID_PARAMETER The input parameter is invalid. 243 244 **/ 245 EFI_STATUS 246 UpdateName ( 247 IN EFI_UDP6_PROTOCOL *Udp6 248 ) 249 { 250 EFI_STATUS Status; 251 CHAR16 HandleName[64]; 252 EFI_UDP6_CONFIG_DATA Udp6ConfigData; 253 254 if (Udp6 == NULL) { 255 return EFI_INVALID_PARAMETER; 256 } 257 258 // 259 // Format the child name into the string buffer. 260 // 261 Status = Udp6->GetModeData (Udp6, &Udp6ConfigData, NULL, NULL, NULL); 262 if (!EFI_ERROR (Status)) { 263 UnicodeSPrint (HandleName, sizeof (HandleName), 264 L"UDPv6 (SrcPort=%d, DestPort=%d)", 265 Udp6ConfigData.StationPort, 266 Udp6ConfigData.RemotePort 267 ); 268 } else if (Status == EFI_NOT_STARTED) { 269 UnicodeSPrint (HandleName, sizeof (HandleName), L"UDPv6 (Not started)"); 270 } else { 271 UnicodeSPrint (HandleName, sizeof (HandleName), L"UDPv6 (%r)", Status); 272 } 273 274 if (gUdp6ControllerNameTable != NULL) { 275 FreeUnicodeStringTable (gUdp6ControllerNameTable); 276 gUdp6ControllerNameTable = NULL; 277 } 278 279 Status = AddUnicodeString2 ( 280 "eng", 281 gUdp6ComponentName.SupportedLanguages, 282 &gUdp6ControllerNameTable, 283 HandleName, 284 TRUE 285 ); 286 if (EFI_ERROR (Status)) { 287 return Status; 288 } 289 290 return AddUnicodeString2 ( 291 "en", 292 gUdp6ComponentName2.SupportedLanguages, 293 &gUdp6ControllerNameTable, 294 HandleName, 295 FALSE 296 ); 297 } 298 299 /** 234 300 Retrieves a Unicode string that is the user-readable name of the controller 235 301 that is being managed by a driver. … … 309 375 ) 310 376 { 311 return EFI_UNSUPPORTED; 377 EFI_STATUS Status; 378 EFI_UDP6_PROTOCOL *Udp6; 379 380 // 381 // Only provide names for child handles. 382 // 383 if (ChildHandle == NULL) { 384 return EFI_UNSUPPORTED; 385 } 386 387 // 388 // Make sure this driver produced ChildHandle 389 // 390 Status = EfiTestChildHandle ( 391 ControllerHandle, 392 ChildHandle, 393 &gEfiIp6ProtocolGuid 394 ); 395 if (EFI_ERROR (Status)) { 396 return Status; 397 } 398 399 // 400 // Retrieve an instance of a produced protocol from ChildHandle 401 // 402 Status = gBS->OpenProtocol ( 403 ChildHandle, 404 &gEfiUdp6ProtocolGuid, 405 (VOID **)&Udp6, 406 NULL, 407 NULL, 408 EFI_OPEN_PROTOCOL_GET_PROTOCOL 409 ); 410 if (EFI_ERROR (Status)) { 411 return Status; 412 } 413 414 // 415 // Update the component name for this child handle. 416 // 417 Status = UpdateName (Udp6); 418 if (EFI_ERROR (Status)) { 419 return Status; 420 } 421 422 return LookupUnicodeString2 ( 423 Language, 424 This->SupportedLanguages, 425 gUdp6ControllerNameTable, 426 ControllerName, 427 (BOOLEAN)(This == &gUdp6ComponentName) 428 ); 312 429 } 313 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Udp6Dxe/Udp6Driver.c
r48674 r58459 2 2 Driver Binding functions and Service Binding functions for the Network driver module. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 166 166 Udp6CleanService (Udp6Service); 167 167 goto EXIT; 168 } else {169 Status = Udp6SetVariableData (Udp6Service);170 168 } 171 169 … … 177 175 } 178 176 return Status; 177 } 178 179 /** 180 Callback function which provided by user to remove one node in NetDestroyLinkList process. 181 182 @param[in] Entry The entry to be removed. 183 @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList. 184 185 @retval EFI_SUCCESS The entry has been removed successfully. 186 @retval Others Fail to remove the entry. 187 188 **/ 189 EFI_STATUS 190 EFIAPI 191 Udp6DestroyChildEntryInHandleBuffer ( 192 IN LIST_ENTRY *Entry, 193 IN VOID *Context 194 ) 195 { 196 UDP6_INSTANCE_DATA *Instance; 197 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 198 UINTN NumberOfChildren; 199 EFI_HANDLE *ChildHandleBuffer; 200 201 if (Entry == NULL || Context == NULL) { 202 return EFI_INVALID_PARAMETER; 203 } 204 205 Instance = NET_LIST_USER_STRUCT_S (Entry, UDP6_INSTANCE_DATA, Link, UDP6_INSTANCE_DATA_SIGNATURE); 206 ServiceBinding = ((UDP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ServiceBinding; 207 NumberOfChildren = ((UDP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->NumberOfChildren; 208 ChildHandleBuffer = ((UDP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ChildHandleBuffer; 209 210 if (!NetIsInHandleBuffer (Instance->ChildHandle, NumberOfChildren, ChildHandleBuffer)) { 211 return EFI_SUCCESS; 212 } 213 214 return ServiceBinding->DestroyChild (ServiceBinding, Instance->ChildHandle); 179 215 } 180 216 … … 212 248 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 213 249 UDP6_SERVICE_DATA *Udp6Service; 214 UDP6_INSTANCE_DATA *Instance; 250 LIST_ENTRY *List; 251 UDP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context; 215 252 216 253 // … … 219 256 NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiIp6ProtocolGuid); 220 257 if (NicHandle == NULL) { 221 return EFI_ DEVICE_ERROR;258 return EFI_SUCCESS; 222 259 } 223 260 … … 239 276 Udp6Service = UDP6_SERVICE_DATA_FROM_THIS (ServiceBinding); 240 277 241 if (NumberOfChildren == 0) { 242 278 if (NumberOfChildren != 0) { 279 // 280 // NumberOfChildren is not zero, destroy the children instances in ChildHandleBuffer. 281 // 282 List = &Udp6Service->ChildrenList; 283 Context.ServiceBinding = ServiceBinding; 284 Context.NumberOfChildren = NumberOfChildren; 285 Context.ChildHandleBuffer = ChildHandleBuffer; 286 Status = NetDestroyLinkList ( 287 List, 288 Udp6DestroyChildEntryInHandleBuffer, 289 &Context, 290 NULL 291 ); 292 } else if (IsListEmpty (&Udp6Service->ChildrenList)) { 243 293 gBS->UninstallMultipleProtocolInterfaces ( 244 294 NicHandle, … … 247 297 NULL 248 298 ); 249 250 Udp6ClearVariableData (Udp6Service); 251 299 252 300 Udp6CleanService (Udp6Service); 253 301 254 302 FreePool (Udp6Service); 255 } else { 256 257 while (!IsListEmpty (&Udp6Service->ChildrenList)) { 258 Instance = NET_LIST_HEAD (&Udp6Service->ChildrenList, UDP6_INSTANCE_DATA, Link); 259 260 Status = ServiceBinding->DestroyChild (ServiceBinding, Instance->ChildHandle); 261 } 303 304 Status = EFI_SUCCESS; 262 305 } 263 306 … … 352 395 } 353 396 397 // 398 // Open this instance's Ip6 protocol in the IpInfo BY_CHILD. 399 // 400 Status = gBS->OpenProtocol ( 401 Instance->IpInfo->ChildHandle, 402 &gEfiIp6ProtocolGuid, 403 (VOID **) &Ip6, 404 gUdp6DriverBinding.DriverBindingHandle, 405 Instance->ChildHandle, 406 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 407 ); 408 if (EFI_ERROR (Status)) { 409 goto ON_ERROR; 410 } 411 354 412 OldTpl = gBS->RaiseTPL (TPL_CALLBACK); 355 413 … … 441 499 Instance = UDP6_INSTANCE_DATA_FROM_THIS (Udp6Proto); 442 500 443 if (Instance-> Destroyed) {501 if (Instance->InDestroy) { 444 502 return EFI_SUCCESS; 445 503 } … … 448 506 // Use the Destroyed flag to avoid the re-entering of the following code. 449 507 // 450 Instance-> Destroyed= TRUE;451 452 // 453 // Close the Ip6 protocol .508 Instance->InDestroy = TRUE; 509 510 // 511 // Close the Ip6 protocol on the default IpIo. 454 512 // 455 513 gBS->CloseProtocol ( … … 459 517 Instance->ChildHandle 460 518 ); 519 // 520 // Close the Ip6 protocol on this instance's IpInfo. 521 // 522 gBS->CloseProtocol ( 523 Instance->IpInfo->ChildHandle, 524 &gEfiIp6ProtocolGuid, 525 gUdp6DriverBinding.DriverBindingHandle, 526 Instance->ChildHandle 527 ); 461 528 462 529 // … … 470 537 ); 471 538 if (EFI_ERROR (Status)) { 472 Instance-> Destroyed= FALSE;539 Instance->InDestroy = FALSE; 473 540 return Status; 474 541 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Udp6Dxe/Udp6Dxe.inf
r48674 r58459 1 1 ## @file Udp6Dxe.inf 2 # Component description file for Udp6 module. 3 # 4 # Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> 2 # UDP packet service based on IPv6 stack. 3 # 4 # This module produces EFI UDPv6 Protocol which provides simple packet-oriented 5 # services to transmit and receive UDP packets. 6 # 7 # Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 8 # 6 9 # This program and the accompanying materials … … 23 26 ENTRY_POINT = Udp6DriverEntryPoint 24 27 UNLOAD_IMAGE = NetLibDefaultUnload 28 MODULE_UNI_FILE = Udp6Dxe.uni 25 29 26 30 # … … 57 61 58 62 [Protocols] 59 gEfiIp6ProtocolGuid # PROTOCOL ALWAYS_CONSUMED60 gEfiIp6ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED61 gEfiUdp6ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED62 gEfiUdp6ProtocolGuid # PROTOCOL ALWAYS_CONSUMED63 gEfiIp6ProtocolGuid ## TO_START 64 gEfiIp6ServiceBindingProtocolGuid ## TO_START 65 gEfiUdp6ServiceBindingProtocolGuid ## BY_START 66 gEfiUdp6ProtocolGuid ## BY_START 63 67 68 [UserExtensions.TianoCore."ExtraFiles"] 69 Udp6DxeExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Udp6Dxe/Udp6Impl.c
r48674 r58459 2 2 Udp6 driver's whole implementation. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 364 364 365 365 IpIoDestroy (Udp6Service->IpIo); 366 366 Udp6Service->IpIo = NULL; 367 367 368 return Status; 368 369 } … … 389 390 // 390 391 IpIoDestroy (Udp6Service->IpIo); 392 Udp6Service->IpIo = NULL; 393 394 ZeroMem (Udp6Service, sizeof (UDP6_SERVICE_DATA)); 391 395 } 392 396 … … 492 496 Instance->Configured = FALSE; 493 497 Instance->IsNoMapping = FALSE; 494 Instance-> Destroyed= FALSE;498 Instance->InDestroy = FALSE; 495 499 } 496 500 … … 1620 1624 } 1621 1625 1622 gRT->GetTime (&RxData.TimeStamp, NULL);1623 1624 1626 Udp6Session = &RxData.UdpSession; 1625 1627 Udp6Session->SourcePort = NTOHS (Udp6Header->SrcPort); … … 1930 1932 ) 1931 1933 { 1932 } 1933 1934 1935 /** 1936 Set the Udp6 variable data. 1937 1938 @param[in] Udp6Service Udp6 service data. 1939 1940 @retval EFI_OUT_OF_RESOURCES There are not enough resources to set the 1941 variable. 1942 @retval other Set variable failed. 1943 1944 **/ 1945 EFI_STATUS 1946 Udp6SetVariableData ( 1947 IN UDP6_SERVICE_DATA *Udp6Service 1948 ) 1949 { 1950 UINT32 NumConfiguredInstance; 1951 LIST_ENTRY *Entry; 1952 UINTN VariableDataSize; 1953 EFI_UDP6_VARIABLE_DATA *Udp6VariableData; 1954 EFI_UDP6_SERVICE_POINT *Udp6ServicePoint; 1955 UDP6_INSTANCE_DATA *Udp6Instance; 1956 CHAR16 *NewMacString; 1957 EFI_STATUS Status; 1958 1959 NumConfiguredInstance = 0; 1960 1961 // 1962 // Go through the children list to count the configured children. 1963 // 1964 NET_LIST_FOR_EACH (Entry, &Udp6Service->ChildrenList) { 1965 Udp6Instance = NET_LIST_USER_STRUCT_S ( 1966 Entry, 1967 UDP6_INSTANCE_DATA, 1968 Link, 1969 UDP6_INSTANCE_DATA_SIGNATURE 1970 ); 1971 1972 if (Udp6Instance->Configured) { 1973 NumConfiguredInstance++; 1974 } 1975 } 1976 1977 // 1978 // Calculate the size of the Udp6VariableData. As there may be no Udp6 child, 1979 // we should add extra buffer for the service points only if the number of configured 1980 // children is more than 1. 1981 // 1982 VariableDataSize = sizeof (EFI_UDP6_VARIABLE_DATA); 1983 1984 if (NumConfiguredInstance > 1) { 1985 VariableDataSize += sizeof (EFI_UDP6_SERVICE_POINT) * (NumConfiguredInstance - 1); 1986 } 1987 1988 Udp6VariableData = AllocateZeroPool (VariableDataSize); 1989 if (Udp6VariableData == NULL) { 1990 return EFI_OUT_OF_RESOURCES; 1991 } 1992 1993 Udp6VariableData->DriverHandle = Udp6Service->ImageHandle; 1994 Udp6VariableData->ServiceCount = NumConfiguredInstance; 1995 1996 Udp6ServicePoint = &Udp6VariableData->Services[0]; 1997 1998 // 1999 // Go through the children list to fill the configured children's address pairs. 2000 // 2001 NET_LIST_FOR_EACH (Entry, &Udp6Service->ChildrenList) { 2002 Udp6Instance = NET_LIST_USER_STRUCT_S ( 2003 Entry, 2004 UDP6_INSTANCE_DATA, 2005 Link, 2006 UDP6_INSTANCE_DATA_SIGNATURE 2007 ); 2008 2009 if (Udp6Instance->Configured) { 2010 Udp6ServicePoint->InstanceHandle = Udp6Instance->ChildHandle; 2011 Udp6ServicePoint->LocalPort = Udp6Instance->ConfigData.StationPort; 2012 Udp6ServicePoint->RemotePort = Udp6Instance->ConfigData.RemotePort; 2013 2014 IP6_COPY_ADDRESS ( 2015 &Udp6ServicePoint->LocalAddress, 2016 &Udp6Instance->ConfigData.StationAddress 2017 ); 2018 IP6_COPY_ADDRESS ( 2019 &Udp6ServicePoint->RemoteAddress, 2020 &Udp6Instance->ConfigData.RemoteAddress 2021 ); 2022 Udp6ServicePoint++; 2023 } 2024 } 2025 2026 // 2027 // Get the MAC string. 2028 // 2029 Status = NetLibGetMacString ( 2030 Udp6Service->ControllerHandle, 2031 Udp6Service->ImageHandle, 2032 &NewMacString 2033 ); 2034 if (EFI_ERROR (Status)) { 2035 goto EXIT; 2036 } 2037 2038 if (Udp6Service->MacString != NULL) { 2039 // 2040 // The variable is set already, we're going to update it. 2041 // 2042 if (StrCmp (Udp6Service->MacString, NewMacString) != 0) { 2043 // 2044 // The MAC address is changed, delete the previous variable first. 2045 // 2046 gRT->SetVariable ( 2047 Udp6Service->MacString, 2048 &gEfiUdp6ServiceBindingProtocolGuid, 2049 EFI_VARIABLE_BOOTSERVICE_ACCESS, 2050 0, 2051 NULL 2052 ); 2053 } 2054 2055 FreePool (Udp6Service->MacString); 2056 } 2057 2058 Udp6Service->MacString = NewMacString; 2059 2060 Status = gRT->SetVariable ( 2061 Udp6Service->MacString, 2062 &gEfiUdp6ServiceBindingProtocolGuid, 2063 EFI_VARIABLE_BOOTSERVICE_ACCESS, 2064 VariableDataSize, 2065 (VOID *) Udp6VariableData 2066 ); 2067 2068 EXIT: 2069 2070 FreePool (Udp6VariableData); 2071 2072 return Status; 2073 } 2074 2075 2076 /** 2077 Clear the variable and free the resource. 2078 2079 @param[in, out] Udp6Service Udp6 service data. 2080 2081 **/ 2082 VOID 2083 Udp6ClearVariableData ( 2084 IN OUT UDP6_SERVICE_DATA *Udp6Service 2085 ) 2086 { 2087 ASSERT (Udp6Service->MacString != NULL); 2088 2089 gRT->SetVariable ( 2090 Udp6Service->MacString, 2091 &gEfiUdp6ServiceBindingProtocolGuid, 2092 EFI_VARIABLE_BOOTSERVICE_ACCESS, 2093 0, 2094 NULL 2095 ); 2096 2097 FreePool (Udp6Service->MacString); 2098 Udp6Service->MacString = NULL; 2099 } 2100 1934 } 2101 1935 2102 1936 /** -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Udp6Dxe/Udp6Impl.h
r48674 r58459 2 2 Udp6 driver's whole implementation and internal data structures. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 31 31 #include <Library/MemoryAllocationLib.h> 32 32 #include <Library/DpcLib.h> 33 #include <Library/PrintLib.h> 33 34 34 35 #include "Udp6Driver.h" … … 36 37 extern EFI_COMPONENT_NAME2_PROTOCOL gUdp6ComponentName2; 37 38 extern EFI_COMPONENT_NAME_PROTOCOL gUdp6ComponentName; 39 extern EFI_UNICODE_STRING_TABLE *gUdp6ControllerNameTable; 38 40 extern EFI_SERVICE_BINDING_PROTOCOL mUdp6ServiceBinding; 39 41 extern EFI_UDP6_PROTOCOL mUdp6Protocol; … … 78 80 IP_IO *IpIo; 79 81 EFI_EVENT TimeoutEvent; 80 CHAR16 *MacString; 81 } UDP6_SERVICE_DATA; 82 } UDP6_SERVICE_DATA; 82 83 83 84 typedef struct _UDP6_INSTANCE_DATA { … … 98 99 EFI_STATUS IcmpError; 99 100 IP_IO_IP_INFO *IpInfo; 100 BOOLEAN Destroyed;101 BOOLEAN InDestroy; 101 102 } UDP6_INSTANCE_DATA; 102 103 … … 108 109 } UDP6_RXDATA_WRAP; 109 110 111 typedef struct { 112 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 113 UINTN NumberOfChildren; 114 EFI_HANDLE *ChildHandleBuffer; 115 } UDP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT; 116 110 117 /** 111 118 Clean the Udp service context data. … … 138 145 IN EFI_HANDLE ControllerHandle 139 146 ); 140 141 /** 142 Set the Udp6 variable data. 143 144 @param[in] Udp6Service Udp6 service data. 145 146 @retval EFI_OUT_OF_RESOURCES There are not enough resources to set the 147 variable. 148 @retval other Set variable failed. 149 150 **/ 151 EFI_STATUS 152 Udp6SetVariableData ( 153 IN UDP6_SERVICE_DATA *Udp6Service 154 ); 155 147 156 148 /** 157 149 This function cleans the udp instance. … … 164 156 IN OUT UDP6_INSTANCE_DATA *Instance 165 157 ); 166 167 /** 168 Clear the variable and free the resource. 169 170 @param[in, out] Udp6Service Udp6 service data. 171 172 **/ 173 VOID 174 Udp6ClearVariableData ( 175 IN OUT UDP6_SERVICE_DATA *Udp6Service 176 ); 177 158 178 159 /** 179 160 This function intializes the new created udp instance. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Udp6Dxe/Udp6Main.c
r48674 r58459 2 2 Contains all EFI_UDP6_PROTOCOL interfaces. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 276 276 // Cancel all the user tokens. 277 277 // 278 Status =Instance->Udp6Proto.Cancel (&Instance->Udp6Proto, NULL);278 Instance->Udp6Proto.Cancel (&Instance->Udp6Proto, NULL); 279 279 280 280 // … … 285 285 ASSERT (IsListEmpty (&Instance->DeliveredDgramQue)); 286 286 } 287 288 Status = Udp6SetVariableData (Instance->Udp6Service); 289 287 290 288 ON_EXIT: 291 289 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/ComponentName.c
r48674 r58459 2 2 UEFI Component Name(2) protocol implementation for UefiPxeBc driver. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 172 172 }; 173 173 174 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPxeBcControllerNameTable[] = { 175 { 176 "eng;en", 177 L"PXE Controller" 178 }, 179 { 180 NULL, 181 NULL 182 } 183 }; 174 184 175 185 /** … … 308 318 ) 309 319 { 310 return EFI_UNSUPPORTED; 320 EFI_STATUS Status; 321 EFI_HANDLE NicHandle; 322 PXEBC_PRIVATE_PROTOCOL *Id; 323 324 if (ControllerHandle == NULL || ChildHandle != NULL) { 325 return EFI_UNSUPPORTED; 326 } 327 328 NicHandle = PxeBcGetNicByIp4Children (ControllerHandle); 329 if (NicHandle == NULL) { 330 NicHandle = PxeBcGetNicByIp6Children (ControllerHandle); 331 if (NicHandle == NULL) { 332 return EFI_UNSUPPORTED; 333 } 334 } 335 336 // 337 // Try to retrieve the private data by PxeBcPrivate protocol. 338 // 339 Status = gBS->OpenProtocol ( 340 NicHandle, 341 &gEfiCallerIdGuid, 342 (VOID **) &Id, 343 NULL, 344 NULL, 345 EFI_OPEN_PROTOCOL_GET_PROTOCOL 346 ); 347 if (EFI_ERROR (Status)) { 348 return Status; 349 } 350 351 return LookupUnicodeString2 ( 352 Language, 353 This->SupportedLanguages, 354 mPxeBcControllerNameTable, 355 ControllerName, 356 (BOOLEAN)(This == &gPxeBcComponentName) 357 ); 311 358 } 312 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c
r48674 r58459 2 2 Boot functions implementation for UefiPxeBc Driver. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 87 87 88 88 // 89 // Only ProxyPxe10 offer needs boot prompt.90 // 91 if (OfferType != PxeOfferTypeProxyPxe10 ) {89 // Only DhcpPxe10 and ProxyPxe10 offer needs boot prompt. 90 // 91 if (OfferType != PxeOfferTypeProxyPxe10 && OfferType != PxeOfferTypeDhcpPxe10) { 92 92 return EFI_NOT_FOUND; 93 93 } … … 99 99 100 100 VendorOpt = &Cache->Dhcp4.VendorOpt; 101 // 102 // According to the PXE specification 2.1, Table 2-1 PXE DHCP Options, 103 // we must not consider a boot prompt or boot menu if all of the following hold: 104 // - the PXE_DISCOVERY_CONTROL tag(6) is present inside the Vendor Options(43), and has bit 3 set 105 // - a boot file name has been presented in the initial DHCP or ProxyDHCP offer packet. 106 // 107 if (IS_DISABLE_PROMPT_MENU (VendorOpt->DiscoverCtrl) && 108 Cache->Dhcp4.OptList[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] != NULL) { 109 return EFI_ABORTED; 110 } 111 101 112 if (!IS_VALID_BOOT_PROMPT (VendorOpt->BitMap)) { 102 return EFI_ SUCCESS;113 return EFI_TIMEOUT; 103 114 } 104 115 … … 111 122 // 112 123 if (Timeout == 0) { 124 return EFI_TIMEOUT; 125 } 126 if (Timeout == 255) { 113 127 return EFI_SUCCESS; 114 }115 if (Timeout == 255) {116 return EFI_TIMEOUT;117 128 } 118 129 … … 174 185 AsciiPrint ("(%d) ", Timeout--); 175 186 187 Status = EFI_TIMEOUT; 176 188 while (EFI_ERROR (gBS->CheckEvent (TimeoutEvent))) { 177 189 if (!EFI_ERROR (gBS->CheckEvent (DescendEvent))) { … … 185 197 // 186 198 // Parse the input key by user. 199 // If <F8> or <Ctrl> + <M> is pressed, return success to display the boot menu. 187 200 // 188 201 if (InputKey.ScanCode == 0) { … … 197 210 case 'm': 198 211 case 'M': 199 Status = EFI_ TIMEOUT;212 Status = EFI_SUCCESS; 200 213 break; 201 214 … … 209 222 210 223 case SCAN_F8: 211 Status = EFI_ TIMEOUT;224 Status = EFI_SUCCESS; 212 225 break; 213 226 … … 277 290 278 291 Finish = FALSE; 279 Select = 1;292 Select = 0; 280 293 Index = 0; 281 294 *Type = 0; … … 285 298 286 299 // 287 // There is no specified ProxyPxe10 for IPv6 in PXE and UEFI spec.300 // There is no specified DhcpPxe10/ProxyPxe10 for IPv6 in PXE and UEFI spec. 288 301 // 289 302 ASSERT (!Mode->UsingIpv6); 290 ASSERT (OfferType == PxeOfferTypeProxyPxe10 );303 ASSERT (OfferType == PxeOfferTypeProxyPxe10 || OfferType == PxeOfferTypeDhcpPxe10); 291 304 292 305 VendorOpt = &Cache->Dhcp4.VendorOpt; … … 352 365 } 353 366 354 if (InputKey.ScanCode != 0) {367 if (InputKey.ScanCode == 0) { 355 368 switch (InputKey.UnicodeChar) { 356 369 case CTRL ('c'): … … 456 469 PXEBC_DHCP4_PACKET_CACHE *Cache4; 457 470 UINT16 Value; 458 471 PXEBC_VENDOR_OPTION *VendorOpt; 472 PXEBC_BOOT_SVR_ENTRY *Entry; 473 459 474 PxeBc = &Private->PxeBc; 460 475 Mode = PxeBc->Mode; … … 473 488 } 474 489 475 // 476 // Parse the boot server Ipv4 address by next server address. 477 // If this field isn't available, use option 54 instead. 478 // 479 CopyMem ( 480 &Private->ServerIp, 481 &Cache4->Packet.Offer.Dhcp4.Header.ServerAddr, 482 sizeof (EFI_IPv4_ADDRESS) 483 ); 484 490 ASSERT (Cache4->OptList[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] != NULL); 491 492 // 493 // Parse the boot server address. 494 // If prompt/discover is disabled, get the first boot server from the boot servers list. 495 // Otherwise, parse the boot server Ipv4 address from next server address field in DHCP header. 496 // If all these fields are not available, use option 54 instead. 497 // 498 VendorOpt = &Cache4->VendorOpt; 499 if (IS_DISABLE_PROMPT_MENU (VendorOpt->DiscoverCtrl) && IS_VALID_BOOT_SERVERS (VendorOpt->BitMap)) { 500 Entry = VendorOpt->BootSvr; 501 if (VendorOpt->BootSvrLen >= sizeof (PXEBC_BOOT_SVR_ENTRY) && Entry->IpCnt > 0) { 502 CopyMem ( 503 &Private->ServerIp, 504 &Entry->IpAddr[0], 505 sizeof (EFI_IPv4_ADDRESS) 506 ); 507 } 508 } 485 509 if (Private->ServerIp.Addr[0] == 0) { 510 // 511 // ServerIp.Addr[0] equals zero means we failed to get IP address from boot server list. 512 // Try to use next server address field. 513 // 514 CopyMem ( 515 &Private->ServerIp, 516 &Cache4->Packet.Offer.Dhcp4.Header.ServerAddr, 517 sizeof (EFI_IPv4_ADDRESS) 518 ); 519 } 520 if (Private->ServerIp.Addr[0] == 0) { 521 // 522 // Still failed , use the IP address from option 54. 523 // 486 524 CopyMem ( 487 525 &Private->ServerIp, … … 494 532 // Parse the boot file name by option. 495 533 // 496 ASSERT (Cache4->OptList[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] != NULL);497 534 Private->BootFileName = Cache4->OptList[PXEBC_DHCP4_TAG_INDEX_BOOTFILE]->Data; 498 535 … … 652 689 @param[in] Private Pointer to PxeBc private data. 653 690 @param[in] Type The type of bootstrap to perform. 654 @param[in, out] InfoPointer to EFI_PXE_BASE_CODE_DISCOVER_INFO.691 @param[in, out] DiscoverInfo Pointer to EFI_PXE_BASE_CODE_DISCOVER_INFO. 655 692 @param[out] BootEntry Pointer to PXEBC_BOOT_SVR_ENTRY. 656 693 @param[out] SrvList Pointer to EFI_PXE_BASE_CODE_SRVLIST. … … 664 701 IN PXEBC_PRIVATE_DATA *Private, 665 702 IN UINT16 Type, 666 IN OUT EFI_PXE_BASE_CODE_DISCOVER_INFO * Info,703 IN OUT EFI_PXE_BASE_CODE_DISCOVER_INFO **DiscoverInfo, 667 704 OUT PXEBC_BOOT_SVR_ENTRY **BootEntry, 668 705 OUT EFI_PXE_BASE_CODE_SRVLIST **SrvList … … 674 711 PXEBC_BOOT_SVR_ENTRY *Entry; 675 712 BOOLEAN IsFound; 713 EFI_PXE_BASE_CODE_DISCOVER_INFO *Info; 714 UINT16 Index; 676 715 677 716 Mode = Private->PxeBc.Mode; 717 Info = *DiscoverInfo; 678 718 679 719 if (Mode->UsingIpv6) { … … 709 749 Info->UseBCast = (BOOLEAN) !IS_DISABLE_BCAST_DISCOVER (VendorOpt->DiscoverCtrl); 710 750 Info->MustUseList = (BOOLEAN) IS_ENABLE_USE_SERVER_LIST (VendorOpt->DiscoverCtrl); 711 Info->UseUCast = Info->MustUseList;751 Info->UseUCast = (BOOLEAN) IS_VALID_BOOT_SERVERS (VendorOpt->BitMap); 712 752 713 753 if (Info->UseMCast) { … … 720 760 Info->IpCnt = 0; 721 761 722 if (Info-> MustUseList) {762 if (Info->UseUCast) { 723 763 Entry = VendorOpt->BootSvr; 724 764 … … 736 776 737 777 Info->IpCnt = Entry->IpCnt; 778 if (Info->IpCnt >= 1) { 779 *DiscoverInfo = AllocatePool (sizeof (*Info) + (Info->IpCnt - 1) * sizeof (**SrvList)); 780 if (*DiscoverInfo == NULL) { 781 return EFI_OUT_OF_RESOURCES; 782 } 783 CopyMem (*DiscoverInfo, Info, sizeof (*Info)); 784 Info = *DiscoverInfo; 785 } 786 787 for (Index = 0; Index < Info->IpCnt; Index++) { 788 CopyMem (&Info->SrvList[Index].IpAddr, &Entry->IpAddr[Index], sizeof (EFI_IPv4_ADDRESS)); 789 Info->SrvList[Index].AcceptAnyResponse = !Info->MustUseList; 790 Info->SrvList[Index].Type = NTOHS (Entry->Type); 791 } 738 792 } 739 793 740 794 *BootEntry = Entry; 795 *SrvList = Info->SrvList; 741 796 } 742 797 … … 843 898 // Choose by user's input. 844 899 // 900 Status = PxeBcSelectBootMenu (Private, &Type, FALSE); 901 } else if (Status == EFI_TIMEOUT) { 902 // 903 // Choose by default item. 904 // 845 905 Status = PxeBcSelectBootMenu (Private, &Type, TRUE); 846 } else if (Status == EFI_TIMEOUT) {847 //848 // Choose by default item.849 //850 Status = PxeBcSelectBootMenu (Private, &Type, FALSE);851 906 } 852 907 … … 868 923 if (EFI_ERROR (Status)) { 869 924 return Status; 925 } 926 927 if (Mode->PxeReplyReceived && !Mode->ProxyOfferReceived) { 928 // 929 // Some network boot loader only search the packet in Mode.ProxyOffer to get its server 930 // IP address, so we need to store a copy of Mode.PxeReply packet into Mode.ProxyOffer. 931 // 932 if (Mode->UsingIpv6) { 933 CopyMem ( 934 &Mode->ProxyOffer.Dhcpv6, 935 &Mode->PxeReply.Dhcpv6, 936 Private->PxeReply.Dhcp6.Packet.Ack.Length 937 ); 938 } else { 939 CopyMem ( 940 &Mode->ProxyOffer.Dhcpv4, 941 &Mode->PxeReply.Dhcpv4, 942 Private->PxeReply.Dhcp4.Packet.Ack.Length 943 ); 944 } 945 Mode->ProxyOfferReceived = TRUE; 870 946 } 871 947 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.h
r48674 r58459 2 2 Boot functions declaration for UefiPxeBc Driver. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 30 30 @param[in] Private Pointer to PxeBc private data. 31 31 @param[in] Type The type of bootstrap to perform. 32 @param[in, out] InfoPointer to EFI_PXE_BASE_CODE_DISCOVER_INFO.32 @param[in, out] DiscoverInfo Pointer to EFI_PXE_BASE_CODE_DISCOVER_INFO. 33 33 @param[out] BootEntry Pointer to PXEBC_BOOT_SVR_ENTRY. 34 34 @param[out] SrvList Pointer to EFI_PXE_BASE_CODE_SRVLIST. … … 42 42 IN PXEBC_PRIVATE_DATA *Private, 43 43 IN UINT16 Type, 44 IN OUT EFI_PXE_BASE_CODE_DISCOVER_INFO * Info,44 IN OUT EFI_PXE_BASE_CODE_DISCOVER_INFO **DiscoverInfo, 45 45 OUT PXEBC_BOOT_SVR_ENTRY **BootEntry, 46 46 OUT EFI_PXE_BASE_CODE_SRVLIST **SrvList -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c
r48674 r58459 2 2 Functions implementation related with DHCPv4 for UefiPxeBc Driver. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 473 473 // 474 474 // Parse DHCPv4 options in this offer, and store the pointers. 475 // First, try to parse DHCPv4 options from the DHCP optional parameters field. 475 476 // 476 477 for (Index = 0; Index < PXEBC_DHCP4_TAG_INDEX_MAX; Index++) { … … 481 482 ); 482 483 } 484 // 485 // Second, Check if bootfilename and serverhostname is overloaded to carry DHCP options refers to rfc-2132. 486 // If yes, try to parse options from the BootFileName field, then ServerName field. 487 // 488 Option = Options[PXEBC_DHCP4_TAG_INDEX_OVERLOAD]; 489 if (Option != NULL) { 490 if ((Option->Data[0] & PXEBC_DHCP4_OVERLOAD_FILE) != 0) { 491 for (Index = 0; Index < PXEBC_DHCP4_TAG_INDEX_MAX; Index++) { 492 if (Options[Index] == NULL) { 493 Options[Index] = PxeBcParseDhcp4Options ( 494 (UINT8 *) Offer->Dhcp4.Header.BootFileName, 495 sizeof (Offer->Dhcp4.Header.BootFileName), 496 mInterestedDhcp4Tags[Index] 497 ); 498 } 499 } 500 } 501 if ((Option->Data[0] & PXEBC_DHCP4_OVERLOAD_SERVER_NAME) != 0) { 502 for (Index = 0; Index < PXEBC_DHCP4_TAG_INDEX_MAX; Index++) { 503 if (Options[Index] == NULL) { 504 Options[Index] = PxeBcParseDhcp4Options ( 505 (UINT8 *) Offer->Dhcp4.Header.ServerName, 506 sizeof (Offer->Dhcp4.Header.ServerName), 507 mInterestedDhcp4Tags[Index] 508 ); 509 } 510 } 511 } 512 } 483 513 484 514 // … … 507 537 508 538 // 509 // Check whether bootfilename and serverhostname overloaded, refers to rfc-2132 in details. 510 // If overloaded, parse the buffer as nested DHCPv4 options, or else just parse as bootfilename 511 // and serverhostname option. 512 // 513 Option = Options[PXEBC_DHCP4_TAG_INDEX_OVERLOAD]; 514 if (Option != NULL && (Option->Data[0] & PXEBC_DHCP4_OVERLOAD_FILE) != 0) { 515 516 Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] = PxeBcParseDhcp4Options ( 517 (UINT8 *) Offer->Dhcp4.Header.BootFileName, 518 sizeof (Offer->Dhcp4.Header.BootFileName), 519 PXEBC_DHCP4_TAG_BOOTFILE 520 ); 539 // Parse PXE boot file name: 540 // According to PXE spec, boot file name should be read from DHCP option 67 (bootfile name) if present. 541 // Otherwise, read from boot file field in DHCP header. 542 // 543 if (Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] != NULL) { 521 544 // 522 545 // RFC 2132, Section 9.5 does not strictly state Bootfile name (option 67) is null 523 546 // terminated string. So force to append null terminated character at the end of string. 524 547 // 525 if (Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] != NULL) { 526 Ptr8 = (UINT8*)&Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE]->Data[0]; 527 Ptr8 += Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE]->Length; 528 *Ptr8 = '\0'; 529 } 530 531 } else if ((Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] == NULL) && 532 (Offer->Dhcp4.Header.BootFileName[0] != 0)) { 548 Ptr8 = (UINT8*)&Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE]->Data[0]; 549 Ptr8 += Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE]->Length; 550 if (*(Ptr8 - 1) != '\0') { 551 *Ptr8 = '\0'; 552 } 553 } else if (Offer->Dhcp4.Header.BootFileName[0] != 0) { 533 554 // 534 555 // If the bootfile is not present and bootfilename is present in DHCPv4 packet, just parse it. 535 // Do not count dhcp option header here, or else will dest ory the serverhostname.556 // Do not count dhcp option header here, or else will destroy the serverhostname. 536 557 // 537 558 Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] = (EFI_DHCP4_PACKET_OPTION *) … … 1444 1465 } 1445 1466 if ((SrvList[SrvIndex].Type == Type) && 1446 EFI_IP4_EQUAL (&Response->Dhcp4.Header.ServerAddr, & Private->ServerIp)) {1467 EFI_IP4_EQUAL (&Response->Dhcp4.Header.ServerAddr, &SrvList[SrvIndex].IpAddr)) { 1447 1468 break; 1448 1469 } … … 1575 1596 CopyMem (&PxeMode->SubnetMask, &Private->SubnetMask, sizeof (EFI_IPv4_ADDRESS)); 1576 1597 1577 Status = PxeBcFlushSta ionIp (Private, &Private->StationIp, &Private->SubnetMask);1598 Status = PxeBcFlushStationIp (Private, &Private->StationIp, &Private->SubnetMask); 1578 1599 if (EFI_ERROR (Status)) { 1579 1600 goto ON_EXIT; … … 1588 1609 1589 1610 PxeBcShowIp4Addr (&Private->StationIp.v4); 1611 AsciiPrint ("\n"); 1590 1612 1591 1613 ON_EXIT: -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.h
r48674 r58459 2 2 Functions declaration related with DHCPv4 for UefiPxeBc Driver. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 128 128 #define BIT(x) (1 << x) 129 129 #define CTRL(x) (0x1F & (x)) 130 #define DEFAULT_CLASS_ID_DATA "PXEClient:Arch: ?????:????:??????"130 #define DEFAULT_CLASS_ID_DATA "PXEClient:Arch:xxxxx:UNDI:003000" 131 131 #define DEFAULT_UNDI_TYPE 1 132 132 #define DEFAULT_UNDI_MAJOR 3 … … 147 147 BIT (PXEBC_VENDOR_TAG_MENU_PROMPT)) 148 148 149 #define IS_VALID_BOOT_SERVERS(x) \ 150 ((((x)[0]) & BIT (PXEBC_VENDOR_TAG_BOOT_SERVERS)) \ 151 == BIT (PXEBC_VENDOR_TAG_BOOT_SERVERS)) 152 149 153 #define IS_VALID_BOOT_PROMPT(x) \ 150 154 ((((x)[0]) & BIT (PXEBC_VENDOR_TAG_MENU_PROMPT)) \ … … 197 201 (((x) & BIT (2)) == BIT (2)) 198 202 199 #define IS_ ENABLE_BOOT_FILE_NAME(x) \203 #define IS_DISABLE_PROMPT_MENU(x) \ 200 204 (((x) & BIT (3)) == BIT (3)) 201 205 … … 257 261 } PXEBC_DHCP4_OPTION_ENTRY; 258 262 263 #pragma pack(1) 259 264 typedef struct { 260 265 UINT16 Type; … … 273 278 UINT8 Prompt[1]; 274 279 } PXEBC_MENU_PROMPT; 280 #pragma pack() 275 281 276 282 typedef struct { -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
r48674 r58459 2 2 Functions implementation related with DHCPv6 for UefiPxeBc Driver. 3 3 4 Copyright (c) 2009 - 201 2, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 1261 1261 EFI_EVENT MappedEvt; 1262 1262 EFI_STATUS Status; 1263 UINT64 DadTriggerTime; 1264 EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadXmits; 1263 1265 1264 1266 Status = EFI_SUCCESS; … … 1301 1303 // 1302 1304 Private->Ip6Policy = PXEBC_IP6_POLICY_MAX; 1305 goto ON_EXIT; 1306 } 1307 1308 // 1309 // Get Duplicate Address Detection Transmits count. 1310 // 1311 DataSize = sizeof (EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS); 1312 Status = Ip6Cfg->GetData ( 1313 Ip6Cfg, 1314 Ip6ConfigDataTypeDupAddrDetectTransmits, 1315 &DataSize, 1316 &DadXmits 1317 ); 1318 if (EFI_ERROR (Status)) { 1303 1319 goto ON_EXIT; 1304 1320 } … … 1355 1371 // 1356 1372 Status = EFI_NO_MAPPING; 1357 gBS->SetTimer (TimeOutEvt, TimerRelative, PXEBC_DHCP6_MAPPING_TIMEOUT); 1373 DadTriggerTime = TICKS_PER_SECOND * DadXmits.DupAddrDetectTransmits + PXEBC_DAD_ADDITIONAL_DELAY; 1374 gBS->SetTimer (TimeOutEvt, TimerRelative, DadTriggerTime); 1358 1375 1359 1376 while (EFI_ERROR (gBS->CheckEvent (TimeOutEvt))) { … … 1699 1716 UINT32 OptCount; 1700 1717 EFI_STATUS Status; 1718 EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg; 1719 EFI_STATUS TimerStatus; 1720 EFI_EVENT Timer; 1721 UINT64 GetMappingTimeOut; 1722 UINTN DataSize; 1723 EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadXmits; 1701 1724 1702 1725 Status = EFI_SUCCESS; 1703 1726 PxeMode = Private->PxeBc.Mode; 1727 Ip6Cfg = Private->Ip6Cfg; 1728 Timer = NULL; 1704 1729 1705 1730 // … … 1724 1749 Config.RapidCommit = FALSE; 1725 1750 Config.ReconfigureAccept = FALSE; 1726 Config.IaDescriptor.IaId = 1;1751 Config.IaDescriptor.IaId = Private->IaId; 1727 1752 Config.IaDescriptor.Type = EFI_DHCP6_IA_TYPE_NA; 1728 1753 Config.SolicitRetransmission = Retransmit; … … 1736 1761 // 1737 1762 Status = Dhcp6->Configure (Dhcp6, &Config); 1738 if (EFI_ERROR (Status)) {1739 FreePool (Retransmit);1763 FreePool (Retransmit); 1764 if (EFI_ERROR (Status)) { 1740 1765 return Status; 1741 1766 } … … 1755 1780 // 1756 1781 Status = Dhcp6->Start (Dhcp6); 1782 if (Status == EFI_NO_MAPPING) { 1783 // 1784 // IP6 Linklocal address is not available for use, so stop current Dhcp process 1785 // and wait for duplicate address detection to finish. 1786 // 1787 Dhcp6->Stop (Dhcp6); 1788 1789 // 1790 // Get Duplicate Address Detection Transmits count. 1791 // 1792 DataSize = sizeof (EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS); 1793 Status = Ip6Cfg->GetData ( 1794 Ip6Cfg, 1795 Ip6ConfigDataTypeDupAddrDetectTransmits, 1796 &DataSize, 1797 &DadXmits 1798 ); 1799 if (EFI_ERROR (Status)) { 1800 Dhcp6->Configure (Dhcp6, NULL); 1801 return Status; 1802 } 1803 1804 Status = gBS->CreateEvent (EVT_TIMER, TPL_CALLBACK, NULL, NULL, &Timer); 1805 if (EFI_ERROR (Status)) { 1806 Dhcp6->Configure (Dhcp6, NULL); 1807 return Status; 1808 } 1809 1810 GetMappingTimeOut = TICKS_PER_SECOND * DadXmits.DupAddrDetectTransmits + PXEBC_DAD_ADDITIONAL_DELAY; 1811 Status = gBS->SetTimer (Timer, TimerRelative, GetMappingTimeOut); 1812 if (EFI_ERROR (Status)) { 1813 gBS->CloseEvent (Timer); 1814 Dhcp6->Configure (Dhcp6, NULL); 1815 return Status; 1816 } 1817 1818 do { 1819 1820 TimerStatus = gBS->CheckEvent (Timer); 1821 if (!EFI_ERROR (TimerStatus)) { 1822 Status = Dhcp6->Start (Dhcp6); 1823 } 1824 } while (TimerStatus == EFI_NOT_READY); 1825 1826 gBS->CloseEvent (Timer); 1827 } 1757 1828 if (EFI_ERROR (Status)) { 1758 1829 if (Status == EFI_ICMP_ERROR) { … … 1782 1853 } 1783 1854 1784 Status = PxeBcFlushSta ionIp (Private, &Private->StationIp, NULL);1855 Status = PxeBcFlushStationIp (Private, &Private->StationIp, NULL); 1785 1856 if (EFI_ERROR (Status)) { 1786 1857 PxeBcUnregisterIp6Address (Private); -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.h
r48674 r58459 2 2 Functions declaration related with DHCPv6 for UefiPxeBc Driver. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 20 20 #define PXEBC_DHCP6_OPTION_MAX_SIZE 312 21 21 #define PXEBC_DHCP6_PACKET_MAX_SIZE 1472 22 #define PXEBC_DHCP6_MAPPING_TIMEOUT 50000000 // 5 seconds, unit is 10nanosecond.23 22 #define PXEBC_IP6_POLICY_MAX 0xff 24 23 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
r48674 r58459 2 2 Driver Binding functions implementationfor for UefiPxeBc Driver. 3 3 4 Copyright (c) 2007 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 17 17 18 18 19 EFI_DRIVER_BINDING_PROTOCOL gPxeBcDriverBinding = { 20 PxeBcDriverBindingSupported, 21 PxeBcDriverBindingStart, 22 PxeBcDriverBindingStop, 19 EFI_DRIVER_BINDING_PROTOCOL gPxeBcIp4DriverBinding = { 20 PxeBcIp4DriverBindingSupported, 21 PxeBcIp4DriverBindingStart, 22 PxeBcIp4DriverBindingStop, 23 0xa, 24 NULL, 25 NULL 26 }; 27 28 EFI_DRIVER_BINDING_PROTOCOL gPxeBcIp6DriverBinding = { 29 PxeBcIp6DriverBindingSupported, 30 PxeBcIp6DriverBindingStart, 31 PxeBcIp6DriverBindingStop, 23 32 0xa, 24 33 NULL, … … 780 789 PXEBC_PRIVATE_PROTOCOL *Id; 781 790 EFI_SIMPLE_NETWORK_PROTOCOL *Snp; 791 UINTN Index; 782 792 783 793 if (Private->Ip6Nic != NULL) { … … 820 830 if (EFI_ERROR (Status)) { 821 831 goto ON_ERROR; 832 } 833 834 // 835 // Generate a random IAID for the Dhcp6 assigned address. 836 // 837 Private->IaId = NET_RANDOM (NetRandomInitSeed ()); 838 if (Private->Snp != NULL) { 839 for (Index = 0; Index < Private->Snp->Mode->HwAddressSize; Index++) { 840 Private->IaId |= (Private->Snp->Mode->CurrentAddress.Addr[Index] << ((Index << 3) & 31)); 841 } 822 842 } 823 843 … … 1079 1099 ) 1080 1100 { 1081 return EfiLibInstallDriverBindingComponentName2 ( 1101 EFI_STATUS Status; 1102 1103 Status = EfiLibInstallDriverBindingComponentName2 ( 1104 ImageHandle, 1105 SystemTable, 1106 &gPxeBcIp4DriverBinding, 1107 ImageHandle, 1108 &gPxeBcComponentName, 1109 &gPxeBcComponentName2 1110 ); 1111 if (EFI_ERROR (Status)) { 1112 return Status; 1113 } 1114 1115 Status = EfiLibInstallDriverBindingComponentName2 ( 1116 ImageHandle, 1117 SystemTable, 1118 &gPxeBcIp6DriverBinding, 1119 NULL, 1120 &gPxeBcComponentName, 1121 &gPxeBcComponentName2 1122 ); 1123 if (EFI_ERROR (Status)) { 1124 gBS->UninstallMultipleProtocolInterfaces ( 1082 1125 ImageHandle, 1083 SystemTable, 1084 &gPxeBcDriverBinding, 1085 ImageHandle, 1126 &gEfiDriverBindingProtocolGuid, 1127 &gPxeBcIp4DriverBinding, 1128 &gEfiComponentName2ProtocolGuid, 1129 &gPxeBcComponentName2, 1130 &gEfiComponentNameProtocolGuid, 1086 1131 &gPxeBcComponentName, 1087 &gPxeBcComponentName21132 NULL 1088 1133 ); 1134 } 1135 1136 return Status; 1089 1137 } 1090 1138 1091 1092 1139 /** 1093 Test to see if this driver supports ControllerHandle. This service 1094 is called by the EFI boot service ConnectController(). In 1095 order to make drivers as small as possible, there are a few calling 1096 restrictions for this service. ConnectController() must 1097 follow these calling restrictions. If any other agent wishes to call 1098 Supported() it must also follow these calling restrictions. 1140 Test to see if this driver supports ControllerHandle. This is the worker function for 1141 PxeBcIp4(6)DriverBindingSupported. 1099 1142 1100 1143 @param[in] This The pointer to the driver binding protocol. … … 1102 1145 @param[in] RemainingDevicePath Optional parameter used to pick a specific child 1103 1146 device to be started. 1104 1147 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. 1148 1105 1149 @retval EFI_SUCCESS This driver supports this device. 1106 1150 @retval EFI_UNSUPPORTED This driver does not support this device. … … 1109 1153 EFI_STATUS 1110 1154 EFIAPI 1111 PxeBc DriverBindingSupported (1155 PxeBcSupported ( 1112 1156 IN EFI_DRIVER_BINDING_PROTOCOL *This, 1113 1157 IN EFI_HANDLE ControllerHandle, 1114 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 1158 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL, 1159 IN UINT8 IpVersion 1115 1160 ) 1116 1161 { 1117 EFI_STATUS Ip4Status; 1118 EFI_STATUS Ip6Status; 1119 1120 // 1121 // Try to open the Mtftp4 and Dhcp4 protocol to test whether IPv4 stack is ready. 1122 // 1123 Ip4Status = gBS->OpenProtocol ( 1162 EFI_STATUS Status; 1163 EFI_GUID *DhcpServiceBindingGuid; 1164 EFI_GUID *MtftpServiceBindingGuid; 1165 1166 if (IpVersion == IP_VERSION_4) { 1167 DhcpServiceBindingGuid = &gEfiDhcp4ServiceBindingProtocolGuid; 1168 MtftpServiceBindingGuid = &gEfiMtftp4ServiceBindingProtocolGuid; 1169 } else { 1170 DhcpServiceBindingGuid = &gEfiDhcp6ServiceBindingProtocolGuid; 1171 MtftpServiceBindingGuid = &gEfiMtftp6ServiceBindingProtocolGuid; 1172 } 1173 1174 // 1175 // Try to open the Mtftp and Dhcp protocol to test whether IP stack is ready. 1176 // 1177 Status = gBS->OpenProtocol ( 1124 1178 ControllerHandle, 1125 &gEfiDhcp4ServiceBindingProtocolGuid,1179 DhcpServiceBindingGuid, 1126 1180 NULL, 1127 1181 This->DriverBindingHandle, … … 1129 1183 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 1130 1184 ); 1131 if (!EFI_ERROR ( Ip4Status)) {1132 Ip4Status = gBS->OpenProtocol (1185 if (!EFI_ERROR (Status)) { 1186 Status = gBS->OpenProtocol ( 1133 1187 ControllerHandle, 1134 &gEfiMtftp4ServiceBindingProtocolGuid,1188 MtftpServiceBindingGuid, 1135 1189 NULL, 1136 1190 This->DriverBindingHandle, … … 1141 1195 1142 1196 // 1143 // Try to open the Mtftp6 and Dhcp6 protocol to test whether IPv4 stack is ready. 1144 // 1145 Ip6Status = gBS->OpenProtocol ( 1146 ControllerHandle, 1147 &gEfiDhcp6ServiceBindingProtocolGuid, 1148 NULL, 1149 This->DriverBindingHandle, 1150 ControllerHandle, 1151 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 1152 ); 1153 if (!EFI_ERROR (Ip6Status)) { 1154 Ip6Status = gBS->OpenProtocol ( 1155 ControllerHandle, 1156 &gEfiMtftp6ServiceBindingProtocolGuid, 1157 NULL, 1158 This->DriverBindingHandle, 1159 ControllerHandle, 1160 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 1161 ); 1162 } 1163 1164 // 1165 // It's unsupported case if both stack are not ready. 1166 // 1167 if (EFI_ERROR (Ip4Status) && EFI_ERROR (Ip6Status)) { 1197 // It's unsupported case if IP stack are not ready. 1198 // 1199 if (EFI_ERROR (Status)) { 1168 1200 return EFI_UNSUPPORTED; 1169 1201 } … … 1172 1204 } 1173 1205 1174 1175 1206 /** 1176 Start this driver on ControllerHandle. This service is called by the 1177 EFI boot service ConnectController(). In order to make 1178 drivers as small as possible, there are a few calling restrictions for 1179 this service. ConnectController() must follow these 1180 calling restrictions. If any other agent wishes to call Start() it 1181 must also follow these calling restrictions. 1207 Start this driver on ControllerHandle. This is the worker function for 1208 PxeBcIp4(6)DriverBindingStart. 1182 1209 1183 1210 @param[in] This The pointer to the driver binding protocol. … … 1185 1212 @param[in] RemainingDevicePath Optional parameter used to pick a specific child 1186 1213 device to be started. 1214 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. 1215 1187 1216 1188 1217 @retval EFI_SUCCESS This driver is installed to ControllerHandle. … … 1193 1222 EFI_STATUS 1194 1223 EFIAPI 1195 PxeBc DriverBindingStart (1224 PxeBcStart ( 1196 1225 IN EFI_DRIVER_BINDING_PROTOCOL *This, 1197 1226 IN EFI_HANDLE ControllerHandle, 1198 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 1227 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL, 1228 IN UINT8 IpVersion 1199 1229 ) 1200 1230 { 1201 1231 PXEBC_PRIVATE_DATA *Private; 1202 1232 EFI_STATUS Status; 1203 EFI_STATUS Ip4Status;1204 EFI_STATUS Ip6Status;1205 1233 PXEBC_PRIVATE_PROTOCOL *Id; 1206 1234 BOOLEAN FirstStart; 1235 1236 FirstStart = FALSE; 1207 1237 Status = gBS->OpenProtocol ( 1208 1238 ControllerHandle, … … 1219 1249 Private = PXEBC_PRIVATE_DATA_FROM_ID (Id); 1220 1250 } else { 1251 FirstStart = TRUE; 1221 1252 // 1222 1253 // If the driver has not been started yet, it should do initialization. … … 1295 1326 } 1296 1327 1297 // 1298 // Try to create virtual NIC handle for IPv4. 1299 // 1300 Ip4Status = PxeBcCreateIp4Children (This, ControllerHandle, Private); 1301 1302 // 1303 // Try to create virtual NIC handle for IPv6. 1304 // 1305 Ip6Status = PxeBcCreateIp6Children (This, ControllerHandle, Private); 1306 1307 if (EFI_ERROR (Ip4Status) && EFI_ERROR (Ip6Status)) { 1328 if (IpVersion == IP_VERSION_4) { 1329 // 1330 // Try to create virtual NIC handle for IPv4. 1331 // 1332 Status = PxeBcCreateIp4Children (This, ControllerHandle, Private); 1333 } else { 1334 // 1335 // Try to create virtual NIC handle for IPv6. 1336 // 1337 Status = PxeBcCreateIp6Children (This, ControllerHandle, Private); 1338 } 1339 if (EFI_ERROR (Status)) { 1308 1340 // 1309 1341 // Failed to start PXE driver if IPv4 and IPv6 stack are both not available. … … 1316 1348 1317 1349 ON_ERROR: 1318 gBS->UninstallProtocolInterface ( 1319 ControllerHandle, 1320 &gEfiCallerIdGuid, 1321 &Private->Id 1322 ); 1323 PxeBcDestroyIp4Children (This, Private); 1324 PxeBcDestroyIp6Children (This, Private); 1325 FreePool (Private); 1350 if (FirstStart) { 1351 gBS->UninstallProtocolInterface ( 1352 ControllerHandle, 1353 &gEfiCallerIdGuid, 1354 &Private->Id 1355 ); 1356 } 1357 1358 if (IpVersion == IP_VERSION_4) { 1359 PxeBcDestroyIp4Children (This, Private); 1360 } else { 1361 PxeBcDestroyIp6Children (This, Private); 1362 } 1363 1364 if (FirstStart && Private != NULL) { 1365 FreePool (Private); 1366 } 1326 1367 1327 1368 return Status; … … 1330 1371 1331 1372 /** 1332 Stop this driver on ControllerHandle. This service is called by the 1333 EFI boot service DisconnectController(). In order to 1334 make drivers as small as possible, there are a few calling 1335 restrictions for this service. DisconnectController() 1336 must follow these calling restrictions. If any other agent wishes 1337 to call Stop() it must also follow these calling restrictions. 1373 Stop this driver on ControllerHandle. This is the worker function for 1374 PxeBcIp4(6)DriverBindingStop. 1338 1375 1339 1376 @param[in] This Protocol instance pointer. … … 1342 1379 children is zero stop the entire bus driver. 1343 1380 @param[in] ChildHandleBuffer List of Child Handles to Stop. 1381 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. 1344 1382 1345 1383 @retval EFI_SUCCESS This driver was removed ControllerHandle. … … 1350 1388 EFI_STATUS 1351 1389 EFIAPI 1352 PxeBc DriverBindingStop (1390 PxeBcStop ( 1353 1391 IN EFI_DRIVER_BINDING_PROTOCOL *This, 1354 1392 IN EFI_HANDLE ControllerHandle, 1355 1393 IN UINTN NumberOfChildren, 1356 IN EFI_HANDLE *ChildHandleBuffer 1394 IN EFI_HANDLE *ChildHandleBuffer, 1395 IN UINT8 IpVersion 1357 1396 ) 1358 1397 { … … 1384 1423 // Get the Nic handle by any pass-over service child handle. 1385 1424 // 1386 NicHandle = PxeBcGetNicByIp4Children (ControllerHandle); 1425 if (IpVersion == IP_VERSION_4) { 1426 NicHandle = PxeBcGetNicByIp4Children (ControllerHandle); 1427 } else { 1428 NicHandle = PxeBcGetNicByIp6Children (ControllerHandle); 1429 } 1387 1430 if (NicHandle == NULL) { 1388 NicHandle = PxeBcGetNicByIp6Children (ControllerHandle); 1389 if (NicHandle == NULL) { 1390 return EFI_DEVICE_ERROR; 1391 } else { 1392 IsIpv6 = TRUE; 1393 } 1431 return EFI_SUCCESS; 1394 1432 } 1395 1433 … … 1429 1467 Private = VirtualNic->Private; 1430 1468 NicHandle = Private->Controller; 1431 1432 if (Private->Ip6Nic == VirtualNic) {1433 IsIpv6 = TRUE;1434 }1435 1469 } 1436 1470 … … 1444 1478 1445 1479 1446 if (Private->Ip4Nic != NULL && !IsIpv6) {1480 if (Private->Ip4Nic != NULL && IpVersion == IP_VERSION_4) { 1447 1481 PxeBcDestroyIp4Children (This, Private); 1448 1482 } 1449 1483 1450 if (Private->Ip6Nic != NULL && I sIpv6) {1484 if (Private->Ip6Nic != NULL && IpVersion == IP_VERSION_6) { 1451 1485 PxeBcDestroyIp6Children (This, Private); 1452 1486 } … … 1463 1497 return EFI_SUCCESS; 1464 1498 } 1499 1500 /** 1501 Test to see if this driver supports ControllerHandle. This service 1502 is called by the EFI boot service ConnectController(). In 1503 order to make drivers as small as possible, there are a few calling 1504 restrictions for this service. ConnectController() must 1505 follow these calling restrictions. If any other agent wishes to call 1506 Supported() it must also follow these calling restrictions. 1507 1508 @param[in] This The pointer to the driver binding protocol. 1509 @param[in] ControllerHandle The handle of device to be tested. 1510 @param[in] RemainingDevicePath Optional parameter used to pick a specific child 1511 device to be started. 1512 1513 @retval EFI_SUCCESS This driver supports this device. 1514 @retval EFI_UNSUPPORTED This driver does not support this device. 1515 1516 **/ 1517 EFI_STATUS 1518 EFIAPI 1519 PxeBcIp4DriverBindingSupported ( 1520 IN EFI_DRIVER_BINDING_PROTOCOL *This, 1521 IN EFI_HANDLE ControllerHandle, 1522 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 1523 ) 1524 { 1525 return PxeBcSupported ( 1526 This, 1527 ControllerHandle, 1528 RemainingDevicePath, 1529 IP_VERSION_4 1530 ); 1531 } 1532 1533 /** 1534 Start this driver on ControllerHandle. This service is called by the 1535 EFI boot service ConnectController(). In order to make 1536 drivers as small as possible, there are a few calling restrictions for 1537 this service. ConnectController() must follow these 1538 calling restrictions. If any other agent wishes to call Start() it 1539 must also follow these calling restrictions. 1540 1541 @param[in] This The pointer to the driver binding protocol. 1542 @param[in] ControllerHandle The handle of device to be started. 1543 @param[in] RemainingDevicePath Optional parameter used to pick a specific child 1544 device to be started. 1545 1546 @retval EFI_SUCCESS This driver is installed to ControllerHandle. 1547 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle. 1548 @retval other This driver does not support this device. 1549 1550 **/ 1551 EFI_STATUS 1552 EFIAPI 1553 PxeBcIp4DriverBindingStart ( 1554 IN EFI_DRIVER_BINDING_PROTOCOL *This, 1555 IN EFI_HANDLE ControllerHandle, 1556 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 1557 ) 1558 { 1559 return PxeBcStart ( 1560 This, 1561 ControllerHandle, 1562 RemainingDevicePath, 1563 IP_VERSION_4 1564 ); 1565 } 1566 1567 /** 1568 Stop this driver on ControllerHandle. This service is called by the 1569 EFI boot service DisconnectController(). In order to 1570 make drivers as small as possible, there are a few calling 1571 restrictions for this service. DisconnectController() 1572 must follow these calling restrictions. If any other agent wishes 1573 to call Stop() it must also follow these calling restrictions. 1574 1575 @param[in] This Protocol instance pointer. 1576 @param[in] ControllerHandle Handle of device to stop driver on 1577 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of 1578 children is zero stop the entire bus driver. 1579 @param[in] ChildHandleBuffer List of Child Handles to Stop. 1580 1581 @retval EFI_SUCCESS This driver is removed ControllerHandle 1582 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. 1583 @retval Others This driver was not removed from this device. 1584 1585 **/ 1586 EFI_STATUS 1587 EFIAPI 1588 PxeBcIp4DriverBindingStop ( 1589 IN EFI_DRIVER_BINDING_PROTOCOL *This, 1590 IN EFI_HANDLE ControllerHandle, 1591 IN UINTN NumberOfChildren, 1592 IN EFI_HANDLE *ChildHandleBuffer 1593 ) 1594 { 1595 return PxeBcStop ( 1596 This, 1597 ControllerHandle, 1598 NumberOfChildren, 1599 ChildHandleBuffer, 1600 IP_VERSION_4 1601 ); 1602 } 1603 1604 /** 1605 Test to see if this driver supports ControllerHandle. This service 1606 is called by the EFI boot service ConnectController(). In 1607 order to make drivers as small as possible, there are a few calling 1608 restrictions for this service. ConnectController() must 1609 follow these calling restrictions. If any other agent wishes to call 1610 Supported() it must also follow these calling restrictions. 1611 1612 @param[in] This The pointer to the driver binding protocol. 1613 @param[in] ControllerHandle The handle of device to be tested. 1614 @param[in] RemainingDevicePath Optional parameter use to pick a specific child 1615 device to be started. 1616 1617 @retval EFI_SUCCESS This driver supports this device. 1618 @retval EFI_UNSUPPORTED This driver does not support this device. 1619 1620 **/ 1621 EFI_STATUS 1622 EFIAPI 1623 PxeBcIp6DriverBindingSupported ( 1624 IN EFI_DRIVER_BINDING_PROTOCOL *This, 1625 IN EFI_HANDLE ControllerHandle, 1626 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 1627 ) 1628 { 1629 return PxeBcSupported ( 1630 This, 1631 ControllerHandle, 1632 RemainingDevicePath, 1633 IP_VERSION_6 1634 ); 1635 } 1636 1637 /** 1638 Start this driver on ControllerHandle. This service is called by the 1639 EFI boot service ConnectController(). In order to make 1640 drivers as small as possible, there are a few calling restrictions for 1641 this service. ConnectController() must follow these 1642 calling restrictions. If any other agent wishes to call Start() it 1643 must also follow these calling restrictions. 1644 1645 @param[in] This The pointer to the driver binding protocol. 1646 @param[in] ControllerHandle The handle of device to be started. 1647 @param[in] RemainingDevicePath Optional parameter used to pick a specific child 1648 device to be started. 1649 1650 @retval EFI_SUCCESS This driver is installed to ControllerHandle. 1651 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle. 1652 @retval other This driver does not support this device. 1653 1654 **/ 1655 EFI_STATUS 1656 EFIAPI 1657 PxeBcIp6DriverBindingStart ( 1658 IN EFI_DRIVER_BINDING_PROTOCOL *This, 1659 IN EFI_HANDLE ControllerHandle, 1660 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 1661 ) 1662 { 1663 return PxeBcStart ( 1664 This, 1665 ControllerHandle, 1666 RemainingDevicePath, 1667 IP_VERSION_6 1668 ); 1669 } 1670 1671 /** 1672 Stop this driver on ControllerHandle. This service is called by the 1673 EFI boot service DisconnectController(). In order to 1674 make drivers as small as possible, there are a few calling 1675 restrictions for this service. DisconnectController() 1676 must follow these calling restrictions. If any other agent wishes 1677 to call Stop() it must also follow these calling restrictions. 1678 1679 @param[in] This Protocol instance pointer. 1680 @param[in] ControllerHandle Handle of device to stop driver on 1681 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of 1682 children is zero stop the entire bus driver. 1683 @param[in] ChildHandleBuffer List of Child Handles to Stop. 1684 1685 @retval EFI_SUCCESS This driver is removed ControllerHandle 1686 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. 1687 @retval Others This driver was not removed from this device. 1688 1689 **/ 1690 EFI_STATUS 1691 EFIAPI 1692 PxeBcIp6DriverBindingStop ( 1693 IN EFI_DRIVER_BINDING_PROTOCOL *This, 1694 IN EFI_HANDLE ControllerHandle, 1695 IN UINTN NumberOfChildren, 1696 IN EFI_HANDLE *ChildHandleBuffer 1697 ) 1698 { 1699 return PxeBcStop ( 1700 This, 1701 ControllerHandle, 1702 NumberOfChildren, 1703 ChildHandleBuffer, 1704 IP_VERSION_6 1705 ); 1706 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.h
r48674 r58459 2 2 Driver Binding functions declaration for UefiPxeBc Driver. 3 3 4 Copyright (c) 2007 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 39 39 EFI_STATUS 40 40 EFIAPI 41 PxeBc DriverBindingSupported (41 PxeBcIp4DriverBindingSupported ( 42 42 IN EFI_DRIVER_BINDING_PROTOCOL *This, 43 43 IN EFI_HANDLE ControllerHandle, 44 44 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 45 45 ); 46 47 46 48 47 /** … … 66 65 EFI_STATUS 67 66 EFIAPI 68 PxeBc DriverBindingStart (67 PxeBcIp4DriverBindingStart ( 69 68 IN EFI_DRIVER_BINDING_PROTOCOL *This, 70 69 IN EFI_HANDLE ControllerHandle, … … 94 93 EFI_STATUS 95 94 EFIAPI 96 PxeBc DriverBindingStop (95 PxeBcIp4DriverBindingStop ( 97 96 IN EFI_DRIVER_BINDING_PROTOCOL *This, 98 97 IN EFI_HANDLE ControllerHandle, … … 101 100 ); 102 101 102 /** 103 Test to see if this driver supports ControllerHandle. This service 104 is called by the EFI boot service ConnectController(). In 105 order to make drivers as small as possible, there are a few calling 106 restrictions for this service. ConnectController() must 107 follow these calling restrictions. If any other agent wishes to call 108 Supported() it must also follow these calling restrictions. 109 110 @param[in] This The pointer to the driver binding protocol. 111 @param[in] ControllerHandle The handle of device to be tested. 112 @param[in] RemainingDevicePath Optional parameter use to pick a specific child 113 device to be started. 114 115 @retval EFI_SUCCESS This driver supports this device. 116 @retval EFI_UNSUPPORTED This driver does not support this device. 117 118 **/ 119 EFI_STATUS 120 EFIAPI 121 PxeBcIp6DriverBindingSupported ( 122 IN EFI_DRIVER_BINDING_PROTOCOL *This, 123 IN EFI_HANDLE ControllerHandle, 124 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 125 ); 126 127 /** 128 Start this driver on ControllerHandle. This service is called by the 129 EFI boot service ConnectController(). In order to make 130 drivers as small as possible, there are a few calling restrictions for 131 this service. ConnectController() must follow these 132 calling restrictions. If any other agent wishes to call Start() it 133 must also follow these calling restrictions. 134 135 @param[in] This The pointer to the driver binding protocol. 136 @param[in] ControllerHandle The handle of device to be started. 137 @param[in] RemainingDevicePath Optional parameter used to pick a specific child 138 device to be started. 139 140 @retval EFI_SUCCESS This driver is installed to ControllerHandle. 141 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle. 142 @retval other This driver does not support this device. 143 144 **/ 145 EFI_STATUS 146 EFIAPI 147 PxeBcIp6DriverBindingStart ( 148 IN EFI_DRIVER_BINDING_PROTOCOL *This, 149 IN EFI_HANDLE ControllerHandle, 150 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 151 ); 152 153 /** 154 Stop this driver on ControllerHandle. This service is called by the 155 EFI boot service DisconnectController(). In order to 156 make drivers as small as possible, there are a few calling 157 restrictions for this service. DisconnectController() 158 must follow these calling restrictions. If any other agent wishes 159 to call Stop() it must also follow these calling restrictions. 160 161 @param[in] This Protocol instance pointer. 162 @param[in] ControllerHandle Handle of device to stop driver on 163 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of 164 children is zero stop the entire bus driver. 165 @param[in] ChildHandleBuffer List of Child Handles to Stop. 166 167 @retval EFI_SUCCESS This driver is removed ControllerHandle 168 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. 169 @retval Others This driver was not removed from this device. 170 171 **/ 172 EFI_STATUS 173 EFIAPI 174 PxeBcIp6DriverBindingStop ( 175 IN EFI_DRIVER_BINDING_PROTOCOL *This, 176 IN EFI_HANDLE ControllerHandle, 177 IN UINTN NumberOfChildren, 178 IN EFI_HANDLE *ChildHandleBuffer 179 ); 103 180 #endif 104 181 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
r48674 r58459 2 2 This implementation of EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROTOCOL. 3 3 4 Copyright (c) 2007 - 201 2, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 346 346 Private->SolicitTimes = 0; 347 347 Private->ElapsedTime = 0; 348 ZeroMem (&Private->StationIp, sizeof (EFI_IP_ADDRESS)); 349 ZeroMem (&Private->SubnetMask, sizeof (EFI_IP_ADDRESS)); 350 ZeroMem (&Private->GatewayIp, sizeof (EFI_IP_ADDRESS)); 351 ZeroMem (&Private->ServerIp, sizeof (EFI_IP_ADDRESS)); 348 352 349 353 // … … 429 433 // 430 434 Status = PxeBcDhcp6Sarr (Private, Private->Dhcp6); 431 432 if (EFI_ERROR (Status)) {433 goto ON_EXIT;434 }435 435 } else { 436 436 … … 444 444 // 445 445 Status = PxeBcDhcp4Dora (Private, Private->Dhcp4); 446 447 if (EFI_ERROR (Status)) { 448 goto ON_EXIT; 449 } 450 } 451 452 ON_EXIT: 446 } 447 448 // 449 // Reconfigure the UDP instance with the default configuration. 450 // 453 451 if (Mode->UsingIpv6) { 454 452 Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData); … … 530 528 EFI_STATUS Status; 531 529 EFI_PXE_BASE_CODE_IP_FILTER IpFilter; 530 EFI_PXE_BASE_CODE_DISCOVER_INFO *NewCreatedInfo; 532 531 533 532 if (This == NULL) { … … 542 541 Status = EFI_DEVICE_ERROR; 543 542 Private->Function = EFI_PXE_BASE_CODE_FUNCTION_DISCOVER; 543 NewCreatedInfo = NULL; 544 544 545 545 if (!Mode->Started) { … … 571 571 // There are 3 methods to get the information for discover. 572 572 // 573 ZeroMem (&DefaultInfo, sizeof (EFI_PXE_BASE_CODE_DISCOVER_INFO)); 573 574 if (*Layer != EFI_PXE_BASE_CODE_BOOT_LAYER_INITIAL) { 574 575 // … … 595 596 // 2. Extract the discover information from the cached packets if unspecified. 596 597 // 597 Info= &DefaultInfo;598 Status = PxeBcExtractDiscoverInfo (Private, Type, Info, &BootSvrEntry, &SrvList);598 NewCreatedInfo = &DefaultInfo; 599 Status = PxeBcExtractDiscoverInfo (Private, Type, &NewCreatedInfo, &BootSvrEntry, &SrvList); 599 600 if (EFI_ERROR (Status)) { 600 601 goto ON_EXIT; 601 602 } 602 603 ASSERT (NewCreatedInfo != NULL); 604 Info = NewCreatedInfo; 603 605 } else { 604 606 // … … 616 618 // 617 619 // It's invalid if the first server doesn't accecpt any response 618 // and meanwhile any of the rest servers accept any reponse.620 // but any of the other servers does accept any response. 619 621 // 620 622 Status = EFI_INVALID_PARAMETER; … … 635 637 Private->IsDoDiscover = TRUE; 636 638 637 if (Info->UseUCast) { 638 // 639 // Do discover by unicast. 640 // 641 for (Index = 0; Index < Info->IpCnt; Index++) { 642 if (BootSvrEntry == NULL) { 643 CopyMem (&Private->ServerIp, &SrvList[Index].IpAddr, sizeof (EFI_IP_ADDRESS)); 644 } else { 645 ASSERT (!Mode->UsingIpv6); 646 ZeroMem (&Private->ServerIp, sizeof (EFI_IP_ADDRESS)); 647 CopyMem (&Private->ServerIp, &BootSvrEntry->IpAddr[Index], sizeof (EFI_IPv4_ADDRESS)); 648 } 649 650 Status = PxeBcDiscoverBootServer ( 651 Private, 652 Type, 653 Layer, 654 UseBis, 655 &SrvList[Index].IpAddr, 656 0, 657 NULL 658 ); 659 } 660 } else if (Info->UseMCast) { 639 if (Info->UseMCast) { 661 640 // 662 641 // Do discover by multicast. … … 668 647 UseBis, 669 648 &Info->ServerMCastIp, 670 0,671 NULL649 Info->IpCnt, 650 SrvList 672 651 ); 673 652 … … 686 665 SrvList 687 666 ); 688 } 689 690 if (EFI_ERROR (Status)) { 691 goto ON_EXIT; 692 } else { 667 668 } else if (Info->UseUCast) { 669 // 670 // Do discover by unicast. 671 // 672 for (Index = 0; Index < Info->IpCnt; Index++) { 673 if (BootSvrEntry == NULL) { 674 CopyMem (&Private->ServerIp, &SrvList[Index].IpAddr, sizeof (EFI_IP_ADDRESS)); 675 } else { 676 ASSERT (!Mode->UsingIpv6); 677 ZeroMem (&Private->ServerIp, sizeof (EFI_IP_ADDRESS)); 678 CopyMem (&Private->ServerIp, &BootSvrEntry->IpAddr[Index], sizeof (EFI_IPv4_ADDRESS)); 679 } 680 681 Status = PxeBcDiscoverBootServer ( 682 Private, 683 Type, 684 Layer, 685 UseBis, 686 &Private->ServerIp, 687 Info->IpCnt, 688 SrvList 689 ); 690 } 691 } 692 693 if (!EFI_ERROR (Status)) { 693 694 // 694 695 // Parse the cached PXE reply packet, and store it into mode data if valid. … … 699 700 CopyMem ( 700 701 &Mode->PxeReply.Dhcpv6, 701 &Private->PxeReply.Dhcp6.Packet. Offer,702 Private->PxeReply.Dhcp6.Packet. Offer.Length702 &Private->PxeReply.Dhcp6.Packet.Ack.Dhcp6, 703 Private->PxeReply.Dhcp6.Packet.Ack.Length 703 704 ); 704 705 Mode->PxeReplyReceived = TRUE; … … 710 711 CopyMem ( 711 712 &Mode->PxeReply.Dhcpv4, 712 &Private->PxeReply.Dhcp4.Packet. Offer,713 Private->PxeReply.Dhcp4.Packet. Offer.Length713 &Private->PxeReply.Dhcp4.Packet.Ack.Dhcp4, 714 Private->PxeReply.Dhcp4.Packet.Ack.Length 714 715 ); 715 716 Mode->PxeReplyReceived = TRUE; … … 721 722 ON_EXIT: 722 723 724 if (NewCreatedInfo != NULL && NewCreatedInfo != &DefaultInfo) { 725 FreePool (NewCreatedInfo); 726 } 727 723 728 if (Mode->UsingIpv6) { 724 729 Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData); … … 958 963 } 959 964 960 if (EFI_ERROR (Status)) { 961 goto ON_EXIT; 962 } 963 964 ON_EXIT: 965 // 966 // Reconfigure the UDP instance with the default configuration. 967 // 965 968 if (Mode->UsingIpv6) { 966 969 Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData); … … 2023 2026 } 2024 2027 2025 Status = PxeBcFlushSta ionIp (Private, NewStationIp, NewSubnetMask);2028 Status = PxeBcFlushStationIp (Private, NewStationIp, NewSubnetMask); 2026 2029 ON_EXIT: 2027 2030 return Status; … … 2342 2345 // 2343 2346 Status = PxeBc->Start (PxeBc, UsingIpv6); 2347 if (Status == EFI_ALREADY_STARTED && UsingIpv6 != PxeBc->Mode->UsingIpv6) { 2348 // 2349 // PxeBc protocol has already been started but not on the required IP version, restart it. 2350 // 2351 Status = PxeBc->Stop (PxeBc); 2352 if (!EFI_ERROR (Status)) { 2353 Status = PxeBc->Start (PxeBc, UsingIpv6); 2354 } 2355 } 2344 2356 if (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED) { 2345 2357 Status = PxeBcLoadBootFile (Private, BufferSize, Buffer); -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h
r48674 r58459 3 3 interfaces declaration. 4 4 5 Copyright (c) 2007 - 201 1, Intel Corporation. All rights reserved.<BR>5 Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR> 6 6 7 7 This program and the accompanying materials … … 66 66 #define PXEBC_DEFAULT_LIFETIME 50000 // 50 ms, unit is microsecond 67 67 #define PXEBC_UDP_TIMEOUT 30000000 // 3 seconds, unit is 100nanosecond 68 #define PXEBC_DAD_ADDITIONAL_DELAY 30000000 // 3 seconds 68 69 #define PXEBC_MTFTP_TIMEOUT 4 69 70 #define PXEBC_MTFTP_RETRIES 6 … … 165 166 EFI_IP_ADDRESS ServerIp; 166 167 UINT16 CurSrcPort; 168 UINT32 IaId; 167 169 168 170 UINT32 Ip4MaxPacketSize; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c
r48674 r58459 2 2 Functions implementation related with Mtftp for UefiPxeBc Driver. 3 3 4 Copyright (c) 2007 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 70 70 PXE_MTFTP_ERROR_STRING_LENGTH 71 71 ); 72 Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] = '\0'; 72 73 } 73 74 … … 163 164 Status = Mtftp6->GetInfo ( 164 165 Mtftp6, 165 FALSE,166 NULL, 166 167 Filename, 167 168 NULL, … … 183 184 PXE_MTFTP_ERROR_STRING_LENGTH 184 185 ); 186 Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] = '\0'; 185 187 } 186 188 goto ON_ERROR; … … 512 514 PXE_MTFTP_ERROR_STRING_LENGTH 513 515 ); 516 Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] = '\0'; 514 517 } 515 518 … … 605 608 Status = Mtftp4->GetInfo ( 606 609 Mtftp4, 607 FALSE,610 NULL, 608 611 Filename, 609 612 NULL, … … 625 628 PXE_MTFTP_ERROR_STRING_LENGTH 626 629 ); 630 Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] = '\0'; 627 631 } 628 632 goto ON_ERROR; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
r48674 r58459 2 2 Support functions implementation for UefiPxeBc Driver. 3 3 4 Copyright (c) 2007 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 29 29 **/ 30 30 EFI_STATUS 31 PxeBcFlushSta ionIp (31 PxeBcFlushStationIp ( 32 32 PXEBC_PRIVATE_DATA *Private, 33 33 EFI_IP_ADDRESS *StationIp, … … 60 60 61 61 Status = Private->Ip6->Receive (Private->Ip6, &Private->Icmp6Token); 62 if (EFI_ERROR (Status)) {63 goto ON_EXIT;64 }65 66 62 } else { 67 63 ASSERT (SubnetMask != NULL); … … 83 79 84 80 Status = Private->Ip4->Receive (Private->Ip4, &Private->IcmpToken); 85 if (EFI_ERROR (Status)) {86 goto ON_EXIT;87 }88 89 81 } 90 82 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h
r48674 r58459 2 2 Support functions declaration for UefiPxeBc Driver. 3 3 4 Copyright (c) 2007 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 39 39 **/ 40 40 EFI_STATUS 41 PxeBcFlushSta ionIp (41 PxeBcFlushStationIp ( 42 42 PXEBC_PRIVATE_DATA *Private, 43 43 EFI_IP_ADDRESS *StationIp, … … 486 486 ); 487 487 488 /** 489 Get the Nic handle using any child handle in the IPv4 stack. 490 491 @param[in] ControllerHandle Pointer to child handle over IPv4. 492 493 @return NicHandle The pointer to the Nic handle. 494 495 **/ 496 EFI_HANDLE 497 PxeBcGetNicByIp4Children ( 498 IN EFI_HANDLE ControllerHandle 499 ); 500 501 /** 502 Get the Nic handle using any child handle in the IPv6 stack. 503 504 @param[in] ControllerHandle Pointer to child handle over IPv6. 505 506 @return NicHandle The pointer to the Nic handle. 507 508 **/ 509 EFI_HANDLE 510 PxeBcGetNicByIp6Children ( 511 IN EFI_HANDLE ControllerHandle 512 ); 488 513 #endif -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
r48674 r58459 1 1 ## @file 2 # Component name for module PxeBc 2 # Access PXE-compatible devices for network access and network booting. 3 # 4 # This driver provides PXE Base Code Protocol which is used to accessing 5 # PXE-compatible device for network access or booting. It could work together 6 # with an IPv4 stack, an IPv6 stack or both. 3 7 # 4 # Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR> 8 # 9 # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR> 5 10 # 6 11 # This program and the accompanying materials … … 22 27 ENTRY_POINT = PxeBcDriverEntryPoint 23 28 UNLOAD_IMAGE = NetLibDefaultUnload 29 MODULE_UNI_FILE = UefiPxeBcDxe.uni 30 24 31 # 25 32 # The following information is for reference only and not required by the build tools. … … 64 71 PcdLib 65 72 66 67 [Guids]68 gEfiSmbiosTableGuid69 70 71 73 [Protocols] 72 gEfiDevicePathProtocolGuid 73 gEfiNetworkInterfaceIdentifierProtocolGuid_31 74 gEfiArpServiceBindingProtocolGuid 75 gEfiArpProtocolGuid 76 gEfiIp4ServiceBindingProtocolGuid 77 gEfiIp4ProtocolGuid 78 gEfiIp6ServiceBindingProtocolGuid 79 gEfiIp6ProtocolGuid 80 gEfiIp6ConfigProtocolGuid 81 gEfiUdp4ServiceBindingProtocolGuid 82 gEfiUdp4ProtocolGuid 83 gEfiMtftp4ServiceBindingProtocolGuid 84 gEfiMtftp4ProtocolGuid 85 gEfiDhcp4ServiceBindingProtocolGuid 86 gEfiDhcp4ProtocolGuid 87 gEfiUdp6ServiceBindingProtocolGuid 88 gEfiUdp6ProtocolGuid 89 gEfiMtftp6ServiceBindingProtocolGuid 90 gEfiMtftp6ProtocolGuid 91 gEfiDhcp6ServiceBindingProtocolGuid 92 gEfiDhcp6ProtocolGuid 93 gEfiPxeBaseCodeCallbackProtocolGuid 94 gEfiPxeBaseCodeProtocolGuid 95 gEfiLoadFileProtocolGuid 74 ## TO_START 75 ## SOMETIMES_CONSUMES 76 gEfiDevicePathProtocolGuid 77 gEfiNetworkInterfaceIdentifierProtocolGuid_31 ## SOMETIMES_CONSUMES 78 gEfiArpServiceBindingProtocolGuid ## TO_START 79 gEfiArpProtocolGuid ## TO_START 80 gEfiIp4ServiceBindingProtocolGuid ## TO_START 81 gEfiIp4ProtocolGuid ## TO_START 82 gEfiIp6ServiceBindingProtocolGuid ## TO_START 83 gEfiIp6ProtocolGuid ## TO_START 84 gEfiIp6ConfigProtocolGuid ## TO_START 85 gEfiUdp4ServiceBindingProtocolGuid ## TO_START 86 gEfiUdp4ProtocolGuid ## TO_START 87 gEfiMtftp4ServiceBindingProtocolGuid ## TO_START 88 gEfiMtftp4ProtocolGuid ## TO_START 89 gEfiDhcp4ServiceBindingProtocolGuid ## TO_START 90 gEfiDhcp4ProtocolGuid ## TO_START 91 gEfiUdp6ServiceBindingProtocolGuid ## TO_START 92 gEfiUdp6ProtocolGuid ## TO_START 93 gEfiMtftp6ServiceBindingProtocolGuid ## TO_START 94 gEfiMtftp6ProtocolGuid ## TO_START 95 gEfiDhcp6ServiceBindingProtocolGuid ## TO_START 96 gEfiDhcp6ProtocolGuid ## TO_START 97 gEfiPxeBaseCodeCallbackProtocolGuid ## SOMETIMES_PRODUCES 98 gEfiPxeBaseCodeProtocolGuid ## BY_START 99 gEfiLoadFileProtocolGuid ## BY_START 96 100 97 101 [Pcd] 98 gEfiMdeModulePkgTokenSpaceGuid.PcdTftpBlockSize ## CONSUMES 102 gEfiMdeModulePkgTokenSpaceGuid.PcdTftpBlockSize ## SOMETIMES_CONSUMES 103 [UserExtensions.TianoCore."ExtraFiles"] 104 UefiPxeBcDxeExtra.uni
Note:
See TracChangeset
for help on using the changeset viewer.