VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/ArmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c@ 108794

Last change on this file since 108794 was 108794, checked in by vboxsync, 2 weeks ago

Devices/EFI/FirmwareNew: Merge edk2-stable202502 from the vendor branch and make it build for the important platforms, bugref:4643

  • Property svn:eol-style set to native
File size: 2.8 KB
Line 
1/** @file
2
3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4 Copyright (c) 2016 HP Development Company, L.P.
5 Copyright (c) 2016 - 2024, Arm Limited. All rights reserved.
6 Copyright (c) 2023, Ventana Micro System Inc. All rights reserved.
7
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10**/
11
12#include <Base.h>
13#include <Pi/PiMmCis.h>
14#include <Library/DebugLib.h>
15#include <Library/BaseMemoryLib.h>
16#include <Library/HobLib.h>
17
18#include <Protocol/DebugSupport.h> // for EFI_SYSTEM_CONTEXT
19
20#include <Guid/ZeroGuid.h>
21#include <Guid/MmramMemoryReserve.h>
22
23#include <StandaloneMmCpu.h>
24
25//
26// mPiMmCpuDriverEpProtocol for Cpu driver entry point to handle
27// mm communication event.
28//
29extern EDKII_PI_MM_CPU_DRIVER_EP_PROTOCOL mPiMmCpuDriverEpProtocol;
30
31//
32// Private copy of the MM system table for future use
33//
34EFI_MM_SYSTEM_TABLE *mMmst = NULL;
35
36//
37// Globals used to initialize the protocol
38//
39STATIC EFI_HANDLE mMmCpuHandle = NULL;
40
41/** Entry point for the Standalone MM CPU driver.
42
43 @param [in] ImageHandle Unused. Not actual image handle.
44 @param [in] SystemTable Pointer to MM System table.
45
46 @retval EFI_SUCCESS The function completed successfully.
47 @retval EFI_INVALID_PARAMETER Invalid parameter.
48 @retval EFI_OUT_OF_RESOURCES Out of resources.
49 @retval EFI_NOT_FOUND Failed to find the HOB for the CPU
50 driver endpoint descriptor.
51**/
52EFI_STATUS
53StandaloneMmCpuInitialize (
54 IN EFI_HANDLE ImageHandle, // not actual imagehandle
55 IN EFI_MM_SYSTEM_TABLE *SystemTable // not actual systemtable
56 )
57{
58 EFI_STATUS Status;
59 EFI_HANDLE DispatchHandle;
60
61 ASSERT (SystemTable != NULL);
62 mMmst = SystemTable;
63
64 // publish the MM config protocol so the MM core can register its entry point
65 Status = mMmst->MmInstallProtocolInterface (
66 &mMmCpuHandle,
67 &gEfiMmConfigurationProtocolGuid,
68 EFI_NATIVE_INTERFACE,
69 &mMmConfig
70 );
71 if (EFI_ERROR (Status)) {
72 return Status;
73 }
74
75 // Install entry point of this CPU driver to allow
76 // the entry point driver to be invoked upon receipt of an event in
77 // DelegatedEventLoop.
78 Status = mMmst->MmInstallProtocolInterface (
79 &mMmCpuHandle,
80 &gEdkiiPiMmCpuDriverEpProtocolGuid,
81 EFI_NATIVE_INTERFACE,
82 &mPiMmCpuDriverEpProtocol
83 );
84 if (EFI_ERROR (Status)) {
85 return Status;
86 }
87
88 // register the root MMI handler
89 Status = mMmst->MmiHandlerRegister (
90 PiMmCpuTpFwRootMmiHandler,
91 NULL,
92 &DispatchHandle
93 );
94 if (EFI_ERROR (Status)) {
95 return Status;
96 }
97
98 return Status;
99}
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