Changeset 99404 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/HttpBootDxe/HttpBootDxe.c
- Timestamp:
- Apr 14, 2023 3:17:44 PM (22 months ago)
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776,129194-145445 /vendor/edk2/current 103735-103757,103769-103776,129194-156846
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/HttpBootDxe/HttpBootDxe.c
r85718 r99404 12 12 /// Driver Binding Protocol instance 13 13 /// 14 EFI_DRIVER_BINDING_PROTOCOL gHttpBootIp4DxeDriverBinding = {14 EFI_DRIVER_BINDING_PROTOCOL gHttpBootIp4DxeDriverBinding = { 15 15 HttpBootIp4DxeDriverBindingSupported, 16 16 HttpBootIp4DxeDriverBindingStart, … … 21 21 }; 22 22 23 EFI_DRIVER_BINDING_PROTOCOL gHttpBootIp6DxeDriverBinding = {23 EFI_DRIVER_BINDING_PROTOCOL gHttpBootIp6DxeDriverBinding = { 24 24 HttpBootIp6DxeDriverBindingSupported, 25 25 HttpBootIp6DxeDriverBindingStart, … … 30 30 }; 31 31 32 33 34 32 /** 35 33 Check whether UNDI protocol supports IPv6. … … 44 42 EFI_STATUS 45 43 HttpBootCheckIpv6Support ( 46 IN HTTP_BOOT_PRIVATE_DATA 47 OUT BOOLEAN 44 IN HTTP_BOOT_PRIVATE_DATA *Private, 45 OUT BOOLEAN *Ipv6Support 48 46 ) 49 47 { 50 EFI_HANDLE Handle;51 EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;52 EFI_STATUS Status;53 EFI_GUID *InfoTypesBuffer;54 UINTN InfoTypeBufferCount;55 UINTN TypeIndex;56 BOOLEAN Supported;57 VOID *InfoBlock;58 UINTN InfoBlockSize;48 EFI_HANDLE Handle; 49 EFI_ADAPTER_INFORMATION_PROTOCOL *Aip; 50 EFI_STATUS Status; 51 EFI_GUID *InfoTypesBuffer; 52 UINTN InfoTypeBufferCount; 53 UINTN TypeIndex; 54 BOOLEAN Supported; 55 VOID *InfoBlock; 56 UINTN InfoBlockSize; 59 57 60 58 ASSERT (Private != NULL && Ipv6Support != NULL); … … 80 78 Handle, 81 79 &gEfiAdapterInformationProtocolGuid, 82 (VOID *) 83 ); 84 if (EFI_ERROR (Status) || Aip == NULL) {80 (VOID *)&Aip 81 ); 82 if (EFI_ERROR (Status) || (Aip == NULL)) { 85 83 return EFI_NOT_FOUND; 86 84 } … … 88 86 InfoTypesBuffer = NULL; 89 87 InfoTypeBufferCount = 0; 90 Status = Aip->GetSupportedTypes (Aip, &InfoTypesBuffer, &InfoTypeBufferCount);91 if (EFI_ERROR (Status) || InfoTypesBuffer == NULL) {88 Status = Aip->GetSupportedTypes (Aip, &InfoTypesBuffer, &InfoTypeBufferCount); 89 if (EFI_ERROR (Status) || (InfoTypesBuffer == NULL)) { 92 90 FreePool (InfoTypesBuffer); 93 91 return EFI_NOT_FOUND; … … 112 110 InfoBlock = NULL; 113 111 InfoBlockSize = 0; 114 Status = Aip->GetInformation (Aip, &gEfiAdapterInfoUndiIpv6SupportGuid, &InfoBlock, &InfoBlockSize);115 if (EFI_ERROR (Status) || InfoBlock == NULL) {112 Status = Aip->GetInformation (Aip, &gEfiAdapterInfoUndiIpv6SupportGuid, &InfoBlock, &InfoBlockSize); 113 if (EFI_ERROR (Status) || (InfoBlock == NULL)) { 116 114 FreePool (InfoBlock); 117 115 return EFI_NOT_FOUND; 118 116 } 119 117 120 *Ipv6Support = ((EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT *) 118 *Ipv6Support = ((EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT *)InfoBlock)->Ipv6Support; 121 119 FreePool (InfoBlock); 122 120 … … 156 154 } 157 155 158 if ( Private->Ip6Nic == NULL&& Private->HttpCreated) {156 if ((Private->Ip6Nic == NULL) && Private->HttpCreated) { 159 157 HttpIoDestroyIo (&Private->HttpIo); 160 158 Private->HttpCreated = FALSE; … … 162 160 163 161 if (Private->Ip4Nic != NULL) { 164 165 162 gBS->CloseProtocol ( 166 163 Private->Controller, … … 181 178 Private->Ip4Nic = NULL; 182 179 } 183 184 180 } 185 181 … … 232 228 } 233 229 234 if ( Private->Ip4Nic == NULL&& Private->HttpCreated) {235 HttpIoDestroyIo (&Private->HttpIo);230 if ((Private->Ip4Nic == NULL) && Private->HttpCreated) { 231 HttpIoDestroyIo (&Private->HttpIo); 236 232 Private->HttpCreated = FALSE; 237 233 } 238 234 239 235 if (Private->Ip6Nic != NULL) { 240 241 236 gBS->CloseProtocol ( 242 237 Private->Controller, … … 309 304 ) 310 305 { 311 EFI_STATUS 306 EFI_STATUS Status; 312 307 313 308 // … … 349 344 return Status; 350 345 } 351 352 346 353 347 /** … … 394 388 ) 395 389 { 396 EFI_STATUS 397 HTTP_BOOT_PRIVATE_DATA 398 EFI_DEV_PATH 399 EFI_DEVICE_PATH_PROTOCOL 400 UINT32 401 BOOLEAN 390 EFI_STATUS Status; 391 HTTP_BOOT_PRIVATE_DATA *Private; 392 EFI_DEV_PATH *Node; 393 EFI_DEVICE_PATH_PROTOCOL *DevicePath; 394 UINT32 *Id; 395 BOOLEAN FirstStart; 402 396 403 397 FirstStart = FALSE; … … 406 400 ControllerHandle, 407 401 &gEfiCallerIdGuid, 408 (VOID **) 402 (VOID **)&Id, 409 403 This->DriverBindingHandle, 410 404 ControllerHandle, … … 413 407 414 408 if (!EFI_ERROR (Status)) { 415 Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID (Id);409 Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID (Id); 416 410 } else { 417 411 FirstStart = TRUE; … … 424 418 return EFI_OUT_OF_RESOURCES; 425 419 } 426 Private->Signature = HTTP_BOOT_PRIVATE_DATA_SIGNATURE; 420 421 Private->Signature = HTTP_BOOT_PRIVATE_DATA_SIGNATURE; 427 422 Private->Controller = ControllerHandle; 428 423 InitializeListHead (&Private->CacheList); … … 433 428 ControllerHandle, 434 429 &gEfiNetworkInterfaceIdentifierProtocolGuid_31, 435 (VOID **) 430 (VOID **)&Private->Nii, 436 431 This->DriverBindingHandle, 437 432 ControllerHandle, … … 448 443 ControllerHandle, 449 444 &gEfiDevicePathProtocolGuid, 450 (VOID **) 445 (VOID **)&Private->ParentDevicePath, 451 446 This->DriverBindingHandle, 452 447 ControllerHandle, … … 478 473 goto ON_ERROR; 479 474 } 480 481 475 } 482 476 … … 493 487 goto ON_ERROR; 494 488 } 489 495 490 Private->Ip4Nic->Private = Private; 496 491 Private->Ip4Nic->ImageHandle = This->DriverBindingHandle; … … 513 508 Private->Dhcp4Child, 514 509 &gEfiDhcp4ProtocolGuid, 515 (VOID **) 510 (VOID **)&Private->Dhcp4, 516 511 This->DriverBindingHandle, 517 512 ControllerHandle, … … 528 523 ControllerHandle, 529 524 &gEfiIp4Config2ProtocolGuid, 530 (VOID **) 525 (VOID **)&Private->Ip4Config2, 531 526 This->DriverBindingHandle, 532 527 ControllerHandle, … … 545 540 goto ON_ERROR; 546 541 } 547 Node->Ipv4.Header.Type = MESSAGING_DEVICE_PATH; 542 543 Node->Ipv4.Header.Type = MESSAGING_DEVICE_PATH; 548 544 Node->Ipv4.Header.SubType = MSG_IPv4_DP; 549 545 SetDevicePathNodeLength (Node, sizeof (IPv4_DEVICE_PATH)); 550 546 Node->Ipv4.StaticIpAddress = FALSE; 551 DevicePath = AppendDevicePathNode (Private->ParentDevicePath, (EFI_DEVICE_PATH_PROTOCOL*)Node);547 DevicePath = AppendDevicePathNode (Private->ParentDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)Node); 552 548 FreePool (Node); 553 549 if (DevicePath == NULL) { … … 564 560 goto ON_ERROR; 565 561 } 566 Node->DevPath.Type = MESSAGING_DEVICE_PATH; 562 563 Node->DevPath.Type = MESSAGING_DEVICE_PATH; 567 564 Node->DevPath.SubType = MSG_URI_DP; 568 565 SetDevicePathNodeLength (Node, sizeof (EFI_DEVICE_PATH_PROTOCOL)); 569 Private->Ip4Nic->DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)Node);566 Private->Ip4Nic->DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)Node); 570 567 FreePool (Node); 571 568 FreePool (DevicePath); … … 598 595 ControllerHandle, 599 596 &gEfiCallerIdGuid, 600 (VOID **) 597 (VOID **)&Id, 601 598 This->DriverBindingHandle, 602 599 Private->Ip4Nic->Controller, … … 629 626 return Status; 630 627 } 631 632 628 633 629 /** … … 666 662 ) 667 663 { 668 EFI_STATUS 669 EFI_LOAD_FILE_PROTOCOL 670 HTTP_BOOT_PRIVATE_DATA 671 EFI_HANDLE 672 UINT32 664 EFI_STATUS Status; 665 EFI_LOAD_FILE_PROTOCOL *LoadFile; 666 HTTP_BOOT_PRIVATE_DATA *Private; 667 EFI_HANDLE NicHandle; 668 UINT32 *Id; 673 669 674 670 // … … 678 674 ControllerHandle, 679 675 &gEfiLoadFileProtocolGuid, 680 (VOID **) 676 (VOID **)&LoadFile, 681 677 This->DriverBindingHandle, 682 678 ControllerHandle, … … 698 694 NicHandle, 699 695 &gEfiCallerIdGuid, 700 (VOID **) 696 (VOID **)&Id, 701 697 This->DriverBindingHandle, 702 698 ControllerHandle, … … 706 702 return Status; 707 703 } 704 708 705 Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID (Id); 709 706 } else { 710 Private = HTTP_BOOT_PRIVATE_DATA_FROM_LOADFILE (LoadFile);707 Private = HTTP_BOOT_PRIVATE_DATA_FROM_LOADFILE (LoadFile); 711 708 NicHandle = Private->Controller; 712 709 } … … 716 713 // 717 714 Status = HttpBootStop (Private); 718 if ( Status != EFI_SUCCESS && Status != EFI_NOT_STARTED) {715 if ((Status != EFI_SUCCESS) && (Status != EFI_NOT_STARTED)) { 719 716 return Status; 720 717 } … … 725 722 HttpBootDestroyIp4Children (This, Private); 726 723 727 if ( Private->Ip4Nic == NULL && Private->Ip6Nic == NULL) {724 if ((Private->Ip4Nic == NULL) && (Private->Ip6Nic == NULL)) { 728 725 // 729 726 // Release the cached data. … … 742 739 ); 743 740 FreePool (Private); 744 745 741 } 746 742 … … 798 794 ) 799 795 { 800 EFI_STATUS 796 EFI_STATUS Status; 801 797 802 798 // … … 837 833 838 834 return Status; 839 840 835 } 841 836 … … 883 878 ) 884 879 { 885 EFI_STATUS 886 HTTP_BOOT_PRIVATE_DATA 887 EFI_DEV_PATH 888 EFI_DEVICE_PATH_PROTOCOL 889 UINT32 890 BOOLEAN 891 BOOLEAN 880 EFI_STATUS Status; 881 HTTP_BOOT_PRIVATE_DATA *Private; 882 EFI_DEV_PATH *Node; 883 EFI_DEVICE_PATH_PROTOCOL *DevicePath; 884 UINT32 *Id; 885 BOOLEAN Ipv6Available; 886 BOOLEAN FirstStart; 892 887 893 888 FirstStart = FALSE; … … 896 891 ControllerHandle, 897 892 &gEfiCallerIdGuid, 898 (VOID **) 893 (VOID **)&Id, 899 894 This->DriverBindingHandle, 900 895 ControllerHandle, … … 903 898 904 899 if (!EFI_ERROR (Status)) { 905 Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID (Id);900 Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID (Id); 906 901 } else { 907 902 FirstStart = TRUE; … … 914 909 return EFI_OUT_OF_RESOURCES; 915 910 } 916 Private->Signature = HTTP_BOOT_PRIVATE_DATA_SIGNATURE; 911 912 Private->Signature = HTTP_BOOT_PRIVATE_DATA_SIGNATURE; 917 913 Private->Controller = ControllerHandle; 918 914 InitializeListHead (&Private->CacheList); … … 923 919 ControllerHandle, 924 920 &gEfiNetworkInterfaceIdentifierProtocolGuid_31, 925 (VOID **) 921 (VOID **)&Private->Nii, 926 922 This->DriverBindingHandle, 927 923 ControllerHandle, … … 938 934 ControllerHandle, 939 935 &gEfiDevicePathProtocolGuid, 940 (VOID **) 936 (VOID **)&Private->ParentDevicePath, 941 937 This->DriverBindingHandle, 942 938 ControllerHandle, … … 968 964 goto ON_ERROR; 969 965 } 970 971 966 } 972 967 … … 1000 995 goto ON_ERROR; 1001 996 } 997 1002 998 Private->Ip6Nic->Private = Private; 1003 999 Private->Ip6Nic->ImageHandle = This->DriverBindingHandle; … … 1019 1015 Private->Dhcp6Child, 1020 1016 &gEfiDhcp6ProtocolGuid, 1021 (VOID **) 1017 (VOID **)&Private->Dhcp6, 1022 1018 This->DriverBindingHandle, 1023 1019 ControllerHandle, … … 1032 1028 // 1033 1029 Status = NetLibCreateServiceChild ( 1034 1035 1036 1037 1038 1030 ControllerHandle, 1031 This->DriverBindingHandle, 1032 &gEfiIp6ServiceBindingProtocolGuid, 1033 &Private->Ip6Child 1034 ); 1039 1035 if (EFI_ERROR (Status)) { 1040 1036 goto ON_ERROR; … … 1044 1040 Private->Ip6Child, 1045 1041 &gEfiIp6ProtocolGuid, 1046 (VOID **) 1042 (VOID **)&Private->Ip6, 1047 1043 This->DriverBindingHandle, 1048 1044 ControllerHandle, … … 1059 1055 ControllerHandle, 1060 1056 &gEfiIp6ConfigProtocolGuid, 1061 (VOID **) 1057 (VOID **)&Private->Ip6Config, 1062 1058 This->DriverBindingHandle, 1063 1059 ControllerHandle, … … 1076 1072 goto ON_ERROR; 1077 1073 } 1078 Node->Ipv6.Header.Type = MESSAGING_DEVICE_PATH; 1074 1075 Node->Ipv6.Header.Type = MESSAGING_DEVICE_PATH; 1079 1076 Node->Ipv6.Header.SubType = MSG_IPv6_DP; 1080 Node->Ipv6.PrefixLength = IP6_PREFIX_LENGTH;1077 Node->Ipv6.PrefixLength = IP6_PREFIX_LENGTH; 1081 1078 SetDevicePathNodeLength (Node, sizeof (IPv6_DEVICE_PATH)); 1082 DevicePath = AppendDevicePathNode (Private->ParentDevicePath, (EFI_DEVICE_PATH*)Node);1083 FreePool (Node);1079 DevicePath = AppendDevicePathNode (Private->ParentDevicePath, (EFI_DEVICE_PATH *)Node); 1080 FreePool (Node); 1084 1081 if (DevicePath == NULL) { 1085 1082 Status = EFI_OUT_OF_RESOURCES; … … 1095 1092 goto ON_ERROR; 1096 1093 } 1097 Node->DevPath.Type = MESSAGING_DEVICE_PATH; 1094 1095 Node->DevPath.Type = MESSAGING_DEVICE_PATH; 1098 1096 Node->DevPath.SubType = MSG_URI_DP; 1099 1097 SetDevicePathNodeLength (Node, sizeof (EFI_DEVICE_PATH_PROTOCOL)); 1100 Private->Ip6Nic->DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)Node);1098 Private->Ip6Nic->DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)Node); 1101 1099 FreePool (Node); 1102 1100 FreePool (DevicePath); … … 1129 1127 ControllerHandle, 1130 1128 &gEfiCallerIdGuid, 1131 (VOID **) 1129 (VOID **)&Id, 1132 1130 This->DriverBindingHandle, 1133 1131 Private->Ip6Nic->Controller, … … 1150 1148 } 1151 1149 1152 HttpBootDestroyIp6Children (This, Private);1150 HttpBootDestroyIp6Children (This, Private); 1153 1151 HttpBootConfigFormUnload (Private); 1154 1152 … … 1196 1194 ) 1197 1195 { 1198 EFI_STATUS 1199 EFI_LOAD_FILE_PROTOCOL 1200 HTTP_BOOT_PRIVATE_DATA 1201 EFI_HANDLE 1202 UINT32 1196 EFI_STATUS Status; 1197 EFI_LOAD_FILE_PROTOCOL *LoadFile; 1198 HTTP_BOOT_PRIVATE_DATA *Private; 1199 EFI_HANDLE NicHandle; 1200 UINT32 *Id; 1203 1201 1204 1202 // … … 1208 1206 ControllerHandle, 1209 1207 &gEfiLoadFileProtocolGuid, 1210 (VOID **) 1208 (VOID **)&LoadFile, 1211 1209 This->DriverBindingHandle, 1212 1210 ControllerHandle, … … 1228 1226 NicHandle, 1229 1227 &gEfiCallerIdGuid, 1230 (VOID **) 1228 (VOID **)&Id, 1231 1229 This->DriverBindingHandle, 1232 1230 ControllerHandle, … … 1236 1234 return Status; 1237 1235 } 1236 1238 1237 Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID (Id); 1239 1238 } else { 1240 Private = HTTP_BOOT_PRIVATE_DATA_FROM_LOADFILE (LoadFile);1239 Private = HTTP_BOOT_PRIVATE_DATA_FROM_LOADFILE (LoadFile); 1241 1240 NicHandle = Private->Controller; 1242 1241 } … … 1246 1245 // 1247 1246 Status = HttpBootStop (Private); 1248 if ( Status != EFI_SUCCESS && Status != EFI_NOT_STARTED) {1247 if ((Status != EFI_SUCCESS) && (Status != EFI_NOT_STARTED)) { 1249 1248 return Status; 1250 1249 } … … 1255 1254 HttpBootDestroyIp6Children (This, Private); 1256 1255 1257 if ( Private->Ip4Nic == NULL && Private->Ip6Nic == NULL) {1256 if ((Private->Ip4Nic == NULL) && (Private->Ip6Nic == NULL)) { 1258 1257 // 1259 1258 // Release the cached data. … … 1272 1271 ); 1273 1272 FreePool (Private); 1274 1275 1273 } 1276 1274 1277 1275 return EFI_SUCCESS; 1278 1276 } 1277 1279 1278 /** 1280 1279 This is the declaration of an EFI image entry point. This entry point is … … 1296 1295 ) 1297 1296 { 1298 EFI_STATUS 1297 EFI_STATUS Status; 1299 1298 1300 1299 // … … 1322 1321 ); 1323 1322 if (EFI_ERROR (Status)) { 1324 EfiLibUninstallDriverBindingComponentName2 (1323 EfiLibUninstallDriverBindingComponentName2 ( 1325 1324 &gHttpBootIp4DxeDriverBinding, 1326 1325 &gHttpBootDxeComponentName, … … 1328 1327 ); 1329 1328 } 1329 1330 1330 return Status; 1331 1331 } 1332
Note:
See TracChangeset
for help on using the changeset viewer.