1/**@file
2   Head file for BDS Platform specific code
3
4Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
5This program and the accompanying materials
6are licensed and made available under the terms and conditions of the BSD License
7which accompanies this distribution.  The full text of the license may be found at
8http://opensource.org/licenses/bsd-license.php
9
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12**/
13
14#ifndef _PLATFORM_BOOT_MANAGER_H
15#define _PLATFORM_BOOT_MANAGER_H
16
17#include <PiDxe.h>
18#include <Guid/WinNtSystemConfig.h>
19#include <Protocol/GenericMemoryTest.h>
20#include <Protocol/WinNtThunk.h>
21#include <Protocol/WinNtIo.h>
22#include <Protocol/LoadedImage.h>
23
24#include <Library/DebugLib.h>
25#include <Library/BaseMemoryLib.h>
26#include <Library/UefiBootServicesTableLib.h>
27#include <Library/UefiRuntimeServicesTableLib.h>
28#include <Library/MemoryAllocationLib.h>
29#include <Library/BaseLib.h>
30#include <Library/UefiRuntimeServicesTableLib.h>
31#include <Library/UefiLib.h>
32#include <Library/UefiBootManagerLib.h>
33#include <Library/PcdLib.h>
34#include <Library/DevicePathLib.h>
35#include <Library/HiiLib.h>
36#include <Library/PrintLib.h>
37#include <Library/DxeServicesLib.h>
38#include <Library/BootLogoLib.h>
39
40
41typedef struct {
42  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
43  UINTN                     ConnectType;
44} PLATFORM_CONSOLE_CONNECT_ENTRY;
45
46extern PLATFORM_CONSOLE_CONNECT_ENTRY  gPlatformConsole[];
47
48#define gEndEntire \
49  { \
50    END_DEVICE_PATH_TYPE,\
51    END_ENTIRE_DEVICE_PATH_SUBTYPE,\
52    END_DEVICE_PATH_LENGTH,\
53    0\
54  }
55
56#define CONSOLE_OUT BIT0
57#define CONSOLE_IN  BIT1
58#define STD_ERROR   BIT2
59
60typedef struct {
61  VENDOR_DEVICE_PATH  VendorDevicePath;
62  UINT32              Instance;
63} WIN_NT_VENDOR_DEVICE_PATH_NODE;
64
65//
66// Below is the platform console device path
67//
68typedef struct {
69  VENDOR_DEVICE_PATH              NtBus;
70  WIN_NT_VENDOR_DEVICE_PATH_NODE  SerialDevice;
71  UART_DEVICE_PATH                Uart;
72  VENDOR_DEVICE_PATH              TerminalType;
73  EFI_DEVICE_PATH_PROTOCOL        End;
74} NT_ISA_SERIAL_DEVICE_PATH;
75
76typedef struct {
77  VENDOR_DEVICE_PATH              NtBus;
78  WIN_NT_VENDOR_DEVICE_PATH_NODE  NtGopDevice;
79  EFI_DEVICE_PATH_PROTOCOL        End;
80} NT_PLATFORM_GOP_DEVICE_PATH;
81
82/**
83  Use SystemTable Conout to stop video based Simple Text Out consoles from going
84  to the video device. Put up LogoFile on every video device that is a console.
85
86  @param[in]  LogoFile   File name of logo to display on the center of the screen.
87
88  @retval EFI_SUCCESS     ConsoleControl has been flipped to graphics and logo displayed.
89  @retval EFI_UNSUPPORTED Logo not found
90
91**/
92EFI_STATUS
93PlatformBootManagerEnableQuietBoot (
94  IN  EFI_GUID  *LogoFile
95  );
96
97/**
98  Use SystemTable Conout to turn on video based Simple Text Out consoles. The
99  Simple Text Out screens will now be synced up with all non video output devices
100
101  @retval EFI_SUCCESS     UGA devices are back in text mode and synced up.
102
103**/
104EFI_STATUS
105PlatformBootManagerDisableQuietBoot (
106  VOID
107  );
108
109/**
110  Perform the memory test base on the memory test intensive level,
111  and update the memory resource.
112
113  @param  Level         The memory test intensive level.
114
115  @retval EFI_STATUS    Success test all the system memory and update
116                        the memory resource
117
118**/
119EFI_STATUS
120PlatformBootManagerMemoryTest (
121  IN EXTENDMEM_COVERAGE_LEVEL Level
122  );
123
124/**
125
126  Show progress bar with title above it. It only works in Graphics mode.
127
128
129  @param TitleForeground Foreground color for Title.
130  @param TitleBackground Background color for Title.
131  @param Title           Title above progress bar.
132  @param ProgressColor   Progress bar color.
133  @param Progress        Progress (0-100)
134  @param PreviousValue   The previous value of the progress.
135
136  @retval  EFI_STATUS       Success update the progress bar
137
138**/
139EFI_STATUS
140PlatformBootManagerShowProgress (
141  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
142  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
143  IN CHAR16                        *Title,
144  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
145  IN UINTN                         Progress,
146  IN UINTN                         PreviousValue
147  );
148
149#endif // _PLATFORM_BOOT_MANAGER_H
150