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 | /**
|
---|
14 | Unloads an image.
|
---|
15 |
|
---|
16 | @param ImageHandle Handle that identifies the image to be unloaded.
|
---|
17 |
|
---|
18 | @retval EFI_SUCCESS The image has been unloaded.
|
---|
19 | @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.
|
---|
20 |
|
---|
21 | **/
|
---|
22 | EFI_STATUS
|
---|
23 | EFIAPI
|
---|
24 | HttpUtilitiesDxeUnload (
|
---|
25 | IN EFI_HANDLE ImageHandle
|
---|
26 | )
|
---|
27 | {
|
---|
28 | EFI_STATUS Status;
|
---|
29 | UINTN HandleNum;
|
---|
30 | EFI_HANDLE *HandleBuffer;
|
---|
31 | UINT32 Index;
|
---|
32 | EFI_HTTP_UTILITIES_PROTOCOL *HttpUtilitiesProtocol;
|
---|
33 |
|
---|
34 |
|
---|
35 | HandleBuffer = NULL;
|
---|
36 |
|
---|
37 | //
|
---|
38 | // Locate all the handles with HttpUtilities protocol.
|
---|
39 | //
|
---|
40 | Status = gBS->LocateHandleBuffer (
|
---|
41 | ByProtocol,
|
---|
42 | &gEfiHttpUtilitiesProtocolGuid,
|
---|
43 | NULL,
|
---|
44 | &HandleNum,
|
---|
45 | &HandleBuffer
|
---|
46 | );
|
---|
47 | if (EFI_ERROR (Status)) {
|
---|
48 | return Status;
|
---|
49 | }
|
---|
50 |
|
---|
51 | for (Index = 0; Index < HandleNum; Index++) {
|
---|
52 | //
|
---|
53 | // Firstly, find HttpUtilitiesProtocol interface
|
---|
54 | //
|
---|
55 | Status = gBS->OpenProtocol (
|
---|
56 | HandleBuffer[Index],
|
---|
57 | &gEfiHttpUtilitiesProtocolGuid,
|
---|
58 | (VOID **) &HttpUtilitiesProtocol,
|
---|
59 | ImageHandle,
|
---|
60 | NULL,
|
---|
61 | EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
|
---|
62 | );
|
---|
63 | if (EFI_ERROR (Status)) {
|
---|
64 | return Status;
|
---|
65 | }
|
---|
66 |
|
---|
67 | //
|
---|
68 | // Then, uninstall HttpUtilities interface
|
---|
69 | //
|
---|
70 | Status = gBS->UninstallMultipleProtocolInterfaces (
|
---|
71 | HandleBuffer[Index],
|
---|
72 | &gEfiHttpUtilitiesProtocolGuid, HttpUtilitiesProtocol,
|
---|
73 | NULL
|
---|
74 | );
|
---|
75 | if (EFI_ERROR (Status)) {
|
---|
76 | return Status;
|
---|
77 | }
|
---|
78 | }
|
---|
79 |
|
---|
80 | return EFI_SUCCESS;
|
---|
81 | }
|
---|
82 |
|
---|
83 |
|
---|
84 | /**
|
---|
85 | This is the declaration of an EFI image entry point. This entry point is
|
---|
86 | the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
|
---|
87 | both device drivers and bus drivers.
|
---|
88 |
|
---|
89 | @param ImageHandle The firmware allocated handle for the UEFI image.
|
---|
90 | @param SystemTable A pointer to the EFI System Table.
|
---|
91 |
|
---|
92 | @retval EFI_SUCCESS The operation completed successfully.
|
---|
93 | @retval Others An unexpected error occurred.
|
---|
94 | **/
|
---|
95 | EFI_STATUS
|
---|
96 | EFIAPI
|
---|
97 | HttpUtilitiesDxeDriverEntryPoint (
|
---|
98 | IN EFI_HANDLE ImageHandle,
|
---|
99 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
100 | )
|
---|
101 | {
|
---|
102 | EFI_STATUS Status;
|
---|
103 |
|
---|
104 | EFI_HANDLE Handle;
|
---|
105 |
|
---|
106 | Handle = NULL;
|
---|
107 |
|
---|
108 | //
|
---|
109 | // Install the HttpUtilities Protocol onto Handle
|
---|
110 | //
|
---|
111 | Status = gBS->InstallMultipleProtocolInterfaces (
|
---|
112 | &Handle,
|
---|
113 | &gEfiHttpUtilitiesProtocolGuid,
|
---|
114 | &mHttpUtilitiesProtocol,
|
---|
115 | NULL
|
---|
116 | );
|
---|
117 |
|
---|
118 | return Status;
|
---|
119 | }
|
---|
120 |
|
---|