hc
2024-03-25 edb30157bad0c0001c32b854271ace01d3b9a16a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/** @file
  Standalone MM Variable Write Lib
 
  This library provides phase agnostic access to the UEFI Variable Services.
  This is done by implementing a wrapper on top of the phase specific mechanism
  for reading from UEFI variables.
 
  This is the standalone MM specific LibraryClass constructor.
 
  Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
  SPDX-License-Identifier: BSD-2-Clause-Patent
 
**/
 
#include <Uefi/UefiBaseType.h>
 
#include <Protocol/SmmVariable.h>
 
#include <Library/DebugLib.h>
#include <Library/MmServicesTableLib.h>
 
extern EFI_SMM_VARIABLE_PROTOCOL  *mVariableWriteLibSmmVariable;
 
/**
  The constructor function acquires the EFI SMM Variable Services
 
  @param  ImageHandle   The firmware allocated handle for the EFI image.
  @param  SystemTable   A pointer to the MM System Table.
 
  @retval EFI_SUCCESS     The constructor always returns RETURN_SUCCESS.
  @retval EFI_NOT_FOUND   gEfiSmmVariableProtocolGuid Protocol interface not
                          found, which technically should not be possible since
                          this protocol is in the LibraryClass DEPEX
 
**/
EFI_STATUS
EFIAPI
StandaloneMmVariableWriteLibConstructor (
  IN EFI_HANDLE           ImageHandle,
  IN EFI_MM_SYSTEM_TABLE  *SystemTable
  )
{
  EFI_STATUS    Status;
 
  //
  // Locate SmmVariableProtocol.
  //
  Status = gMmst->MmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID **) &mVariableWriteLibSmmVariable);
  ASSERT_EFI_ERROR (Status);
  return Status;
}