]>
Commit | Line | Data |
---|---|---|
aa498f8c JW |
1 | /** @file |
2 | The DriverEntryPoint and Unload for HttpUtilities driver. | |
3 | ||
4 | Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> | |
5 | ||
6 | This program and the accompanying materials | |
7 | are licensed and made available under the terms and conditions of the BSD License | |
8 | which accompanies this distribution. The full text of the license may be found at | |
9 | http://opensource.org/licenses/bsd-license.php. | |
10 | ||
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. | |
13 | ||
14 | **/ | |
15 | ||
16 | #include "HttpUtilitiesDxe.h" | |
17 | ||
18 | ||
19 | /** | |
20 | Unloads an image. | |
21 | ||
22 | @param ImageHandle Handle that identifies the image to be unloaded. | |
23 | ||
24 | @retval EFI_SUCCESS The image has been unloaded. | |
25 | @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle. | |
26 | ||
27 | **/ | |
28 | EFI_STATUS | |
29 | EFIAPI | |
30 | HttpUtilitiesDxeUnload ( | |
31 | IN EFI_HANDLE ImageHandle | |
32 | ) | |
33 | { | |
34 | EFI_STATUS Status; | |
35 | UINTN HandleNum; | |
36 | EFI_HANDLE *HandleBuffer; | |
37 | UINT32 Index; | |
38 | EFI_HTTP_UTILITIES_PROTOCOL *HttpUtilitiesProtocol; | |
39 | ||
40 | ||
41 | HandleBuffer = NULL; | |
42 | ||
43 | // | |
44 | // Locate all the handles with HttpUtilities protocol. | |
45 | // | |
46 | Status = gBS->LocateHandleBuffer ( | |
47 | ByProtocol, | |
48 | &gEfiHttpUtilitiesProtocolGuid, | |
49 | NULL, | |
50 | &HandleNum, | |
51 | &HandleBuffer | |
52 | ); | |
53 | if (EFI_ERROR (Status)) { | |
54 | return Status; | |
55 | } | |
56 | ||
57 | for (Index = 0; Index < HandleNum; Index++) { | |
58 | // | |
59 | // Firstly, find HttpUtilitiesProtocol interface | |
60 | // | |
61 | Status = gBS->OpenProtocol ( | |
62 | HandleBuffer[Index], | |
63 | &gEfiHttpUtilitiesProtocolGuid, | |
64 | (VOID **) &HttpUtilitiesProtocol, | |
65 | ImageHandle, | |
66 | NULL, | |
67 | EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL | |
68 | ); | |
69 | if (EFI_ERROR (Status)) { | |
70 | return Status; | |
71 | } | |
72 | ||
73 | // | |
74 | // Then, uninstall HttpUtilities interface | |
75 | // | |
76 | Status = gBS->UninstallMultipleProtocolInterfaces ( | |
77 | HandleBuffer[Index], | |
78 | &gEfiHttpUtilitiesProtocolGuid, HttpUtilitiesProtocol, | |
79 | NULL | |
80 | ); | |
81 | if (EFI_ERROR (Status)) { | |
82 | return Status; | |
83 | } | |
84 | } | |
85 | ||
86 | return EFI_SUCCESS; | |
87 | } | |
88 | ||
89 | ||
90 | /** | |
91 | This is the declaration of an EFI image entry point. This entry point is | |
92 | the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including | |
93 | both device drivers and bus drivers. | |
94 | ||
95 | @param ImageHandle The firmware allocated handle for the UEFI image. | |
96 | @param SystemTable A pointer to the EFI System Table. | |
97 | ||
98 | @retval EFI_SUCCESS The operation completed successfully. | |
99 | @retval Others An unexpected error occurred. | |
100 | **/ | |
101 | EFI_STATUS | |
102 | EFIAPI | |
103 | HttpUtilitiesDxeDriverEntryPoint ( | |
104 | IN EFI_HANDLE ImageHandle, | |
105 | IN EFI_SYSTEM_TABLE *SystemTable | |
106 | ) | |
107 | { | |
108 | EFI_STATUS Status; | |
109 | ||
110 | EFI_HANDLE Handle; | |
111 | ||
112 | Handle = NULL; | |
113 | ||
114 | // | |
115 | // Install the HttpUtilities Protocol onto Handle | |
116 | // | |
117 | Status = gBS->InstallMultipleProtocolInterfaces ( | |
118 | &Handle, | |
119 | &gEfiHttpUtilitiesProtocolGuid, | |
120 | &mHttpUtilitiesProtocol, | |
121 | NULL | |
122 | ); | |
123 | ||
124 | return Status; | |
125 | } | |
126 |