TianoCore EDK2 master
Loading...
Searching...
No Matches
SecureBootConfigDriver.c
Go to the documentation of this file.
1
10
24EFIAPI
26 IN EFI_HANDLE ImageHandle,
27 IN EFI_SYSTEM_TABLE *SystemTable
28 )
29{
30 EFI_STATUS Status;
32
33 //
34 // If already started, return.
35 //
36 Status = gBS->OpenProtocol (
37 ImageHandle,
38 &gEfiCallerIdGuid,
39 NULL,
40 ImageHandle,
41 ImageHandle,
42 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
43 );
44 if (!EFI_ERROR (Status)) {
45 return EFI_ALREADY_STARTED;
46 }
47
48 //
49 // Create a private data structure.
50 //
51 PrivateData = AllocateCopyPool (sizeof (SECUREBOOT_CONFIG_PRIVATE_DATA), &mSecureBootConfigPrivateDateTemplate);
52 if (PrivateData == NULL) {
53 return EFI_OUT_OF_RESOURCES;
54 }
55
56 //
57 // Install SecureBoot configuration form
58 //
59 Status = InstallSecureBootConfigForm (PrivateData);
60 if (EFI_ERROR (Status)) {
61 goto ErrorExit;
62 }
63
64 //
65 // Install private GUID.
66 //
67 Status = gBS->InstallMultipleProtocolInterfaces (
68 &ImageHandle,
69 &gEfiCallerIdGuid,
70 PrivateData,
71 NULL
72 );
73
74 if (EFI_ERROR (Status)) {
75 goto ErrorExit;
76 }
77
78 return EFI_SUCCESS;
79
80ErrorExit:
81 if (PrivateData != NULL) {
83 }
84
85 return Status;
86}
87
98EFIAPI
100 IN EFI_HANDLE ImageHandle
101 )
102{
103 EFI_STATUS Status;
105
106 Status = gBS->HandleProtocol (
107 ImageHandle,
108 &gEfiCallerIdGuid,
109 (VOID **)&PrivateData
110 );
111 if (EFI_ERROR (Status)) {
112 return Status;
113 }
114
115 ASSERT (PrivateData->Signature == SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE);
116
117 gBS->UninstallMultipleProtocolInterfaces (
118 ImageHandle,
119 &gEfiCallerIdGuid,
120 PrivateData,
121 NULL
122 );
123
124 UninstallSecureBootConfigForm (PrivateData);
125
126 return EFI_SUCCESS;
127}
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
EFI_STATUS EFIAPI SecureBootConfigDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI SecureBootConfigDriverUnload(IN EFI_HANDLE ImageHandle)
EFI_STATUS InstallSecureBootConfigForm(IN OUT SECUREBOOT_CONFIG_PRIVATE_DATA *PrivateData)
VOID UninstallSecureBootConfigForm(IN OUT SECUREBOOT_CONFIG_PRIVATE_DATA *PrivateData)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS