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