klu2 | 6ae8142 | 2008-03-19 03:23:16 +0000 | [diff] [blame] | 1 | /**@file
|
qwang12 | 89b6542 | 2007-06-26 10:10:18 +0000 | [diff] [blame] | 2 |
|
| 3 | Copyright (c) 2006, Intel Corporation
|
| 4 | All rights reserved. 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 |
|
klu2 | 6ae8142 | 2008-03-19 03:23:16 +0000 | [diff] [blame] | 20 | **/
|
qwang12 | 89b6542 | 2007-06-26 10:10:18 +0000 | [diff] [blame] | 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 |
|
| 39 |
|
| 40 | //
|
| 41 | // Module globals
|
| 42 | //
|
| 43 | EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {
|
| 44 | (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
| 45 | &gEfiPeiMasterBootModePpiGuid,
|
| 46 | NULL
|
| 47 | };
|
| 48 |
|
| 49 | EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {
|
| 50 | (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
| 51 | &gEfiPeiBootInRecoveryModePpiGuid,
|
| 52 | NULL
|
| 53 | };
|
| 54 |
|
| 55 | EFI_STATUS
|
| 56 | EFIAPI
|
| 57 | InitializeBootMode (
|
lgao4 | f0ba8fd | 2008-11-27 05:18:34 +0000 | [diff] [blame] | 58 | IN EFI_PEI_FILE_HANDLE FileHandle,
|
| 59 | IN CONST EFI_PEI_SERVICES **PeiServices
|
qwang12 | 89b6542 | 2007-06-26 10:10:18 +0000 | [diff] [blame] | 60 | )
|
| 61 | /*++
|
| 62 |
|
| 63 | Routine Description:
|
| 64 |
|
| 65 | Peform the boot mode determination logic
|
| 66 |
|
| 67 | Arguments:
|
| 68 |
|
lgao4 | f0ba8fd | 2008-11-27 05:18:34 +0000 | [diff] [blame] | 69 | FileHandle - Handle of the file being invoked.
|
| 70 | PeiServices - Describes the list of possible PEI Services.
|
qwang12 | 89b6542 | 2007-06-26 10:10:18 +0000 | [diff] [blame] | 71 |
|
| 72 | Returns:
|
| 73 |
|
| 74 | Status - EFI_SUCCESS if the boot mode could be set
|
| 75 |
|
| 76 | --*/
|
qwang12 | 89b6542 | 2007-06-26 10:10:18 +0000 | [diff] [blame] | 77 | {
|
| 78 | EFI_STATUS Status;
|
| 79 | UINTN BootMode;
|
| 80 |
|
| 81 | DEBUG ((EFI_D_ERROR, "NT32 Boot Mode PEIM Loaded\n"));
|
| 82 |
|
| 83 | //
|
| 84 | // Let's assume things are OK if not told otherwise
|
| 85 | // Should we read an environment variable in order to easily change this?
|
| 86 | //
|
| 87 | BootMode = BOOT_WITH_FULL_CONFIGURATION;
|
| 88 |
|
lgao4 | f0ba8fd | 2008-11-27 05:18:34 +0000 | [diff] [blame] | 89 | Status = (**PeiServices).SetBootMode (PeiServices, (UINT8) BootMode);
|
qwang12 | 89b6542 | 2007-06-26 10:10:18 +0000 | [diff] [blame] | 90 | ASSERT_EFI_ERROR (Status);
|
| 91 |
|
lgao4 | f0ba8fd | 2008-11-27 05:18:34 +0000 | [diff] [blame] | 92 | Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListBootMode);
|
qwang12 | 89b6542 | 2007-06-26 10:10:18 +0000 | [diff] [blame] | 93 | ASSERT_EFI_ERROR (Status);
|
| 94 |
|
| 95 | if (BootMode == BOOT_IN_RECOVERY_MODE) {
|
lgao4 | f0ba8fd | 2008-11-27 05:18:34 +0000 | [diff] [blame] | 96 | Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListRecoveryBootMode);
|
qwang12 | 89b6542 | 2007-06-26 10:10:18 +0000 | [diff] [blame] | 97 | ASSERT_EFI_ERROR (Status);
|
| 98 | }
|
| 99 |
|
| 100 | return Status;
|
| 101 | }
|