]>
Commit | Line | Data |
---|---|---|
1d5d0ae9 | 1 | /** @file\r |
2 | *\r | |
3 | * Copyright (c) 2011, ARM Limited. All rights reserved.\r | |
1d5d0ae9 | 4 | *\r |
3402aac7 RC |
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 | |
1d5d0ae9 | 12 | *\r |
13 | **/\r | |
14 | \r | |
1d5d0ae9 | 15 | #include <PiPei.h>\r |
48835130 | 16 | \r |
1d5d0ae9 | 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 | |
8fc38a3f | 22 | #include <Ppi/GuidedSectionExtraction.h>\r |
1d5d0ae9 | 23 | //\r |
24 | // The Library classes this module consumes\r | |
25 | //\r | |
8fc38a3f | 26 | #include <Library/ArmPlatformLib.h>\r |
27 | #include <Library/BaseMemoryLib.h>\r | |
28 | #include <Library/DebugLib.h>\r | |
29 | #include <Library/HobLib.h>\r | |
1d5d0ae9 | 30 | #include <Library/PeimEntryPoint.h>\r |
8fc38a3f | 31 | #include <Library/PeiServicesLib.h>\r |
1d5d0ae9 | 32 | #include <Library/PcdLib.h>\r |
8fc38a3f | 33 | \r |
48835130 | 34 | EFI_STATUS\r |
35 | EFIAPI\r | |
36 | InitializePlatformPeim (\r | |
37 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
38 | IN CONST EFI_PEI_SERVICES **PeiServices\r | |
39 | );\r | |
3402aac7 | 40 | \r |
3723a71a | 41 | EFI_STATUS\r |
42 | EFIAPI\r | |
43 | PlatformPeim (\r | |
44 | VOID\r | |
45 | );\r | |
1d5d0ae9 | 46 | \r |
47 | //\r | |
48 | // Module globals\r | |
49 | //\r | |
64748d26 | 50 | CONST EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {\r |
1d5d0ae9 | 51 | (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r |
52 | &gEfiPeiMasterBootModePpiGuid,\r | |
53 | NULL\r | |
54 | };\r | |
55 | \r | |
64748d26 | 56 | CONST EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {\r |
1d5d0ae9 | 57 | (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r |
58 | &gEfiPeiBootInRecoveryModePpiGuid,\r | |
59 | NULL\r | |
60 | };\r | |
61 | \r | |
1d5d0ae9 | 62 | /*++\r |
63 | \r | |
64 | Routine Description:\r | |
65 | \r | |
3402aac7 | 66 | \r |
1d5d0ae9 | 67 | \r |
68 | Arguments:\r | |
69 | \r | |
70 | FileHandle - Handle of the file being invoked.\r | |
71 | PeiServices - Describes the list of possible PEI Services.\r | |
3402aac7 | 72 | \r |
1d5d0ae9 | 73 | Returns:\r |
74 | \r | |
75 | Status - EFI_SUCCESS if the boot mode could be set\r | |
76 | \r | |
77 | --*/\r | |
48835130 | 78 | EFI_STATUS\r |
79 | EFIAPI\r | |
80 | InitializePlatformPeim (\r | |
81 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
82 | IN CONST EFI_PEI_SERVICES **PeiServices\r | |
83 | )\r | |
1d5d0ae9 | 84 | {\r |
85 | EFI_STATUS Status;\r | |
86 | UINTN BootMode;\r | |
87 | \r | |
3d5cf372 | 88 | DEBUG ((EFI_D_LOAD | EFI_D_INFO, "Platform PEIM Loaded\n"));\r |
1d5d0ae9 | 89 | \r |
48835130 | 90 | PlatformPeim ();\r |
3402aac7 | 91 | \r |
a534d714 | 92 | BootMode = ArmPlatformGetBootMode ();\r |
1d5d0ae9 | 93 | Status = (**PeiServices).SetBootMode (PeiServices, (UINT8) BootMode);\r |
94 | ASSERT_EFI_ERROR (Status);\r | |
95 | \r | |
96 | Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListBootMode);\r | |
97 | ASSERT_EFI_ERROR (Status);\r | |
98 | \r | |
99 | if (BootMode == BOOT_IN_RECOVERY_MODE) {\r | |
100 | Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListRecoveryBootMode);\r | |
101 | ASSERT_EFI_ERROR (Status);\r | |
102 | }\r | |
103 | \r | |
104 | return Status;\r | |
105 | }\r |