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