]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.c
08e230674e5d158b1f1b3011934ddf3bb5929623
[mirror_edk2.git] / MdePkg / Library / PeiResourcePublicationLib / PeiResourcePublicationLib.c
1 /** @file
2 Resource Publication Library that uses PEI Core Services to publish system memory.
3
4 Copyright (c) 2006, Intel Corporation<BR>
5 All rights reserved. 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 // The package level header files this module uses
18 //
19 #include <PiPei.h>
20 //
21 // The protocols, PPI and GUID defintions for this module
22 //
23 //
24 // The Library classes this module consumes
25 //
26 #include <Library/ResourcePublicationLib.h>
27 #include <Library/PeiServicesLib.h>
28 #include <Library/DebugLib.h>
29
30
31 /**
32
33 Declares the presence of permanent system memory in the platform.
34
35 Declares that the system memory buffer specified by MemoryBegin and MemoryLength
36 as permanent memory that may be used for general purpose use by software.
37 The amount of memory available to software may be less than MemoryLength
38 if published memory has alignment restrictions.
39
40 @param MemoryBegin The start address of the memory being declared.
41 @param MemoryLength The number of bytes of memory being declared.
42
43 @retval RETURN_SUCCESS The memory buffer was published.
44 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to publish the memory buffer
45
46 **/
47 RETURN_STATUS
48 EFIAPI
49 PublishSystemMemory (
50 IN PHYSICAL_ADDRESS MemoryBegin,
51 IN UINT64 MemoryLength
52 )
53 {
54 EFI_STATUS Status;
55
56 ASSERT (MemoryLength > 0);
57 ASSERT (MemoryLength <= (MAX_ADDRESS - MemoryBegin + 1));
58
59 Status = PeiServicesInstallPeiMemory (MemoryBegin, MemoryLength);
60
61 return (RETURN_STATUS) Status;
62 }
63