1 | /** @file
|
---|
2 | The DriverEntryPoint for TlsAuthConfigDxe driver.
|
---|
3 |
|
---|
4 | Copyright (c) 2016 - 2017, 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 "TlsAuthConfigImpl.h"
|
---|
17 |
|
---|
18 | /**
|
---|
19 | Unloads an image.
|
---|
20 |
|
---|
21 | @param ImageHandle Handle that identifies the image to be unloaded.
|
---|
22 |
|
---|
23 | @retval EFI_SUCCESS The image has been unloaded.
|
---|
24 | @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.
|
---|
25 |
|
---|
26 | **/
|
---|
27 | EFI_STATUS
|
---|
28 | EFIAPI
|
---|
29 | TlsAuthConfigDxeUnload (
|
---|
30 | IN EFI_HANDLE ImageHandle
|
---|
31 | )
|
---|
32 | {
|
---|
33 | EFI_STATUS Status;
|
---|
34 | TLS_AUTH_CONFIG_PRIVATE_DATA *PrivateData;
|
---|
35 |
|
---|
36 | Status = gBS->HandleProtocol (
|
---|
37 | ImageHandle,
|
---|
38 | &gEfiCallerIdGuid,
|
---|
39 | (VOID **) &PrivateData
|
---|
40 | );
|
---|
41 | if (EFI_ERROR (Status)) {
|
---|
42 | return Status;
|
---|
43 | }
|
---|
44 |
|
---|
45 | ASSERT (PrivateData->Signature == TLS_AUTH_CONFIG_PRIVATE_DATA_SIGNATURE);
|
---|
46 |
|
---|
47 | gBS->UninstallMultipleProtocolInterfaces (
|
---|
48 | &ImageHandle,
|
---|
49 | &gEfiCallerIdGuid,
|
---|
50 | PrivateData,
|
---|
51 | NULL
|
---|
52 | );
|
---|
53 |
|
---|
54 | TlsAuthConfigFormUnload (PrivateData);
|
---|
55 |
|
---|
56 | return EFI_SUCCESS;
|
---|
57 | }
|
---|
58 |
|
---|
59 | /**
|
---|
60 | This is the declaration of an EFI image entry point. This entry point is
|
---|
61 | the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
|
---|
62 | both device drivers and bus drivers.
|
---|
63 |
|
---|
64 | @param ImageHandle The firmware allocated handle for the UEFI image.
|
---|
65 | @param SystemTable A pointer to the EFI System Table.
|
---|
66 |
|
---|
67 | @retval EFI_SUCCESS The operation completed successfully.
|
---|
68 | @retval Others An unexpected error occurred.
|
---|
69 | **/
|
---|
70 | EFI_STATUS
|
---|
71 | EFIAPI
|
---|
72 | TlsAuthConfigDxeDriverEntryPoint (
|
---|
73 | IN EFI_HANDLE ImageHandle,
|
---|
74 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
75 | )
|
---|
76 | {
|
---|
77 | EFI_STATUS Status;
|
---|
78 |
|
---|
79 | TLS_AUTH_CONFIG_PRIVATE_DATA *PrivateData;
|
---|
80 |
|
---|
81 | PrivateData = NULL;
|
---|
82 |
|
---|
83 | //
|
---|
84 | // If already started, return.
|
---|
85 | //
|
---|
86 | Status = gBS->OpenProtocol (
|
---|
87 | ImageHandle,
|
---|
88 | &gEfiCallerIdGuid,
|
---|
89 | NULL,
|
---|
90 | ImageHandle,
|
---|
91 | ImageHandle,
|
---|
92 | EFI_OPEN_PROTOCOL_TEST_PROTOCOL
|
---|
93 | );
|
---|
94 | if (!EFI_ERROR (Status)) {
|
---|
95 | return EFI_ALREADY_STARTED;
|
---|
96 | }
|
---|
97 |
|
---|
98 | //
|
---|
99 | // Initialize the private data structure.
|
---|
100 | //
|
---|
101 | PrivateData = AllocateZeroPool (sizeof (TLS_AUTH_CONFIG_PRIVATE_DATA));
|
---|
102 | if (PrivateData == NULL) {
|
---|
103 | return EFI_OUT_OF_RESOURCES;
|
---|
104 | }
|
---|
105 |
|
---|
106 | //
|
---|
107 | // Initialize the HII configuration form.
|
---|
108 | //
|
---|
109 | Status = TlsAuthConfigFormInit (PrivateData);
|
---|
110 | if (EFI_ERROR (Status)) {
|
---|
111 | goto ON_ERROR;
|
---|
112 | }
|
---|
113 |
|
---|
114 | //
|
---|
115 | // Install private GUID.
|
---|
116 | //
|
---|
117 | Status = gBS->InstallMultipleProtocolInterfaces (
|
---|
118 | &ImageHandle,
|
---|
119 | &gEfiCallerIdGuid,
|
---|
120 | PrivateData,
|
---|
121 | NULL
|
---|
122 | );
|
---|
123 | if (EFI_ERROR (Status)) {
|
---|
124 | goto ON_ERROR;
|
---|
125 | }
|
---|
126 |
|
---|
127 | return EFI_SUCCESS;
|
---|
128 |
|
---|
129 | ON_ERROR:
|
---|
130 | TlsAuthConfigFormUnload (PrivateData);
|
---|
131 |
|
---|
132 | return Status;
|
---|
133 | }
|
---|
134 |
|
---|