]>
Commit | Line | Data |
---|---|---|
1d5d0ae9 | 1 | /** @file\r |
2 | *\r | |
3 | * Copyright (c) 2011, ARM Limited. All rights reserved.\r | |
4 | * \r | |
5 | * 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 | **/\r | |
14 | \r | |
15 | //\r | |
16 | // The package level header files this module uses\r | |
17 | //\r | |
18 | #include <PiPei.h>\r | |
19 | //\r | |
20 | // The protocols, PPI and GUID defintions for this module\r | |
21 | //\r | |
22 | #include <Ppi/MasterBootMode.h>\r | |
23 | #include <Ppi/BootInRecoveryMode.h>\r | |
24 | //\r | |
25 | // The Library classes this module consumes\r | |
26 | //\r | |
e862cd50 | 27 | #include <Library/ArmPlatformLib.h>\r |
1d5d0ae9 | 28 | #include <Library/DebugLib.h>\r |
29 | #include <Library/PeimEntryPoint.h>\r | |
30 | #include <Library/PcdLib.h>\r | |
31 | #include <Library/HobLib.h>\r | |
32 | \r | |
33 | \r | |
34 | //\r | |
35 | // Module globals\r | |
36 | //\r | |
37 | EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {\r | |
38 | (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r | |
39 | &gEfiPeiMasterBootModePpiGuid,\r | |
40 | NULL\r | |
41 | };\r | |
42 | \r | |
43 | EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {\r | |
44 | (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r | |
45 | &gEfiPeiBootInRecoveryModePpiGuid,\r | |
46 | NULL\r | |
47 | };\r | |
48 | \r | |
49 | EFI_STATUS\r | |
50 | EFIAPI\r | |
51 | InitializePlatformPeim (\r | |
52 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
53 | IN CONST EFI_PEI_SERVICES **PeiServices\r | |
54 | )\r | |
55 | /*++\r | |
56 | \r | |
57 | Routine Description:\r | |
58 | \r | |
59 | \r | |
60 | \r | |
61 | Arguments:\r | |
62 | \r | |
63 | FileHandle - Handle of the file being invoked.\r | |
64 | PeiServices - Describes the list of possible PEI Services.\r | |
65 | \r | |
66 | Returns:\r | |
67 | \r | |
68 | Status - EFI_SUCCESS if the boot mode could be set\r | |
69 | \r | |
70 | --*/\r | |
71 | {\r | |
72 | EFI_STATUS Status;\r | |
73 | UINTN BootMode;\r | |
74 | \r | |
75 | DEBUG ((EFI_D_ERROR, "Platform PEIM Loaded\n"));\r | |
76 | \r | |
aa01abaa | 77 | // Initialize the platform specific controllers\r |
78 | ArmPlatformNormalInitialize ();\r | |
79 | \r | |
1d5d0ae9 | 80 | BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize));\r |
81 | \r | |
1ad14bc8 | 82 | BuildFvHob (PcdGet32(PcdNormalFvBaseAddress), PcdGet32(PcdNormalFvSize));\r |
1d5d0ae9 | 83 | \r |
a534d714 | 84 | BootMode = ArmPlatformGetBootMode ();\r |
1d5d0ae9 | 85 | Status = (**PeiServices).SetBootMode (PeiServices, (UINT8) BootMode);\r |
86 | ASSERT_EFI_ERROR (Status);\r | |
87 | \r | |
88 | Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListBootMode);\r | |
89 | ASSERT_EFI_ERROR (Status);\r | |
90 | \r | |
91 | if (BootMode == BOOT_IN_RECOVERY_MODE) {\r | |
92 | Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListRecoveryBootMode);\r | |
93 | ASSERT_EFI_ERROR (Status);\r | |
94 | }\r | |
95 | \r | |
96 | return Status;\r | |
97 | }\r |