]> git.proxmox.com Git - mirror_edk2.git/blob - ArmRealViewEbPkg/PlatformPei/PlatformPei.c
Remove ArmEbPkg and replace with ArmRealViewEbPkg. Ported ArmRealViewEbPkg to have...
[mirror_edk2.git] / ArmRealViewEbPkg / PlatformPei / PlatformPei.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 BootMode.c
15
16 Abstract:
17
18 Tiano PEIM to provide the platform support functionality within Windows
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
41
42 //
43 // Module globals
44 //
45 EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {
46 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
47 &gEfiPeiMasterBootModePpiGuid,
48 NULL
49 };
50
51 EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {
52 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
53 &gEfiPeiBootInRecoveryModePpiGuid,
54 NULL
55 };
56
57 EFI_STATUS
58 EFIAPI
59 InitializePlatformPeim (
60 IN EFI_PEI_FILE_HANDLE FileHandle,
61 IN CONST EFI_PEI_SERVICES **PeiServices
62 )
63 /*++
64
65 Routine Description:
66
67
68
69 Arguments:
70
71 FileHandle - Handle of the file being invoked.
72 PeiServices - Describes the list of possible PEI Services.
73
74 Returns:
75
76 Status - EFI_SUCCESS if the boot mode could be set
77
78 --*/
79 {
80 EFI_STATUS Status;
81 EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;
82 UINTN BootMode;
83
84 DEBUG ((EFI_D_ERROR, "ARM EB Platform PEIM Loaded\n"));
85
86 BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize));
87
88 Attributes =(
89 EFI_RESOURCE_ATTRIBUTE_PRESENT |
90 EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
91 EFI_RESOURCE_ATTRIBUTE_TESTED |
92 EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
93 EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
94 EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
95 EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE
96 );
97
98 //BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, Attributes, (UINTN)MemoryBegin, MemoryLength);
99
100 BuildFvHob (FixedPcdGet32(PcdFlashFvMainBase), FixedPcdGet32(PcdFlashFvMainSize));
101
102 BuildResourceDescriptorHob (EFI_RESOURCE_FIRMWARE_DEVICE,
103 (EFI_RESOURCE_ATTRIBUTE_PRESENT |
104 EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
105 EFI_RESOURCE_ATTRIBUTE_TESTED |
106 EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE),
107 FixedPcdGet32(PcdFlashFvMainBase), FixedPcdGet32(PcdFlashFvMainSize));
108
109 //BuildStackHob ((UINTN)StackBase, Hob->EfiMemoryTop - (UINTN)StackBase);
110
111
112 //
113 // Let's assume things are OK if not told otherwise
114 // Should we read an environment variable in order to easily change this?
115 //
116 BootMode = BOOT_WITH_FULL_CONFIGURATION;
117
118 Status = (**PeiServices).SetBootMode (PeiServices, (UINT8) BootMode);
119 ASSERT_EFI_ERROR (Status);
120
121 Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListBootMode);
122 ASSERT_EFI_ERROR (Status);
123
124 if (BootMode == BOOT_IN_RECOVERY_MODE) {
125 Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListRecoveryBootMode);
126 ASSERT_EFI_ERROR (Status);
127 }
128
129 return Status;
130 }