VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfileLib.c@ 77662

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

EFI: First step in UDK2018 merge. Does not build yet.

  • 屬性 svn:eol-style 設為 native
檔案大小: 4.2 KB
 
1/** @file
2 SMM driver instance of SmiHandlerProfile Library.
3
4 Copyright (c) 2017, 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.
9
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.
12
13**/
14
15#include <PiSmm.h>
16#include <Library/SmiHandlerProfileLib.h>
17#include <Library/SmmServicesTableLib.h>
18#include <Guid/SmiHandlerProfile.h>
19
20SMI_HANDLER_PROFILE_PROTOCOL *mSmiHandlerProfile;
21
22/**
23 This function is called by SmmChildDispatcher module to report
24 a new SMI handler is registered, to SmmCore.
25
26 @param HandlerGuid The GUID to identify the type of the handler.
27 For the SmmChildDispatch protocol, the HandlerGuid
28 must be the GUID of SmmChildDispatch protocol.
29 @param Handler The SMI handler.
30 @param CallerAddress The address of the module who registers the SMI handler.
31 @param Context The context of the SMI handler.
32 For the SmmChildDispatch protocol, the Context
33 must match the one defined for SmmChildDispatch protocol.
34 @param ContextSize The size of the context in bytes.
35 For the SmmChildDispatch protocol, the Context
36 must match the one defined for SmmChildDispatch protocol.
37
38 @retval EFI_SUCCESS The information is recorded.
39 @retval EFI_UNSUPPORTED The feature is unsupported.
40 @retval EFI_OUT_OF_RESOURCES There is no enough resource to record the information.
41**/
42EFI_STATUS
43EFIAPI
44SmiHandlerProfileRegisterHandler (
45 IN EFI_GUID *HandlerGuid,
46 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
47 IN PHYSICAL_ADDRESS CallerAddress,
48 IN VOID *Context, OPTIONAL
49 IN UINTN ContextSize OPTIONAL
50 )
51{
52 if (mSmiHandlerProfile != NULL) {
53 return mSmiHandlerProfile->RegisterHandler (mSmiHandlerProfile, HandlerGuid, Handler, CallerAddress, Context, ContextSize);
54 }
55 return EFI_UNSUPPORTED;
56}
57
58/**
59 This function is called by SmmChildDispatcher module to report
60 an existing SMI handler is unregistered, to SmmCore.
61
62 @param HandlerGuid The GUID to identify the type of the handler.
63 For the SmmChildDispatch protocol, the HandlerGuid
64 must be the GUID of SmmChildDispatch protocol.
65 @param Handler The SMI handler.
66 @param Context The context of the SMI handler.
67 If it is NOT NULL, it will be used to check what is registered.
68 @param ContextSize The size of the context in bytes.
69 If Context is NOT NULL, it will be used to check what is registered.
70
71 @retval EFI_SUCCESS The original record is removed.
72 @retval EFI_UNSUPPORTED The feature is unsupported.
73 @retval EFI_NOT_FOUND There is no record for the HandlerGuid and handler.
74**/
75EFI_STATUS
76EFIAPI
77SmiHandlerProfileUnregisterHandler (
78 IN EFI_GUID *HandlerGuid,
79 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
80 IN VOID *Context, OPTIONAL
81 IN UINTN ContextSize OPTIONAL
82 )
83{
84 if (mSmiHandlerProfile != NULL) {
85 return mSmiHandlerProfile->UnregisterHandler (mSmiHandlerProfile, HandlerGuid, Handler, Context, ContextSize);
86 }
87 return EFI_UNSUPPORTED;
88}
89
90/**
91 The constructor function for SMI handler profile.
92
93 @param ImageHandle The firmware allocated handle for the EFI image.
94 @param SystemTable A pointer to the EFI System Table.
95
96 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
97**/
98EFI_STATUS
99EFIAPI
100SmmSmiHandlerProfileLibConstructor (
101 IN EFI_HANDLE ImageHandle,
102 IN EFI_SYSTEM_TABLE *SystemTable
103 )
104{
105 gSmst->SmmLocateProtocol (
106 &gSmiHandlerProfileGuid,
107 NULL,
108 (VOID **) &mSmiHandlerProfile
109 );
110 return EFI_SUCCESS;
111}
112
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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