2 This file include all platform action which can be customized
5 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "PlatformBootManager.h"
19 Perform the platform diagnostic, such like test memory. OEM/IBV also
20 can customize this function to support specific platform diagnostic.
22 @param MemoryTestLevel The memory test intensive level
23 @param QuietBoot Indicate if need to enable the quiet boot
27 PlatformBootManagerDiagnostics (
28 IN EXTENDMEM_COVERAGE_LEVEL MemoryTestLevel
,
35 // Here we can decide if we need to show
36 // the diagnostics screen
37 // Notes: this quiet boot code should be remove
38 // from the graphic lib
41 BootLogoEnableLogo (ImageFormatBmp
, PcdGetPtr(PcdLogoFile
), EdkiiPlatformLogoDisplayAttributeCenter
, 0, 0);
44 // Perform system diagnostic
46 Status
= PlatformBootManagerMemoryTest (MemoryTestLevel
);
47 if (EFI_ERROR (Status
)) {
48 BootLogoDisableLogo ();
55 // Perform system diagnostic
57 Status
= PlatformBootManagerMemoryTest (MemoryTestLevel
);
61 Do the platform specific action before the console is connected.
64 Update console variable;
65 Register new Driver#### or Boot####;
66 Signal ReadyToLock event.
70 PlatformBootManagerBeforeConsole (
76 WIN_NT_SYSTEM_CONFIGURATION
*Configuration
;
78 GetVariable2 (L
"Setup", &gEfiWinNtSystemConfigGuid
, (VOID
**) &Configuration
, NULL
);
79 if (Configuration
!= NULL
) {
81 // SetupVariable is corrupt
83 Configuration
->ConOutRow
= PcdGet32 (PcdConOutColumn
);
84 Configuration
->ConOutColumn
= PcdGet32 (PcdConOutRow
);
86 Status
= gRT
->SetVariable (
88 &gEfiWinNtSystemConfigGuid
,
89 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
,
90 sizeof (WIN_NT_SYSTEM_CONFIGURATION
),
93 if (EFI_ERROR (Status
)) {
94 DEBUG ((EFI_D_ERROR
, "Failed to save Setup Variable to non-volatile storage, Status = %r\n", Status
));
96 FreePool (Configuration
);
100 // Update the ocnsole variables.
102 for (Index
= 0; gPlatformConsole
[Index
].DevicePath
!= NULL
; Index
++) {
103 if ((gPlatformConsole
[Index
].ConnectType
& CONSOLE_IN
) == CONSOLE_IN
) {
104 EfiBootManagerUpdateConsoleVariable (ConIn
, gPlatformConsole
[Index
].DevicePath
, NULL
);
107 if ((gPlatformConsole
[Index
].ConnectType
& CONSOLE_OUT
) == CONSOLE_OUT
) {
108 EfiBootManagerUpdateConsoleVariable (ConOut
, gPlatformConsole
[Index
].DevicePath
, NULL
);
111 if ((gPlatformConsole
[Index
].ConnectType
& STD_ERROR
) == STD_ERROR
) {
112 EfiBootManagerUpdateConsoleVariable (ErrOut
, gPlatformConsole
[Index
].DevicePath
, NULL
);
118 Do the platform specific action after the console is connected.
121 Dynamically switch output mode;
122 Signal console ready platform customized event;
123 Run diagnostics like memory testing;
124 Connect certain devices;
125 Dispatch aditional option roms.
129 PlatformBootManagerAfterConsole (
133 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black
;
134 EFI_GRAPHICS_OUTPUT_BLT_PIXEL White
;
137 EFI_BOOT_MANAGER_LOAD_OPTION BootOption
;
139 Black
.Blue
= Black
.Green
= Black
.Red
= Black
.Reserved
= 0;
140 White
.Blue
= White
.Green
= White
.Red
= White
.Reserved
= 0xFF;
142 EfiBootManagerConnectAll ();
143 EfiBootManagerRefreshAllBootOption ();
146 // Register ENTER as CONTINUE key
148 Enter
.ScanCode
= SCAN_NULL
;
149 Enter
.UnicodeChar
= CHAR_CARRIAGE_RETURN
;
150 EfiBootManagerRegisterContinueKeyOption (0, &Enter
, NULL
);
152 // Map F2 to Boot Manager Menu
154 F2
.ScanCode
= SCAN_F2
;
155 F2
.UnicodeChar
= CHAR_NULL
;
156 EfiBootManagerGetBootManagerMenu (&BootOption
);
157 EfiBootManagerAddKeyOptionVariable (NULL
, (UINT16
) BootOption
.OptionNumber
, 0, &F2
, NULL
);
159 PlatformBootManagerDiagnostics (QUICK
, TRUE
);
161 PrintXY (10, 10, &White
, &Black
, L
"F2 to enter Boot Manager Menu. ");
162 PrintXY (10, 30, &White
, &Black
, L
"Enter to boot directly.");
166 This function is called each second during the boot manager waits the timeout.
168 @param TimeoutRemain The remaining timeout.
172 PlatformBootManagerWaitCallback (
176 EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Black
;
177 EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION White
;
180 Timeout
= PcdGet16 (PcdPlatformBootTimeOut
);
182 Black
.Raw
= 0x00000000;
183 White
.Raw
= 0x00FFFFFF;
185 BootLogoUpdateProgress (
188 L
"Start boot option",
190 (Timeout
- TimeoutRemain
) * 100 / Timeout
,