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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**@file
  Memory Detection for Virtual Machines.
 
  Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 
  SPDX-License-Identifier: BSD-2-Clause-Patent
 
Module Name:
 
  MemDetect.c
 
**/
 
//
// The package level header files this module uses
//
#include <PiPei.h>
 
//
// The Library classes this module consumes
//
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/HobLib.h>
#include <Library/IoLib.h>
#include <Library/PcdLib.h>
#include <Library/PeimEntryPoint.h>
#include <Library/ResourcePublicationLib.h>
 
#include "Platform.h"
 
 
/**
  Publish PEI core memory
 
  @return EFI_SUCCESS     The PEIM initialized successfully.
 
**/
EFI_STATUS
PublishPeiMemory (
  VOID
  )
{
  EFI_STATUS                  Status;
  EFI_PHYSICAL_ADDRESS        MemoryBase;
  UINT64                      MemorySize;
 
  MemoryBase = 0x80000000UL + 0x1000000UL;
  MemorySize = 0x40000000UL - 0x1000000UL; //1GB - 16MB
 
  DEBUG((DEBUG_INFO, "%a: MemoryBase:0x%x MemorySize:%x\n", __FUNCTION__, MemoryBase, MemorySize));
 
  //
  // Publish this memory to the PEI Core
  //
  Status = PublishSystemMemory(MemoryBase, MemorySize);
  ASSERT_EFI_ERROR (Status);
 
  return Status;
}
 
/**
  Publish system RAM and reserve memory regions
 
**/
VOID
InitializeRamRegions (
  VOID
  )
{
  AddMemoryRangeHob(0x81000000UL, 0x81000000UL + 0x3F000000UL);
 
}