• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Resource Publication Library that uses PEI Core Services to publish system memory.
3 
4   Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5   This program and the accompanying materials
6   are licensed and made available under the terms and conditions of the BSD License
7   which accompanies this distribution.  The full text of the license may be found at
8   http://opensource.org/licenses/bsd-license.php.
9 
10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 
16 
17 #include <PiPei.h>
18 
19 
20 #include <Library/ResourcePublicationLib.h>
21 #include <Library/PeiServicesLib.h>
22 #include <Library/DebugLib.h>
23 
24 
25 /**
26   Declares the presence of permanent system memory in the platform.
27 
28   Declares that the system memory buffer specified by MemoryBegin and MemoryLength
29   as permanent memory that may be used for general purpose use by software.
30   The amount of memory available to software may be less than MemoryLength
31   if published memory has alignment restrictions.
32   If MemoryLength is 0, then ASSERT().
33   If MemoryLength is greater than (MAX_ADDRESS - MemoryBegin + 1), then ASSERT().
34 
35   @param  MemoryBegin               The start address of the memory being declared.
36   @param  MemoryLength              The number of bytes of memory being declared.
37 
38   @retval  RETURN_SUCCESS           The memory buffer was published.
39   @retval  RETURN_OUT_OF_RESOURCES  There are not enough resources to publish the memory buffer
40 
41 **/
42 RETURN_STATUS
43 EFIAPI
PublishSystemMemory(IN PHYSICAL_ADDRESS MemoryBegin,IN UINT64 MemoryLength)44 PublishSystemMemory (
45   IN PHYSICAL_ADDRESS       MemoryBegin,
46   IN UINT64                 MemoryLength
47   )
48 {
49   EFI_STATUS        Status;
50 
51   ASSERT (MemoryLength > 0);
52   ASSERT (MemoryLength <= (MAX_ADDRESS - MemoryBegin + 1));
53 
54   Status      = PeiServicesInstallPeiMemory (MemoryBegin, MemoryLength);
55 
56   return (RETURN_STATUS) Status;
57 }
58 
59