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