VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitRuntimeDxe.c@ 99404

最後變更 在這個檔案從99404是 99404,由 vboxsync 提交於 2 年 前

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 2.2 KB
 
1/** @file -- VariablePolicyExtraInitRuntimeDxe.c
2This file contains extra init and deinit routines that register and unregister
3VariableAddressChange callbacks.
4
5Copyright (c) Microsoft Corporation.
6SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9
10#include <Library/UefiBootServicesTableLib.h>
11#include <Library/UefiRuntimeServicesTableLib.h>
12
13extern EFI_GET_VARIABLE mGetVariableHelper;
14extern UINT8 *mPolicyTable;
15STATIC BOOLEAN mIsVirtualAddrConverted;
16STATIC EFI_EVENT mVariablePolicyLibVirtualAddressChangeEvent = NULL;
17
18/**
19 For the RuntimeDxe version of this lib, convert internal pointer addresses to virtual addresses.
20
21 @param[in] Event Event whose notification function is being invoked.
22 @param[in] Context The pointer to the notification function's context, which
23 is implementation-dependent.
24**/
25STATIC
26VOID
27EFIAPI
28VariablePolicyLibVirtualAddressCallback (
29 IN EFI_EVENT Event,
30 IN VOID *Context
31 )
32{
33 gRT->ConvertPointer (0, (VOID **)&mPolicyTable);
34 gRT->ConvertPointer (0, (VOID **)&mGetVariableHelper);
35 mIsVirtualAddrConverted = TRUE;
36}
37
38/**
39 An extra init hook that enables the RuntimeDxe library instance to
40 register VirtualAddress change callbacks. Among other things.
41
42 @retval EFI_SUCCESS Everything is good. Continue with init.
43 @retval Others Uh... don't continue.
44
45**/
46EFI_STATUS
47VariablePolicyExtraInit (
48 VOID
49 )
50{
51 return gBS->CreateEventEx (
52 EVT_NOTIFY_SIGNAL,
53 TPL_NOTIFY,
54 VariablePolicyLibVirtualAddressCallback,
55 NULL,
56 &gEfiEventVirtualAddressChangeGuid,
57 &mVariablePolicyLibVirtualAddressChangeEvent
58 );
59}
60
61/**
62 An extra deinit hook that enables the RuntimeDxe library instance to
63 register VirtualAddress change callbacks. Among other things.
64
65 @retval EFI_SUCCESS Everything is good. Continue with deinit.
66 @retval Others Uh... don't continue.
67
68**/
69EFI_STATUS
70VariablePolicyExtraDeinit (
71 VOID
72 )
73{
74 EFI_STATUS Status;
75
76 Status = EFI_SUCCESS;
77 if (mIsVirtualAddrConverted) {
78 Status = gBS->CloseEvent (mVariablePolicyLibVirtualAddressChangeEvent);
79 } else {
80 Status = EFI_SUCCESS;
81 }
82
83 return Status;
84}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette