]> git.proxmox.com Git - mirror_edk2.git/blob - ArmRealViewEbPkg/MemoryInitPei/MemoryInit.c
Remove ArmEbPkg and replace with ArmRealViewEbPkg. Ported ArmRealViewEbPkg to have...
[mirror_edk2.git] / ArmRealViewEbPkg / MemoryInitPei / MemoryInit.c
1 /**@file
2
3 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 MemoryInit.c
15
16 Abstract:
17
18 PEIM to provide fake memory init
19
20 **/
21
22
23
24 //
25 // The package level header files this module uses
26 //
27 #include <PiPei.h>
28 //
29 // The protocols, PPI and GUID defintions for this module
30 //
31 #include <Ppi/MasterBootMode.h>
32 #include <Ppi/BootInRecoveryMode.h>
33 //
34 // The Library classes this module consumes
35 //
36 #include <Library/DebugLib.h>
37 #include <Library/PeimEntryPoint.h>
38 #include <Library/PcdLib.h>
39 #include <Library/HobLib.h>
40 #include <Library/PeiServicesLib.h>
41
42
43 //
44 // Module globals
45 //
46
47 EFI_STATUS
48 EFIAPI
49 InitializeMemory (
50 IN EFI_PEI_FILE_HANDLE FileHandle,
51 IN CONST EFI_PEI_SERVICES **PeiServices
52 )
53 /*++
54
55 Routine Description:
56
57
58
59 Arguments:
60
61 FileHandle - Handle of the file being invoked.
62 PeiServices - Describes the list of possible PEI Services.
63
64 Returns:
65
66 Status - EFI_SUCCESS if the boot mode could be set
67
68 --*/
69 {
70 EFI_STATUS Status;
71 EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;
72 UINT64 MemoryBase;
73 UINT64 MemorySize;
74
75 DEBUG ((EFI_D_ERROR, "Memory Init PEIM Loaded\n"));
76
77 // NOTE: this needs to come from your memory controller initization process
78 MemoryBase = 0;
79 MemorySize = 0x10000000;
80
81 DEBUG ((EFI_D_ERROR, "Installing hardcoded 256MB\n"));
82 Status = PeiServicesInstallPeiMemory (MemoryBase, MemorySize);
83 ASSERT_EFI_ERROR (Status);
84
85 Attributes =
86 (
87 EFI_RESOURCE_ATTRIBUTE_PRESENT |
88 EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
89 EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
90 EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
91 EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
92 EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |
93 EFI_RESOURCE_ATTRIBUTE_TESTED
94 );
95
96 BuildResourceDescriptorHob (
97 EFI_RESOURCE_SYSTEM_MEMORY,
98 Attributes,
99 MemoryBase,
100 MemorySize
101 );
102
103 return Status;
104 }