2 Driver Binding functions implementationfor for UefiPxeBc Driver.
4 (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
5 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php.
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include "PxeBcImpl.h"
20 EFI_DRIVER_BINDING_PROTOCOL gPxeBcIp4DriverBinding
= {
21 PxeBcIp4DriverBindingSupported
,
22 PxeBcIp4DriverBindingStart
,
23 PxeBcIp4DriverBindingStop
,
29 EFI_DRIVER_BINDING_PROTOCOL gPxeBcIp6DriverBinding
= {
30 PxeBcIp6DriverBindingSupported
,
31 PxeBcIp6DriverBindingStart
,
32 PxeBcIp6DriverBindingStop
,
39 Get the Nic handle using any child handle in the IPv4 stack.
41 @param[in] ControllerHandle Pointer to child handle over IPv4.
43 @return NicHandle The pointer to the Nic handle.
47 PxeBcGetNicByIp4Children (
48 IN EFI_HANDLE ControllerHandle
53 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiArpProtocolGuid
);
54 if (NicHandle
== NULL
) {
55 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiIp4ProtocolGuid
);
56 if (NicHandle
== NULL
) {
57 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiUdp4ProtocolGuid
);
58 if (NicHandle
== NULL
) {
59 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiDhcp4ProtocolGuid
);
60 if (NicHandle
== NULL
) {
61 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiMtftp4ProtocolGuid
);
62 if (NicHandle
== NULL
) {
75 Get the Nic handle using any child handle in the IPv6 stack.
77 @param[in] ControllerHandle Pointer to child handle over IPv6.
79 @return NicHandle The pointer to the Nic handle.
83 PxeBcGetNicByIp6Children (
84 IN EFI_HANDLE ControllerHandle
89 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiIp6ProtocolGuid
);
90 if (NicHandle
== NULL
) {
91 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiUdp6ProtocolGuid
);
92 if (NicHandle
== NULL
) {
93 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiDhcp6ProtocolGuid
);
94 if (NicHandle
== NULL
) {
95 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiMtftp6ProtocolGuid
);
96 if (NicHandle
== NULL
) {
108 Destroy the opened instances based on IPv4.
110 @param[in] This Pointer to the EFI_DRIVER_BINDING_PROTOCOL.
111 @param[in] Private Pointer to PXEBC_PRIVATE_DATA.
115 PxeBcDestroyIp4Children (
116 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
117 IN PXEBC_PRIVATE_DATA
*Private
120 ASSERT(Private
!= NULL
);
122 if (Private
->ArpChild
!= NULL
) {
124 // Close Arp for PxeBc->Arp and destroy the instance.
128 &gEfiArpProtocolGuid
,
129 This
->DriverBindingHandle
,
133 NetLibDestroyServiceChild (
135 This
->DriverBindingHandle
,
136 &gEfiArpServiceBindingProtocolGuid
,
141 if (Private
->Ip4Child
!= NULL
) {
143 // Close Ip4 for background ICMP error message and destroy the instance.
147 &gEfiIp4ProtocolGuid
,
148 This
->DriverBindingHandle
,
152 NetLibDestroyServiceChild (
154 This
->DriverBindingHandle
,
155 &gEfiIp4ServiceBindingProtocolGuid
,
160 if (Private
->Udp4WriteChild
!= NULL
) {
162 // Close Udp4 for PxeBc->UdpWrite and destroy the instance.
165 Private
->Udp4WriteChild
,
166 &gEfiUdp4ProtocolGuid
,
167 This
->DriverBindingHandle
,
171 NetLibDestroyServiceChild (
173 This
->DriverBindingHandle
,
174 &gEfiUdp4ServiceBindingProtocolGuid
,
175 Private
->Udp4WriteChild
179 if (Private
->Udp4ReadChild
!= NULL
) {
181 // Close Udp4 for PxeBc->UdpRead and destroy the instance.
184 Private
->Udp4ReadChild
,
185 &gEfiUdp4ProtocolGuid
,
186 This
->DriverBindingHandle
,
190 NetLibDestroyServiceChild (
192 This
->DriverBindingHandle
,
193 &gEfiUdp4ServiceBindingProtocolGuid
,
194 Private
->Udp4ReadChild
198 if (Private
->Mtftp4Child
!= NULL
) {
200 // Close Mtftp4 for PxeBc->Mtftp4 and destroy the instance.
203 Private
->Mtftp4Child
,
204 &gEfiMtftp4ProtocolGuid
,
205 This
->DriverBindingHandle
,
209 NetLibDestroyServiceChild (
211 This
->DriverBindingHandle
,
212 &gEfiMtftp4ServiceBindingProtocolGuid
,
217 if (Private
->Dhcp4Child
!= NULL
) {
219 // Close Dhcp4 for PxeBc->Dhcp4 and destroy the instance.
223 &gEfiDhcp4ProtocolGuid
,
224 This
->DriverBindingHandle
,
228 NetLibDestroyServiceChild (
230 This
->DriverBindingHandle
,
231 &gEfiDhcp4ServiceBindingProtocolGuid
,
236 if (Private
->Ip4Nic
!= NULL
) {
238 // Close PxeBcPrivate from the parent Nic handle and destroy the virtual handle.
243 This
->DriverBindingHandle
,
244 Private
->Ip4Nic
->Controller
247 gBS
->UninstallMultipleProtocolInterfaces (
248 Private
->Ip4Nic
->Controller
,
249 &gEfiDevicePathProtocolGuid
,
250 Private
->Ip4Nic
->DevicePath
,
251 &gEfiLoadFileProtocolGuid
,
252 &Private
->Ip4Nic
->LoadFile
,
253 &gEfiPxeBaseCodeProtocolGuid
,
257 FreePool (Private
->Ip4Nic
->DevicePath
);
259 if (Private
->Snp
!= NULL
) {
261 // Close SNP from the child virtual handle
264 Private
->Ip4Nic
->Controller
,
265 &gEfiSimpleNetworkProtocolGuid
,
266 This
->DriverBindingHandle
,
267 Private
->Ip4Nic
->Controller
270 gBS
->UninstallProtocolInterface (
271 Private
->Ip4Nic
->Controller
,
272 &gEfiSimpleNetworkProtocolGuid
,
276 FreePool (Private
->Ip4Nic
);
279 Private
->ArpChild
= NULL
;
280 Private
->Ip4Child
= NULL
;
281 Private
->Udp4WriteChild
= NULL
;
282 Private
->Udp4ReadChild
= NULL
;
283 Private
->Mtftp4Child
= NULL
;
284 Private
->Dhcp4Child
= NULL
;
285 Private
->Ip4Nic
= NULL
;
290 Destroy the opened instances based on IPv6.
292 @param[in] This Pointer to the EFI_DRIVER_BINDING_PROTOCOL.
293 @param[in] Private Pointer to PXEBC_PRIVATE_DATA.
297 PxeBcDestroyIp6Children (
298 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
299 IN PXEBC_PRIVATE_DATA
*Private
302 ASSERT(Private
!= NULL
);
304 if (Private
->Ip6Child
!= NULL
) {
306 // Close Ip6 for Ip6->Ip6Config and destroy the instance.
310 &gEfiIp6ProtocolGuid
,
311 This
->DriverBindingHandle
,
315 NetLibDestroyServiceChild (
317 This
->DriverBindingHandle
,
318 &gEfiIp6ServiceBindingProtocolGuid
,
323 if (Private
->Udp6WriteChild
!= NULL
) {
325 // Close Udp6 for PxeBc->UdpWrite and destroy the instance.
328 Private
->Udp6WriteChild
,
329 &gEfiUdp6ProtocolGuid
,
330 This
->DriverBindingHandle
,
333 NetLibDestroyServiceChild (
335 This
->DriverBindingHandle
,
336 &gEfiUdp6ServiceBindingProtocolGuid
,
337 Private
->Udp6WriteChild
341 if (Private
->Udp6ReadChild
!= NULL
) {
343 // Close Udp6 for PxeBc->UdpRead and destroy the instance.
346 Private
->Udp6ReadChild
,
347 &gEfiUdp6ProtocolGuid
,
348 This
->DriverBindingHandle
,
351 NetLibDestroyServiceChild (
353 This
->DriverBindingHandle
,
354 &gEfiUdp6ServiceBindingProtocolGuid
,
355 Private
->Udp6ReadChild
359 if (Private
->Mtftp6Child
!= NULL
) {
361 // Close Mtftp6 for PxeBc->Mtftp and destroy the instance.
364 Private
->Mtftp6Child
,
365 &gEfiMtftp6ProtocolGuid
,
366 This
->DriverBindingHandle
,
370 NetLibDestroyServiceChild (
372 This
->DriverBindingHandle
,
373 &gEfiMtftp6ServiceBindingProtocolGuid
,
378 if (Private
->Dhcp6Child
!= NULL
) {
380 // Close Dhcp6 for PxeBc->Dhcp and destroy the instance.
384 &gEfiDhcp6ProtocolGuid
,
385 This
->DriverBindingHandle
,
389 NetLibDestroyServiceChild (
391 This
->DriverBindingHandle
,
392 &gEfiDhcp6ServiceBindingProtocolGuid
,
397 if (Private
->Ip6Nic
!= NULL
) {
399 // Close PxeBcPrivate from the parent Nic handle and destroy the virtual handle.
404 This
->DriverBindingHandle
,
405 Private
->Ip6Nic
->Controller
408 gBS
->UninstallMultipleProtocolInterfaces (
409 Private
->Ip6Nic
->Controller
,
410 &gEfiDevicePathProtocolGuid
,
411 Private
->Ip6Nic
->DevicePath
,
412 &gEfiLoadFileProtocolGuid
,
413 &Private
->Ip6Nic
->LoadFile
,
414 &gEfiPxeBaseCodeProtocolGuid
,
418 FreePool (Private
->Ip6Nic
->DevicePath
);
420 if (Private
->Snp
!= NULL
) {
422 // Close SNP from the child virtual handle
425 Private
->Ip6Nic
->Controller
,
426 &gEfiSimpleNetworkProtocolGuid
,
427 This
->DriverBindingHandle
,
428 Private
->Ip6Nic
->Controller
430 gBS
->UninstallProtocolInterface (
431 Private
->Ip6Nic
->Controller
,
432 &gEfiSimpleNetworkProtocolGuid
,
436 FreePool (Private
->Ip6Nic
);
439 Private
->Ip6Child
= NULL
;
440 Private
->Udp6WriteChild
= NULL
;
441 Private
->Udp6ReadChild
= NULL
;
442 Private
->Mtftp6Child
= NULL
;
443 Private
->Dhcp6Child
= NULL
;
444 Private
->Ip6Nic
= NULL
;
445 Private
->Mode
.Ipv6Available
= FALSE
;
449 Check whether UNDI protocol supports IPv6.
451 @param[in] ControllerHandle Controller handle.
452 @param[in] Private Pointer to PXEBC_PRIVATE_DATA.
453 @param[out] Ipv6Support TRUE if UNDI supports IPv6.
455 @retval EFI_SUCCESS Get the result whether UNDI supports IPv6 by NII or AIP protocol successfully.
456 @retval EFI_NOT_FOUND Don't know whether UNDI supports IPv6 since NII or AIP is not available.
460 PxeBcCheckIpv6Support (
461 IN EFI_HANDLE ControllerHandle
,
462 IN PXEBC_PRIVATE_DATA
*Private
,
463 OUT BOOLEAN
*Ipv6Support
467 EFI_ADAPTER_INFORMATION_PROTOCOL
*Aip
;
469 EFI_GUID
*InfoTypesBuffer
;
470 UINTN InfoTypeBufferCount
;
476 ASSERT (Private
!= NULL
&& Ipv6Support
!= NULL
);
479 // Check whether the UNDI supports IPv6 by NII protocol.
481 if (Private
->Nii
!= NULL
) {
482 *Ipv6Support
= Private
->Nii
->Ipv6Supported
;
487 // Check whether the UNDI supports IPv6 by AIP protocol.
491 // Get the NIC handle by SNP protocol.
493 Handle
= NetLibGetSnpHandle (ControllerHandle
, NULL
);
494 if (Handle
== NULL
) {
495 return EFI_NOT_FOUND
;
499 Status
= gBS
->HandleProtocol (
501 &gEfiAdapterInformationProtocolGuid
,
504 if (EFI_ERROR (Status
) || Aip
== NULL
) {
505 return EFI_NOT_FOUND
;
508 InfoTypesBuffer
= NULL
;
509 InfoTypeBufferCount
= 0;
510 Status
= Aip
->GetSupportedTypes (Aip
, &InfoTypesBuffer
, &InfoTypeBufferCount
);
511 if (EFI_ERROR (Status
) || InfoTypesBuffer
== NULL
) {
512 FreePool (InfoTypesBuffer
);
513 return EFI_NOT_FOUND
;
517 for (TypeIndex
= 0; TypeIndex
< InfoTypeBufferCount
; TypeIndex
++) {
518 if (CompareGuid (&InfoTypesBuffer
[TypeIndex
], &gEfiAdapterInfoUndiIpv6SupportGuid
)) {
524 FreePool (InfoTypesBuffer
);
526 return EFI_NOT_FOUND
;
530 // We now have adapter information block.
534 Status
= Aip
->GetInformation (Aip
, &gEfiAdapterInfoUndiIpv6SupportGuid
, &InfoBlock
, &InfoBlockSize
);
535 if (EFI_ERROR (Status
) || InfoBlock
== NULL
) {
536 FreePool (InfoBlock
);
537 return EFI_NOT_FOUND
;
540 *Ipv6Support
= ((EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT
*) InfoBlock
)->Ipv6Support
;
541 FreePool (InfoBlock
);
547 Create the opened instances based on IPv4.
549 @param[in] This Pointer to EFI_DRIVER_BINDING_PROTOCOL.
550 @param[in] ControllerHandle Handle of the child to destroy.
551 @param[in] Private Handle Pointer to PXEBC_PRIVATE_DATA.
553 @retval EFI_SUCCESS The instances based on IPv4 were all created successfully.
554 @retval Others An unexpected error occurred.
558 PxeBcCreateIp4Children (
559 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
560 IN EFI_HANDLE ControllerHandle
,
561 IN PXEBC_PRIVATE_DATA
*Private
565 IPv4_DEVICE_PATH Ip4Node
;
566 EFI_PXE_BASE_CODE_MODE
*Mode
;
567 EFI_UDP4_CONFIG_DATA
*Udp4CfgData
;
568 EFI_IP4_CONFIG_DATA
*Ip4CfgData
;
569 EFI_IP4_MODE_DATA Ip4ModeData
;
570 PXEBC_PRIVATE_PROTOCOL
*Id
;
571 EFI_SIMPLE_NETWORK_PROTOCOL
*Snp
;
573 if (Private
->Ip4Nic
!= NULL
) {
575 // Already created before.
581 // Create Dhcp4 child and open Dhcp4 protocol for PxeBc->Dhcp.
583 Status
= NetLibCreateServiceChild (
585 This
->DriverBindingHandle
,
586 &gEfiDhcp4ServiceBindingProtocolGuid
,
589 if (EFI_ERROR (Status
)) {
593 Status
= gBS
->OpenProtocol (
595 &gEfiDhcp4ProtocolGuid
,
596 (VOID
**) &Private
->Dhcp4
,
597 This
->DriverBindingHandle
,
599 EFI_OPEN_PROTOCOL_BY_DRIVER
601 if (EFI_ERROR (Status
)) {
606 // Create Mtftp4 child and open Mtftp4 protocol for PxeBc->Mtftp.
608 Status
= NetLibCreateServiceChild (
610 This
->DriverBindingHandle
,
611 &gEfiMtftp4ServiceBindingProtocolGuid
,
612 &Private
->Mtftp4Child
614 if (EFI_ERROR (Status
)) {
618 Status
= gBS
->OpenProtocol (
619 Private
->Mtftp4Child
,
620 &gEfiMtftp4ProtocolGuid
,
621 (VOID
**) &Private
->Mtftp4
,
622 This
->DriverBindingHandle
,
624 EFI_OPEN_PROTOCOL_BY_DRIVER
626 if (EFI_ERROR (Status
)) {
631 // Create Udp4 child and open Udp4 protocol for PxeBc->UdpRead.
633 Status
= NetLibCreateServiceChild (
635 This
->DriverBindingHandle
,
636 &gEfiUdp4ServiceBindingProtocolGuid
,
637 &Private
->Udp4ReadChild
639 if (EFI_ERROR (Status
)) {
643 Status
= gBS
->OpenProtocol (
644 Private
->Udp4ReadChild
,
645 &gEfiUdp4ProtocolGuid
,
646 (VOID
**) &Private
->Udp4Read
,
647 This
->DriverBindingHandle
,
649 EFI_OPEN_PROTOCOL_BY_DRIVER
651 if (EFI_ERROR (Status
)) {
656 // Create Udp4 child and open Udp4 protocol for PxeBc->UdpWrite.
658 Status
= NetLibCreateServiceChild (
660 This
->DriverBindingHandle
,
661 &gEfiUdp4ServiceBindingProtocolGuid
,
662 &Private
->Udp4WriteChild
664 if (EFI_ERROR (Status
)) {
668 Status
= gBS
->OpenProtocol (
669 Private
->Udp4WriteChild
,
670 &gEfiUdp4ProtocolGuid
,
671 (VOID
**) &Private
->Udp4Write
,
672 This
->DriverBindingHandle
,
674 EFI_OPEN_PROTOCOL_BY_DRIVER
676 if (EFI_ERROR (Status
)) {
681 // Create Arp child and open Arp protocol for PxeBc->Arp.
683 Status
= NetLibCreateServiceChild (
685 This
->DriverBindingHandle
,
686 &gEfiArpServiceBindingProtocolGuid
,
689 if (EFI_ERROR (Status
)) {
693 Status
= gBS
->OpenProtocol (
695 &gEfiArpProtocolGuid
,
696 (VOID
**) &Private
->Arp
,
697 This
->DriverBindingHandle
,
699 EFI_OPEN_PROTOCOL_BY_DRIVER
701 if (EFI_ERROR (Status
)) {
706 // Create Ip4 child and open Ip4 protocol for background ICMP packets.
708 Status
= NetLibCreateServiceChild (
710 This
->DriverBindingHandle
,
711 &gEfiIp4ServiceBindingProtocolGuid
,
714 if (EFI_ERROR (Status
)) {
718 Status
= gBS
->OpenProtocol (
720 &gEfiIp4ProtocolGuid
,
721 (VOID
**) &Private
->Ip4
,
722 This
->DriverBindingHandle
,
724 EFI_OPEN_PROTOCOL_BY_DRIVER
726 if (EFI_ERROR (Status
)) {
731 // Get max packet size from Ip4 to calculate block size for Tftp later.
733 Status
= Private
->Ip4
->GetModeData (Private
->Ip4
, &Ip4ModeData
, NULL
, NULL
);
734 if (EFI_ERROR (Status
)) {
738 Private
->Ip4MaxPacketSize
= Ip4ModeData
.MaxPacketSize
;
740 Private
->Ip4Nic
= AllocateZeroPool (sizeof (PXEBC_VIRTUAL_NIC
));
741 if (Private
->Ip4Nic
== NULL
) {
742 return EFI_OUT_OF_RESOURCES
;
745 Private
->Ip4Nic
->Private
= Private
;
746 Private
->Ip4Nic
->Signature
= PXEBC_VIRTUAL_NIC_SIGNATURE
;
749 // Locate Ip4->Ip4Config2 and store it for set IPv4 Policy.
751 Status
= gBS
->HandleProtocol (
753 &gEfiIp4Config2ProtocolGuid
,
754 (VOID
**) &Private
->Ip4Config2
756 if (EFI_ERROR (Status
)) {
761 // Create a device path node for Ipv4 virtual nic, and append it.
763 ZeroMem (&Ip4Node
, sizeof (IPv4_DEVICE_PATH
));
764 Ip4Node
.Header
.Type
= MESSAGING_DEVICE_PATH
;
765 Ip4Node
.Header
.SubType
= MSG_IPv4_DP
;
766 Ip4Node
.StaticIpAddress
= FALSE
;
768 SetDevicePathNodeLength (&Ip4Node
.Header
, sizeof (Ip4Node
));
770 Private
->Ip4Nic
->DevicePath
= AppendDevicePathNode (Private
->DevicePath
, &Ip4Node
.Header
);
772 if (Private
->Ip4Nic
->DevicePath
== NULL
) {
773 Status
= EFI_OUT_OF_RESOURCES
;
778 &Private
->Ip4Nic
->LoadFile
,
779 &gLoadFileProtocolTemplate
,
780 sizeof (EFI_LOAD_FILE_PROTOCOL
)
784 // Create a new handle for IPv4 virtual nic,
785 // and install PxeBaseCode, LoadFile and DevicePath protocols.
787 Status
= gBS
->InstallMultipleProtocolInterfaces (
788 &Private
->Ip4Nic
->Controller
,
789 &gEfiDevicePathProtocolGuid
,
790 Private
->Ip4Nic
->DevicePath
,
791 &gEfiLoadFileProtocolGuid
,
792 &Private
->Ip4Nic
->LoadFile
,
793 &gEfiPxeBaseCodeProtocolGuid
,
797 if (EFI_ERROR (Status
)) {
801 if (Private
->Snp
!= NULL
) {
803 // Install SNP protocol on purpose is for some OS loader backward
804 // compatibility consideration.
806 Status
= gBS
->InstallProtocolInterface (
807 &Private
->Ip4Nic
->Controller
,
808 &gEfiSimpleNetworkProtocolGuid
,
809 EFI_NATIVE_INTERFACE
,
812 if (EFI_ERROR (Status
)) {
817 // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally
818 // layering to perform the experiment.
820 Status
= gBS
->OpenProtocol (
821 Private
->Ip4Nic
->Controller
,
822 &gEfiSimpleNetworkProtocolGuid
,
824 This
->DriverBindingHandle
,
825 Private
->Ip4Nic
->Controller
,
826 EFI_OPEN_PROTOCOL_BY_DRIVER
|EFI_OPEN_PROTOCOL_EXCLUSIVE
828 if (EFI_ERROR (Status
)) {
834 // Open PxeBaseCodePrivate protocol by child to setup a parent-child relationship between
835 // real NIC handle and the virtual IPv4 NIC handle.
837 Status
= gBS
->OpenProtocol (
841 This
->DriverBindingHandle
,
842 Private
->Ip4Nic
->Controller
,
843 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
845 if (EFI_ERROR (Status
)) {
850 // Set default configure data for Udp4Read and Ip4 instance.
852 Mode
= Private
->PxeBc
.Mode
;
853 Udp4CfgData
= &Private
->Udp4CfgData
;
854 Ip4CfgData
= &Private
->Ip4CfgData
;
856 Udp4CfgData
->AcceptBroadcast
= FALSE
;
857 Udp4CfgData
->AcceptAnyPort
= TRUE
;
858 Udp4CfgData
->AllowDuplicatePort
= TRUE
;
859 Udp4CfgData
->TypeOfService
= Mode
->ToS
;
860 Udp4CfgData
->TimeToLive
= Mode
->TTL
;
861 Udp4CfgData
->ReceiveTimeout
= PXEBC_DEFAULT_LIFETIME
;
862 Udp4CfgData
->TransmitTimeout
= PXEBC_DEFAULT_LIFETIME
;
864 Ip4CfgData
->AcceptIcmpErrors
= TRUE
;
865 Ip4CfgData
->DefaultProtocol
= EFI_IP_PROTO_ICMP
;
866 Ip4CfgData
->TypeOfService
= Mode
->ToS
;
867 Ip4CfgData
->TimeToLive
= Mode
->TTL
;
868 Ip4CfgData
->ReceiveTimeout
= PXEBC_DEFAULT_LIFETIME
;
869 Ip4CfgData
->TransmitTimeout
= PXEBC_DEFAULT_LIFETIME
;
874 PxeBcDestroyIp4Children (This
, Private
);
880 Create the opened instances based on IPv6.
882 @param[in] This Pointer to EFI_DRIVER_BINDING_PROTOCOL.
883 @param[in] ControllerHandle Handle of the child to destroy.
884 @param[in] Private Handle Pointer to PXEBC_PRIVATE_DATA.
886 @retval EFI_SUCCESS The instances based on IPv6 were all created successfully.
887 @retval Others An unexpected error occurred.
891 PxeBcCreateIp6Children (
892 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
893 IN EFI_HANDLE ControllerHandle
,
894 IN PXEBC_PRIVATE_DATA
*Private
898 IPv6_DEVICE_PATH Ip6Node
;
899 EFI_UDP6_CONFIG_DATA
*Udp6CfgData
;
900 EFI_IP6_CONFIG_DATA
*Ip6CfgData
;
901 EFI_IP6_MODE_DATA Ip6ModeData
;
902 PXEBC_PRIVATE_PROTOCOL
*Id
;
903 EFI_SIMPLE_NETWORK_PROTOCOL
*Snp
;
906 if (Private
->Ip6Nic
!= NULL
) {
908 // Already created before.
913 Private
->Ip6Nic
= AllocateZeroPool (sizeof (PXEBC_VIRTUAL_NIC
));
915 if (Private
->Ip6Nic
== NULL
) {
916 return EFI_OUT_OF_RESOURCES
;
919 Private
->Ip6Nic
->Private
= Private
;
920 Private
->Ip6Nic
->Signature
= PXEBC_VIRTUAL_NIC_SIGNATURE
;
923 // Create Dhcp6 child and open Dhcp6 protocol for PxeBc->Dhcp.
925 Status
= NetLibCreateServiceChild (
927 This
->DriverBindingHandle
,
928 &gEfiDhcp6ServiceBindingProtocolGuid
,
931 if (EFI_ERROR (Status
)) {
935 Status
= gBS
->OpenProtocol (
937 &gEfiDhcp6ProtocolGuid
,
938 (VOID
**) &Private
->Dhcp6
,
939 This
->DriverBindingHandle
,
941 EFI_OPEN_PROTOCOL_BY_DRIVER
943 if (EFI_ERROR (Status
)) {
948 // Generate a random IAID for the Dhcp6 assigned address.
950 Private
->IaId
= NET_RANDOM (NetRandomInitSeed ());
951 if (Private
->Snp
!= NULL
) {
952 for (Index
= 0; Index
< Private
->Snp
->Mode
->HwAddressSize
; Index
++) {
953 Private
->IaId
|= (Private
->Snp
->Mode
->CurrentAddress
.Addr
[Index
] << ((Index
<< 3) & 31));
958 // Create Mtftp6 child and open Mtftp6 protocol for PxeBc->Mtftp.
960 Status
= NetLibCreateServiceChild (
962 This
->DriverBindingHandle
,
963 &gEfiMtftp6ServiceBindingProtocolGuid
,
964 &Private
->Mtftp6Child
966 if (EFI_ERROR (Status
)) {
970 Status
= gBS
->OpenProtocol (
971 Private
->Mtftp6Child
,
972 &gEfiMtftp6ProtocolGuid
,
973 (VOID
**) &Private
->Mtftp6
,
974 This
->DriverBindingHandle
,
976 EFI_OPEN_PROTOCOL_BY_DRIVER
978 if (EFI_ERROR (Status
)) {
983 // Create Udp6 child and open Udp6 protocol for PxeBc->UdpRead.
985 Status
= NetLibCreateServiceChild (
987 This
->DriverBindingHandle
,
988 &gEfiUdp6ServiceBindingProtocolGuid
,
989 &Private
->Udp6ReadChild
991 if (EFI_ERROR (Status
)) {
995 Status
= gBS
->OpenProtocol (
996 Private
->Udp6ReadChild
,
997 &gEfiUdp6ProtocolGuid
,
998 (VOID
**) &Private
->Udp6Read
,
999 This
->DriverBindingHandle
,
1001 EFI_OPEN_PROTOCOL_BY_DRIVER
1003 if (EFI_ERROR (Status
)) {
1008 // Create Udp6 child and open Udp6 protocol for PxeBc->UdpWrite.
1010 Status
= NetLibCreateServiceChild (
1012 This
->DriverBindingHandle
,
1013 &gEfiUdp6ServiceBindingProtocolGuid
,
1014 &Private
->Udp6WriteChild
1016 if (EFI_ERROR (Status
)) {
1020 Status
= gBS
->OpenProtocol (
1021 Private
->Udp6WriteChild
,
1022 &gEfiUdp6ProtocolGuid
,
1023 (VOID
**) &Private
->Udp6Write
,
1024 This
->DriverBindingHandle
,
1026 EFI_OPEN_PROTOCOL_BY_DRIVER
1028 if (EFI_ERROR (Status
)) {
1033 // Create Ip6 child and open Ip6 protocol for background ICMP6 packets.
1035 Status
= NetLibCreateServiceChild (
1037 This
->DriverBindingHandle
,
1038 &gEfiIp6ServiceBindingProtocolGuid
,
1041 if (EFI_ERROR (Status
)) {
1045 Status
= gBS
->OpenProtocol (
1047 &gEfiIp6ProtocolGuid
,
1048 (VOID
**) &Private
->Ip6
,
1049 This
->DriverBindingHandle
,
1051 EFI_OPEN_PROTOCOL_BY_DRIVER
1053 if (EFI_ERROR (Status
)) {
1058 // Get max packet size from Ip6 to calculate block size for Tftp later.
1060 Status
= Private
->Ip6
->GetModeData (Private
->Ip6
, &Ip6ModeData
, NULL
, NULL
);
1061 if (EFI_ERROR (Status
)) {
1065 Private
->Ip6MaxPacketSize
= Ip6ModeData
.MaxPacketSize
;
1067 if (Ip6ModeData
.AddressList
!= NULL
) {
1068 FreePool (Ip6ModeData
.AddressList
);
1071 if (Ip6ModeData
.GroupTable
!= NULL
) {
1072 FreePool (Ip6ModeData
.GroupTable
);
1075 if (Ip6ModeData
.RouteTable
!= NULL
) {
1076 FreePool (Ip6ModeData
.RouteTable
);
1079 if (Ip6ModeData
.NeighborCache
!= NULL
) {
1080 FreePool (Ip6ModeData
.NeighborCache
);
1083 if (Ip6ModeData
.PrefixTable
!= NULL
) {
1084 FreePool (Ip6ModeData
.PrefixTable
);
1087 if (Ip6ModeData
.IcmpTypeList
!= NULL
) {
1088 FreePool (Ip6ModeData
.IcmpTypeList
);
1092 // Locate Ip6->Ip6Config and store it for set IPv6 address.
1094 Status
= gBS
->HandleProtocol (
1096 &gEfiIp6ConfigProtocolGuid
,
1097 (VOID
**) &Private
->Ip6Cfg
1099 if (EFI_ERROR (Status
)) {
1104 // Create a device path node for Ipv6 virtual nic, and append it.
1106 ZeroMem (&Ip6Node
, sizeof (IPv6_DEVICE_PATH
));
1107 Ip6Node
.Header
.Type
= MESSAGING_DEVICE_PATH
;
1108 Ip6Node
.Header
.SubType
= MSG_IPv6_DP
;
1109 Ip6Node
.PrefixLength
= IP6_PREFIX_LENGTH
;
1111 SetDevicePathNodeLength (&Ip6Node
.Header
, sizeof (Ip6Node
));
1113 Private
->Ip6Nic
->DevicePath
= AppendDevicePathNode (Private
->DevicePath
, &Ip6Node
.Header
);
1115 if (Private
->Ip6Nic
->DevicePath
== NULL
) {
1116 Status
= EFI_OUT_OF_RESOURCES
;
1121 &Private
->Ip6Nic
->LoadFile
,
1122 &gLoadFileProtocolTemplate
,
1123 sizeof (EFI_LOAD_FILE_PROTOCOL
)
1127 // Create a new handle for IPv6 virtual nic,
1128 // and install PxeBaseCode, LoadFile and DevicePath protocols.
1130 Status
= gBS
->InstallMultipleProtocolInterfaces (
1131 &Private
->Ip6Nic
->Controller
,
1132 &gEfiDevicePathProtocolGuid
,
1133 Private
->Ip6Nic
->DevicePath
,
1134 &gEfiLoadFileProtocolGuid
,
1135 &Private
->Ip6Nic
->LoadFile
,
1136 &gEfiPxeBaseCodeProtocolGuid
,
1140 if (EFI_ERROR (Status
)) {
1144 if (Private
->Snp
!= NULL
) {
1146 // Install SNP protocol on purpose is for some OS loader backward
1147 // compatibility consideration.
1149 Status
= gBS
->InstallProtocolInterface (
1150 &Private
->Ip6Nic
->Controller
,
1151 &gEfiSimpleNetworkProtocolGuid
,
1152 EFI_NATIVE_INTERFACE
,
1155 if (EFI_ERROR (Status
)) {
1160 // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally
1161 // layering to perform the experiment.
1163 Status
= gBS
->OpenProtocol (
1164 Private
->Ip6Nic
->Controller
,
1165 &gEfiSimpleNetworkProtocolGuid
,
1167 This
->DriverBindingHandle
,
1168 Private
->Ip6Nic
->Controller
,
1169 EFI_OPEN_PROTOCOL_BY_DRIVER
|EFI_OPEN_PROTOCOL_EXCLUSIVE
1171 if (EFI_ERROR (Status
)) {
1177 // Open PxeBaseCodePrivate protocol by child to setup a parent-child relationship between
1178 // real NIC handle and the virtual IPv6 NIC handle.
1180 Status
= gBS
->OpenProtocol (
1184 This
->DriverBindingHandle
,
1185 Private
->Ip6Nic
->Controller
,
1186 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
1188 if (EFI_ERROR (Status
)) {
1193 // Set IPv6 avaiable flag and set default configure data for
1194 // Udp6Read and Ip6 instance.
1196 Status
= PxeBcCheckIpv6Support (ControllerHandle
, Private
, &Private
->Mode
.Ipv6Available
);
1197 if (EFI_ERROR (Status
)) {
1199 // Fail to get the data whether UNDI supports IPv6. Set default value.
1201 Private
->Mode
.Ipv6Available
= TRUE
;
1204 if (!Private
->Mode
.Ipv6Available
) {
1208 Udp6CfgData
= &Private
->Udp6CfgData
;
1209 Ip6CfgData
= &Private
->Ip6CfgData
;
1211 Udp6CfgData
->AcceptAnyPort
= TRUE
;
1212 Udp6CfgData
->AllowDuplicatePort
= TRUE
;
1213 Udp6CfgData
->HopLimit
= PXEBC_DEFAULT_HOPLIMIT
;
1214 Udp6CfgData
->ReceiveTimeout
= PXEBC_DEFAULT_LIFETIME
;
1215 Udp6CfgData
->TransmitTimeout
= PXEBC_DEFAULT_LIFETIME
;
1217 Ip6CfgData
->AcceptIcmpErrors
= TRUE
;
1218 Ip6CfgData
->DefaultProtocol
= IP6_ICMP
;
1219 Ip6CfgData
->HopLimit
= PXEBC_DEFAULT_HOPLIMIT
;
1220 Ip6CfgData
->ReceiveTimeout
= PXEBC_DEFAULT_LIFETIME
;
1221 Ip6CfgData
->TransmitTimeout
= PXEBC_DEFAULT_LIFETIME
;
1226 PxeBcDestroyIp6Children (This
, Private
);
1232 The entry point for UefiPxeBc driver that installs the driver
1233 binding and component name protocol on its image.
1235 @param[in] ImageHandle The Image handle of the driver.
1236 @param[in] SystemTable The system table.
1244 PxeBcDriverEntryPoint (
1245 IN EFI_HANDLE ImageHandle
,
1246 IN EFI_SYSTEM_TABLE
*SystemTable
1251 Status
= EfiLibInstallDriverBindingComponentName2 (
1254 &gPxeBcIp4DriverBinding
,
1256 &gPxeBcComponentName
,
1257 &gPxeBcComponentName2
1259 if (EFI_ERROR (Status
)) {
1263 Status
= EfiLibInstallDriverBindingComponentName2 (
1266 &gPxeBcIp6DriverBinding
,
1268 &gPxeBcComponentName
,
1269 &gPxeBcComponentName2
1271 if (EFI_ERROR (Status
)) {
1272 EfiLibUninstallDriverBindingComponentName2 (
1273 &gPxeBcIp4DriverBinding
,
1274 &gPxeBcComponentName
,
1275 &gPxeBcComponentName2
1283 Test to see if this driver supports ControllerHandle. This is the worker function for
1284 PxeBcIp4(6)DriverBindingSupported.
1286 @param[in] This The pointer to the driver binding protocol.
1287 @param[in] ControllerHandle The handle of device to be tested.
1288 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1289 device to be started.
1290 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
1292 @retval EFI_SUCCESS This driver supports this device.
1293 @retval EFI_UNSUPPORTED This driver does not support this device.
1299 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1300 IN EFI_HANDLE ControllerHandle
,
1301 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1306 EFI_GUID
*DhcpServiceBindingGuid
;
1307 EFI_GUID
*MtftpServiceBindingGuid
;
1309 if (IpVersion
== IP_VERSION_4
) {
1310 DhcpServiceBindingGuid
= &gEfiDhcp4ServiceBindingProtocolGuid
;
1311 MtftpServiceBindingGuid
= &gEfiMtftp4ServiceBindingProtocolGuid
;
1313 DhcpServiceBindingGuid
= &gEfiDhcp6ServiceBindingProtocolGuid
;
1314 MtftpServiceBindingGuid
= &gEfiMtftp6ServiceBindingProtocolGuid
;
1318 // Try to open the Mtftp and Dhcp protocol to test whether IP stack is ready.
1320 Status
= gBS
->OpenProtocol (
1322 DhcpServiceBindingGuid
,
1324 This
->DriverBindingHandle
,
1326 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
1328 if (!EFI_ERROR (Status
)) {
1329 Status
= gBS
->OpenProtocol (
1331 MtftpServiceBindingGuid
,
1333 This
->DriverBindingHandle
,
1335 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
1340 // It's unsupported case if IP stack are not ready.
1342 if (EFI_ERROR (Status
)) {
1343 return EFI_UNSUPPORTED
;
1350 Start this driver on ControllerHandle. This is the worker function for
1351 PxeBcIp4(6)DriverBindingStart.
1353 @param[in] This The pointer to the driver binding protocol.
1354 @param[in] ControllerHandle The handle of device to be started.
1355 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1356 device to be started.
1357 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
1360 @retval EFI_SUCCESS This driver is installed to ControllerHandle.
1361 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
1362 @retval other This driver does not support this device.
1368 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1369 IN EFI_HANDLE ControllerHandle
,
1370 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1374 PXEBC_PRIVATE_DATA
*Private
;
1376 PXEBC_PRIVATE_PROTOCOL
*Id
;
1380 Status
= gBS
->OpenProtocol (
1384 This
->DriverBindingHandle
,
1386 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1388 if (!EFI_ERROR (Status
)) {
1390 // Skip the initialization if the driver has been started already.
1392 Private
= PXEBC_PRIVATE_DATA_FROM_ID (Id
);
1396 // If the driver has not been started yet, it should do initialization.
1398 Private
= AllocateZeroPool (sizeof (PXEBC_PRIVATE_DATA
));
1399 if (Private
== NULL
) {
1400 return EFI_OUT_OF_RESOURCES
;
1405 &gPxeBcProtocolTemplate
,
1406 sizeof (EFI_PXE_BASE_CODE_PROTOCOL
)
1409 Private
->Signature
= PXEBC_PRIVATE_DATA_SIGNATURE
;
1410 Private
->Controller
= ControllerHandle
;
1411 Private
->Image
= This
->ImageHandle
;
1412 Private
->PxeBc
.Mode
= &Private
->Mode
;
1413 Private
->Mode
.Ipv6Supported
= TRUE
;
1414 Private
->Mode
.AutoArp
= TRUE
;
1415 Private
->Mode
.TTL
= DEFAULT_TTL
;
1416 Private
->Mode
.ToS
= DEFAULT_ToS
;
1419 // Open device path to prepare for appending virtual NIC node.
1421 Status
= gBS
->OpenProtocol (
1423 &gEfiDevicePathProtocolGuid
,
1424 (VOID
**) &Private
->DevicePath
,
1425 This
->DriverBindingHandle
,
1427 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1430 if (EFI_ERROR (Status
)) {
1435 // Get the NII interface if it exists, it's not required.
1437 Status
= gBS
->OpenProtocol (
1439 &gEfiNetworkInterfaceIdentifierProtocolGuid_31
,
1440 (VOID
**) &Private
->Nii
,
1441 This
->DriverBindingHandle
,
1443 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1445 if (EFI_ERROR (Status
)) {
1446 Private
->Nii
= NULL
;
1450 // Install PxeBaseCodePrivate protocol onto the real NIC handler.
1451 // PxeBaseCodePrivate protocol is only used to keep the relationship between
1452 // NIC handle and virtual child handles.
1453 // gEfiCallerIdGuid will be used as its protocol guid.
1455 Status
= gBS
->InstallProtocolInterface (
1458 EFI_NATIVE_INTERFACE
,
1461 if (EFI_ERROR (Status
)) {
1466 // Try to locate SNP protocol.
1468 NetLibGetSnpHandle(ControllerHandle
, &Private
->Snp
);
1471 if (IpVersion
== IP_VERSION_4
) {
1473 // Try to create virtual NIC handle for IPv4.
1475 Status
= PxeBcCreateIp4Children (This
, ControllerHandle
, Private
);
1478 // Try to create virtual NIC handle for IPv6.
1480 Status
= PxeBcCreateIp6Children (This
, ControllerHandle
, Private
);
1482 if (EFI_ERROR (Status
)) {
1484 // Failed to start PXE driver if IPv4 and IPv6 stack are both not available.
1486 Status
= EFI_DEVICE_ERROR
;
1494 gBS
->UninstallProtocolInterface (
1501 if (IpVersion
== IP_VERSION_4
) {
1502 PxeBcDestroyIp4Children (This
, Private
);
1504 PxeBcDestroyIp6Children (This
, Private
);
1507 if (FirstStart
&& Private
!= NULL
) {
1516 Stop this driver on ControllerHandle. This is the worker function for
1517 PxeBcIp4(6)DriverBindingStop.
1519 @param[in] This Protocol instance pointer.
1520 @param[in] ControllerHandle Handle of device to stop driver on.
1521 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
1522 children is zero stop the entire bus driver.
1523 @param[in] ChildHandleBuffer List of Child Handles to Stop.
1524 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
1526 @retval EFI_SUCCESS This driver was removed ControllerHandle.
1527 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1528 @retval Others This driver was not removed from this device
1534 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1535 IN EFI_HANDLE ControllerHandle
,
1536 IN UINTN NumberOfChildren
,
1537 IN EFI_HANDLE
*ChildHandleBuffer
,
1541 PXEBC_PRIVATE_DATA
*Private
;
1542 PXEBC_VIRTUAL_NIC
*VirtualNic
;
1543 EFI_LOAD_FILE_PROTOCOL
*LoadFile
;
1545 EFI_HANDLE NicHandle
;
1546 PXEBC_PRIVATE_PROTOCOL
*Id
;
1554 Status
= gBS
->OpenProtocol (
1556 &gEfiLoadFileProtocolGuid
,
1557 (VOID
**) &LoadFile
,
1558 This
->DriverBindingHandle
,
1560 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1562 if (EFI_ERROR (Status
)) {
1564 // Get the Nic handle by any pass-over service child handle.
1566 if (IpVersion
== IP_VERSION_4
) {
1567 NicHandle
= PxeBcGetNicByIp4Children (ControllerHandle
);
1569 NicHandle
= PxeBcGetNicByIp6Children (ControllerHandle
);
1571 if (NicHandle
== NULL
) {
1576 // Try to retrieve the private data by PxeBcPrivate protocol.
1578 Status
= gBS
->OpenProtocol (
1582 This
->DriverBindingHandle
,
1584 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1586 if (EFI_ERROR (Status
)) {
1589 Private
= PXEBC_PRIVATE_DATA_FROM_ID (Id
);
1593 // It's a virtual handle with LoadFileProtocol.
1595 Status
= gBS
->OpenProtocol (
1597 &gEfiLoadFileProtocolGuid
,
1598 (VOID
**) &LoadFile
,
1599 This
->DriverBindingHandle
,
1601 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1603 if (EFI_ERROR (Status
)) {
1607 VirtualNic
= PXEBC_VIRTUAL_NIC_FROM_LOADFILE (LoadFile
);
1608 Private
= VirtualNic
->Private
;
1609 NicHandle
= Private
->Controller
;
1613 // Stop functionality of PXE Base Code protocol
1615 Status
= Private
->PxeBc
.Stop (&Private
->PxeBc
);
1616 if (Status
!= EFI_SUCCESS
&& Status
!= EFI_NOT_STARTED
) {
1621 if (Private
->Ip4Nic
!= NULL
&& IpVersion
== IP_VERSION_4
) {
1622 PxeBcDestroyIp4Children (This
, Private
);
1625 if (Private
->Ip6Nic
!= NULL
&& IpVersion
== IP_VERSION_6
) {
1626 PxeBcDestroyIp6Children (This
, Private
);
1629 if (Private
->Ip4Nic
== NULL
&& Private
->Ip6Nic
== NULL
) {
1630 gBS
->UninstallProtocolInterface (
1642 Test to see if this driver supports ControllerHandle. This service
1643 is called by the EFI boot service ConnectController(). In
1644 order to make drivers as small as possible, there are a few calling
1645 restrictions for this service. ConnectController() must
1646 follow these calling restrictions. If any other agent wishes to call
1647 Supported() it must also follow these calling restrictions.
1649 @param[in] This The pointer to the driver binding protocol.
1650 @param[in] ControllerHandle The handle of device to be tested.
1651 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1652 device to be started.
1654 @retval EFI_SUCCESS This driver supports this device.
1655 @retval EFI_UNSUPPORTED This driver does not support this device.
1660 PxeBcIp4DriverBindingSupported (
1661 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1662 IN EFI_HANDLE ControllerHandle
,
1663 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
1666 return PxeBcSupported (
1669 RemainingDevicePath
,
1675 Start this driver on ControllerHandle. This service is called by the
1676 EFI boot service ConnectController(). In order to make
1677 drivers as small as possible, there are a few calling restrictions for
1678 this service. ConnectController() must follow these
1679 calling restrictions. If any other agent wishes to call Start() it
1680 must also follow these calling restrictions.
1682 @param[in] This The pointer to the driver binding protocol.
1683 @param[in] ControllerHandle The handle of device to be started.
1684 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1685 device to be started.
1687 @retval EFI_SUCCESS This driver is installed to ControllerHandle.
1688 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
1689 @retval other This driver does not support this device.
1694 PxeBcIp4DriverBindingStart (
1695 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1696 IN EFI_HANDLE ControllerHandle
,
1697 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
1703 RemainingDevicePath
,
1709 Stop this driver on ControllerHandle. This service is called by the
1710 EFI boot service DisconnectController(). In order to
1711 make drivers as small as possible, there are a few calling
1712 restrictions for this service. DisconnectController()
1713 must follow these calling restrictions. If any other agent wishes
1714 to call Stop() it must also follow these calling restrictions.
1716 @param[in] This Protocol instance pointer.
1717 @param[in] ControllerHandle Handle of device to stop driver on
1718 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
1719 children is zero stop the entire bus driver.
1720 @param[in] ChildHandleBuffer List of Child Handles to Stop.
1722 @retval EFI_SUCCESS This driver is removed ControllerHandle
1723 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1724 @retval Others This driver was not removed from this device.
1729 PxeBcIp4DriverBindingStop (
1730 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1731 IN EFI_HANDLE ControllerHandle
,
1732 IN UINTN NumberOfChildren
,
1733 IN EFI_HANDLE
*ChildHandleBuffer
1746 Test to see if this driver supports ControllerHandle. This service
1747 is called by the EFI boot service ConnectController(). In
1748 order to make drivers as small as possible, there are a few calling
1749 restrictions for this service. ConnectController() must
1750 follow these calling restrictions. If any other agent wishes to call
1751 Supported() it must also follow these calling restrictions.
1753 @param[in] This The pointer to the driver binding protocol.
1754 @param[in] ControllerHandle The handle of device to be tested.
1755 @param[in] RemainingDevicePath Optional parameter use to pick a specific child
1756 device to be started.
1758 @retval EFI_SUCCESS This driver supports this device.
1759 @retval EFI_UNSUPPORTED This driver does not support this device.
1764 PxeBcIp6DriverBindingSupported (
1765 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1766 IN EFI_HANDLE ControllerHandle
,
1767 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
1770 return PxeBcSupported (
1773 RemainingDevicePath
,
1779 Start this driver on ControllerHandle. This service is called by the
1780 EFI boot service ConnectController(). In order to make
1781 drivers as small as possible, there are a few calling restrictions for
1782 this service. ConnectController() must follow these
1783 calling restrictions. If any other agent wishes to call Start() it
1784 must also follow these calling restrictions.
1786 @param[in] This The pointer to the driver binding protocol.
1787 @param[in] ControllerHandle The handle of device to be started.
1788 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1789 device to be started.
1791 @retval EFI_SUCCESS This driver is installed to ControllerHandle.
1792 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
1793 @retval other This driver does not support this device.
1798 PxeBcIp6DriverBindingStart (
1799 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1800 IN EFI_HANDLE ControllerHandle
,
1801 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
1807 RemainingDevicePath
,
1813 Stop this driver on ControllerHandle. This service is called by the
1814 EFI boot service DisconnectController(). In order to
1815 make drivers as small as possible, there are a few calling
1816 restrictions for this service. DisconnectController()
1817 must follow these calling restrictions. If any other agent wishes
1818 to call Stop() it must also follow these calling restrictions.
1820 @param[in] This Protocol instance pointer.
1821 @param[in] ControllerHandle Handle of device to stop driver on
1822 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
1823 children is zero stop the entire bus driver.
1824 @param[in] ChildHandleBuffer List of Child Handles to Stop.
1826 @retval EFI_SUCCESS This driver is removed ControllerHandle
1827 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1828 @retval Others This driver was not removed from this device.
1833 PxeBcIp6DriverBindingStop (
1834 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1835 IN EFI_HANDLE ControllerHandle
,
1836 IN UINTN NumberOfChildren
,
1837 IN EFI_HANDLE
*ChildHandleBuffer