• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Head file for BDS Architectural Protocol implementation
3 
4 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution.  The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9 
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #ifndef _BDS_MODULE_H_
16 #define _BDS_MODULE_H_
17 
18 #include <FrameworkDxe.h>
19 #include <IndustryStandard/PeImage.h>
20 #include <Guid/MdeModuleHii.h>
21 #include <Guid/FileSystemVolumeLabelInfo.h>
22 #include <Guid/HiiPlatformSetupFormset.h>
23 #include <Guid/StatusCodeDataTypeVariable.h>
24 #include <Protocol/DevicePath.h>
25 #include <IndustryStandard/SmBios.h>
26 #include <Protocol/LoadFile.h>
27 #include <Guid/FileInfo.h>
28 #include <Protocol/HiiConfigRouting.h>
29 #include <Protocol/Bds.h>
30 #include <Protocol/Smbios.h>
31 #include <Protocol/UgaDraw.h>
32 #include <Protocol/BlockIo.h>
33 #include <Guid/GlobalVariable.h>
34 #include <Guid/CapsuleVendor.h>
35 #include <Guid/StatusCodeDataTypeId.h>
36 #include <Guid/LegacyDevOrder.h>
37 #include <Guid/BdsHii.h>
38 #include <Guid/ConnectConInEvent.h>
39 #include <Guid/Performance.h>
40 #include <Guid/FmpCapsule.h>
41 #include <Protocol/GenericMemoryTest.h>
42 #include <Protocol/FormBrowser2.h>
43 #include <Protocol/HiiConfigAccess.h>
44 #include <Protocol/GraphicsOutput.h>
45 #include <Protocol/SimpleFileSystem.h>
46 #include <Protocol/HiiDatabase.h>
47 #include <Protocol/HiiString.h>
48 #include <Protocol/SerialIo.h>
49 #include <Protocol/LegacyBios.h>
50 #include <Protocol/SimpleTextInEx.h>
51 #include <Protocol/DriverHealth.h>
52 #include <Protocol/BootLogo.h>
53 #include <Protocol/VariableLock.h>
54 
55 #include <Library/UefiDriverEntryPoint.h>
56 #include <Library/PrintLib.h>
57 #include <Library/DebugLib.h>
58 #include <Library/BaseMemoryLib.h>
59 #include <Library/UefiBootServicesTableLib.h>
60 #include <Library/UefiLib.h>
61 #include <Library/MemoryAllocationLib.h>
62 #include <Library/PerformanceLib.h>
63 #include <Library/ReportStatusCodeLib.h>
64 #include <Library/UefiRuntimeServicesTableLib.h>
65 #include <Library/HobLib.h>
66 #include <Library/BaseLib.h>
67 #include <Library/DevicePathLib.h>
68 #include <Library/PcdLib.h>
69 #include <Library/CapsuleLib.h>
70 #include <Library/HiiLib.h>
71 #include <Library/DevicePathLib.h>
72 #include <Library/UefiHiiServicesLib.h>
73 
74 #include <Library/GenericBdsLib.h>
75 #include <Library/PlatformBdsLib.h>
76 
77 #pragma pack(1)
78 
79 ///
80 /// HII specific Vendor Device Path definition.
81 ///
82 typedef struct {
83   VENDOR_DEVICE_PATH             VendorDevicePath;
84   EFI_DEVICE_PATH_PROTOCOL       End;
85 } HII_VENDOR_DEVICE_PATH;
86 
87 #pragma pack()
88 
89 /**
90 
91   Show progress bar with title above it. It only works in Graphics mode.
92 
93   @param TitleForeground Foreground color for Title.
94   @param TitleBackground Background color for Title.
95   @param Title           Title above progress bar.
96   @param ProgressColor   Progress bar color.
97   @param Progress        Progress (0-100)
98   @param PreviousValue   The previous value of the progress.
99 
100   @retval  EFI_STATUS       Success update the progress bar
101 
102 **/
103 EFI_STATUS
104 PlatformBdsShowProgress (
105   IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
106   IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
107   IN CHAR16                        *Title,
108   IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
109   IN UINTN                         Progress,
110   IN UINTN                         PreviousValue
111   );
112 
113 //
114 // Prototypes
115 //
116 
117 /**
118 
119   Install Boot Device Selection Protocol
120 
121   @param ImageHandle     The image handle.
122   @param SystemTable     The system table.
123 
124   @retval  EFI_SUCEESS  BDS has finished initializing.
125                         Return the dispatcher and recall BDS.Entry
126   @retval  Other        Return status from AllocatePool() or gBS->InstallProtocolInterface
127 
128 **/
129 EFI_STATUS
130 EFIAPI
131 BdsInitialize (
132   IN EFI_HANDLE                     ImageHandle,
133   IN EFI_SYSTEM_TABLE               *SystemTable
134   );
135 
136 /**
137 
138   Service routine for BdsInstance->Entry(). Devices are connected, the
139   consoles are initialized, and the boot options are tried.
140 
141   @param This            Protocol Instance structure.
142 
143 **/
144 VOID
145 EFIAPI
146 BdsEntry (
147   IN  EFI_BDS_ARCH_PROTOCOL *This
148   );
149 
150 
151 /**
152   Perform the memory test base on the memory test intensive level,
153   and update the memory resource.
154 
155   @param  Level         The memory test intensive level.
156 
157   @retval EFI_STATUS    Success test all the system memory and update
158                         the memory resource
159 
160 **/
161 EFI_STATUS
162 EFIAPI
163 BdsMemoryTest (
164   IN EXTENDMEM_COVERAGE_LEVEL Level
165   );
166 
167 /**
168 
169   This routine is called to see if there are any capsules we need to process.
170   If the boot mode is not UPDATE, then we do nothing. Otherwise find the
171   capsule HOBS and produce firmware volumes for them via the DXE service.
172   Then call the dispatcher to dispatch drivers from them. Finally, check
173   the status of the updates.
174 
175   This function should be called by BDS in case we need to do some
176   sort of processing even if there is no capsule to process. We
177   need to do this if an earlier update went away and we need to
178   clear the capsule variable so on the next reset PEI does not see it and
179   think there is a capsule available.
180 
181   @param BootMode                 the current boot mode
182 
183   @retval EFI_INVALID_PARAMETER   boot mode is not correct for an update
184   @retval EFI_SUCCESS             There is no error when processing capsule
185 
186 **/
187 EFI_STATUS
188 EFIAPI
189 BdsProcessCapsules (
190   EFI_BOOT_MODE BootMode
191   );
192 
193 /**
194   Set the variable and report the error through status code upon failure.
195 
196   @param  VariableName           A Null-terminated string that is the name of the vendor's variable.
197                                  Each VariableName is unique for each VendorGuid. VariableName must
198                                  contain 1 or more characters. If VariableName is an empty string,
199                                  then EFI_INVALID_PARAMETER is returned.
200   @param  VendorGuid             A unique identifier for the vendor.
201   @param  Attributes             Attributes bitmask to set for the variable.
202   @param  DataSize               The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE,
203                                  EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, or
204                                  EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero
205                                  causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is
206                                  set, then a SetVariable() call with a DataSize of zero will not cause any change to
207                                  the variable value (the timestamp associated with the variable may be updated however
208                                  even if no new data value is provided,see the description of the
209                                  EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not
210                                  be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated).
211   @param  Data                   The contents for the variable.
212 
213   @retval EFI_SUCCESS            The firmware has successfully stored the variable and its data as
214                                  defined by the Attributes.
215   @retval EFI_INVALID_PARAMETER  An invalid combination of attribute bits, name, and GUID was supplied, or the
216                                  DataSize exceeds the maximum allowed.
217   @retval EFI_INVALID_PARAMETER  VariableName is an empty string.
218   @retval EFI_OUT_OF_RESOURCES   Not enough storage is available to hold the variable and its data.
219   @retval EFI_DEVICE_ERROR       The variable could not be retrieved due to a hardware error.
220   @retval EFI_WRITE_PROTECTED    The variable in question is read-only.
221   @retval EFI_WRITE_PROTECTED    The variable in question cannot be deleted.
222   @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS
223                                  or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set, but the AuthInfo
224                                  does NOT pass the validation check carried out by the firmware.
225 
226   @retval EFI_NOT_FOUND          The variable trying to be updated or deleted was not found.
227 **/
228 EFI_STATUS
229 BdsDxeSetVariableAndReportStatusCodeOnError (
230   IN CHAR16     *VariableName,
231   IN EFI_GUID   *VendorGuid,
232   IN UINT32     Attributes,
233   IN UINTN      DataSize,
234   IN VOID       *Data
235   );
236 
237 #endif
238