2 Driver Binding functions implementationfor for UefiPxeBc Driver.
4 (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
5 Copyright (c) 2007 - 2016, 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
,
258 if (Private
->Snp
!= NULL
) {
260 // Close SNP from the child virtual handle
263 Private
->Ip4Nic
->Controller
,
264 &gEfiSimpleNetworkProtocolGuid
,
265 This
->DriverBindingHandle
,
266 Private
->Ip4Nic
->Controller
269 gBS
->UninstallProtocolInterface (
270 Private
->Ip4Nic
->Controller
,
271 &gEfiSimpleNetworkProtocolGuid
,
275 FreePool (Private
->Ip4Nic
);
278 Private
->ArpChild
= NULL
;
279 Private
->Ip4Child
= NULL
;
280 Private
->Udp4WriteChild
= NULL
;
281 Private
->Udp4ReadChild
= NULL
;
282 Private
->Mtftp4Child
= NULL
;
283 Private
->Dhcp4Child
= NULL
;
284 Private
->Ip4Nic
= NULL
;
289 Destroy the opened instances based on IPv6.
291 @param[in] This Pointer to the EFI_DRIVER_BINDING_PROTOCOL.
292 @param[in] Private Pointer to PXEBC_PRIVATE_DATA.
296 PxeBcDestroyIp6Children (
297 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
298 IN PXEBC_PRIVATE_DATA
*Private
301 ASSERT(Private
!= NULL
);
303 if (Private
->Ip6Child
!= NULL
) {
305 // Close Ip6 for Ip6->Ip6Config and destroy the instance.
309 &gEfiIp6ProtocolGuid
,
310 This
->DriverBindingHandle
,
314 NetLibDestroyServiceChild (
316 This
->DriverBindingHandle
,
317 &gEfiIp6ServiceBindingProtocolGuid
,
322 if (Private
->Udp6WriteChild
!= NULL
) {
324 // Close Udp6 for PxeBc->UdpWrite and destroy the instance.
327 Private
->Udp6WriteChild
,
328 &gEfiUdp6ProtocolGuid
,
329 This
->DriverBindingHandle
,
332 NetLibDestroyServiceChild (
334 This
->DriverBindingHandle
,
335 &gEfiUdp6ServiceBindingProtocolGuid
,
336 Private
->Udp6WriteChild
340 if (Private
->Udp6ReadChild
!= NULL
) {
342 // Close Udp6 for PxeBc->UdpRead and destroy the instance.
345 Private
->Udp6ReadChild
,
346 &gEfiUdp6ProtocolGuid
,
347 This
->DriverBindingHandle
,
350 NetLibDestroyServiceChild (
352 This
->DriverBindingHandle
,
353 &gEfiUdp6ServiceBindingProtocolGuid
,
354 Private
->Udp6ReadChild
358 if (Private
->Mtftp6Child
!= NULL
) {
360 // Close Mtftp6 for PxeBc->Mtftp and destroy the instance.
363 Private
->Mtftp6Child
,
364 &gEfiMtftp6ProtocolGuid
,
365 This
->DriverBindingHandle
,
369 NetLibDestroyServiceChild (
371 This
->DriverBindingHandle
,
372 &gEfiMtftp6ServiceBindingProtocolGuid
,
377 if (Private
->Dhcp6Child
!= NULL
) {
379 // Close Dhcp6 for PxeBc->Dhcp and destroy the instance.
383 &gEfiDhcp6ProtocolGuid
,
384 This
->DriverBindingHandle
,
388 NetLibDestroyServiceChild (
390 This
->DriverBindingHandle
,
391 &gEfiDhcp6ServiceBindingProtocolGuid
,
396 if (Private
->Ip6Nic
!= NULL
) {
398 // Close PxeBcPrivate from the parent Nic handle and destroy the virtual handle.
403 This
->DriverBindingHandle
,
404 Private
->Ip6Nic
->Controller
407 gBS
->UninstallMultipleProtocolInterfaces (
408 Private
->Ip6Nic
->Controller
,
409 &gEfiDevicePathProtocolGuid
,
410 Private
->Ip6Nic
->DevicePath
,
411 &gEfiLoadFileProtocolGuid
,
412 &Private
->Ip6Nic
->LoadFile
,
413 &gEfiPxeBaseCodeProtocolGuid
,
417 if (Private
->Snp
!= NULL
) {
419 // Close SNP from the child virtual handle
422 Private
->Ip6Nic
->Controller
,
423 &gEfiSimpleNetworkProtocolGuid
,
424 This
->DriverBindingHandle
,
425 Private
->Ip6Nic
->Controller
427 gBS
->UninstallProtocolInterface (
428 Private
->Ip6Nic
->Controller
,
429 &gEfiSimpleNetworkProtocolGuid
,
433 FreePool (Private
->Ip6Nic
);
436 Private
->Ip6Child
= NULL
;
437 Private
->Udp6WriteChild
= NULL
;
438 Private
->Udp6ReadChild
= NULL
;
439 Private
->Mtftp6Child
= NULL
;
440 Private
->Dhcp6Child
= NULL
;
441 Private
->Ip6Nic
= NULL
;
442 Private
->Mode
.Ipv6Available
= FALSE
;
446 Check whether UNDI protocol supports IPv6.
448 @param[in] ControllerHandle Controller handle.
449 @param[in] Private Pointer to PXEBC_PRIVATE_DATA.
450 @param[out] Ipv6Support TRUE if UNDI supports IPv6.
452 @retval EFI_SUCCESS Get the result whether UNDI supports IPv6 by NII or AIP protocol successfully.
453 @retval EFI_NOT_FOUND Don't know whether UNDI supports IPv6 since NII or AIP is not available.
457 PxeBcCheckIpv6Support (
458 IN EFI_HANDLE ControllerHandle
,
459 IN PXEBC_PRIVATE_DATA
*Private
,
460 OUT BOOLEAN
*Ipv6Support
464 EFI_ADAPTER_INFORMATION_PROTOCOL
*Aip
;
466 EFI_GUID
*InfoTypesBuffer
;
467 UINTN InfoTypeBufferCount
;
473 ASSERT (Private
!= NULL
&& Ipv6Support
!= NULL
);
476 // Check whether the UNDI supports IPv6 by NII protocol.
478 if (Private
->Nii
!= NULL
) {
479 *Ipv6Support
= Private
->Nii
->Ipv6Supported
;
484 // Check whether the UNDI supports IPv6 by AIP protocol.
488 // Get the NIC handle by SNP protocol.
490 Handle
= NetLibGetSnpHandle (ControllerHandle
, NULL
);
491 if (Handle
== NULL
) {
492 return EFI_NOT_FOUND
;
496 Status
= gBS
->HandleProtocol (
498 &gEfiAdapterInformationProtocolGuid
,
501 if (EFI_ERROR (Status
) || Aip
== NULL
) {
502 return EFI_NOT_FOUND
;
505 InfoTypesBuffer
= NULL
;
506 InfoTypeBufferCount
= 0;
507 Status
= Aip
->GetSupportedTypes (Aip
, &InfoTypesBuffer
, &InfoTypeBufferCount
);
508 if (EFI_ERROR (Status
) || InfoTypesBuffer
== NULL
) {
509 FreePool (InfoTypesBuffer
);
510 return EFI_NOT_FOUND
;
514 for (TypeIndex
= 0; TypeIndex
< InfoTypeBufferCount
; TypeIndex
++) {
515 if (CompareGuid (&InfoTypesBuffer
[TypeIndex
], &gEfiAdapterInfoUndiIpv6SupportGuid
)) {
521 FreePool (InfoTypesBuffer
);
523 return EFI_NOT_FOUND
;
527 // We now have adapter information block.
531 Status
= Aip
->GetInformation (Aip
, &gEfiAdapterInfoUndiIpv6SupportGuid
, &InfoBlock
, &InfoBlockSize
);
532 if (EFI_ERROR (Status
) || InfoBlock
== NULL
) {
533 FreePool (InfoBlock
);
534 return EFI_NOT_FOUND
;
537 *Ipv6Support
= ((EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT
*) InfoBlock
)->Ipv6Support
;
538 FreePool (InfoBlock
);
544 Create the opened instances based on IPv4.
546 @param[in] This Pointer to EFI_DRIVER_BINDING_PROTOCOL.
547 @param[in] ControllerHandle Handle of the child to destroy.
548 @param[in] Private Handle Pointer to PXEBC_PRIVATE_DATA.
550 @retval EFI_SUCCESS The instances based on IPv4 were all created successfully.
551 @retval Others An unexpected error occurred.
555 PxeBcCreateIp4Children (
556 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
557 IN EFI_HANDLE ControllerHandle
,
558 IN PXEBC_PRIVATE_DATA
*Private
562 IPv4_DEVICE_PATH Ip4Node
;
563 EFI_PXE_BASE_CODE_MODE
*Mode
;
564 EFI_UDP4_CONFIG_DATA
*Udp4CfgData
;
565 EFI_IP4_CONFIG_DATA
*Ip4CfgData
;
566 EFI_IP4_MODE_DATA Ip4ModeData
;
567 PXEBC_PRIVATE_PROTOCOL
*Id
;
568 EFI_SIMPLE_NETWORK_PROTOCOL
*Snp
;
570 if (Private
->Ip4Nic
!= NULL
) {
572 // Already created before.
578 // Create Dhcp4 child and open Dhcp4 protocol for PxeBc->Dhcp.
580 Status
= NetLibCreateServiceChild (
582 This
->DriverBindingHandle
,
583 &gEfiDhcp4ServiceBindingProtocolGuid
,
586 if (EFI_ERROR (Status
)) {
590 Status
= gBS
->OpenProtocol (
592 &gEfiDhcp4ProtocolGuid
,
593 (VOID
**) &Private
->Dhcp4
,
594 This
->DriverBindingHandle
,
596 EFI_OPEN_PROTOCOL_BY_DRIVER
598 if (EFI_ERROR (Status
)) {
603 // Create Mtftp4 child and open Mtftp4 protocol for PxeBc->Mtftp.
605 Status
= NetLibCreateServiceChild (
607 This
->DriverBindingHandle
,
608 &gEfiMtftp4ServiceBindingProtocolGuid
,
609 &Private
->Mtftp4Child
611 if (EFI_ERROR (Status
)) {
615 Status
= gBS
->OpenProtocol (
616 Private
->Mtftp4Child
,
617 &gEfiMtftp4ProtocolGuid
,
618 (VOID
**) &Private
->Mtftp4
,
619 This
->DriverBindingHandle
,
621 EFI_OPEN_PROTOCOL_BY_DRIVER
623 if (EFI_ERROR (Status
)) {
628 // Create Udp4 child and open Udp4 protocol for PxeBc->UdpRead.
630 Status
= NetLibCreateServiceChild (
632 This
->DriverBindingHandle
,
633 &gEfiUdp4ServiceBindingProtocolGuid
,
634 &Private
->Udp4ReadChild
636 if (EFI_ERROR (Status
)) {
640 Status
= gBS
->OpenProtocol (
641 Private
->Udp4ReadChild
,
642 &gEfiUdp4ProtocolGuid
,
643 (VOID
**) &Private
->Udp4Read
,
644 This
->DriverBindingHandle
,
646 EFI_OPEN_PROTOCOL_BY_DRIVER
648 if (EFI_ERROR (Status
)) {
653 // Create Udp4 child and open Udp4 protocol for PxeBc->UdpWrite.
655 Status
= NetLibCreateServiceChild (
657 This
->DriverBindingHandle
,
658 &gEfiUdp4ServiceBindingProtocolGuid
,
659 &Private
->Udp4WriteChild
661 if (EFI_ERROR (Status
)) {
665 Status
= gBS
->OpenProtocol (
666 Private
->Udp4WriteChild
,
667 &gEfiUdp4ProtocolGuid
,
668 (VOID
**) &Private
->Udp4Write
,
669 This
->DriverBindingHandle
,
671 EFI_OPEN_PROTOCOL_BY_DRIVER
673 if (EFI_ERROR (Status
)) {
678 // Create Arp child and open Arp protocol for PxeBc->Arp.
680 Status
= NetLibCreateServiceChild (
682 This
->DriverBindingHandle
,
683 &gEfiArpServiceBindingProtocolGuid
,
686 if (EFI_ERROR (Status
)) {
690 Status
= gBS
->OpenProtocol (
692 &gEfiArpProtocolGuid
,
693 (VOID
**) &Private
->Arp
,
694 This
->DriverBindingHandle
,
696 EFI_OPEN_PROTOCOL_BY_DRIVER
698 if (EFI_ERROR (Status
)) {
703 // Create Ip4 child and open Ip4 protocol for background ICMP packets.
705 Status
= NetLibCreateServiceChild (
707 This
->DriverBindingHandle
,
708 &gEfiIp4ServiceBindingProtocolGuid
,
711 if (EFI_ERROR (Status
)) {
715 Status
= gBS
->OpenProtocol (
717 &gEfiIp4ProtocolGuid
,
718 (VOID
**) &Private
->Ip4
,
719 This
->DriverBindingHandle
,
721 EFI_OPEN_PROTOCOL_BY_DRIVER
723 if (EFI_ERROR (Status
)) {
728 // Get max packet size from Ip4 to calculate block size for Tftp later.
730 Status
= Private
->Ip4
->GetModeData (Private
->Ip4
, &Ip4ModeData
, NULL
, NULL
);
731 if (EFI_ERROR (Status
)) {
735 Private
->Ip4MaxPacketSize
= Ip4ModeData
.MaxPacketSize
;
737 Private
->Ip4Nic
= AllocateZeroPool (sizeof (PXEBC_VIRTUAL_NIC
));
738 if (Private
->Ip4Nic
== NULL
) {
739 return EFI_OUT_OF_RESOURCES
;
742 Private
->Ip4Nic
->Private
= Private
;
743 Private
->Ip4Nic
->Signature
= PXEBC_VIRTUAL_NIC_SIGNATURE
;
746 // Locate Ip4->Ip4Config2 and store it for set IPv4 Policy.
748 Status
= gBS
->HandleProtocol (
750 &gEfiIp4Config2ProtocolGuid
,
751 (VOID
**) &Private
->Ip4Config2
753 if (EFI_ERROR (Status
)) {
758 // Create a device path node for Ipv4 virtual nic, and append it.
760 ZeroMem (&Ip4Node
, sizeof (IPv4_DEVICE_PATH
));
761 Ip4Node
.Header
.Type
= MESSAGING_DEVICE_PATH
;
762 Ip4Node
.Header
.SubType
= MSG_IPv4_DP
;
763 Ip4Node
.StaticIpAddress
= FALSE
;
765 SetDevicePathNodeLength (&Ip4Node
.Header
, sizeof (Ip4Node
));
767 Private
->Ip4Nic
->DevicePath
= AppendDevicePathNode (Private
->DevicePath
, &Ip4Node
.Header
);
769 if (Private
->Ip4Nic
->DevicePath
== NULL
) {
770 Status
= EFI_OUT_OF_RESOURCES
;
775 &Private
->Ip4Nic
->LoadFile
,
776 &gLoadFileProtocolTemplate
,
777 sizeof (EFI_LOAD_FILE_PROTOCOL
)
781 // Create a new handle for IPv4 virtual nic,
782 // and install PxeBaseCode, LoadFile and DevicePath protocols.
784 Status
= gBS
->InstallMultipleProtocolInterfaces (
785 &Private
->Ip4Nic
->Controller
,
786 &gEfiDevicePathProtocolGuid
,
787 Private
->Ip4Nic
->DevicePath
,
788 &gEfiLoadFileProtocolGuid
,
789 &Private
->Ip4Nic
->LoadFile
,
790 &gEfiPxeBaseCodeProtocolGuid
,
794 if (EFI_ERROR (Status
)) {
798 if (Private
->Snp
!= NULL
) {
800 // Install SNP protocol on purpose is for some OS loader backward
801 // compatibility consideration.
803 Status
= gBS
->InstallProtocolInterface (
804 &Private
->Ip4Nic
->Controller
,
805 &gEfiSimpleNetworkProtocolGuid
,
806 EFI_NATIVE_INTERFACE
,
809 if (EFI_ERROR (Status
)) {
814 // Open SNP on the child handle BY_DRIVER. It will prevent any additionally
815 // layering to perform the experiment.
817 Status
= gBS
->OpenProtocol (
818 Private
->Ip4Nic
->Controller
,
819 &gEfiSimpleNetworkProtocolGuid
,
821 This
->DriverBindingHandle
,
822 Private
->Ip4Nic
->Controller
,
823 EFI_OPEN_PROTOCOL_BY_DRIVER
825 if (EFI_ERROR (Status
)) {
831 // Open PxeBaseCodePrivate protocol by child to setup a parent-child relationship between
832 // real NIC handle and the virtual IPv4 NIC handle.
834 Status
= gBS
->OpenProtocol (
838 This
->DriverBindingHandle
,
839 Private
->Ip4Nic
->Controller
,
840 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
842 if (EFI_ERROR (Status
)) {
847 // Set default configure data for Udp4Read and Ip4 instance.
849 Mode
= Private
->PxeBc
.Mode
;
850 Udp4CfgData
= &Private
->Udp4CfgData
;
851 Ip4CfgData
= &Private
->Ip4CfgData
;
853 Udp4CfgData
->AcceptBroadcast
= FALSE
;
854 Udp4CfgData
->AcceptAnyPort
= TRUE
;
855 Udp4CfgData
->AllowDuplicatePort
= TRUE
;
856 Udp4CfgData
->TypeOfService
= Mode
->ToS
;
857 Udp4CfgData
->TimeToLive
= Mode
->TTL
;
858 Udp4CfgData
->ReceiveTimeout
= PXEBC_DEFAULT_LIFETIME
;
859 Udp4CfgData
->TransmitTimeout
= PXEBC_DEFAULT_LIFETIME
;
861 Ip4CfgData
->AcceptIcmpErrors
= TRUE
;
862 Ip4CfgData
->DefaultProtocol
= EFI_IP_PROTO_ICMP
;
863 Ip4CfgData
->TypeOfService
= Mode
->ToS
;
864 Ip4CfgData
->TimeToLive
= Mode
->TTL
;
865 Ip4CfgData
->ReceiveTimeout
= PXEBC_DEFAULT_LIFETIME
;
866 Ip4CfgData
->TransmitTimeout
= PXEBC_DEFAULT_LIFETIME
;
871 PxeBcDestroyIp4Children (This
, Private
);
877 Create the opened instances based on IPv6.
879 @param[in] This Pointer to EFI_DRIVER_BINDING_PROTOCOL.
880 @param[in] ControllerHandle Handle of the child to destroy.
881 @param[in] Private Handle Pointer to PXEBC_PRIVATE_DATA.
883 @retval EFI_SUCCESS The instances based on IPv6 were all created successfully.
884 @retval Others An unexpected error occurred.
888 PxeBcCreateIp6Children (
889 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
890 IN EFI_HANDLE ControllerHandle
,
891 IN PXEBC_PRIVATE_DATA
*Private
895 IPv6_DEVICE_PATH Ip6Node
;
896 EFI_UDP6_CONFIG_DATA
*Udp6CfgData
;
897 EFI_IP6_CONFIG_DATA
*Ip6CfgData
;
898 EFI_IP6_MODE_DATA Ip6ModeData
;
899 PXEBC_PRIVATE_PROTOCOL
*Id
;
900 EFI_SIMPLE_NETWORK_PROTOCOL
*Snp
;
903 if (Private
->Ip6Nic
!= NULL
) {
905 // Already created before.
910 Private
->Ip6Nic
= AllocateZeroPool (sizeof (PXEBC_VIRTUAL_NIC
));
912 if (Private
->Ip6Nic
== NULL
) {
913 return EFI_OUT_OF_RESOURCES
;
916 Private
->Ip6Nic
->Private
= Private
;
917 Private
->Ip6Nic
->Signature
= PXEBC_VIRTUAL_NIC_SIGNATURE
;
920 // Create Dhcp6 child and open Dhcp6 protocol for PxeBc->Dhcp.
922 Status
= NetLibCreateServiceChild (
924 This
->DriverBindingHandle
,
925 &gEfiDhcp6ServiceBindingProtocolGuid
,
928 if (EFI_ERROR (Status
)) {
932 Status
= gBS
->OpenProtocol (
934 &gEfiDhcp6ProtocolGuid
,
935 (VOID
**) &Private
->Dhcp6
,
936 This
->DriverBindingHandle
,
938 EFI_OPEN_PROTOCOL_BY_DRIVER
940 if (EFI_ERROR (Status
)) {
945 // Generate a random IAID for the Dhcp6 assigned address.
947 Private
->IaId
= NET_RANDOM (NetRandomInitSeed ());
948 if (Private
->Snp
!= NULL
) {
949 for (Index
= 0; Index
< Private
->Snp
->Mode
->HwAddressSize
; Index
++) {
950 Private
->IaId
|= (Private
->Snp
->Mode
->CurrentAddress
.Addr
[Index
] << ((Index
<< 3) & 31));
955 // Create Mtftp6 child and open Mtftp6 protocol for PxeBc->Mtftp.
957 Status
= NetLibCreateServiceChild (
959 This
->DriverBindingHandle
,
960 &gEfiMtftp6ServiceBindingProtocolGuid
,
961 &Private
->Mtftp6Child
963 if (EFI_ERROR (Status
)) {
967 Status
= gBS
->OpenProtocol (
968 Private
->Mtftp6Child
,
969 &gEfiMtftp6ProtocolGuid
,
970 (VOID
**) &Private
->Mtftp6
,
971 This
->DriverBindingHandle
,
973 EFI_OPEN_PROTOCOL_BY_DRIVER
975 if (EFI_ERROR (Status
)) {
980 // Create Udp6 child and open Udp6 protocol for PxeBc->UdpRead.
982 Status
= NetLibCreateServiceChild (
984 This
->DriverBindingHandle
,
985 &gEfiUdp6ServiceBindingProtocolGuid
,
986 &Private
->Udp6ReadChild
988 if (EFI_ERROR (Status
)) {
992 Status
= gBS
->OpenProtocol (
993 Private
->Udp6ReadChild
,
994 &gEfiUdp6ProtocolGuid
,
995 (VOID
**) &Private
->Udp6Read
,
996 This
->DriverBindingHandle
,
998 EFI_OPEN_PROTOCOL_BY_DRIVER
1000 if (EFI_ERROR (Status
)) {
1005 // Create Udp6 child and open Udp6 protocol for PxeBc->UdpWrite.
1007 Status
= NetLibCreateServiceChild (
1009 This
->DriverBindingHandle
,
1010 &gEfiUdp6ServiceBindingProtocolGuid
,
1011 &Private
->Udp6WriteChild
1013 if (EFI_ERROR (Status
)) {
1017 Status
= gBS
->OpenProtocol (
1018 Private
->Udp6WriteChild
,
1019 &gEfiUdp6ProtocolGuid
,
1020 (VOID
**) &Private
->Udp6Write
,
1021 This
->DriverBindingHandle
,
1023 EFI_OPEN_PROTOCOL_BY_DRIVER
1025 if (EFI_ERROR (Status
)) {
1030 // Create Ip6 child and open Ip6 protocol for background ICMP6 packets.
1032 Status
= NetLibCreateServiceChild (
1034 This
->DriverBindingHandle
,
1035 &gEfiIp6ServiceBindingProtocolGuid
,
1038 if (EFI_ERROR (Status
)) {
1042 Status
= gBS
->OpenProtocol (
1044 &gEfiIp6ProtocolGuid
,
1045 (VOID
**) &Private
->Ip6
,
1046 This
->DriverBindingHandle
,
1048 EFI_OPEN_PROTOCOL_BY_DRIVER
1050 if (EFI_ERROR (Status
)) {
1055 // Get max packet size from Ip6 to calculate block size for Tftp later.
1057 Status
= Private
->Ip6
->GetModeData (Private
->Ip6
, &Ip6ModeData
, NULL
, NULL
);
1058 if (EFI_ERROR (Status
)) {
1062 Private
->Ip6MaxPacketSize
= Ip6ModeData
.MaxPacketSize
;
1064 if (Ip6ModeData
.AddressList
!= NULL
) {
1065 FreePool (Ip6ModeData
.AddressList
);
1068 if (Ip6ModeData
.GroupTable
!= NULL
) {
1069 FreePool (Ip6ModeData
.GroupTable
);
1072 if (Ip6ModeData
.RouteTable
!= NULL
) {
1073 FreePool (Ip6ModeData
.RouteTable
);
1076 if (Ip6ModeData
.NeighborCache
!= NULL
) {
1077 FreePool (Ip6ModeData
.NeighborCache
);
1080 if (Ip6ModeData
.PrefixTable
!= NULL
) {
1081 FreePool (Ip6ModeData
.PrefixTable
);
1084 if (Ip6ModeData
.IcmpTypeList
!= NULL
) {
1085 FreePool (Ip6ModeData
.IcmpTypeList
);
1089 // Locate Ip6->Ip6Config and store it for set IPv6 address.
1091 Status
= gBS
->HandleProtocol (
1093 &gEfiIp6ConfigProtocolGuid
,
1094 (VOID
**) &Private
->Ip6Cfg
1096 if (EFI_ERROR (Status
)) {
1101 // Create a device path node for Ipv6 virtual nic, and append it.
1103 ZeroMem (&Ip6Node
, sizeof (IPv6_DEVICE_PATH
));
1104 Ip6Node
.Header
.Type
= MESSAGING_DEVICE_PATH
;
1105 Ip6Node
.Header
.SubType
= MSG_IPv6_DP
;
1106 Ip6Node
.PrefixLength
= IP6_PREFIX_LENGTH
;
1108 SetDevicePathNodeLength (&Ip6Node
.Header
, sizeof (Ip6Node
));
1110 Private
->Ip6Nic
->DevicePath
= AppendDevicePathNode (Private
->DevicePath
, &Ip6Node
.Header
);
1112 if (Private
->Ip6Nic
->DevicePath
== NULL
) {
1113 Status
= EFI_OUT_OF_RESOURCES
;
1118 &Private
->Ip6Nic
->LoadFile
,
1119 &gLoadFileProtocolTemplate
,
1120 sizeof (EFI_LOAD_FILE_PROTOCOL
)
1124 // Create a new handle for IPv6 virtual nic,
1125 // and install PxeBaseCode, LoadFile and DevicePath protocols.
1127 Status
= gBS
->InstallMultipleProtocolInterfaces (
1128 &Private
->Ip6Nic
->Controller
,
1129 &gEfiDevicePathProtocolGuid
,
1130 Private
->Ip6Nic
->DevicePath
,
1131 &gEfiLoadFileProtocolGuid
,
1132 &Private
->Ip6Nic
->LoadFile
,
1133 &gEfiPxeBaseCodeProtocolGuid
,
1137 if (EFI_ERROR (Status
)) {
1141 if (Private
->Snp
!= NULL
) {
1143 // Install SNP protocol on purpose is for some OS loader backward
1144 // compatibility consideration.
1146 Status
= gBS
->InstallProtocolInterface (
1147 &Private
->Ip6Nic
->Controller
,
1148 &gEfiSimpleNetworkProtocolGuid
,
1149 EFI_NATIVE_INTERFACE
,
1152 if (EFI_ERROR (Status
)) {
1157 // Open SNP on the child handle BY_DRIVER. It will prevent any additionally
1158 // layering to perform the experiment.
1160 Status
= gBS
->OpenProtocol (
1161 Private
->Ip6Nic
->Controller
,
1162 &gEfiSimpleNetworkProtocolGuid
,
1164 This
->DriverBindingHandle
,
1165 Private
->Ip6Nic
->Controller
,
1166 EFI_OPEN_PROTOCOL_BY_DRIVER
1168 if (EFI_ERROR (Status
)) {
1174 // Open PxeBaseCodePrivate protocol by child to setup a parent-child relationship between
1175 // real NIC handle and the virtual IPv6 NIC handle.
1177 Status
= gBS
->OpenProtocol (
1181 This
->DriverBindingHandle
,
1182 Private
->Ip6Nic
->Controller
,
1183 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
1185 if (EFI_ERROR (Status
)) {
1190 // Set IPv6 avaiable flag and set default configure data for
1191 // Udp6Read and Ip6 instance.
1193 Status
= PxeBcCheckIpv6Support (ControllerHandle
, Private
, &Private
->Mode
.Ipv6Available
);
1194 if (EFI_ERROR (Status
)) {
1196 // Fail to get the data whether UNDI supports IPv6. Set default value.
1198 Private
->Mode
.Ipv6Available
= TRUE
;
1201 if (!Private
->Mode
.Ipv6Available
) {
1205 Udp6CfgData
= &Private
->Udp6CfgData
;
1206 Ip6CfgData
= &Private
->Ip6CfgData
;
1208 Udp6CfgData
->AcceptAnyPort
= TRUE
;
1209 Udp6CfgData
->AllowDuplicatePort
= TRUE
;
1210 Udp6CfgData
->HopLimit
= PXEBC_DEFAULT_HOPLIMIT
;
1211 Udp6CfgData
->ReceiveTimeout
= PXEBC_DEFAULT_LIFETIME
;
1212 Udp6CfgData
->TransmitTimeout
= PXEBC_DEFAULT_LIFETIME
;
1214 Ip6CfgData
->AcceptIcmpErrors
= TRUE
;
1215 Ip6CfgData
->DefaultProtocol
= IP6_ICMP
;
1216 Ip6CfgData
->HopLimit
= PXEBC_DEFAULT_HOPLIMIT
;
1217 Ip6CfgData
->ReceiveTimeout
= PXEBC_DEFAULT_LIFETIME
;
1218 Ip6CfgData
->TransmitTimeout
= PXEBC_DEFAULT_LIFETIME
;
1223 PxeBcDestroyIp6Children (This
, Private
);
1229 The entry point for UefiPxeBc driver that installs the driver
1230 binding and component name protocol on its image.
1232 @param[in] ImageHandle The Image handle of the driver.
1233 @param[in] SystemTable The system table.
1241 PxeBcDriverEntryPoint (
1242 IN EFI_HANDLE ImageHandle
,
1243 IN EFI_SYSTEM_TABLE
*SystemTable
1248 Status
= EfiLibInstallDriverBindingComponentName2 (
1251 &gPxeBcIp4DriverBinding
,
1253 &gPxeBcComponentName
,
1254 &gPxeBcComponentName2
1256 if (EFI_ERROR (Status
)) {
1260 Status
= EfiLibInstallDriverBindingComponentName2 (
1263 &gPxeBcIp6DriverBinding
,
1265 &gPxeBcComponentName
,
1266 &gPxeBcComponentName2
1268 if (EFI_ERROR (Status
)) {
1269 gBS
->UninstallMultipleProtocolInterfaces (
1271 &gEfiDriverBindingProtocolGuid
,
1272 &gPxeBcIp4DriverBinding
,
1273 &gEfiComponentName2ProtocolGuid
,
1274 &gPxeBcComponentName2
,
1275 &gEfiComponentNameProtocolGuid
,
1276 &gPxeBcComponentName
,
1285 Test to see if this driver supports ControllerHandle. This is the worker function for
1286 PxeBcIp4(6)DriverBindingSupported.
1288 @param[in] This The pointer to the driver binding protocol.
1289 @param[in] ControllerHandle The handle of device to be tested.
1290 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1291 device to be started.
1292 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
1294 @retval EFI_SUCCESS This driver supports this device.
1295 @retval EFI_UNSUPPORTED This driver does not support this device.
1301 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1302 IN EFI_HANDLE ControllerHandle
,
1303 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1308 EFI_GUID
*DhcpServiceBindingGuid
;
1309 EFI_GUID
*MtftpServiceBindingGuid
;
1311 if (IpVersion
== IP_VERSION_4
) {
1312 DhcpServiceBindingGuid
= &gEfiDhcp4ServiceBindingProtocolGuid
;
1313 MtftpServiceBindingGuid
= &gEfiMtftp4ServiceBindingProtocolGuid
;
1315 DhcpServiceBindingGuid
= &gEfiDhcp6ServiceBindingProtocolGuid
;
1316 MtftpServiceBindingGuid
= &gEfiMtftp6ServiceBindingProtocolGuid
;
1320 // Try to open the Mtftp and Dhcp protocol to test whether IP stack is ready.
1322 Status
= gBS
->OpenProtocol (
1324 DhcpServiceBindingGuid
,
1326 This
->DriverBindingHandle
,
1328 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
1330 if (!EFI_ERROR (Status
)) {
1331 Status
= gBS
->OpenProtocol (
1333 MtftpServiceBindingGuid
,
1335 This
->DriverBindingHandle
,
1337 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
1342 // It's unsupported case if IP stack are not ready.
1344 if (EFI_ERROR (Status
)) {
1345 return EFI_UNSUPPORTED
;
1352 Start this driver on ControllerHandle. This is the worker function for
1353 PxeBcIp4(6)DriverBindingStart.
1355 @param[in] This The pointer to the driver binding protocol.
1356 @param[in] ControllerHandle The handle of device to be started.
1357 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1358 device to be started.
1359 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
1362 @retval EFI_SUCCESS This driver is installed to ControllerHandle.
1363 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
1364 @retval other This driver does not support this device.
1370 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1371 IN EFI_HANDLE ControllerHandle
,
1372 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1376 PXEBC_PRIVATE_DATA
*Private
;
1378 PXEBC_PRIVATE_PROTOCOL
*Id
;
1382 Status
= gBS
->OpenProtocol (
1386 This
->DriverBindingHandle
,
1388 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1390 if (!EFI_ERROR (Status
)) {
1392 // Skip the initialization if the driver has been started already.
1394 Private
= PXEBC_PRIVATE_DATA_FROM_ID (Id
);
1398 // If the driver has not been started yet, it should do initialization.
1400 Private
= AllocateZeroPool (sizeof (PXEBC_PRIVATE_DATA
));
1401 if (Private
== NULL
) {
1402 return EFI_OUT_OF_RESOURCES
;
1407 &gPxeBcProtocolTemplate
,
1408 sizeof (EFI_PXE_BASE_CODE_PROTOCOL
)
1411 Private
->Signature
= PXEBC_PRIVATE_DATA_SIGNATURE
;
1412 Private
->Controller
= ControllerHandle
;
1413 Private
->Image
= This
->ImageHandle
;
1414 Private
->PxeBc
.Mode
= &Private
->Mode
;
1415 Private
->Mode
.Ipv6Supported
= TRUE
;
1416 Private
->Mode
.AutoArp
= TRUE
;
1417 Private
->Mode
.TTL
= DEFAULT_TTL
;
1418 Private
->Mode
.ToS
= DEFAULT_ToS
;
1421 // Open device path to prepare for appending virtual NIC node.
1423 Status
= gBS
->OpenProtocol (
1425 &gEfiDevicePathProtocolGuid
,
1426 (VOID
**) &Private
->DevicePath
,
1427 This
->DriverBindingHandle
,
1429 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1432 if (EFI_ERROR (Status
)) {
1437 // Get the NII interface if it exists, it's not required.
1439 Status
= gBS
->OpenProtocol (
1441 &gEfiNetworkInterfaceIdentifierProtocolGuid_31
,
1442 (VOID
**) &Private
->Nii
,
1443 This
->DriverBindingHandle
,
1445 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1447 if (EFI_ERROR (Status
)) {
1448 Private
->Nii
= NULL
;
1452 // Install PxeBaseCodePrivate protocol onto the real NIC handler.
1453 // PxeBaseCodePrivate protocol is only used to keep the relationship between
1454 // NIC handle and virtual child handles.
1455 // gEfiCallerIdGuid will be used as its protocol guid.
1457 Status
= gBS
->InstallProtocolInterface (
1460 EFI_NATIVE_INTERFACE
,
1463 if (EFI_ERROR (Status
)) {
1468 // Try to locate SNP protocol.
1470 NetLibGetSnpHandle(ControllerHandle
, &Private
->Snp
);
1473 if (IpVersion
== IP_VERSION_4
) {
1475 // Try to create virtual NIC handle for IPv4.
1477 Status
= PxeBcCreateIp4Children (This
, ControllerHandle
, Private
);
1480 // Try to create virtual NIC handle for IPv6.
1482 Status
= PxeBcCreateIp6Children (This
, ControllerHandle
, Private
);
1484 if (EFI_ERROR (Status
)) {
1486 // Failed to start PXE driver if IPv4 and IPv6 stack are both not available.
1488 Status
= EFI_DEVICE_ERROR
;
1496 gBS
->UninstallProtocolInterface (
1503 if (IpVersion
== IP_VERSION_4
) {
1504 PxeBcDestroyIp4Children (This
, Private
);
1506 PxeBcDestroyIp6Children (This
, Private
);
1509 if (FirstStart
&& Private
!= NULL
) {
1518 Stop this driver on ControllerHandle. This is the worker function for
1519 PxeBcIp4(6)DriverBindingStop.
1521 @param[in] This Protocol instance pointer.
1522 @param[in] ControllerHandle Handle of device to stop driver on.
1523 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
1524 children is zero stop the entire bus driver.
1525 @param[in] ChildHandleBuffer List of Child Handles to Stop.
1526 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
1528 @retval EFI_SUCCESS This driver was removed ControllerHandle.
1529 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1530 @retval Others This driver was not removed from this device
1536 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1537 IN EFI_HANDLE ControllerHandle
,
1538 IN UINTN NumberOfChildren
,
1539 IN EFI_HANDLE
*ChildHandleBuffer
,
1543 PXEBC_PRIVATE_DATA
*Private
;
1544 PXEBC_VIRTUAL_NIC
*VirtualNic
;
1545 EFI_LOAD_FILE_PROTOCOL
*LoadFile
;
1547 EFI_HANDLE NicHandle
;
1548 PXEBC_PRIVATE_PROTOCOL
*Id
;
1556 Status
= gBS
->OpenProtocol (
1558 &gEfiLoadFileProtocolGuid
,
1559 (VOID
**) &LoadFile
,
1560 This
->DriverBindingHandle
,
1562 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1564 if (EFI_ERROR (Status
)) {
1566 // Get the Nic handle by any pass-over service child handle.
1568 if (IpVersion
== IP_VERSION_4
) {
1569 NicHandle
= PxeBcGetNicByIp4Children (ControllerHandle
);
1571 NicHandle
= PxeBcGetNicByIp6Children (ControllerHandle
);
1573 if (NicHandle
== NULL
) {
1578 // Try to retrieve the private data by PxeBcPrivate protocol.
1580 Status
= gBS
->OpenProtocol (
1584 This
->DriverBindingHandle
,
1586 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1588 if (EFI_ERROR (Status
)) {
1591 Private
= PXEBC_PRIVATE_DATA_FROM_ID (Id
);
1595 // It's a virtual handle with LoadFileProtocol.
1597 Status
= gBS
->OpenProtocol (
1599 &gEfiLoadFileProtocolGuid
,
1600 (VOID
**) &LoadFile
,
1601 This
->DriverBindingHandle
,
1603 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1605 if (EFI_ERROR (Status
)) {
1609 VirtualNic
= PXEBC_VIRTUAL_NIC_FROM_LOADFILE (LoadFile
);
1610 Private
= VirtualNic
->Private
;
1611 NicHandle
= Private
->Controller
;
1615 // Stop functionality of PXE Base Code protocol
1617 Status
= Private
->PxeBc
.Stop (&Private
->PxeBc
);
1618 if (Status
!= EFI_SUCCESS
&& Status
!= EFI_NOT_STARTED
) {
1623 if (Private
->Ip4Nic
!= NULL
&& IpVersion
== IP_VERSION_4
) {
1624 PxeBcDestroyIp4Children (This
, Private
);
1627 if (Private
->Ip6Nic
!= NULL
&& IpVersion
== IP_VERSION_6
) {
1628 PxeBcDestroyIp6Children (This
, Private
);
1631 if (Private
->Ip4Nic
== NULL
&& Private
->Ip6Nic
== NULL
) {
1632 gBS
->UninstallProtocolInterface (
1644 Test to see if this driver supports ControllerHandle. This service
1645 is called by the EFI boot service ConnectController(). In
1646 order to make drivers as small as possible, there are a few calling
1647 restrictions for this service. ConnectController() must
1648 follow these calling restrictions. If any other agent wishes to call
1649 Supported() it must also follow these calling restrictions.
1651 @param[in] This The pointer to the driver binding protocol.
1652 @param[in] ControllerHandle The handle of device to be tested.
1653 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1654 device to be started.
1656 @retval EFI_SUCCESS This driver supports this device.
1657 @retval EFI_UNSUPPORTED This driver does not support this device.
1662 PxeBcIp4DriverBindingSupported (
1663 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1664 IN EFI_HANDLE ControllerHandle
,
1665 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
1668 return PxeBcSupported (
1671 RemainingDevicePath
,
1677 Start this driver on ControllerHandle. This service is called by the
1678 EFI boot service ConnectController(). In order to make
1679 drivers as small as possible, there are a few calling restrictions for
1680 this service. ConnectController() must follow these
1681 calling restrictions. If any other agent wishes to call Start() it
1682 must also follow these calling restrictions.
1684 @param[in] This The pointer to the driver binding protocol.
1685 @param[in] ControllerHandle The handle of device to be started.
1686 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1687 device to be started.
1689 @retval EFI_SUCCESS This driver is installed to ControllerHandle.
1690 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
1691 @retval other This driver does not support this device.
1696 PxeBcIp4DriverBindingStart (
1697 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1698 IN EFI_HANDLE ControllerHandle
,
1699 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
1705 RemainingDevicePath
,
1711 Stop this driver on ControllerHandle. This service is called by the
1712 EFI boot service DisconnectController(). In order to
1713 make drivers as small as possible, there are a few calling
1714 restrictions for this service. DisconnectController()
1715 must follow these calling restrictions. If any other agent wishes
1716 to call Stop() it must also follow these calling restrictions.
1718 @param[in] This Protocol instance pointer.
1719 @param[in] ControllerHandle Handle of device to stop driver on
1720 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
1721 children is zero stop the entire bus driver.
1722 @param[in] ChildHandleBuffer List of Child Handles to Stop.
1724 @retval EFI_SUCCESS This driver is removed ControllerHandle
1725 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1726 @retval Others This driver was not removed from this device.
1731 PxeBcIp4DriverBindingStop (
1732 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1733 IN EFI_HANDLE ControllerHandle
,
1734 IN UINTN NumberOfChildren
,
1735 IN EFI_HANDLE
*ChildHandleBuffer
1748 Test to see if this driver supports ControllerHandle. This service
1749 is called by the EFI boot service ConnectController(). In
1750 order to make drivers as small as possible, there are a few calling
1751 restrictions for this service. ConnectController() must
1752 follow these calling restrictions. If any other agent wishes to call
1753 Supported() it must also follow these calling restrictions.
1755 @param[in] This The pointer to the driver binding protocol.
1756 @param[in] ControllerHandle The handle of device to be tested.
1757 @param[in] RemainingDevicePath Optional parameter use to pick a specific child
1758 device to be started.
1760 @retval EFI_SUCCESS This driver supports this device.
1761 @retval EFI_UNSUPPORTED This driver does not support this device.
1766 PxeBcIp6DriverBindingSupported (
1767 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1768 IN EFI_HANDLE ControllerHandle
,
1769 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
1772 return PxeBcSupported (
1775 RemainingDevicePath
,
1781 Start this driver on ControllerHandle. This service is called by the
1782 EFI boot service ConnectController(). In order to make
1783 drivers as small as possible, there are a few calling restrictions for
1784 this service. ConnectController() must follow these
1785 calling restrictions. If any other agent wishes to call Start() it
1786 must also follow these calling restrictions.
1788 @param[in] This The pointer to the driver binding protocol.
1789 @param[in] ControllerHandle The handle of device to be started.
1790 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1791 device to be started.
1793 @retval EFI_SUCCESS This driver is installed to ControllerHandle.
1794 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
1795 @retval other This driver does not support this device.
1800 PxeBcIp6DriverBindingStart (
1801 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1802 IN EFI_HANDLE ControllerHandle
,
1803 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
1809 RemainingDevicePath
,
1815 Stop this driver on ControllerHandle. This service is called by the
1816 EFI boot service DisconnectController(). In order to
1817 make drivers as small as possible, there are a few calling
1818 restrictions for this service. DisconnectController()
1819 must follow these calling restrictions. If any other agent wishes
1820 to call Stop() it must also follow these calling restrictions.
1822 @param[in] This Protocol instance pointer.
1823 @param[in] ControllerHandle Handle of device to stop driver on
1824 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
1825 children is zero stop the entire bus driver.
1826 @param[in] ChildHandleBuffer List of Child Handles to Stop.
1828 @retval EFI_SUCCESS This driver is removed ControllerHandle
1829 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1830 @retval Others This driver was not removed from this device.
1835 PxeBcIp6DriverBindingStop (
1836 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1837 IN EFI_HANDLE ControllerHandle
,
1838 IN UINTN NumberOfChildren
,
1839 IN EFI_HANDLE
*ChildHandleBuffer