summaryrefslogtreecommitdiff
path: root/OvmfPkg/Library/MemDebugLogLib/MemDebugLogSec.c
blob: 62905fc1778835d4e430c93bcfc28eacb57ef715 (plain)
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
/** @file
 *
  Memory Debug Log Library - SEC Phase

  Copyright (C) 2025, Oracle and/or its affiliates.

  SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#include <Library/MemDebugLogLib.h>

EFI_STATUS
EFIAPI
MemDebugLogWrite (
  IN  CHAR8  *Buffer,
  IN  UINTN  Length
  )
{
  EFI_STATUS  Status;

  if (FixedPcdGet32 (PcdOvmfEarlyMemDebugLogBase) != 0x0) {
    Status = MemDebugLogWriteBuffer (
               (EFI_PHYSICAL_ADDRESS)(UINTN)FixedPcdGet32 (PcdOvmfEarlyMemDebugLogBase),
               Buffer,
               Length
               );
  } else {
    Status = EFI_NOT_FOUND;
  }

  return Status;
}

RETURN_STATUS
EFIAPI
MemDebugLogLibConstructor (
  VOID
  )
{
  if (FixedPcdGet32 (PcdOvmfEarlyMemDebugLogSize) != 0) {
    MemDebugLogInit (
      (EFI_PHYSICAL_ADDRESS)(UINTN)FixedPcdGet32 (PcdOvmfEarlyMemDebugLogBase),
      (UINT32)FixedPcdGet32 (PcdOvmfEarlyMemDebugLogSize)
      );
  }

  return RETURN_SUCCESS;
}