2 The module entry point for SecureBoot configuration module.
4 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "SecureBootConfigImpl.h"
18 The entry point for SecureBoot configuration driver.
20 @param[in] ImageHandle The image handle of the driver.
21 @param[in] SystemTable The system table.
23 @retval EFI_ALREADY_STARTED The driver already exists in system.
24 @retval EFI_OUT_OF_RESOURCES Fail to execute entry point due to lack of resources.
25 @retval EFI_SUCCES All the related protocols are installed on the driver.
26 @retval Others Fail to get the SecureBootEnable variable.
31 SecureBootConfigDriverEntryPoint (
32 IN EFI_HANDLE ImageHandle
,
33 IN EFI_SYSTEM_TABLE
*SystemTable
37 SECUREBOOT_CONFIG_PRIVATE_DATA
*PrivateData
;
40 // If already started, return.
42 Status
= gBS
->OpenProtocol (
48 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
50 if (!EFI_ERROR (Status
)) {
51 return EFI_ALREADY_STARTED
;
55 // Create a private data structure.
57 PrivateData
= AllocateCopyPool (sizeof (SECUREBOOT_CONFIG_PRIVATE_DATA
), &mSecureBootConfigPrivateDateTemplate
);
58 if (PrivateData
== NULL
) {
59 return EFI_OUT_OF_RESOURCES
;
63 // Install SecureBoot configuration form
65 Status
= InstallSecureBootConfigForm (PrivateData
);
66 if (EFI_ERROR (Status
)) {
71 // Install private GUID.
73 Status
= gBS
->InstallMultipleProtocolInterfaces (
80 if (EFI_ERROR (Status
)) {
87 if (PrivateData
!= NULL
) {
88 UninstallSecureBootConfigForm (PrivateData
);
95 Unload the SecureBoot configuration form.
97 @param[in] ImageHandle The driver's image handle.
99 @retval EFI_SUCCESS The SecureBoot configuration form is unloaded.
100 @retval Others Failed to unload the form.
105 SecureBootConfigDriverUnload (
106 IN EFI_HANDLE ImageHandle
110 SECUREBOOT_CONFIG_PRIVATE_DATA
*PrivateData
;
112 Status
= gBS
->HandleProtocol (
115 (VOID
**) &PrivateData
117 if (EFI_ERROR (Status
)) {
121 ASSERT (PrivateData
->Signature
== SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE
);
123 gBS
->UninstallMultipleProtocolInterfaces (
130 UninstallSecureBootConfigForm (PrivateData
);