]> git.proxmox.com Git - mirror_edk2.git/blame - UnixPkg/BootModePei/BootModePei.c
Add DEBUG() macros for DEBUG_CACHE to MTRR Library show all changes memory caches...
[mirror_edk2.git] / UnixPkg / BootModePei / BootModePei.c
CommitLineData
804405e7 1/**@file\r
2\r
f9b8ab56
HT
3Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
4This program and the accompanying materials \r
804405e7 5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 BootMode.c\r
15 \r
16Abstract:\r
17\r
18 Tiano PEIM to provide the platform support functionality within Unix\r
19\r
20**/\r
21\r
22\r
23\r
24//\r
25// The package level header files this module uses\r
26//\r
27#include <PiPei.h>\r
28//\r
29// The protocols, PPI and GUID defintions for this module\r
30//\r
31#include <Ppi/MasterBootMode.h>\r
32#include <Ppi/BootInRecoveryMode.h>\r
33//\r
34// The Library classes this module consumes\r
35//\r
36#include <Library/DebugLib.h>\r
37#include <Library/PeimEntryPoint.h>\r
38\r
39\r
40//\r
41// Module globals\r
42//\r
43EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {\r
44 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
45 &gEfiPeiMasterBootModePpiGuid,\r
46 NULL\r
47};\r
48\r
49EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {\r
50 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
51 &gEfiPeiBootInRecoveryModePpiGuid,\r
52 NULL\r
53};\r
54\r
55EFI_STATUS\r
56EFIAPI\r
57InitializeBootMode (\r
f49a99ed 58 IN EFI_PEI_FILE_HANDLE FileHandle,\r
59 IN CONST EFI_PEI_SERVICES **PeiServices\r
804405e7 60 )\r
61/*++\r
62\r
63Routine Description:\r
64\r
65 Peform the boot mode determination logic\r
66\r
67Arguments:\r
68\r
69 PeiServices - General purpose services available to every PEIM.\r
70 \r
71Returns:\r
72\r
73 Status - EFI_SUCCESS if the boot mode could be set\r
74\r
75--*/\r
76// TODO: FfsHeader - add argument and description to function comment\r
77{\r
78 EFI_STATUS Status;\r
79 UINTN BootMode;\r
80\r
81 DEBUG ((EFI_D_ERROR, "Unix Boot Mode PEIM Loaded\n"));\r
82\r
83 //\r
84 // Let's assume things are OK if not told otherwise\r
85 // Should we read an environment variable in order to easily change this?\r
86 //\r
87 BootMode = BOOT_WITH_FULL_CONFIGURATION;\r
88\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