VirtualBox

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

Last change on this file since 108793 was 99404, checked in by vboxsync, 2 years ago

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

  • Property svn:eol-style set to native
File size: 3.6 KB
Line 
1/** @file
2 MM driver instance of SmiHandlerProfile Library.
3
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
5 Copyright (c) Microsoft Corporation.
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9
10#include <PiMm.h>
11#include <Library/SmiHandlerProfileLib.h>
12#include <Library/MmServicesTableLib.h>
13#include <Guid/SmiHandlerProfile.h>
14
15SMI_HANDLER_PROFILE_PROTOCOL *mSmiHandlerProfile;
16
17/**
18 This function is called by SmmChildDispatcher module to report
19 a new SMI handler is registered, to SmmCore.
20
21 @param HandlerGuid The GUID to identify the type of the handler.
22 For the SmmChildDispatch protocol, the HandlerGuid
23 must be the GUID of SmmChildDispatch protocol.
24 @param Handler The SMI handler.
25 @param CallerAddress The address of the module who registers the SMI handler.
26 @param Context The context of the SMI handler.
27 For the SmmChildDispatch protocol, the Context
28 must match the one defined for SmmChildDispatch protocol.
29 @param ContextSize The size of the context in bytes.
30 For the SmmChildDispatch protocol, the Context
31 must match the one defined for SmmChildDispatch protocol.
32
33 @retval EFI_SUCCESS The information is recorded.
34 @retval EFI_UNSUPPORTED The feature is unsupported.
35 @retval EFI_OUT_OF_RESOURCES There is no enough resource to record the information.
36**/
37EFI_STATUS
38EFIAPI
39SmiHandlerProfileRegisterHandler (
40 IN EFI_GUID *HandlerGuid,
41 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
42 IN PHYSICAL_ADDRESS CallerAddress,
43 IN VOID *Context OPTIONAL,
44 IN UINTN ContextSize OPTIONAL
45 )
46{
47 if (mSmiHandlerProfile != NULL) {
48 return mSmiHandlerProfile->RegisterHandler (mSmiHandlerProfile, HandlerGuid, Handler, CallerAddress, Context, ContextSize);
49 }
50
51 return EFI_UNSUPPORTED;
52}
53
54/**
55 This function is called by SmmChildDispatcher module to report
56 an existing SMI handler is unregistered, to SmmCore.
57
58 @param HandlerGuid The GUID to identify the type of the handler.
59 For the SmmChildDispatch protocol, the HandlerGuid
60 must be the GUID of SmmChildDispatch protocol.
61 @param Handler The SMI handler.
62 @param Context The context of the SMI handler.
63 If it is NOT NULL, it will be used to check what is registered.
64 @param ContextSize The size of the context in bytes.
65 If Context is NOT NULL, it will be used to check what is registered.
66
67 @retval EFI_SUCCESS The original record is removed.
68 @retval EFI_UNSUPPORTED The feature is unsupported.
69 @retval EFI_NOT_FOUND There is no record for the HandlerGuid and handler.
70**/
71EFI_STATUS
72EFIAPI
73SmiHandlerProfileUnregisterHandler (
74 IN EFI_GUID *HandlerGuid,
75 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
76 IN VOID *Context OPTIONAL,
77 IN UINTN ContextSize OPTIONAL
78 )
79{
80 if (mSmiHandlerProfile != NULL) {
81 return mSmiHandlerProfile->UnregisterHandler (mSmiHandlerProfile, HandlerGuid, Handler, Context, ContextSize);
82 }
83
84 return EFI_UNSUPPORTED;
85}
86
87/**
88 The common constructor function for SMI handler profile.
89
90 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
91**/
92EFI_STATUS
93MmSmiHandlerProfileLibInitialization (
94 VOID
95 )
96{
97 gMmst->MmLocateProtocol (
98 &gSmiHandlerProfileGuid,
99 NULL,
100 (VOID **)&mSmiHandlerProfile
101 );
102 return EFI_SUCCESS;
103}
Note: See TracBrowser for help on using the repository browser.

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