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