]> git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / NetworkPkg / HttpUtilitiesDxe / HttpUtilitiesDxe.c
1 /** @file
2 The DriverEntryPoint and Unload for HttpUtilities driver.
3
4 Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #include "HttpUtilitiesDxe.h"
11
12 /**
13 Unloads an image.
14
15 @param ImageHandle Handle that identifies the image to be unloaded.
16
17 @retval EFI_SUCCESS The image has been unloaded.
18 @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.
19
20 **/
21 EFI_STATUS
22 EFIAPI
23 HttpUtilitiesDxeUnload (
24 IN EFI_HANDLE ImageHandle
25 )
26 {
27 EFI_STATUS Status;
28 UINTN HandleNum;
29 EFI_HANDLE *HandleBuffer;
30 UINT32 Index;
31 EFI_HTTP_UTILITIES_PROTOCOL *HttpUtilitiesProtocol;
32
33 HandleBuffer = NULL;
34
35 //
36 // Locate all the handles with HttpUtilities protocol.
37 //
38 Status = gBS->LocateHandleBuffer (
39 ByProtocol,
40 &gEfiHttpUtilitiesProtocolGuid,
41 NULL,
42 &HandleNum,
43 &HandleBuffer
44 );
45 if (EFI_ERROR (Status)) {
46 return Status;
47 }
48
49 for (Index = 0; Index < HandleNum; Index++) {
50 //
51 // Firstly, find HttpUtilitiesProtocol interface
52 //
53 Status = gBS->OpenProtocol (
54 HandleBuffer[Index],
55 &gEfiHttpUtilitiesProtocolGuid,
56 (VOID **)&HttpUtilitiesProtocol,
57 ImageHandle,
58 NULL,
59 EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
60 );
61 if (EFI_ERROR (Status)) {
62 return Status;
63 }
64
65 //
66 // Then, uninstall HttpUtilities interface
67 //
68 Status = gBS->UninstallMultipleProtocolInterfaces (
69 HandleBuffer[Index],
70 &gEfiHttpUtilitiesProtocolGuid,
71 HttpUtilitiesProtocol,
72 NULL
73 );
74 if (EFI_ERROR (Status)) {
75 return Status;
76 }
77 }
78
79 return EFI_SUCCESS;
80 }
81
82 /**
83 This is the declaration of an EFI image entry point. This entry point is
84 the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
85 both device drivers and bus drivers.
86
87 @param ImageHandle The firmware allocated handle for the UEFI image.
88 @param SystemTable A pointer to the EFI System Table.
89
90 @retval EFI_SUCCESS The operation completed successfully.
91 @retval Others An unexpected error occurred.
92 **/
93 EFI_STATUS
94 EFIAPI
95 HttpUtilitiesDxeDriverEntryPoint (
96 IN EFI_HANDLE ImageHandle,
97 IN EFI_SYSTEM_TABLE *SystemTable
98 )
99 {
100 EFI_STATUS Status;
101
102 EFI_HANDLE Handle;
103
104 Handle = NULL;
105
106 //
107 // Install the HttpUtilities Protocol onto Handle
108 //
109 Status = gBS->InstallMultipleProtocolInterfaces (
110 &Handle,
111 &gEfiHttpUtilitiesProtocolGuid,
112 &mHttpUtilitiesProtocol,
113 NULL
114 );
115
116 return Status;
117 }