VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c@ 107064

Last change on this file since 107064 was 99404, checked in by vboxsync, 23 months ago

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

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1/** @file
2 MM Services Table Library.
3
4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
5 Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9
10#include <PiMm.h>
11#include <Protocol/MmBase.h>
12#include <Library/MmServicesTableLib.h>
13#include <Library/DebugLib.h>
14
15EFI_MM_SYSTEM_TABLE *gMmst = NULL;
16
17/**
18 The constructor function caches the pointer of the MM Services Table.
19
20 @param ImageHandle The firmware allocated handle for the EFI image.
21 @param SystemTable A pointer to the EFI System Table.
22
23 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
24
25**/
26EFI_STATUS
27EFIAPI
28MmServicesTableLibConstructor (
29 IN EFI_HANDLE ImageHandle,
30 IN EFI_SYSTEM_TABLE *SystemTable
31 )
32{
33 EFI_STATUS Status;
34 EFI_MM_BASE_PROTOCOL *InternalMmBase;
35
36 InternalMmBase = NULL;
37 //
38 // Retrieve MM Base Protocol, Do not use gBS from UefiBootServicesTableLib on purpose
39 // to prevent inclusion of gBS, gST, and gImageHandle from SMM Drivers unless the
40 // MM driver explicity declares that dependency.
41 //
42 Status = SystemTable->BootServices->LocateProtocol (
43 &gEfiMmBaseProtocolGuid,
44 NULL,
45 (VOID **)&InternalMmBase
46 );
47 ASSERT_EFI_ERROR (Status);
48 ASSERT (InternalMmBase != NULL);
49
50 //
51 // We are in MM, retrieve the pointer to MM System Table
52 //
53 InternalMmBase->GetMmstLocation (InternalMmBase, &gMmst);
54 ASSERT (gMmst != NULL);
55
56 return EFI_SUCCESS;
57}
Note: See TracBrowser for help on using the repository browser.

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