2 Driver Binding functions implementation for UefiPxeBc Driver.
4 (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
5 Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include "PxeBcImpl.h"
14 EFI_DRIVER_BINDING_PROTOCOL gPxeBcIp4DriverBinding
= {
15 PxeBcIp4DriverBindingSupported
,
16 PxeBcIp4DriverBindingStart
,
17 PxeBcIp4DriverBindingStop
,
23 EFI_DRIVER_BINDING_PROTOCOL gPxeBcIp6DriverBinding
= {
24 PxeBcIp6DriverBindingSupported
,
25 PxeBcIp6DriverBindingStart
,
26 PxeBcIp6DriverBindingStop
,
33 Get the Nic handle using any child handle in the IPv4 stack.
35 @param[in] ControllerHandle Pointer to child handle over IPv4.
37 @return NicHandle The pointer to the Nic handle.
41 PxeBcGetNicByIp4Children (
42 IN EFI_HANDLE ControllerHandle
47 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiArpProtocolGuid
);
48 if (NicHandle
== NULL
) {
49 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiIp4ProtocolGuid
);
50 if (NicHandle
== NULL
) {
51 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiUdp4ProtocolGuid
);
52 if (NicHandle
== NULL
) {
53 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiDhcp4ProtocolGuid
);
54 if (NicHandle
== NULL
) {
55 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiMtftp4ProtocolGuid
);
56 if (NicHandle
== NULL
) {
69 Get the Nic handle using any child handle in the IPv6 stack.
71 @param[in] ControllerHandle Pointer to child handle over IPv6.
73 @return NicHandle The pointer to the Nic handle.
77 PxeBcGetNicByIp6Children (
78 IN EFI_HANDLE ControllerHandle
83 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiIp6ProtocolGuid
);
84 if (NicHandle
== NULL
) {
85 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiUdp6ProtocolGuid
);
86 if (NicHandle
== NULL
) {
87 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiDhcp6ProtocolGuid
);
88 if (NicHandle
== NULL
) {
89 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiMtftp6ProtocolGuid
);
90 if (NicHandle
== NULL
) {
102 Destroy the opened instances based on IPv4.
104 @param[in] This Pointer to the EFI_DRIVER_BINDING_PROTOCOL.
105 @param[in] Private Pointer to PXEBC_PRIVATE_DATA.
109 PxeBcDestroyIp4Children (
110 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
111 IN PXEBC_PRIVATE_DATA
*Private
114 ASSERT(Private
!= NULL
);
116 if (Private
->ArpChild
!= NULL
) {
118 // Close Arp for PxeBc->Arp and destroy the instance.
122 &gEfiArpProtocolGuid
,
123 This
->DriverBindingHandle
,
127 NetLibDestroyServiceChild (
129 This
->DriverBindingHandle
,
130 &gEfiArpServiceBindingProtocolGuid
,
135 if (Private
->Ip4Child
!= NULL
) {
137 // Close Ip4 for background ICMP error message and destroy the instance.
141 &gEfiIp4ProtocolGuid
,
142 This
->DriverBindingHandle
,
146 NetLibDestroyServiceChild (
148 This
->DriverBindingHandle
,
149 &gEfiIp4ServiceBindingProtocolGuid
,
154 if (Private
->Udp4WriteChild
!= NULL
) {
156 // Close Udp4 for PxeBc->UdpWrite and destroy the instance.
159 Private
->Udp4WriteChild
,
160 &gEfiUdp4ProtocolGuid
,
161 This
->DriverBindingHandle
,
165 NetLibDestroyServiceChild (
167 This
->DriverBindingHandle
,
168 &gEfiUdp4ServiceBindingProtocolGuid
,
169 Private
->Udp4WriteChild
173 if (Private
->Udp4ReadChild
!= NULL
) {
175 // Close Udp4 for PxeBc->UdpRead and destroy the instance.
178 Private
->Udp4ReadChild
,
179 &gEfiUdp4ProtocolGuid
,
180 This
->DriverBindingHandle
,
184 NetLibDestroyServiceChild (
186 This
->DriverBindingHandle
,
187 &gEfiUdp4ServiceBindingProtocolGuid
,
188 Private
->Udp4ReadChild
192 if (Private
->Mtftp4Child
!= NULL
) {
194 // Close Mtftp4 for PxeBc->Mtftp4 and destroy the instance.
197 Private
->Mtftp4Child
,
198 &gEfiMtftp4ProtocolGuid
,
199 This
->DriverBindingHandle
,
203 NetLibDestroyServiceChild (
205 This
->DriverBindingHandle
,
206 &gEfiMtftp4ServiceBindingProtocolGuid
,
211 if (Private
->Dhcp4Child
!= NULL
) {
213 // Close Dhcp4 for PxeBc->Dhcp4 and destroy the instance.
217 &gEfiDhcp4ProtocolGuid
,
218 This
->DriverBindingHandle
,
222 NetLibDestroyServiceChild (
224 This
->DriverBindingHandle
,
225 &gEfiDhcp4ServiceBindingProtocolGuid
,
230 if (Private
->Ip4Nic
!= NULL
) {
232 // Close PxeBcPrivate from the parent Nic handle and destroy the virtual handle.
237 This
->DriverBindingHandle
,
238 Private
->Ip4Nic
->Controller
241 gBS
->UninstallMultipleProtocolInterfaces (
242 Private
->Ip4Nic
->Controller
,
243 &gEfiDevicePathProtocolGuid
,
244 Private
->Ip4Nic
->DevicePath
,
245 &gEfiLoadFileProtocolGuid
,
246 &Private
->Ip4Nic
->LoadFile
,
247 &gEfiPxeBaseCodeProtocolGuid
,
251 FreePool (Private
->Ip4Nic
->DevicePath
);
253 if (Private
->Snp
!= NULL
) {
255 // Close SNP from the child virtual handle
258 Private
->Ip4Nic
->Controller
,
259 &gEfiSimpleNetworkProtocolGuid
,
260 This
->DriverBindingHandle
,
261 Private
->Ip4Nic
->Controller
264 gBS
->UninstallProtocolInterface (
265 Private
->Ip4Nic
->Controller
,
266 &gEfiSimpleNetworkProtocolGuid
,
270 FreePool (Private
->Ip4Nic
);
273 Private
->ArpChild
= NULL
;
274 Private
->Ip4Child
= NULL
;
275 Private
->Udp4WriteChild
= NULL
;
276 Private
->Udp4ReadChild
= NULL
;
277 Private
->Mtftp4Child
= NULL
;
278 Private
->Dhcp4Child
= NULL
;
279 Private
->Ip4Nic
= NULL
;
284 Destroy the opened instances based on IPv6.
286 @param[in] This Pointer to the EFI_DRIVER_BINDING_PROTOCOL.
287 @param[in] Private Pointer to PXEBC_PRIVATE_DATA.
291 PxeBcDestroyIp6Children (
292 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
293 IN PXEBC_PRIVATE_DATA
*Private
296 ASSERT(Private
!= NULL
);
298 if (Private
->Ip6Child
!= NULL
) {
300 // Close Ip6 for Ip6->Ip6Config and destroy the instance.
304 &gEfiIp6ProtocolGuid
,
305 This
->DriverBindingHandle
,
309 NetLibDestroyServiceChild (
311 This
->DriverBindingHandle
,
312 &gEfiIp6ServiceBindingProtocolGuid
,
317 if (Private
->Udp6WriteChild
!= NULL
) {
319 // Close Udp6 for PxeBc->UdpWrite and destroy the instance.
322 Private
->Udp6WriteChild
,
323 &gEfiUdp6ProtocolGuid
,
324 This
->DriverBindingHandle
,
327 NetLibDestroyServiceChild (
329 This
->DriverBindingHandle
,
330 &gEfiUdp6ServiceBindingProtocolGuid
,
331 Private
->Udp6WriteChild
335 if (Private
->Udp6ReadChild
!= NULL
) {
337 // Close Udp6 for PxeBc->UdpRead and destroy the instance.
340 Private
->Udp6ReadChild
,
341 &gEfiUdp6ProtocolGuid
,
342 This
->DriverBindingHandle
,
345 NetLibDestroyServiceChild (
347 This
->DriverBindingHandle
,
348 &gEfiUdp6ServiceBindingProtocolGuid
,
349 Private
->Udp6ReadChild
353 if (Private
->Mtftp6Child
!= NULL
) {
355 // Close Mtftp6 for PxeBc->Mtftp and destroy the instance.
358 Private
->Mtftp6Child
,
359 &gEfiMtftp6ProtocolGuid
,
360 This
->DriverBindingHandle
,
364 NetLibDestroyServiceChild (
366 This
->DriverBindingHandle
,
367 &gEfiMtftp6ServiceBindingProtocolGuid
,
372 if (Private
->Dhcp6Child
!= NULL
) {
374 // Close Dhcp6 for PxeBc->Dhcp and destroy the instance.
378 &gEfiDhcp6ProtocolGuid
,
379 This
->DriverBindingHandle
,
383 NetLibDestroyServiceChild (
385 This
->DriverBindingHandle
,
386 &gEfiDhcp6ServiceBindingProtocolGuid
,
391 if (Private
->Ip6Nic
!= NULL
) {
393 // Close PxeBcPrivate from the parent Nic handle and destroy the virtual handle.
398 This
->DriverBindingHandle
,
399 Private
->Ip6Nic
->Controller
402 gBS
->UninstallMultipleProtocolInterfaces (
403 Private
->Ip6Nic
->Controller
,
404 &gEfiDevicePathProtocolGuid
,
405 Private
->Ip6Nic
->DevicePath
,
406 &gEfiLoadFileProtocolGuid
,
407 &Private
->Ip6Nic
->LoadFile
,
408 &gEfiPxeBaseCodeProtocolGuid
,
412 FreePool (Private
->Ip6Nic
->DevicePath
);
414 if (Private
->Snp
!= NULL
) {
416 // Close SNP from the child virtual handle
419 Private
->Ip6Nic
->Controller
,
420 &gEfiSimpleNetworkProtocolGuid
,
421 This
->DriverBindingHandle
,
422 Private
->Ip6Nic
->Controller
424 gBS
->UninstallProtocolInterface (
425 Private
->Ip6Nic
->Controller
,
426 &gEfiSimpleNetworkProtocolGuid
,
430 FreePool (Private
->Ip6Nic
);
433 Private
->Ip6Child
= NULL
;
434 Private
->Udp6WriteChild
= NULL
;
435 Private
->Udp6ReadChild
= NULL
;
436 Private
->Mtftp6Child
= NULL
;
437 Private
->Dhcp6Child
= NULL
;
438 Private
->Ip6Nic
= NULL
;
439 Private
->Mode
.Ipv6Available
= FALSE
;
443 Check whether UNDI protocol supports IPv6.
445 @param[in] ControllerHandle Controller handle.
446 @param[in] Private Pointer to PXEBC_PRIVATE_DATA.
447 @param[out] Ipv6Support TRUE if UNDI supports IPv6.
449 @retval EFI_SUCCESS Get the result whether UNDI supports IPv6 by NII or AIP protocol successfully.
450 @retval EFI_NOT_FOUND Don't know whether UNDI supports IPv6 since NII or AIP is not available.
454 PxeBcCheckIpv6Support (
455 IN EFI_HANDLE ControllerHandle
,
456 IN PXEBC_PRIVATE_DATA
*Private
,
457 OUT BOOLEAN
*Ipv6Support
461 EFI_ADAPTER_INFORMATION_PROTOCOL
*Aip
;
463 EFI_GUID
*InfoTypesBuffer
;
464 UINTN InfoTypeBufferCount
;
470 ASSERT (Private
!= NULL
&& Ipv6Support
!= NULL
);
473 // Check whether the UNDI supports IPv6 by NII protocol.
475 if (Private
->Nii
!= NULL
) {
476 *Ipv6Support
= Private
->Nii
->Ipv6Supported
;
481 // Check whether the UNDI supports IPv6 by AIP protocol.
485 // Get the NIC handle by SNP protocol.
487 Handle
= NetLibGetSnpHandle (ControllerHandle
, NULL
);
488 if (Handle
== NULL
) {
489 return EFI_NOT_FOUND
;
493 Status
= gBS
->HandleProtocol (
495 &gEfiAdapterInformationProtocolGuid
,
498 if (EFI_ERROR (Status
) || Aip
== NULL
) {
499 return EFI_NOT_FOUND
;
502 InfoTypesBuffer
= NULL
;
503 InfoTypeBufferCount
= 0;
504 Status
= Aip
->GetSupportedTypes (Aip
, &InfoTypesBuffer
, &InfoTypeBufferCount
);
505 if (EFI_ERROR (Status
) || InfoTypesBuffer
== NULL
) {
506 FreePool (InfoTypesBuffer
);
507 return EFI_NOT_FOUND
;
511 for (TypeIndex
= 0; TypeIndex
< InfoTypeBufferCount
; TypeIndex
++) {
512 if (CompareGuid (&InfoTypesBuffer
[TypeIndex
], &gEfiAdapterInfoUndiIpv6SupportGuid
)) {
518 FreePool (InfoTypesBuffer
);
520 return EFI_NOT_FOUND
;
524 // We now have adapter information block.
528 Status
= Aip
->GetInformation (Aip
, &gEfiAdapterInfoUndiIpv6SupportGuid
, &InfoBlock
, &InfoBlockSize
);
529 if (EFI_ERROR (Status
) || InfoBlock
== NULL
) {
530 FreePool (InfoBlock
);
531 return EFI_NOT_FOUND
;
534 *Ipv6Support
= ((EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT
*) InfoBlock
)->Ipv6Support
;
535 FreePool (InfoBlock
);
541 Create the opened instances based on IPv4.
543 @param[in] This Pointer to EFI_DRIVER_BINDING_PROTOCOL.
544 @param[in] ControllerHandle Handle of the child to destroy.
545 @param[in] Private Handle Pointer to PXEBC_PRIVATE_DATA.
547 @retval EFI_SUCCESS The instances based on IPv4 were all created successfully.
548 @retval Others An unexpected error occurred.
552 PxeBcCreateIp4Children (
553 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
554 IN EFI_HANDLE ControllerHandle
,
555 IN PXEBC_PRIVATE_DATA
*Private
559 IPv4_DEVICE_PATH Ip4Node
;
560 EFI_PXE_BASE_CODE_MODE
*Mode
;
561 EFI_UDP4_CONFIG_DATA
*Udp4CfgData
;
562 EFI_IP4_CONFIG_DATA
*Ip4CfgData
;
563 EFI_IP4_MODE_DATA Ip4ModeData
;
564 PXEBC_PRIVATE_PROTOCOL
*Id
;
565 EFI_SIMPLE_NETWORK_PROTOCOL
*Snp
;
567 if (Private
->Ip4Nic
!= NULL
) {
569 // Already created before.
575 // Create Dhcp4 child and open Dhcp4 protocol for PxeBc->Dhcp.
577 Status
= NetLibCreateServiceChild (
579 This
->DriverBindingHandle
,
580 &gEfiDhcp4ServiceBindingProtocolGuid
,
583 if (EFI_ERROR (Status
)) {
587 Status
= gBS
->OpenProtocol (
589 &gEfiDhcp4ProtocolGuid
,
590 (VOID
**) &Private
->Dhcp4
,
591 This
->DriverBindingHandle
,
593 EFI_OPEN_PROTOCOL_BY_DRIVER
595 if (EFI_ERROR (Status
)) {
600 // Create Mtftp4 child and open Mtftp4 protocol for PxeBc->Mtftp.
602 Status
= NetLibCreateServiceChild (
604 This
->DriverBindingHandle
,
605 &gEfiMtftp4ServiceBindingProtocolGuid
,
606 &Private
->Mtftp4Child
608 if (EFI_ERROR (Status
)) {
612 Status
= gBS
->OpenProtocol (
613 Private
->Mtftp4Child
,
614 &gEfiMtftp4ProtocolGuid
,
615 (VOID
**) &Private
->Mtftp4
,
616 This
->DriverBindingHandle
,
618 EFI_OPEN_PROTOCOL_BY_DRIVER
620 if (EFI_ERROR (Status
)) {
625 // Create Udp4 child and open Udp4 protocol for PxeBc->UdpRead.
627 Status
= NetLibCreateServiceChild (
629 This
->DriverBindingHandle
,
630 &gEfiUdp4ServiceBindingProtocolGuid
,
631 &Private
->Udp4ReadChild
633 if (EFI_ERROR (Status
)) {
637 Status
= gBS
->OpenProtocol (
638 Private
->Udp4ReadChild
,
639 &gEfiUdp4ProtocolGuid
,
640 (VOID
**) &Private
->Udp4Read
,
641 This
->DriverBindingHandle
,
643 EFI_OPEN_PROTOCOL_BY_DRIVER
645 if (EFI_ERROR (Status
)) {
650 // Create Udp4 child and open Udp4 protocol for PxeBc->UdpWrite.
652 Status
= NetLibCreateServiceChild (
654 This
->DriverBindingHandle
,
655 &gEfiUdp4ServiceBindingProtocolGuid
,
656 &Private
->Udp4WriteChild
658 if (EFI_ERROR (Status
)) {
662 Status
= gBS
->OpenProtocol (
663 Private
->Udp4WriteChild
,
664 &gEfiUdp4ProtocolGuid
,
665 (VOID
**) &Private
->Udp4Write
,
666 This
->DriverBindingHandle
,
668 EFI_OPEN_PROTOCOL_BY_DRIVER
670 if (EFI_ERROR (Status
)) {
675 // Create Arp child and open Arp protocol for PxeBc->Arp.
677 Status
= NetLibCreateServiceChild (
679 This
->DriverBindingHandle
,
680 &gEfiArpServiceBindingProtocolGuid
,
683 if (EFI_ERROR (Status
)) {
687 Status
= gBS
->OpenProtocol (
689 &gEfiArpProtocolGuid
,
690 (VOID
**) &Private
->Arp
,
691 This
->DriverBindingHandle
,
693 EFI_OPEN_PROTOCOL_BY_DRIVER
695 if (EFI_ERROR (Status
)) {
700 // Create Ip4 child and open Ip4 protocol for background ICMP packets.
702 Status
= NetLibCreateServiceChild (
704 This
->DriverBindingHandle
,
705 &gEfiIp4ServiceBindingProtocolGuid
,
708 if (EFI_ERROR (Status
)) {
712 Status
= gBS
->OpenProtocol (
714 &gEfiIp4ProtocolGuid
,
715 (VOID
**) &Private
->Ip4
,
716 This
->DriverBindingHandle
,
718 EFI_OPEN_PROTOCOL_BY_DRIVER
720 if (EFI_ERROR (Status
)) {
725 // Get max packet size from Ip4 to calculate block size for Tftp later.
727 Status
= Private
->Ip4
->GetModeData (Private
->Ip4
, &Ip4ModeData
, NULL
, NULL
);
728 if (EFI_ERROR (Status
)) {
732 Private
->Ip4MaxPacketSize
= Ip4ModeData
.MaxPacketSize
;
734 Private
->Ip4Nic
= AllocateZeroPool (sizeof (PXEBC_VIRTUAL_NIC
));
735 if (Private
->Ip4Nic
== NULL
) {
736 return EFI_OUT_OF_RESOURCES
;
739 Private
->Ip4Nic
->Private
= Private
;
740 Private
->Ip4Nic
->Signature
= PXEBC_VIRTUAL_NIC_SIGNATURE
;
743 // Locate Ip4->Ip4Config2 and store it for set IPv4 Policy.
745 Status
= gBS
->HandleProtocol (
747 &gEfiIp4Config2ProtocolGuid
,
748 (VOID
**) &Private
->Ip4Config2
750 if (EFI_ERROR (Status
)) {
755 // Create a device path node for Ipv4 virtual nic, and append it.
757 ZeroMem (&Ip4Node
, sizeof (IPv4_DEVICE_PATH
));
758 Ip4Node
.Header
.Type
= MESSAGING_DEVICE_PATH
;
759 Ip4Node
.Header
.SubType
= MSG_IPv4_DP
;
760 Ip4Node
.StaticIpAddress
= FALSE
;
762 SetDevicePathNodeLength (&Ip4Node
.Header
, sizeof (Ip4Node
));
764 Private
->Ip4Nic
->DevicePath
= AppendDevicePathNode (Private
->DevicePath
, &Ip4Node
.Header
);
766 if (Private
->Ip4Nic
->DevicePath
== NULL
) {
767 Status
= EFI_OUT_OF_RESOURCES
;
772 &Private
->Ip4Nic
->LoadFile
,
773 &gLoadFileProtocolTemplate
,
774 sizeof (EFI_LOAD_FILE_PROTOCOL
)
778 // Create a new handle for IPv4 virtual nic,
779 // and install PxeBaseCode, LoadFile and DevicePath protocols.
781 Status
= gBS
->InstallMultipleProtocolInterfaces (
782 &Private
->Ip4Nic
->Controller
,
783 &gEfiDevicePathProtocolGuid
,
784 Private
->Ip4Nic
->DevicePath
,
785 &gEfiLoadFileProtocolGuid
,
786 &Private
->Ip4Nic
->LoadFile
,
787 &gEfiPxeBaseCodeProtocolGuid
,
791 if (EFI_ERROR (Status
)) {
795 if (Private
->Snp
!= NULL
) {
797 // Install SNP protocol on purpose is for some OS loader backward
798 // compatibility consideration.
800 Status
= gBS
->InstallProtocolInterface (
801 &Private
->Ip4Nic
->Controller
,
802 &gEfiSimpleNetworkProtocolGuid
,
803 EFI_NATIVE_INTERFACE
,
806 if (EFI_ERROR (Status
)) {
811 // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally
812 // layering to perform the experiment.
814 Status
= gBS
->OpenProtocol (
815 Private
->Ip4Nic
->Controller
,
816 &gEfiSimpleNetworkProtocolGuid
,
818 This
->DriverBindingHandle
,
819 Private
->Ip4Nic
->Controller
,
820 EFI_OPEN_PROTOCOL_BY_DRIVER
|EFI_OPEN_PROTOCOL_EXCLUSIVE
822 if (EFI_ERROR (Status
)) {
828 // Open PxeBaseCodePrivate protocol by child to setup a parent-child relationship between
829 // real NIC handle and the virtual IPv4 NIC handle.
831 Status
= gBS
->OpenProtocol (
835 This
->DriverBindingHandle
,
836 Private
->Ip4Nic
->Controller
,
837 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
839 if (EFI_ERROR (Status
)) {
844 // Set default configure data for Udp4Read and Ip4 instance.
846 Mode
= Private
->PxeBc
.Mode
;
847 Udp4CfgData
= &Private
->Udp4CfgData
;
848 Ip4CfgData
= &Private
->Ip4CfgData
;
850 Udp4CfgData
->AcceptBroadcast
= FALSE
;
851 Udp4CfgData
->AcceptAnyPort
= TRUE
;
852 Udp4CfgData
->AllowDuplicatePort
= TRUE
;
853 Udp4CfgData
->TypeOfService
= Mode
->ToS
;
854 Udp4CfgData
->TimeToLive
= Mode
->TTL
;
855 Udp4CfgData
->ReceiveTimeout
= PXEBC_DEFAULT_LIFETIME
;
856 Udp4CfgData
->TransmitTimeout
= PXEBC_DEFAULT_LIFETIME
;
858 Ip4CfgData
->AcceptIcmpErrors
= TRUE
;
859 Ip4CfgData
->DefaultProtocol
= EFI_IP_PROTO_ICMP
;
860 Ip4CfgData
->TypeOfService
= Mode
->ToS
;
861 Ip4CfgData
->TimeToLive
= Mode
->TTL
;
862 Ip4CfgData
->ReceiveTimeout
= PXEBC_DEFAULT_LIFETIME
;
863 Ip4CfgData
->TransmitTimeout
= PXEBC_DEFAULT_LIFETIME
;
868 PxeBcDestroyIp4Children (This
, Private
);
874 Create the opened instances based on IPv6.
876 @param[in] This Pointer to EFI_DRIVER_BINDING_PROTOCOL.
877 @param[in] ControllerHandle Handle of the child to destroy.
878 @param[in] Private Handle Pointer to PXEBC_PRIVATE_DATA.
880 @retval EFI_SUCCESS The instances based on IPv6 were all created successfully.
881 @retval Others An unexpected error occurred.
885 PxeBcCreateIp6Children (
886 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
887 IN EFI_HANDLE ControllerHandle
,
888 IN PXEBC_PRIVATE_DATA
*Private
892 IPv6_DEVICE_PATH Ip6Node
;
893 EFI_UDP6_CONFIG_DATA
*Udp6CfgData
;
894 EFI_IP6_CONFIG_DATA
*Ip6CfgData
;
895 EFI_IP6_MODE_DATA Ip6ModeData
;
896 PXEBC_PRIVATE_PROTOCOL
*Id
;
897 EFI_SIMPLE_NETWORK_PROTOCOL
*Snp
;
900 if (Private
->Ip6Nic
!= NULL
) {
902 // Already created before.
907 Private
->Ip6Nic
= AllocateZeroPool (sizeof (PXEBC_VIRTUAL_NIC
));
909 if (Private
->Ip6Nic
== NULL
) {
910 return EFI_OUT_OF_RESOURCES
;
913 Private
->Ip6Nic
->Private
= Private
;
914 Private
->Ip6Nic
->Signature
= PXEBC_VIRTUAL_NIC_SIGNATURE
;
917 // Create Dhcp6 child and open Dhcp6 protocol for PxeBc->Dhcp.
919 Status
= NetLibCreateServiceChild (
921 This
->DriverBindingHandle
,
922 &gEfiDhcp6ServiceBindingProtocolGuid
,
925 if (EFI_ERROR (Status
)) {
929 Status
= gBS
->OpenProtocol (
931 &gEfiDhcp6ProtocolGuid
,
932 (VOID
**) &Private
->Dhcp6
,
933 This
->DriverBindingHandle
,
935 EFI_OPEN_PROTOCOL_BY_DRIVER
937 if (EFI_ERROR (Status
)) {
942 // Generate a random IAID for the Dhcp6 assigned address.
944 Private
->IaId
= NET_RANDOM (NetRandomInitSeed ());
945 if (Private
->Snp
!= NULL
) {
946 for (Index
= 0; Index
< Private
->Snp
->Mode
->HwAddressSize
; Index
++) {
947 Private
->IaId
|= (Private
->Snp
->Mode
->CurrentAddress
.Addr
[Index
] << ((Index
<< 3) & 31));
952 // Create Mtftp6 child and open Mtftp6 protocol for PxeBc->Mtftp.
954 Status
= NetLibCreateServiceChild (
956 This
->DriverBindingHandle
,
957 &gEfiMtftp6ServiceBindingProtocolGuid
,
958 &Private
->Mtftp6Child
960 if (EFI_ERROR (Status
)) {
964 Status
= gBS
->OpenProtocol (
965 Private
->Mtftp6Child
,
966 &gEfiMtftp6ProtocolGuid
,
967 (VOID
**) &Private
->Mtftp6
,
968 This
->DriverBindingHandle
,
970 EFI_OPEN_PROTOCOL_BY_DRIVER
972 if (EFI_ERROR (Status
)) {
977 // Create Udp6 child and open Udp6 protocol for PxeBc->UdpRead.
979 Status
= NetLibCreateServiceChild (
981 This
->DriverBindingHandle
,
982 &gEfiUdp6ServiceBindingProtocolGuid
,
983 &Private
->Udp6ReadChild
985 if (EFI_ERROR (Status
)) {
989 Status
= gBS
->OpenProtocol (
990 Private
->Udp6ReadChild
,
991 &gEfiUdp6ProtocolGuid
,
992 (VOID
**) &Private
->Udp6Read
,
993 This
->DriverBindingHandle
,
995 EFI_OPEN_PROTOCOL_BY_DRIVER
997 if (EFI_ERROR (Status
)) {
1002 // Create Udp6 child and open Udp6 protocol for PxeBc->UdpWrite.
1004 Status
= NetLibCreateServiceChild (
1006 This
->DriverBindingHandle
,
1007 &gEfiUdp6ServiceBindingProtocolGuid
,
1008 &Private
->Udp6WriteChild
1010 if (EFI_ERROR (Status
)) {
1014 Status
= gBS
->OpenProtocol (
1015 Private
->Udp6WriteChild
,
1016 &gEfiUdp6ProtocolGuid
,
1017 (VOID
**) &Private
->Udp6Write
,
1018 This
->DriverBindingHandle
,
1020 EFI_OPEN_PROTOCOL_BY_DRIVER
1022 if (EFI_ERROR (Status
)) {
1027 // Create Ip6 child and open Ip6 protocol for background ICMP6 packets.
1029 Status
= NetLibCreateServiceChild (
1031 This
->DriverBindingHandle
,
1032 &gEfiIp6ServiceBindingProtocolGuid
,
1035 if (EFI_ERROR (Status
)) {
1039 Status
= gBS
->OpenProtocol (
1041 &gEfiIp6ProtocolGuid
,
1042 (VOID
**) &Private
->Ip6
,
1043 This
->DriverBindingHandle
,
1045 EFI_OPEN_PROTOCOL_BY_DRIVER
1047 if (EFI_ERROR (Status
)) {
1052 // Get max packet size from Ip6 to calculate block size for Tftp later.
1054 Status
= Private
->Ip6
->GetModeData (Private
->Ip6
, &Ip6ModeData
, NULL
, NULL
);
1055 if (EFI_ERROR (Status
)) {
1059 Private
->Ip6MaxPacketSize
= Ip6ModeData
.MaxPacketSize
;
1061 if (Ip6ModeData
.AddressList
!= NULL
) {
1062 FreePool (Ip6ModeData
.AddressList
);
1065 if (Ip6ModeData
.GroupTable
!= NULL
) {
1066 FreePool (Ip6ModeData
.GroupTable
);
1069 if (Ip6ModeData
.RouteTable
!= NULL
) {
1070 FreePool (Ip6ModeData
.RouteTable
);
1073 if (Ip6ModeData
.NeighborCache
!= NULL
) {
1074 FreePool (Ip6ModeData
.NeighborCache
);
1077 if (Ip6ModeData
.PrefixTable
!= NULL
) {
1078 FreePool (Ip6ModeData
.PrefixTable
);
1081 if (Ip6ModeData
.IcmpTypeList
!= NULL
) {
1082 FreePool (Ip6ModeData
.IcmpTypeList
);
1086 // Locate Ip6->Ip6Config and store it for set IPv6 address.
1088 Status
= gBS
->HandleProtocol (
1090 &gEfiIp6ConfigProtocolGuid
,
1091 (VOID
**) &Private
->Ip6Cfg
1093 if (EFI_ERROR (Status
)) {
1098 // Create a device path node for Ipv6 virtual nic, and append it.
1100 ZeroMem (&Ip6Node
, sizeof (IPv6_DEVICE_PATH
));
1101 Ip6Node
.Header
.Type
= MESSAGING_DEVICE_PATH
;
1102 Ip6Node
.Header
.SubType
= MSG_IPv6_DP
;
1103 Ip6Node
.PrefixLength
= IP6_PREFIX_LENGTH
;
1105 SetDevicePathNodeLength (&Ip6Node
.Header
, sizeof (Ip6Node
));
1107 Private
->Ip6Nic
->DevicePath
= AppendDevicePathNode (Private
->DevicePath
, &Ip6Node
.Header
);
1109 if (Private
->Ip6Nic
->DevicePath
== NULL
) {
1110 Status
= EFI_OUT_OF_RESOURCES
;
1115 &Private
->Ip6Nic
->LoadFile
,
1116 &gLoadFileProtocolTemplate
,
1117 sizeof (EFI_LOAD_FILE_PROTOCOL
)
1121 // Create a new handle for IPv6 virtual nic,
1122 // and install PxeBaseCode, LoadFile and DevicePath protocols.
1124 Status
= gBS
->InstallMultipleProtocolInterfaces (
1125 &Private
->Ip6Nic
->Controller
,
1126 &gEfiDevicePathProtocolGuid
,
1127 Private
->Ip6Nic
->DevicePath
,
1128 &gEfiLoadFileProtocolGuid
,
1129 &Private
->Ip6Nic
->LoadFile
,
1130 &gEfiPxeBaseCodeProtocolGuid
,
1134 if (EFI_ERROR (Status
)) {
1138 if (Private
->Snp
!= NULL
) {
1140 // Install SNP protocol on purpose is for some OS loader backward
1141 // compatibility consideration.
1143 Status
= gBS
->InstallProtocolInterface (
1144 &Private
->Ip6Nic
->Controller
,
1145 &gEfiSimpleNetworkProtocolGuid
,
1146 EFI_NATIVE_INTERFACE
,
1149 if (EFI_ERROR (Status
)) {
1154 // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally
1155 // layering to perform the experiment.
1157 Status
= gBS
->OpenProtocol (
1158 Private
->Ip6Nic
->Controller
,
1159 &gEfiSimpleNetworkProtocolGuid
,
1161 This
->DriverBindingHandle
,
1162 Private
->Ip6Nic
->Controller
,
1163 EFI_OPEN_PROTOCOL_BY_DRIVER
|EFI_OPEN_PROTOCOL_EXCLUSIVE
1165 if (EFI_ERROR (Status
)) {
1171 // Open PxeBaseCodePrivate protocol by child to setup a parent-child relationship between
1172 // real NIC handle and the virtual IPv6 NIC handle.
1174 Status
= gBS
->OpenProtocol (
1178 This
->DriverBindingHandle
,
1179 Private
->Ip6Nic
->Controller
,
1180 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
1182 if (EFI_ERROR (Status
)) {
1187 // Set IPv6 available flag and set default configure data for
1188 // Udp6Read and Ip6 instance.
1190 Status
= PxeBcCheckIpv6Support (ControllerHandle
, Private
, &Private
->Mode
.Ipv6Available
);
1191 if (EFI_ERROR (Status
)) {
1193 // Fail to get the data whether UNDI supports IPv6. Set default value.
1195 Private
->Mode
.Ipv6Available
= TRUE
;
1198 if (!Private
->Mode
.Ipv6Available
) {
1202 Udp6CfgData
= &Private
->Udp6CfgData
;
1203 Ip6CfgData
= &Private
->Ip6CfgData
;
1205 Udp6CfgData
->AcceptAnyPort
= TRUE
;
1206 Udp6CfgData
->AllowDuplicatePort
= TRUE
;
1207 Udp6CfgData
->HopLimit
= PXEBC_DEFAULT_HOPLIMIT
;
1208 Udp6CfgData
->ReceiveTimeout
= PXEBC_DEFAULT_LIFETIME
;
1209 Udp6CfgData
->TransmitTimeout
= PXEBC_DEFAULT_LIFETIME
;
1211 Ip6CfgData
->AcceptIcmpErrors
= TRUE
;
1212 Ip6CfgData
->DefaultProtocol
= IP6_ICMP
;
1213 Ip6CfgData
->HopLimit
= PXEBC_DEFAULT_HOPLIMIT
;
1214 Ip6CfgData
->ReceiveTimeout
= PXEBC_DEFAULT_LIFETIME
;
1215 Ip6CfgData
->TransmitTimeout
= PXEBC_DEFAULT_LIFETIME
;
1220 PxeBcDestroyIp6Children (This
, Private
);
1226 The entry point for UefiPxeBc driver that installs the driver
1227 binding and component name protocol on its image.
1229 @param[in] ImageHandle The Image handle of the driver.
1230 @param[in] SystemTable The system table.
1238 PxeBcDriverEntryPoint (
1239 IN EFI_HANDLE ImageHandle
,
1240 IN EFI_SYSTEM_TABLE
*SystemTable
1245 if ((PcdGet8(PcdIPv4PXESupport
) == PXE_DISABLED
) && (PcdGet8(PcdIPv6PXESupport
) == PXE_DISABLED
)) {
1246 return EFI_UNSUPPORTED
;
1249 Status
= EfiLibInstallDriverBindingComponentName2 (
1252 &gPxeBcIp4DriverBinding
,
1254 &gPxeBcComponentName
,
1255 &gPxeBcComponentName2
1257 if (EFI_ERROR (Status
)) {
1261 Status
= EfiLibInstallDriverBindingComponentName2 (
1264 &gPxeBcIp6DriverBinding
,
1266 &gPxeBcComponentName
,
1267 &gPxeBcComponentName2
1269 if (EFI_ERROR (Status
)) {
1270 EfiLibUninstallDriverBindingComponentName2 (
1271 &gPxeBcIp4DriverBinding
,
1272 &gPxeBcComponentName
,
1273 &gPxeBcComponentName2
1281 Test to see if this driver supports ControllerHandle. This is the worker function for
1282 PxeBcIp4(6)DriverBindingSupported.
1284 @param[in] This The pointer to the driver binding protocol.
1285 @param[in] ControllerHandle The handle of device to be tested.
1286 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1287 device to be started.
1288 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
1290 @retval EFI_SUCCESS This driver supports this device.
1291 @retval EFI_UNSUPPORTED This driver does not support this device.
1297 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1298 IN EFI_HANDLE ControllerHandle
,
1299 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1304 EFI_GUID
*DhcpServiceBindingGuid
;
1305 EFI_GUID
*MtftpServiceBindingGuid
;
1307 if (IpVersion
== IP_VERSION_4
) {
1308 if (PcdGet8(PcdIPv4PXESupport
) == PXE_DISABLED
) {
1309 return EFI_UNSUPPORTED
;
1311 DhcpServiceBindingGuid
= &gEfiDhcp4ServiceBindingProtocolGuid
;
1312 MtftpServiceBindingGuid
= &gEfiMtftp4ServiceBindingProtocolGuid
;
1314 if (PcdGet8(PcdIPv6PXESupport
) == PXE_DISABLED
) {
1315 return EFI_UNSUPPORTED
;
1317 DhcpServiceBindingGuid
= &gEfiDhcp6ServiceBindingProtocolGuid
;
1318 MtftpServiceBindingGuid
= &gEfiMtftp6ServiceBindingProtocolGuid
;
1322 // Try to open the Mtftp and Dhcp protocol to test whether IP stack is ready.
1324 Status
= gBS
->OpenProtocol (
1326 DhcpServiceBindingGuid
,
1328 This
->DriverBindingHandle
,
1330 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
1332 if (!EFI_ERROR (Status
)) {
1333 Status
= gBS
->OpenProtocol (
1335 MtftpServiceBindingGuid
,
1337 This
->DriverBindingHandle
,
1339 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
1344 // It's unsupported case if IP stack are not ready.
1346 if (EFI_ERROR (Status
)) {
1347 return EFI_UNSUPPORTED
;
1354 Start this driver on ControllerHandle. This is the worker function for
1355 PxeBcIp4(6)DriverBindingStart.
1357 @param[in] This The pointer to the driver binding protocol.
1358 @param[in] ControllerHandle The handle of device to be started.
1359 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1360 device to be started.
1361 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
1364 @retval EFI_SUCCESS This driver is installed to ControllerHandle.
1365 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
1366 @retval other This driver does not support this device.
1372 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1373 IN EFI_HANDLE ControllerHandle
,
1374 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1378 PXEBC_PRIVATE_DATA
*Private
;
1380 PXEBC_PRIVATE_PROTOCOL
*Id
;
1384 Status
= gBS
->OpenProtocol (
1388 This
->DriverBindingHandle
,
1390 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1392 if (!EFI_ERROR (Status
)) {
1394 // Skip the initialization if the driver has been started already.
1396 Private
= PXEBC_PRIVATE_DATA_FROM_ID (Id
);
1400 // If the driver has not been started yet, it should do initialization.
1402 Private
= AllocateZeroPool (sizeof (PXEBC_PRIVATE_DATA
));
1403 if (Private
== NULL
) {
1404 return EFI_OUT_OF_RESOURCES
;
1409 &gPxeBcProtocolTemplate
,
1410 sizeof (EFI_PXE_BASE_CODE_PROTOCOL
)
1413 Private
->Signature
= PXEBC_PRIVATE_DATA_SIGNATURE
;
1414 Private
->Controller
= ControllerHandle
;
1415 Private
->Image
= This
->ImageHandle
;
1416 Private
->PxeBc
.Mode
= &Private
->Mode
;
1417 Private
->Mode
.Ipv6Supported
= TRUE
;
1418 Private
->Mode
.AutoArp
= TRUE
;
1419 Private
->Mode
.TTL
= DEFAULT_TTL
;
1420 Private
->Mode
.ToS
= DEFAULT_ToS
;
1423 // Open device path to prepare for appending virtual NIC node.
1425 Status
= gBS
->OpenProtocol (
1427 &gEfiDevicePathProtocolGuid
,
1428 (VOID
**) &Private
->DevicePath
,
1429 This
->DriverBindingHandle
,
1431 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1434 if (EFI_ERROR (Status
)) {
1439 // Get the NII interface if it exists, it's not required.
1441 Status
= gBS
->OpenProtocol (
1443 &gEfiNetworkInterfaceIdentifierProtocolGuid_31
,
1444 (VOID
**) &Private
->Nii
,
1445 This
->DriverBindingHandle
,
1447 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1449 if (EFI_ERROR (Status
)) {
1450 Private
->Nii
= NULL
;
1454 // Install PxeBaseCodePrivate protocol onto the real NIC handler.
1455 // PxeBaseCodePrivate protocol is only used to keep the relationship between
1456 // NIC handle and virtual child handles.
1457 // gEfiCallerIdGuid will be used as its protocol guid.
1459 Status
= gBS
->InstallProtocolInterface (
1462 EFI_NATIVE_INTERFACE
,
1465 if (EFI_ERROR (Status
)) {
1470 // Try to locate SNP protocol.
1472 NetLibGetSnpHandle(ControllerHandle
, &Private
->Snp
);
1475 if (IpVersion
== IP_VERSION_4
) {
1477 // Try to create virtual NIC handle for IPv4.
1479 Status
= PxeBcCreateIp4Children (This
, ControllerHandle
, Private
);
1482 // Try to create virtual NIC handle for IPv6.
1484 Status
= PxeBcCreateIp6Children (This
, ControllerHandle
, Private
);
1486 if (EFI_ERROR (Status
)) {
1488 // Failed to start PXE driver if IPv4 and IPv6 stack are both not available.
1490 Status
= EFI_DEVICE_ERROR
;
1498 gBS
->UninstallProtocolInterface (
1505 if (IpVersion
== IP_VERSION_4
) {
1506 PxeBcDestroyIp4Children (This
, Private
);
1508 PxeBcDestroyIp6Children (This
, Private
);
1511 if (FirstStart
&& Private
!= NULL
) {
1520 Stop this driver on ControllerHandle. This is the worker function for
1521 PxeBcIp4(6)DriverBindingStop.
1523 @param[in] This Protocol instance pointer.
1524 @param[in] ControllerHandle Handle of device to stop driver on.
1525 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
1526 children is zero stop the entire bus driver.
1527 @param[in] ChildHandleBuffer List of Child Handles to Stop.
1528 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
1530 @retval EFI_SUCCESS This driver was removed ControllerHandle.
1531 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1532 @retval Others This driver was not removed from this device
1538 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1539 IN EFI_HANDLE ControllerHandle
,
1540 IN UINTN NumberOfChildren
,
1541 IN EFI_HANDLE
*ChildHandleBuffer
,
1545 PXEBC_PRIVATE_DATA
*Private
;
1546 PXEBC_VIRTUAL_NIC
*VirtualNic
;
1547 EFI_LOAD_FILE_PROTOCOL
*LoadFile
;
1549 EFI_HANDLE NicHandle
;
1550 PXEBC_PRIVATE_PROTOCOL
*Id
;
1558 Status
= gBS
->OpenProtocol (
1560 &gEfiLoadFileProtocolGuid
,
1561 (VOID
**) &LoadFile
,
1562 This
->DriverBindingHandle
,
1564 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1566 if (EFI_ERROR (Status
)) {
1568 // Get the Nic handle by any pass-over service child handle.
1570 if (IpVersion
== IP_VERSION_4
) {
1571 NicHandle
= PxeBcGetNicByIp4Children (ControllerHandle
);
1573 NicHandle
= PxeBcGetNicByIp6Children (ControllerHandle
);
1575 if (NicHandle
== NULL
) {
1580 // Try to retrieve the private data by PxeBcPrivate protocol.
1582 Status
= gBS
->OpenProtocol (
1586 This
->DriverBindingHandle
,
1588 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1590 if (EFI_ERROR (Status
)) {
1593 Private
= PXEBC_PRIVATE_DATA_FROM_ID (Id
);
1597 // It's a virtual handle with LoadFileProtocol.
1599 Status
= gBS
->OpenProtocol (
1601 &gEfiLoadFileProtocolGuid
,
1602 (VOID
**) &LoadFile
,
1603 This
->DriverBindingHandle
,
1605 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1607 if (EFI_ERROR (Status
)) {
1611 VirtualNic
= PXEBC_VIRTUAL_NIC_FROM_LOADFILE (LoadFile
);
1612 Private
= VirtualNic
->Private
;
1613 NicHandle
= Private
->Controller
;
1617 // Stop functionality of PXE Base Code protocol
1619 Status
= Private
->PxeBc
.Stop (&Private
->PxeBc
);
1620 if (Status
!= EFI_SUCCESS
&& Status
!= EFI_NOT_STARTED
) {
1625 if (Private
->Ip4Nic
!= NULL
&& IpVersion
== IP_VERSION_4
) {
1626 PxeBcDestroyIp4Children (This
, Private
);
1629 if (Private
->Ip6Nic
!= NULL
&& IpVersion
== IP_VERSION_6
) {
1630 PxeBcDestroyIp6Children (This
, Private
);
1633 if (Private
->Ip4Nic
== NULL
&& Private
->Ip6Nic
== NULL
) {
1634 gBS
->UninstallProtocolInterface (
1646 Test to see if this driver supports ControllerHandle. This service
1647 is called by the EFI boot service ConnectController(). In
1648 order to make drivers as small as possible, there are a few calling
1649 restrictions for this service. ConnectController() must
1650 follow these calling restrictions. If any other agent wishes to call
1651 Supported() it must also follow these calling restrictions.
1653 @param[in] This The pointer to the driver binding protocol.
1654 @param[in] ControllerHandle The handle of device to be tested.
1655 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1656 device to be started.
1658 @retval EFI_SUCCESS This driver supports this device.
1659 @retval EFI_UNSUPPORTED This driver does not support this device.
1664 PxeBcIp4DriverBindingSupported (
1665 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1666 IN EFI_HANDLE ControllerHandle
,
1667 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
1670 return PxeBcSupported (
1673 RemainingDevicePath
,
1679 Start this driver on ControllerHandle. This service is called by the
1680 EFI boot service ConnectController(). In order to make
1681 drivers as small as possible, there are a few calling restrictions for
1682 this service. ConnectController() must follow these
1683 calling restrictions. If any other agent wishes to call Start() it
1684 must also follow these calling restrictions.
1686 @param[in] This The pointer to the driver binding protocol.
1687 @param[in] ControllerHandle The handle of device to be started.
1688 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1689 device to be started.
1691 @retval EFI_SUCCESS This driver is installed to ControllerHandle.
1692 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
1693 @retval other This driver does not support this device.
1698 PxeBcIp4DriverBindingStart (
1699 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1700 IN EFI_HANDLE ControllerHandle
,
1701 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
1707 RemainingDevicePath
,
1713 Stop this driver on ControllerHandle. This service is called by the
1714 EFI boot service DisconnectController(). In order to
1715 make drivers as small as possible, there are a few calling
1716 restrictions for this service. DisconnectController()
1717 must follow these calling restrictions. If any other agent wishes
1718 to call Stop() it must also follow these calling restrictions.
1720 @param[in] This Protocol instance pointer.
1721 @param[in] ControllerHandle Handle of device to stop driver on
1722 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
1723 children is zero stop the entire bus driver.
1724 @param[in] ChildHandleBuffer List of Child Handles to Stop.
1726 @retval EFI_SUCCESS This driver is removed ControllerHandle
1727 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1728 @retval Others This driver was not removed from this device.
1733 PxeBcIp4DriverBindingStop (
1734 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1735 IN EFI_HANDLE ControllerHandle
,
1736 IN UINTN NumberOfChildren
,
1737 IN EFI_HANDLE
*ChildHandleBuffer
1750 Test to see if this driver supports ControllerHandle. This service
1751 is called by the EFI boot service ConnectController(). In
1752 order to make drivers as small as possible, there are a few calling
1753 restrictions for this service. ConnectController() must
1754 follow these calling restrictions. If any other agent wishes to call
1755 Supported() it must also follow these calling restrictions.
1757 @param[in] This The pointer to the driver binding protocol.
1758 @param[in] ControllerHandle The handle of device to be tested.
1759 @param[in] RemainingDevicePath Optional parameter use to pick a specific child
1760 device to be started.
1762 @retval EFI_SUCCESS This driver supports this device.
1763 @retval EFI_UNSUPPORTED This driver does not support this device.
1768 PxeBcIp6DriverBindingSupported (
1769 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1770 IN EFI_HANDLE ControllerHandle
,
1771 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
1774 return PxeBcSupported (
1777 RemainingDevicePath
,
1783 Start this driver on ControllerHandle. This service is called by the
1784 EFI boot service ConnectController(). In order to make
1785 drivers as small as possible, there are a few calling restrictions for
1786 this service. ConnectController() must follow these
1787 calling restrictions. If any other agent wishes to call Start() it
1788 must also follow these calling restrictions.
1790 @param[in] This The pointer to the driver binding protocol.
1791 @param[in] ControllerHandle The handle of device to be started.
1792 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1793 device to be started.
1795 @retval EFI_SUCCESS This driver is installed to ControllerHandle.
1796 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
1797 @retval other This driver does not support this device.
1802 PxeBcIp6DriverBindingStart (
1803 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1804 IN EFI_HANDLE ControllerHandle
,
1805 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
1811 RemainingDevicePath
,
1817 Stop this driver on ControllerHandle. This service is called by the
1818 EFI boot service DisconnectController(). In order to
1819 make drivers as small as possible, there are a few calling
1820 restrictions for this service. DisconnectController()
1821 must follow these calling restrictions. If any other agent wishes
1822 to call Stop() it must also follow these calling restrictions.
1824 @param[in] This Protocol instance pointer.
1825 @param[in] ControllerHandle Handle of device to stop driver on
1826 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
1827 children is zero stop the entire bus driver.
1828 @param[in] ChildHandleBuffer List of Child Handles to Stop.
1830 @retval EFI_SUCCESS This driver is removed ControllerHandle
1831 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1832 @retval Others This driver was not removed from this device.
1837 PxeBcIp6DriverBindingStop (
1838 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1839 IN EFI_HANDLE ControllerHandle
,
1840 IN UINTN NumberOfChildren
,
1841 IN EFI_HANDLE
*ChildHandleBuffer