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"
13 EFI_DRIVER_BINDING_PROTOCOL gPxeBcIp4DriverBinding
= {
14 PxeBcIp4DriverBindingSupported
,
15 PxeBcIp4DriverBindingStart
,
16 PxeBcIp4DriverBindingStop
,
22 EFI_DRIVER_BINDING_PROTOCOL gPxeBcIp6DriverBinding
= {
23 PxeBcIp6DriverBindingSupported
,
24 PxeBcIp6DriverBindingStart
,
25 PxeBcIp6DriverBindingStop
,
32 Get the Nic handle using any child handle in the IPv4 stack.
34 @param[in] ControllerHandle Pointer to child handle over IPv4.
36 @return NicHandle The pointer to the Nic handle.
40 PxeBcGetNicByIp4Children (
41 IN EFI_HANDLE ControllerHandle
46 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiArpProtocolGuid
);
47 if (NicHandle
== NULL
) {
48 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiIp4ProtocolGuid
);
49 if (NicHandle
== NULL
) {
50 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiUdp4ProtocolGuid
);
51 if (NicHandle
== NULL
) {
52 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiDhcp4ProtocolGuid
);
53 if (NicHandle
== NULL
) {
54 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiMtftp4ProtocolGuid
);
55 if (NicHandle
== NULL
) {
67 Get the Nic handle using any child handle in the IPv6 stack.
69 @param[in] ControllerHandle Pointer to child handle over IPv6.
71 @return NicHandle The pointer to the Nic handle.
75 PxeBcGetNicByIp6Children (
76 IN EFI_HANDLE ControllerHandle
81 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiIp6ProtocolGuid
);
82 if (NicHandle
== NULL
) {
83 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiUdp6ProtocolGuid
);
84 if (NicHandle
== NULL
) {
85 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiDhcp6ProtocolGuid
);
86 if (NicHandle
== NULL
) {
87 NicHandle
= NetLibGetNicHandle (ControllerHandle
, &gEfiMtftp6ProtocolGuid
);
88 if (NicHandle
== NULL
) {
99 Destroy the opened instances based on IPv4.
101 @param[in] This Pointer to the EFI_DRIVER_BINDING_PROTOCOL.
102 @param[in] Private Pointer to PXEBC_PRIVATE_DATA.
106 PxeBcDestroyIp4Children (
107 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
108 IN PXEBC_PRIVATE_DATA
*Private
111 ASSERT (Private
!= NULL
);
113 if (Private
->ArpChild
!= NULL
) {
115 // Close Arp for PxeBc->Arp and destroy the instance.
119 &gEfiArpProtocolGuid
,
120 This
->DriverBindingHandle
,
124 NetLibDestroyServiceChild (
126 This
->DriverBindingHandle
,
127 &gEfiArpServiceBindingProtocolGuid
,
132 if (Private
->Ip4Child
!= NULL
) {
134 // Close Ip4 for background ICMP error message and destroy the instance.
138 &gEfiIp4ProtocolGuid
,
139 This
->DriverBindingHandle
,
143 NetLibDestroyServiceChild (
145 This
->DriverBindingHandle
,
146 &gEfiIp4ServiceBindingProtocolGuid
,
151 if (Private
->Udp4WriteChild
!= NULL
) {
153 // Close Udp4 for PxeBc->UdpWrite and destroy the instance.
156 Private
->Udp4WriteChild
,
157 &gEfiUdp4ProtocolGuid
,
158 This
->DriverBindingHandle
,
162 NetLibDestroyServiceChild (
164 This
->DriverBindingHandle
,
165 &gEfiUdp4ServiceBindingProtocolGuid
,
166 Private
->Udp4WriteChild
170 if (Private
->Udp4ReadChild
!= NULL
) {
172 // Close Udp4 for PxeBc->UdpRead and destroy the instance.
175 Private
->Udp4ReadChild
,
176 &gEfiUdp4ProtocolGuid
,
177 This
->DriverBindingHandle
,
181 NetLibDestroyServiceChild (
183 This
->DriverBindingHandle
,
184 &gEfiUdp4ServiceBindingProtocolGuid
,
185 Private
->Udp4ReadChild
189 if (Private
->Mtftp4Child
!= NULL
) {
191 // Close Mtftp4 for PxeBc->Mtftp4 and destroy the instance.
194 Private
->Mtftp4Child
,
195 &gEfiMtftp4ProtocolGuid
,
196 This
->DriverBindingHandle
,
200 NetLibDestroyServiceChild (
202 This
->DriverBindingHandle
,
203 &gEfiMtftp4ServiceBindingProtocolGuid
,
208 if (Private
->Dhcp4Child
!= NULL
) {
210 // Close Dhcp4 for PxeBc->Dhcp4 and destroy the instance.
214 &gEfiDhcp4ProtocolGuid
,
215 This
->DriverBindingHandle
,
219 NetLibDestroyServiceChild (
221 This
->DriverBindingHandle
,
222 &gEfiDhcp4ServiceBindingProtocolGuid
,
227 if (Private
->Ip4Nic
!= NULL
) {
229 // Close PxeBcPrivate from the parent Nic handle and destroy the virtual handle.
234 This
->DriverBindingHandle
,
235 Private
->Ip4Nic
->Controller
238 gBS
->UninstallMultipleProtocolInterfaces (
239 Private
->Ip4Nic
->Controller
,
240 &gEfiDevicePathProtocolGuid
,
241 Private
->Ip4Nic
->DevicePath
,
242 &gEfiLoadFileProtocolGuid
,
243 &Private
->Ip4Nic
->LoadFile
,
244 &gEfiPxeBaseCodeProtocolGuid
,
248 FreePool (Private
->Ip4Nic
->DevicePath
);
250 if (Private
->Snp
!= NULL
) {
252 // Close SNP from the child virtual handle
255 Private
->Ip4Nic
->Controller
,
256 &gEfiSimpleNetworkProtocolGuid
,
257 This
->DriverBindingHandle
,
258 Private
->Ip4Nic
->Controller
261 gBS
->UninstallProtocolInterface (
262 Private
->Ip4Nic
->Controller
,
263 &gEfiSimpleNetworkProtocolGuid
,
268 FreePool (Private
->Ip4Nic
);
271 Private
->ArpChild
= NULL
;
272 Private
->Ip4Child
= NULL
;
273 Private
->Udp4WriteChild
= NULL
;
274 Private
->Udp4ReadChild
= NULL
;
275 Private
->Mtftp4Child
= NULL
;
276 Private
->Dhcp4Child
= NULL
;
277 Private
->Ip4Nic
= NULL
;
281 Destroy the opened instances based on IPv6.
283 @param[in] This Pointer to the EFI_DRIVER_BINDING_PROTOCOL.
284 @param[in] Private Pointer to PXEBC_PRIVATE_DATA.
288 PxeBcDestroyIp6Children (
289 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
290 IN PXEBC_PRIVATE_DATA
*Private
293 ASSERT (Private
!= NULL
);
295 if (Private
->Ip6Child
!= NULL
) {
297 // Close Ip6 for Ip6->Ip6Config and destroy the instance.
301 &gEfiIp6ProtocolGuid
,
302 This
->DriverBindingHandle
,
306 NetLibDestroyServiceChild (
308 This
->DriverBindingHandle
,
309 &gEfiIp6ServiceBindingProtocolGuid
,
314 if (Private
->Udp6WriteChild
!= NULL
) {
316 // Close Udp6 for PxeBc->UdpWrite and destroy the instance.
319 Private
->Udp6WriteChild
,
320 &gEfiUdp6ProtocolGuid
,
321 This
->DriverBindingHandle
,
324 NetLibDestroyServiceChild (
326 This
->DriverBindingHandle
,
327 &gEfiUdp6ServiceBindingProtocolGuid
,
328 Private
->Udp6WriteChild
332 if (Private
->Udp6ReadChild
!= NULL
) {
334 // Close Udp6 for PxeBc->UdpRead and destroy the instance.
337 Private
->Udp6ReadChild
,
338 &gEfiUdp6ProtocolGuid
,
339 This
->DriverBindingHandle
,
342 NetLibDestroyServiceChild (
344 This
->DriverBindingHandle
,
345 &gEfiUdp6ServiceBindingProtocolGuid
,
346 Private
->Udp6ReadChild
350 if (Private
->Mtftp6Child
!= NULL
) {
352 // Close Mtftp6 for PxeBc->Mtftp and destroy the instance.
355 Private
->Mtftp6Child
,
356 &gEfiMtftp6ProtocolGuid
,
357 This
->DriverBindingHandle
,
361 NetLibDestroyServiceChild (
363 This
->DriverBindingHandle
,
364 &gEfiMtftp6ServiceBindingProtocolGuid
,
369 if (Private
->Dhcp6Child
!= NULL
) {
371 // Close Dhcp6 for PxeBc->Dhcp and destroy the instance.
375 &gEfiDhcp6ProtocolGuid
,
376 This
->DriverBindingHandle
,
380 NetLibDestroyServiceChild (
382 This
->DriverBindingHandle
,
383 &gEfiDhcp6ServiceBindingProtocolGuid
,
388 if (Private
->Ip6Nic
!= NULL
) {
390 // Close PxeBcPrivate from the parent Nic handle and destroy the virtual handle.
395 This
->DriverBindingHandle
,
396 Private
->Ip6Nic
->Controller
399 gBS
->UninstallMultipleProtocolInterfaces (
400 Private
->Ip6Nic
->Controller
,
401 &gEfiDevicePathProtocolGuid
,
402 Private
->Ip6Nic
->DevicePath
,
403 &gEfiLoadFileProtocolGuid
,
404 &Private
->Ip6Nic
->LoadFile
,
405 &gEfiPxeBaseCodeProtocolGuid
,
409 FreePool (Private
->Ip6Nic
->DevicePath
);
411 if (Private
->Snp
!= NULL
) {
413 // Close SNP from the child virtual handle
416 Private
->Ip6Nic
->Controller
,
417 &gEfiSimpleNetworkProtocolGuid
,
418 This
->DriverBindingHandle
,
419 Private
->Ip6Nic
->Controller
421 gBS
->UninstallProtocolInterface (
422 Private
->Ip6Nic
->Controller
,
423 &gEfiSimpleNetworkProtocolGuid
,
428 FreePool (Private
->Ip6Nic
);
431 Private
->Ip6Child
= NULL
;
432 Private
->Udp6WriteChild
= NULL
;
433 Private
->Udp6ReadChild
= NULL
;
434 Private
->Mtftp6Child
= NULL
;
435 Private
->Dhcp6Child
= NULL
;
436 Private
->Ip6Nic
= NULL
;
437 Private
->Mode
.Ipv6Available
= FALSE
;
441 Check whether UNDI protocol supports IPv6.
443 @param[in] ControllerHandle Controller handle.
444 @param[in] Private Pointer to PXEBC_PRIVATE_DATA.
445 @param[out] Ipv6Support TRUE if UNDI supports IPv6.
447 @retval EFI_SUCCESS Get the result whether UNDI supports IPv6 by NII or AIP protocol successfully.
448 @retval EFI_NOT_FOUND Don't know whether UNDI supports IPv6 since NII or AIP is not available.
452 PxeBcCheckIpv6Support (
453 IN EFI_HANDLE ControllerHandle
,
454 IN PXEBC_PRIVATE_DATA
*Private
,
455 OUT BOOLEAN
*Ipv6Support
459 EFI_ADAPTER_INFORMATION_PROTOCOL
*Aip
;
461 EFI_GUID
*InfoTypesBuffer
;
462 UINTN InfoTypeBufferCount
;
468 ASSERT (Private
!= NULL
&& Ipv6Support
!= NULL
);
471 // Check whether the UNDI supports IPv6 by NII protocol.
473 if (Private
->Nii
!= NULL
) {
474 *Ipv6Support
= Private
->Nii
->Ipv6Supported
;
479 // Check whether the UNDI supports IPv6 by AIP protocol.
483 // Get the NIC handle by SNP protocol.
485 Handle
= NetLibGetSnpHandle (ControllerHandle
, NULL
);
486 if (Handle
== NULL
) {
487 return EFI_NOT_FOUND
;
491 Status
= gBS
->HandleProtocol (
493 &gEfiAdapterInformationProtocolGuid
,
496 if (EFI_ERROR (Status
) || (Aip
== NULL
)) {
497 return EFI_NOT_FOUND
;
500 InfoTypesBuffer
= NULL
;
501 InfoTypeBufferCount
= 0;
502 Status
= Aip
->GetSupportedTypes (Aip
, &InfoTypesBuffer
, &InfoTypeBufferCount
);
503 if (EFI_ERROR (Status
) || (InfoTypesBuffer
== NULL
)) {
504 FreePool (InfoTypesBuffer
);
505 return EFI_NOT_FOUND
;
509 for (TypeIndex
= 0; TypeIndex
< InfoTypeBufferCount
; TypeIndex
++) {
510 if (CompareGuid (&InfoTypesBuffer
[TypeIndex
], &gEfiAdapterInfoUndiIpv6SupportGuid
)) {
516 FreePool (InfoTypesBuffer
);
518 return EFI_NOT_FOUND
;
522 // We now have adapter information block.
526 Status
= Aip
->GetInformation (Aip
, &gEfiAdapterInfoUndiIpv6SupportGuid
, &InfoBlock
, &InfoBlockSize
);
527 if (EFI_ERROR (Status
) || (InfoBlock
== NULL
)) {
528 FreePool (InfoBlock
);
529 return EFI_NOT_FOUND
;
532 *Ipv6Support
= ((EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT
*)InfoBlock
)->Ipv6Support
;
533 FreePool (InfoBlock
);
538 Create the opened instances based on IPv4.
540 @param[in] This Pointer to EFI_DRIVER_BINDING_PROTOCOL.
541 @param[in] ControllerHandle Handle of the child to destroy.
542 @param[in] Private Handle Pointer to PXEBC_PRIVATE_DATA.
544 @retval EFI_SUCCESS The instances based on IPv4 were all created successfully.
545 @retval Others An unexpected error occurred.
549 PxeBcCreateIp4Children (
550 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
551 IN EFI_HANDLE ControllerHandle
,
552 IN PXEBC_PRIVATE_DATA
*Private
556 IPv4_DEVICE_PATH Ip4Node
;
557 EFI_PXE_BASE_CODE_MODE
*Mode
;
558 EFI_UDP4_CONFIG_DATA
*Udp4CfgData
;
559 EFI_IP4_CONFIG_DATA
*Ip4CfgData
;
560 EFI_IP4_MODE_DATA Ip4ModeData
;
561 PXEBC_PRIVATE_PROTOCOL
*Id
;
562 EFI_SIMPLE_NETWORK_PROTOCOL
*Snp
;
564 if (Private
->Ip4Nic
!= NULL
) {
566 // Already created before.
572 // Create Dhcp4 child and open Dhcp4 protocol for PxeBc->Dhcp.
574 Status
= NetLibCreateServiceChild (
576 This
->DriverBindingHandle
,
577 &gEfiDhcp4ServiceBindingProtocolGuid
,
580 if (EFI_ERROR (Status
)) {
584 Status
= gBS
->OpenProtocol (
586 &gEfiDhcp4ProtocolGuid
,
587 (VOID
**)&Private
->Dhcp4
,
588 This
->DriverBindingHandle
,
590 EFI_OPEN_PROTOCOL_BY_DRIVER
592 if (EFI_ERROR (Status
)) {
597 // Create Mtftp4 child and open Mtftp4 protocol for PxeBc->Mtftp.
599 Status
= NetLibCreateServiceChild (
601 This
->DriverBindingHandle
,
602 &gEfiMtftp4ServiceBindingProtocolGuid
,
603 &Private
->Mtftp4Child
605 if (EFI_ERROR (Status
)) {
609 Status
= gBS
->OpenProtocol (
610 Private
->Mtftp4Child
,
611 &gEfiMtftp4ProtocolGuid
,
612 (VOID
**)&Private
->Mtftp4
,
613 This
->DriverBindingHandle
,
615 EFI_OPEN_PROTOCOL_BY_DRIVER
617 if (EFI_ERROR (Status
)) {
622 // Create Udp4 child and open Udp4 protocol for PxeBc->UdpRead.
624 Status
= NetLibCreateServiceChild (
626 This
->DriverBindingHandle
,
627 &gEfiUdp4ServiceBindingProtocolGuid
,
628 &Private
->Udp4ReadChild
630 if (EFI_ERROR (Status
)) {
634 Status
= gBS
->OpenProtocol (
635 Private
->Udp4ReadChild
,
636 &gEfiUdp4ProtocolGuid
,
637 (VOID
**)&Private
->Udp4Read
,
638 This
->DriverBindingHandle
,
640 EFI_OPEN_PROTOCOL_BY_DRIVER
642 if (EFI_ERROR (Status
)) {
647 // Create Udp4 child and open Udp4 protocol for PxeBc->UdpWrite.
649 Status
= NetLibCreateServiceChild (
651 This
->DriverBindingHandle
,
652 &gEfiUdp4ServiceBindingProtocolGuid
,
653 &Private
->Udp4WriteChild
655 if (EFI_ERROR (Status
)) {
659 Status
= gBS
->OpenProtocol (
660 Private
->Udp4WriteChild
,
661 &gEfiUdp4ProtocolGuid
,
662 (VOID
**)&Private
->Udp4Write
,
663 This
->DriverBindingHandle
,
665 EFI_OPEN_PROTOCOL_BY_DRIVER
667 if (EFI_ERROR (Status
)) {
672 // Create Arp child and open Arp protocol for PxeBc->Arp.
674 Status
= NetLibCreateServiceChild (
676 This
->DriverBindingHandle
,
677 &gEfiArpServiceBindingProtocolGuid
,
680 if (EFI_ERROR (Status
)) {
684 Status
= gBS
->OpenProtocol (
686 &gEfiArpProtocolGuid
,
687 (VOID
**)&Private
->Arp
,
688 This
->DriverBindingHandle
,
690 EFI_OPEN_PROTOCOL_BY_DRIVER
692 if (EFI_ERROR (Status
)) {
697 // Create Ip4 child and open Ip4 protocol for background ICMP packets.
699 Status
= NetLibCreateServiceChild (
701 This
->DriverBindingHandle
,
702 &gEfiIp4ServiceBindingProtocolGuid
,
705 if (EFI_ERROR (Status
)) {
709 Status
= gBS
->OpenProtocol (
711 &gEfiIp4ProtocolGuid
,
712 (VOID
**)&Private
->Ip4
,
713 This
->DriverBindingHandle
,
715 EFI_OPEN_PROTOCOL_BY_DRIVER
717 if (EFI_ERROR (Status
)) {
722 // Get max packet size from Ip4 to calculate block size for Tftp later.
724 Status
= Private
->Ip4
->GetModeData (Private
->Ip4
, &Ip4ModeData
, NULL
, NULL
);
725 if (EFI_ERROR (Status
)) {
729 Private
->Ip4MaxPacketSize
= Ip4ModeData
.MaxPacketSize
;
731 Private
->Ip4Nic
= AllocateZeroPool (sizeof (PXEBC_VIRTUAL_NIC
));
732 if (Private
->Ip4Nic
== NULL
) {
733 return EFI_OUT_OF_RESOURCES
;
736 Private
->Ip4Nic
->Private
= Private
;
737 Private
->Ip4Nic
->Signature
= PXEBC_VIRTUAL_NIC_SIGNATURE
;
740 // Locate Ip4->Ip4Config2 and store it for set IPv4 Policy.
742 Status
= gBS
->HandleProtocol (
744 &gEfiIp4Config2ProtocolGuid
,
745 (VOID
**)&Private
->Ip4Config2
747 if (EFI_ERROR (Status
)) {
752 // Create a device path node for Ipv4 virtual nic, and append it.
754 ZeroMem (&Ip4Node
, sizeof (IPv4_DEVICE_PATH
));
755 Ip4Node
.Header
.Type
= MESSAGING_DEVICE_PATH
;
756 Ip4Node
.Header
.SubType
= MSG_IPv4_DP
;
757 Ip4Node
.StaticIpAddress
= FALSE
;
759 SetDevicePathNodeLength (&Ip4Node
.Header
, sizeof (Ip4Node
));
761 Private
->Ip4Nic
->DevicePath
= AppendDevicePathNode (Private
->DevicePath
, &Ip4Node
.Header
);
763 if (Private
->Ip4Nic
->DevicePath
== NULL
) {
764 Status
= EFI_OUT_OF_RESOURCES
;
769 &Private
->Ip4Nic
->LoadFile
,
770 &gLoadFileProtocolTemplate
,
771 sizeof (EFI_LOAD_FILE_PROTOCOL
)
775 // Create a new handle for IPv4 virtual nic,
776 // and install PxeBaseCode, LoadFile and DevicePath protocols.
778 Status
= gBS
->InstallMultipleProtocolInterfaces (
779 &Private
->Ip4Nic
->Controller
,
780 &gEfiDevicePathProtocolGuid
,
781 Private
->Ip4Nic
->DevicePath
,
782 &gEfiLoadFileProtocolGuid
,
783 &Private
->Ip4Nic
->LoadFile
,
784 &gEfiPxeBaseCodeProtocolGuid
,
788 if (EFI_ERROR (Status
)) {
792 if (Private
->Snp
!= NULL
) {
794 // Install SNP protocol on purpose is for some OS loader backward
795 // compatibility consideration.
797 Status
= gBS
->InstallProtocolInterface (
798 &Private
->Ip4Nic
->Controller
,
799 &gEfiSimpleNetworkProtocolGuid
,
800 EFI_NATIVE_INTERFACE
,
803 if (EFI_ERROR (Status
)) {
808 // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally
809 // layering to perform the experiment.
811 Status
= gBS
->OpenProtocol (
812 Private
->Ip4Nic
->Controller
,
813 &gEfiSimpleNetworkProtocolGuid
,
815 This
->DriverBindingHandle
,
816 Private
->Ip4Nic
->Controller
,
817 EFI_OPEN_PROTOCOL_BY_DRIVER
|EFI_OPEN_PROTOCOL_EXCLUSIVE
819 if (EFI_ERROR (Status
)) {
825 // Open PxeBaseCodePrivate protocol by child to setup a parent-child relationship between
826 // real NIC handle and the virtual IPv4 NIC handle.
828 Status
= gBS
->OpenProtocol (
832 This
->DriverBindingHandle
,
833 Private
->Ip4Nic
->Controller
,
834 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
836 if (EFI_ERROR (Status
)) {
841 // Set default configure data for Udp4Read and Ip4 instance.
843 Mode
= Private
->PxeBc
.Mode
;
844 Udp4CfgData
= &Private
->Udp4CfgData
;
845 Ip4CfgData
= &Private
->Ip4CfgData
;
847 Udp4CfgData
->AcceptBroadcast
= FALSE
;
848 Udp4CfgData
->AcceptAnyPort
= TRUE
;
849 Udp4CfgData
->AllowDuplicatePort
= TRUE
;
850 Udp4CfgData
->TypeOfService
= Mode
->ToS
;
851 Udp4CfgData
->TimeToLive
= Mode
->TTL
;
852 Udp4CfgData
->ReceiveTimeout
= PXEBC_DEFAULT_LIFETIME
;
853 Udp4CfgData
->TransmitTimeout
= PXEBC_DEFAULT_LIFETIME
;
855 Ip4CfgData
->AcceptIcmpErrors
= TRUE
;
856 Ip4CfgData
->DefaultProtocol
= EFI_IP_PROTO_ICMP
;
857 Ip4CfgData
->TypeOfService
= Mode
->ToS
;
858 Ip4CfgData
->TimeToLive
= Mode
->TTL
;
859 Ip4CfgData
->ReceiveTimeout
= PXEBC_DEFAULT_LIFETIME
;
860 Ip4CfgData
->TransmitTimeout
= PXEBC_DEFAULT_LIFETIME
;
865 PxeBcDestroyIp4Children (This
, Private
);
870 Create the opened instances based on IPv6.
872 @param[in] This Pointer to EFI_DRIVER_BINDING_PROTOCOL.
873 @param[in] ControllerHandle Handle of the child to destroy.
874 @param[in] Private Handle Pointer to PXEBC_PRIVATE_DATA.
876 @retval EFI_SUCCESS The instances based on IPv6 were all created successfully.
877 @retval Others An unexpected error occurred.
881 PxeBcCreateIp6Children (
882 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
883 IN EFI_HANDLE ControllerHandle
,
884 IN PXEBC_PRIVATE_DATA
*Private
888 IPv6_DEVICE_PATH Ip6Node
;
889 EFI_UDP6_CONFIG_DATA
*Udp6CfgData
;
890 EFI_IP6_CONFIG_DATA
*Ip6CfgData
;
891 EFI_IP6_MODE_DATA Ip6ModeData
;
892 PXEBC_PRIVATE_PROTOCOL
*Id
;
893 EFI_SIMPLE_NETWORK_PROTOCOL
*Snp
;
896 if (Private
->Ip6Nic
!= NULL
) {
898 // Already created before.
903 Private
->Ip6Nic
= AllocateZeroPool (sizeof (PXEBC_VIRTUAL_NIC
));
905 if (Private
->Ip6Nic
== NULL
) {
906 return EFI_OUT_OF_RESOURCES
;
909 Private
->Ip6Nic
->Private
= Private
;
910 Private
->Ip6Nic
->Signature
= PXEBC_VIRTUAL_NIC_SIGNATURE
;
913 // Create Dhcp6 child and open Dhcp6 protocol for PxeBc->Dhcp.
915 Status
= NetLibCreateServiceChild (
917 This
->DriverBindingHandle
,
918 &gEfiDhcp6ServiceBindingProtocolGuid
,
921 if (EFI_ERROR (Status
)) {
925 Status
= gBS
->OpenProtocol (
927 &gEfiDhcp6ProtocolGuid
,
928 (VOID
**)&Private
->Dhcp6
,
929 This
->DriverBindingHandle
,
931 EFI_OPEN_PROTOCOL_BY_DRIVER
933 if (EFI_ERROR (Status
)) {
938 // Generate a random IAID for the Dhcp6 assigned address.
940 Private
->IaId
= NET_RANDOM (NetRandomInitSeed ());
941 if (Private
->Snp
!= NULL
) {
942 for (Index
= 0; Index
< Private
->Snp
->Mode
->HwAddressSize
; Index
++) {
943 Private
->IaId
|= (Private
->Snp
->Mode
->CurrentAddress
.Addr
[Index
] << ((Index
<< 3) & 31));
948 // Create Mtftp6 child and open Mtftp6 protocol for PxeBc->Mtftp.
950 Status
= NetLibCreateServiceChild (
952 This
->DriverBindingHandle
,
953 &gEfiMtftp6ServiceBindingProtocolGuid
,
954 &Private
->Mtftp6Child
956 if (EFI_ERROR (Status
)) {
960 Status
= gBS
->OpenProtocol (
961 Private
->Mtftp6Child
,
962 &gEfiMtftp6ProtocolGuid
,
963 (VOID
**)&Private
->Mtftp6
,
964 This
->DriverBindingHandle
,
966 EFI_OPEN_PROTOCOL_BY_DRIVER
968 if (EFI_ERROR (Status
)) {
973 // Create Udp6 child and open Udp6 protocol for PxeBc->UdpRead.
975 Status
= NetLibCreateServiceChild (
977 This
->DriverBindingHandle
,
978 &gEfiUdp6ServiceBindingProtocolGuid
,
979 &Private
->Udp6ReadChild
981 if (EFI_ERROR (Status
)) {
985 Status
= gBS
->OpenProtocol (
986 Private
->Udp6ReadChild
,
987 &gEfiUdp6ProtocolGuid
,
988 (VOID
**)&Private
->Udp6Read
,
989 This
->DriverBindingHandle
,
991 EFI_OPEN_PROTOCOL_BY_DRIVER
993 if (EFI_ERROR (Status
)) {
998 // Create Udp6 child and open Udp6 protocol for PxeBc->UdpWrite.
1000 Status
= NetLibCreateServiceChild (
1002 This
->DriverBindingHandle
,
1003 &gEfiUdp6ServiceBindingProtocolGuid
,
1004 &Private
->Udp6WriteChild
1006 if (EFI_ERROR (Status
)) {
1010 Status
= gBS
->OpenProtocol (
1011 Private
->Udp6WriteChild
,
1012 &gEfiUdp6ProtocolGuid
,
1013 (VOID
**)&Private
->Udp6Write
,
1014 This
->DriverBindingHandle
,
1016 EFI_OPEN_PROTOCOL_BY_DRIVER
1018 if (EFI_ERROR (Status
)) {
1023 // Create Ip6 child and open Ip6 protocol for background ICMP6 packets.
1025 Status
= NetLibCreateServiceChild (
1027 This
->DriverBindingHandle
,
1028 &gEfiIp6ServiceBindingProtocolGuid
,
1031 if (EFI_ERROR (Status
)) {
1035 Status
= gBS
->OpenProtocol (
1037 &gEfiIp6ProtocolGuid
,
1038 (VOID
**)&Private
->Ip6
,
1039 This
->DriverBindingHandle
,
1041 EFI_OPEN_PROTOCOL_BY_DRIVER
1043 if (EFI_ERROR (Status
)) {
1048 // Get max packet size from Ip6 to calculate block size for Tftp later.
1050 Status
= Private
->Ip6
->GetModeData (Private
->Ip6
, &Ip6ModeData
, NULL
, NULL
);
1051 if (EFI_ERROR (Status
)) {
1055 Private
->Ip6MaxPacketSize
= Ip6ModeData
.MaxPacketSize
;
1057 if (Ip6ModeData
.AddressList
!= NULL
) {
1058 FreePool (Ip6ModeData
.AddressList
);
1061 if (Ip6ModeData
.GroupTable
!= NULL
) {
1062 FreePool (Ip6ModeData
.GroupTable
);
1065 if (Ip6ModeData
.RouteTable
!= NULL
) {
1066 FreePool (Ip6ModeData
.RouteTable
);
1069 if (Ip6ModeData
.NeighborCache
!= NULL
) {
1070 FreePool (Ip6ModeData
.NeighborCache
);
1073 if (Ip6ModeData
.PrefixTable
!= NULL
) {
1074 FreePool (Ip6ModeData
.PrefixTable
);
1077 if (Ip6ModeData
.IcmpTypeList
!= NULL
) {
1078 FreePool (Ip6ModeData
.IcmpTypeList
);
1082 // Locate Ip6->Ip6Config and store it for set IPv6 address.
1084 Status
= gBS
->HandleProtocol (
1086 &gEfiIp6ConfigProtocolGuid
,
1087 (VOID
**)&Private
->Ip6Cfg
1089 if (EFI_ERROR (Status
)) {
1094 // Create a device path node for Ipv6 virtual nic, and append it.
1096 ZeroMem (&Ip6Node
, sizeof (IPv6_DEVICE_PATH
));
1097 Ip6Node
.Header
.Type
= MESSAGING_DEVICE_PATH
;
1098 Ip6Node
.Header
.SubType
= MSG_IPv6_DP
;
1099 Ip6Node
.PrefixLength
= IP6_PREFIX_LENGTH
;
1101 SetDevicePathNodeLength (&Ip6Node
.Header
, sizeof (Ip6Node
));
1103 Private
->Ip6Nic
->DevicePath
= AppendDevicePathNode (Private
->DevicePath
, &Ip6Node
.Header
);
1105 if (Private
->Ip6Nic
->DevicePath
== NULL
) {
1106 Status
= EFI_OUT_OF_RESOURCES
;
1111 &Private
->Ip6Nic
->LoadFile
,
1112 &gLoadFileProtocolTemplate
,
1113 sizeof (EFI_LOAD_FILE_PROTOCOL
)
1117 // Create a new handle for IPv6 virtual nic,
1118 // and install PxeBaseCode, LoadFile and DevicePath protocols.
1120 Status
= gBS
->InstallMultipleProtocolInterfaces (
1121 &Private
->Ip6Nic
->Controller
,
1122 &gEfiDevicePathProtocolGuid
,
1123 Private
->Ip6Nic
->DevicePath
,
1124 &gEfiLoadFileProtocolGuid
,
1125 &Private
->Ip6Nic
->LoadFile
,
1126 &gEfiPxeBaseCodeProtocolGuid
,
1130 if (EFI_ERROR (Status
)) {
1134 if (Private
->Snp
!= NULL
) {
1136 // Install SNP protocol on purpose is for some OS loader backward
1137 // compatibility consideration.
1139 Status
= gBS
->InstallProtocolInterface (
1140 &Private
->Ip6Nic
->Controller
,
1141 &gEfiSimpleNetworkProtocolGuid
,
1142 EFI_NATIVE_INTERFACE
,
1145 if (EFI_ERROR (Status
)) {
1150 // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally
1151 // layering to perform the experiment.
1153 Status
= gBS
->OpenProtocol (
1154 Private
->Ip6Nic
->Controller
,
1155 &gEfiSimpleNetworkProtocolGuid
,
1157 This
->DriverBindingHandle
,
1158 Private
->Ip6Nic
->Controller
,
1159 EFI_OPEN_PROTOCOL_BY_DRIVER
|EFI_OPEN_PROTOCOL_EXCLUSIVE
1161 if (EFI_ERROR (Status
)) {
1167 // Open PxeBaseCodePrivate protocol by child to setup a parent-child relationship between
1168 // real NIC handle and the virtual IPv6 NIC handle.
1170 Status
= gBS
->OpenProtocol (
1174 This
->DriverBindingHandle
,
1175 Private
->Ip6Nic
->Controller
,
1176 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
1178 if (EFI_ERROR (Status
)) {
1183 // Set IPv6 available flag and set default configure data for
1184 // Udp6Read and Ip6 instance.
1186 Status
= PxeBcCheckIpv6Support (ControllerHandle
, Private
, &Private
->Mode
.Ipv6Available
);
1187 if (EFI_ERROR (Status
)) {
1189 // Fail to get the data whether UNDI supports IPv6. Set default value.
1191 Private
->Mode
.Ipv6Available
= TRUE
;
1194 if (!Private
->Mode
.Ipv6Available
) {
1198 Udp6CfgData
= &Private
->Udp6CfgData
;
1199 Ip6CfgData
= &Private
->Ip6CfgData
;
1201 Udp6CfgData
->AcceptAnyPort
= TRUE
;
1202 Udp6CfgData
->AllowDuplicatePort
= TRUE
;
1203 Udp6CfgData
->HopLimit
= PXEBC_DEFAULT_HOPLIMIT
;
1204 Udp6CfgData
->ReceiveTimeout
= PXEBC_DEFAULT_LIFETIME
;
1205 Udp6CfgData
->TransmitTimeout
= PXEBC_DEFAULT_LIFETIME
;
1207 Ip6CfgData
->AcceptIcmpErrors
= TRUE
;
1208 Ip6CfgData
->DefaultProtocol
= IP6_ICMP
;
1209 Ip6CfgData
->HopLimit
= PXEBC_DEFAULT_HOPLIMIT
;
1210 Ip6CfgData
->ReceiveTimeout
= PXEBC_DEFAULT_LIFETIME
;
1211 Ip6CfgData
->TransmitTimeout
= PXEBC_DEFAULT_LIFETIME
;
1216 PxeBcDestroyIp6Children (This
, Private
);
1221 The entry point for UefiPxeBc driver that installs the driver
1222 binding and component name protocol on its image.
1224 @param[in] ImageHandle The Image handle of the driver.
1225 @param[in] SystemTable The system table.
1233 PxeBcDriverEntryPoint (
1234 IN EFI_HANDLE ImageHandle
,
1235 IN EFI_SYSTEM_TABLE
*SystemTable
1240 if ((PcdGet8 (PcdIPv4PXESupport
) == PXE_DISABLED
) && (PcdGet8 (PcdIPv6PXESupport
) == PXE_DISABLED
)) {
1241 return EFI_UNSUPPORTED
;
1244 Status
= EfiLibInstallDriverBindingComponentName2 (
1247 &gPxeBcIp4DriverBinding
,
1249 &gPxeBcComponentName
,
1250 &gPxeBcComponentName2
1252 if (EFI_ERROR (Status
)) {
1256 Status
= EfiLibInstallDriverBindingComponentName2 (
1259 &gPxeBcIp6DriverBinding
,
1261 &gPxeBcComponentName
,
1262 &gPxeBcComponentName2
1264 if (EFI_ERROR (Status
)) {
1265 EfiLibUninstallDriverBindingComponentName2 (
1266 &gPxeBcIp4DriverBinding
,
1267 &gPxeBcComponentName
,
1268 &gPxeBcComponentName2
1276 Test to see if this driver supports ControllerHandle. This is the worker function for
1277 PxeBcIp4(6)DriverBindingSupported.
1279 @param[in] This The pointer to the driver binding protocol.
1280 @param[in] ControllerHandle The handle of device to be tested.
1281 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1282 device to be started.
1283 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
1285 @retval EFI_SUCCESS This driver supports this device.
1286 @retval EFI_UNSUPPORTED This driver does not support this device.
1292 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1293 IN EFI_HANDLE ControllerHandle
,
1294 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1299 EFI_GUID
*DhcpServiceBindingGuid
;
1300 EFI_GUID
*MtftpServiceBindingGuid
;
1302 if (IpVersion
== IP_VERSION_4
) {
1303 if (PcdGet8 (PcdIPv4PXESupport
) == PXE_DISABLED
) {
1304 return EFI_UNSUPPORTED
;
1307 DhcpServiceBindingGuid
= &gEfiDhcp4ServiceBindingProtocolGuid
;
1308 MtftpServiceBindingGuid
= &gEfiMtftp4ServiceBindingProtocolGuid
;
1310 if (PcdGet8 (PcdIPv6PXESupport
) == PXE_DISABLED
) {
1311 return EFI_UNSUPPORTED
;
1314 DhcpServiceBindingGuid
= &gEfiDhcp6ServiceBindingProtocolGuid
;
1315 MtftpServiceBindingGuid
= &gEfiMtftp6ServiceBindingProtocolGuid
;
1319 // Try to open the Mtftp and Dhcp protocol to test whether IP stack is ready.
1321 Status
= gBS
->OpenProtocol (
1323 DhcpServiceBindingGuid
,
1325 This
->DriverBindingHandle
,
1327 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
1329 if (!EFI_ERROR (Status
)) {
1330 Status
= gBS
->OpenProtocol (
1332 MtftpServiceBindingGuid
,
1334 This
->DriverBindingHandle
,
1336 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
1341 // It's unsupported case if IP stack are not ready.
1343 if (EFI_ERROR (Status
)) {
1344 return EFI_UNSUPPORTED
;
1351 Start this driver on ControllerHandle. This is the worker function for
1352 PxeBcIp4(6)DriverBindingStart.
1354 @param[in] This The pointer to the driver binding protocol.
1355 @param[in] ControllerHandle The handle of device to be started.
1356 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1357 device to be started.
1358 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
1361 @retval EFI_SUCCESS This driver is installed to ControllerHandle.
1362 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
1363 @retval other This driver does not support this device.
1369 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1370 IN EFI_HANDLE ControllerHandle
,
1371 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1375 PXEBC_PRIVATE_DATA
*Private
;
1377 PXEBC_PRIVATE_PROTOCOL
*Id
;
1381 Status
= gBS
->OpenProtocol (
1385 This
->DriverBindingHandle
,
1387 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1389 if (!EFI_ERROR (Status
)) {
1391 // Skip the initialization if the driver has been started already.
1393 Private
= PXEBC_PRIVATE_DATA_FROM_ID (Id
);
1397 // If the driver has not been started yet, it should do initialization.
1399 Private
= AllocateZeroPool (sizeof (PXEBC_PRIVATE_DATA
));
1400 if (Private
== NULL
) {
1401 return EFI_OUT_OF_RESOURCES
;
1406 &gPxeBcProtocolTemplate
,
1407 sizeof (EFI_PXE_BASE_CODE_PROTOCOL
)
1410 Private
->Signature
= PXEBC_PRIVATE_DATA_SIGNATURE
;
1411 Private
->Controller
= ControllerHandle
;
1412 Private
->Image
= This
->ImageHandle
;
1413 Private
->PxeBc
.Mode
= &Private
->Mode
;
1414 Private
->Mode
.Ipv6Supported
= TRUE
;
1415 Private
->Mode
.AutoArp
= TRUE
;
1416 Private
->Mode
.TTL
= DEFAULT_TTL
;
1417 Private
->Mode
.ToS
= DEFAULT_ToS
;
1420 // Open device path to prepare for appending virtual NIC node.
1422 Status
= gBS
->OpenProtocol (
1424 &gEfiDevicePathProtocolGuid
,
1425 (VOID
**)&Private
->DevicePath
,
1426 This
->DriverBindingHandle
,
1428 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1431 if (EFI_ERROR (Status
)) {
1436 // Get the NII interface if it exists, it's not required.
1438 Status
= gBS
->OpenProtocol (
1440 &gEfiNetworkInterfaceIdentifierProtocolGuid_31
,
1441 (VOID
**)&Private
->Nii
,
1442 This
->DriverBindingHandle
,
1444 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1446 if (EFI_ERROR (Status
)) {
1447 Private
->Nii
= NULL
;
1451 // Install PxeBaseCodePrivate protocol onto the real NIC handler.
1452 // PxeBaseCodePrivate protocol is only used to keep the relationship between
1453 // NIC handle and virtual child handles.
1454 // gEfiCallerIdGuid will be used as its protocol guid.
1456 Status
= gBS
->InstallProtocolInterface (
1459 EFI_NATIVE_INTERFACE
,
1462 if (EFI_ERROR (Status
)) {
1467 // Try to locate SNP protocol.
1469 NetLibGetSnpHandle (ControllerHandle
, &Private
->Snp
);
1472 if (IpVersion
== IP_VERSION_4
) {
1474 // Try to create virtual NIC handle for IPv4.
1476 Status
= PxeBcCreateIp4Children (This
, ControllerHandle
, Private
);
1479 // Try to create virtual NIC handle for IPv6.
1481 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
)) {
1517 Stop this driver on ControllerHandle. This is the worker function for
1518 PxeBcIp4(6)DriverBindingStop.
1520 @param[in] This Protocol instance pointer.
1521 @param[in] ControllerHandle Handle of device to stop driver on.
1522 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
1523 children is zero stop the entire bus driver.
1524 @param[in] ChildHandleBuffer List of Child Handles to Stop.
1525 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
1527 @retval EFI_SUCCESS This driver was removed ControllerHandle.
1528 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1529 @retval Others This driver was not removed from this device
1535 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1536 IN EFI_HANDLE ControllerHandle
,
1537 IN UINTN NumberOfChildren
,
1538 IN EFI_HANDLE
*ChildHandleBuffer
,
1542 PXEBC_PRIVATE_DATA
*Private
;
1543 PXEBC_VIRTUAL_NIC
*VirtualNic
;
1544 EFI_LOAD_FILE_PROTOCOL
*LoadFile
;
1546 EFI_HANDLE NicHandle
;
1547 PXEBC_PRIVATE_PROTOCOL
*Id
;
1555 Status
= gBS
->OpenProtocol (
1557 &gEfiLoadFileProtocolGuid
,
1559 This
->DriverBindingHandle
,
1561 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1563 if (EFI_ERROR (Status
)) {
1565 // Get the Nic handle by any pass-over service child handle.
1567 if (IpVersion
== IP_VERSION_4
) {
1568 NicHandle
= PxeBcGetNicByIp4Children (ControllerHandle
);
1570 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
)) {
1592 Private
= PXEBC_PRIVATE_DATA_FROM_ID (Id
);
1595 // It's a virtual handle with LoadFileProtocol.
1597 Status
= gBS
->OpenProtocol (
1599 &gEfiLoadFileProtocolGuid
,
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
)) {
1622 if ((Private
->Ip4Nic
!= NULL
) && (IpVersion
== IP_VERSION_4
)) {
1623 PxeBcDestroyIp4Children (This
, Private
);
1626 if ((Private
->Ip6Nic
!= NULL
) && (IpVersion
== IP_VERSION_6
)) {
1627 PxeBcDestroyIp6Children (This
, Private
);
1630 if ((Private
->Ip4Nic
== NULL
) && (Private
->Ip6Nic
== NULL
)) {
1631 gBS
->UninstallProtocolInterface (
1643 Test to see if this driver supports ControllerHandle. This service
1644 is called by the EFI boot service ConnectController(). In
1645 order to make drivers as small as possible, there are a few calling
1646 restrictions for this service. ConnectController() must
1647 follow these calling restrictions. If any other agent wishes to call
1648 Supported() it must also follow these calling restrictions.
1650 @param[in] This The pointer to the driver binding protocol.
1651 @param[in] ControllerHandle The handle of device to be tested.
1652 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1653 device to be started.
1655 @retval EFI_SUCCESS This driver supports this device.
1656 @retval EFI_UNSUPPORTED This driver does not support this device.
1661 PxeBcIp4DriverBindingSupported (
1662 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1663 IN EFI_HANDLE ControllerHandle
,
1664 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
1667 return PxeBcSupported (
1670 RemainingDevicePath
,
1676 Start this driver on ControllerHandle. This service is called by the
1677 EFI boot service ConnectController(). In order to make
1678 drivers as small as possible, there are a few calling restrictions for
1679 this service. ConnectController() must follow these
1680 calling restrictions. If any other agent wishes to call Start() it
1681 must also follow these calling restrictions.
1683 @param[in] This The pointer to the driver binding protocol.
1684 @param[in] ControllerHandle The handle of device to be started.
1685 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1686 device to be started.
1688 @retval EFI_SUCCESS This driver is installed to ControllerHandle.
1689 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
1690 @retval other This driver does not support this device.
1695 PxeBcIp4DriverBindingStart (
1696 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1697 IN EFI_HANDLE ControllerHandle
,
1698 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
1704 RemainingDevicePath
,
1710 Stop this driver on ControllerHandle. This service is called by the
1711 EFI boot service DisconnectController(). In order to
1712 make drivers as small as possible, there are a few calling
1713 restrictions for this service. DisconnectController()
1714 must follow these calling restrictions. If any other agent wishes
1715 to call Stop() it must also follow these calling restrictions.
1717 @param[in] This Protocol instance pointer.
1718 @param[in] ControllerHandle Handle of device to stop driver on
1719 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
1720 children is zero stop the entire bus driver.
1721 @param[in] ChildHandleBuffer List of Child Handles to Stop.
1723 @retval EFI_SUCCESS This driver is removed ControllerHandle
1724 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1725 @retval Others This driver was not removed from this device.
1730 PxeBcIp4DriverBindingStop (
1731 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1732 IN EFI_HANDLE ControllerHandle
,
1733 IN UINTN NumberOfChildren
,
1734 IN EFI_HANDLE
*ChildHandleBuffer
1747 Test to see if this driver supports ControllerHandle. This service
1748 is called by the EFI boot service ConnectController(). In
1749 order to make drivers as small as possible, there are a few calling
1750 restrictions for this service. ConnectController() must
1751 follow these calling restrictions. If any other agent wishes to call
1752 Supported() it must also follow these calling restrictions.
1754 @param[in] This The pointer to the driver binding protocol.
1755 @param[in] ControllerHandle The handle of device to be tested.
1756 @param[in] RemainingDevicePath Optional parameter use to pick a specific child
1757 device to be started.
1759 @retval EFI_SUCCESS This driver supports this device.
1760 @retval EFI_UNSUPPORTED This driver does not support this device.
1765 PxeBcIp6DriverBindingSupported (
1766 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1767 IN EFI_HANDLE ControllerHandle
,
1768 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
1771 return PxeBcSupported (
1774 RemainingDevicePath
,
1780 Start this driver on ControllerHandle. This service is called by the
1781 EFI boot service ConnectController(). In order to make
1782 drivers as small as possible, there are a few calling restrictions for
1783 this service. ConnectController() must follow these
1784 calling restrictions. If any other agent wishes to call Start() it
1785 must also follow these calling restrictions.
1787 @param[in] This The pointer to the driver binding protocol.
1788 @param[in] ControllerHandle The handle of device to be started.
1789 @param[in] RemainingDevicePath Optional parameter used to pick a specific child
1790 device to be started.
1792 @retval EFI_SUCCESS This driver is installed to ControllerHandle.
1793 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
1794 @retval other This driver does not support this device.
1799 PxeBcIp6DriverBindingStart (
1800 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1801 IN EFI_HANDLE ControllerHandle
,
1802 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
1808 RemainingDevicePath
,
1814 Stop this driver on ControllerHandle. This service is called by the
1815 EFI boot service DisconnectController(). In order to
1816 make drivers as small as possible, there are a few calling
1817 restrictions for this service. DisconnectController()
1818 must follow these calling restrictions. If any other agent wishes
1819 to call Stop() it must also follow these calling restrictions.
1821 @param[in] This Protocol instance pointer.
1822 @param[in] ControllerHandle Handle of device to stop driver on
1823 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
1824 children is zero stop the entire bus driver.
1825 @param[in] ChildHandleBuffer List of Child Handles to Stop.
1827 @retval EFI_SUCCESS This driver is removed ControllerHandle
1828 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1829 @retval Others This driver was not removed from this device.
1834 PxeBcIp6DriverBindingStop (
1835 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
1836 IN EFI_HANDLE ControllerHandle
,
1837 IN UINTN NumberOfChildren
,
1838 IN EFI_HANDLE
*ChildHandleBuffer