Bds.h revision 19bf20e11acd88a02922201f97e6d64edcd16390
15c08e1173703234cc2913757f237ee916087498aklu/** @file 25c08e1173703234cc2913757f237ee916087498aklu Head file for BDS Architectural Protocol implementation 35c08e1173703234cc2913757f237ee916087498aklu 45c08e1173703234cc2913757f237ee916087498akluCopyright (c) 2004 - 2008, Intel Corporation. <BR> 55c08e1173703234cc2913757f237ee916087498akluAll rights reserved. This program and the accompanying materials 65c08e1173703234cc2913757f237ee916087498akluare licensed and made available under the terms and conditions of the BSD License 75c08e1173703234cc2913757f237ee916087498akluwhich accompanies this distribution. The full text of the license may be found at 85c08e1173703234cc2913757f237ee916087498akluhttp://opensource.org/licenses/bsd-license.php 95c08e1173703234cc2913757f237ee916087498aklu 105c08e1173703234cc2913757f237ee916087498akluTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 115c08e1173703234cc2913757f237ee916087498akluWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 125c08e1173703234cc2913757f237ee916087498aklu 135c08e1173703234cc2913757f237ee916087498aklu**/ 145c08e1173703234cc2913757f237ee916087498aklu 155c08e1173703234cc2913757f237ee916087498aklu#ifndef _BDS_MODULE_H_ 165c08e1173703234cc2913757f237ee916087498aklu#define _BDS_MODULE_H_ 175c08e1173703234cc2913757f237ee916087498aklu 1879bc7a89f7da2c5c17332a55e514dd69e849ce87mdkinney#include <FrameworkDxe.h> 1967d632277d0650197002996fb98cb3cb41dce9e8lgao#include <IndustryStandard/PeImage.h> 20a2ded1d652cef1f2aaf85e73fc8f5bc5626723beqhuang#include <Guid/MdeModuleHii.h> 215c08e1173703234cc2913757f237ee916087498aklu#include <Guid/FileSystemVolumeLabelInfo.h> 225c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/DevicePath.h> 235c08e1173703234cc2913757f237ee916087498aklu#include <Guid/DataHubRecords.h> 245c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/LoadFile.h> 255c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/CpuIo.h> 265c08e1173703234cc2913757f237ee916087498aklu#include <Guid/FileInfo.h> 275c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/HiiConfigRouting.h> 285c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/Bds.h> 295c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/DataHub.h> 305c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/UgaDraw.h> 315c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/BlockIo.h> 325c08e1173703234cc2913757f237ee916087498aklu#include <Guid/GlobalVariable.h> 335c08e1173703234cc2913757f237ee916087498aklu#include <Guid/CapsuleVendor.h> 3455e1864e6bff2fb719e0745b35ed386aa74065c3lgao#include <Guid/StatusCodeDataTypeId.h> 355c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/GenericMemoryTest.h> 365c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/FormBrowser2.h> 375c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/HiiConfigAccess.h> 385c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/GraphicsOutput.h> 395c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/SimpleFileSystem.h> 405c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/HiiDatabase.h> 415c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/HiiString.h> 425c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/SerialIo.h> 435c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/LegacyBios.h> 445c08e1173703234cc2913757f237ee916087498aklu#include <Protocol/SimpleTextInEx.h> 455c08e1173703234cc2913757f237ee916087498aklu 465c08e1173703234cc2913757f237ee916087498aklu#include <Library/UefiDriverEntryPoint.h> 475c08e1173703234cc2913757f237ee916087498aklu#include <Library/PrintLib.h> 485c08e1173703234cc2913757f237ee916087498aklu#include <Library/DebugLib.h> 495c08e1173703234cc2913757f237ee916087498aklu#include <Library/BaseMemoryLib.h> 505c08e1173703234cc2913757f237ee916087498aklu#include <Library/UefiBootServicesTableLib.h> 515c08e1173703234cc2913757f237ee916087498aklu#include <Library/UefiLib.h> 525c08e1173703234cc2913757f237ee916087498aklu#include <Library/MemoryAllocationLib.h> 535c08e1173703234cc2913757f237ee916087498aklu#include <Library/PerformanceLib.h> 545c08e1173703234cc2913757f237ee916087498aklu#include <Library/ReportStatusCodeLib.h> 555c08e1173703234cc2913757f237ee916087498aklu#include <Library/UefiRuntimeServicesTableLib.h> 565c08e1173703234cc2913757f237ee916087498aklu#include <Library/HobLib.h> 575c08e1173703234cc2913757f237ee916087498aklu#include <Library/BaseLib.h> 585c08e1173703234cc2913757f237ee916087498aklu#include <Library/DevicePathLib.h> 595c08e1173703234cc2913757f237ee916087498aklu#include <Library/PcdLib.h> 605c08e1173703234cc2913757f237ee916087498aklu#include <Library/CapsuleLib.h> 615c08e1173703234cc2913757f237ee916087498aklu#include <Library/HiiLib.h> 62f6f910dd125144707e3516bbb517b8ec7a388c06rsun#include <Library/DevicePathLib.h> 638c81cb83b96c81a9891e36d16cc13e789c6f8901klu#include <Library/PcdLib.h> 645c08e1173703234cc2913757f237ee916087498aklu 655c08e1173703234cc2913757f237ee916087498aklu#include <Library/GenericBdsLib.h> 665c08e1173703234cc2913757f237ee916087498aklu#include <Library/PlatformBdsLib.h> 675c08e1173703234cc2913757f237ee916087498aklu 68f6f910dd125144707e3516bbb517b8ec7a388c06rsun#pragma pack(1) 69f6f910dd125144707e3516bbb517b8ec7a388c06rsun 70f6f910dd125144707e3516bbb517b8ec7a388c06rsun/// 71f6f910dd125144707e3516bbb517b8ec7a388c06rsun/// HII specific Vendor Device Path definition. 72f6f910dd125144707e3516bbb517b8ec7a388c06rsun/// 73f6f910dd125144707e3516bbb517b8ec7a388c06rsuntypedef struct { 74f6f910dd125144707e3516bbb517b8ec7a388c06rsun VENDOR_DEVICE_PATH VendorDevicePath; 75f6f910dd125144707e3516bbb517b8ec7a388c06rsun EFI_DEVICE_PATH_PROTOCOL End; 76f6f910dd125144707e3516bbb517b8ec7a388c06rsun} HII_VENDOR_DEVICE_PATH; 77f6f910dd125144707e3516bbb517b8ec7a388c06rsun 78f6f910dd125144707e3516bbb517b8ec7a388c06rsun#pragma pack() 79f6f910dd125144707e3516bbb517b8ec7a388c06rsun 805c08e1173703234cc2913757f237ee916087498aklu/** 815c08e1173703234cc2913757f237ee916087498aklu 825c08e1173703234cc2913757f237ee916087498aklu Show progress bar with title above it. It only works in Graphics mode. 835c08e1173703234cc2913757f237ee916087498aklu 845c08e1173703234cc2913757f237ee916087498aklu @param TitleForeground Foreground color for Title. 855c08e1173703234cc2913757f237ee916087498aklu @param TitleBackground Background color for Title. 865c08e1173703234cc2913757f237ee916087498aklu @param Title Title above progress bar. 875c08e1173703234cc2913757f237ee916087498aklu @param ProgressColor Progress bar color. 885c08e1173703234cc2913757f237ee916087498aklu @param Progress Progress (0-100) 895c08e1173703234cc2913757f237ee916087498aklu @param PreviousValue The previous value of the progress. 905c08e1173703234cc2913757f237ee916087498aklu 915c08e1173703234cc2913757f237ee916087498aklu @retval EFI_STATUS Success update the progress bar 925c08e1173703234cc2913757f237ee916087498aklu 935c08e1173703234cc2913757f237ee916087498aklu**/ 945c08e1173703234cc2913757f237ee916087498akluEFI_STATUS 955c08e1173703234cc2913757f237ee916087498akluPlatformBdsShowProgress ( 965c08e1173703234cc2913757f237ee916087498aklu IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground, 975c08e1173703234cc2913757f237ee916087498aklu IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground, 985c08e1173703234cc2913757f237ee916087498aklu IN CHAR16 *Title, 995c08e1173703234cc2913757f237ee916087498aklu IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor, 1005c08e1173703234cc2913757f237ee916087498aklu IN UINTN Progress, 1015c08e1173703234cc2913757f237ee916087498aklu IN UINTN PreviousValue 1025c08e1173703234cc2913757f237ee916087498aklu ); 1035c08e1173703234cc2913757f237ee916087498aklu 1045c08e1173703234cc2913757f237ee916087498aklu// 1055c08e1173703234cc2913757f237ee916087498aklu// Prototypes 1065c08e1173703234cc2913757f237ee916087498aklu// 1075c08e1173703234cc2913757f237ee916087498aklu 1085c08e1173703234cc2913757f237ee916087498aklu/** 1095c08e1173703234cc2913757f237ee916087498aklu 1105c08e1173703234cc2913757f237ee916087498aklu Install Boot Device Selection Protocol 1115c08e1173703234cc2913757f237ee916087498aklu 1125c08e1173703234cc2913757f237ee916087498aklu @param ImageHandle The image handle. 1135c08e1173703234cc2913757f237ee916087498aklu @param SystemTable The system table. 1145c08e1173703234cc2913757f237ee916087498aklu 1155c08e1173703234cc2913757f237ee916087498aklu @retval EFI_SUCEESS BDS has finished initializing. 1165c08e1173703234cc2913757f237ee916087498aklu Return the dispatcher and recall BDS.Entry 1175c08e1173703234cc2913757f237ee916087498aklu @retval Other Return status from AllocatePool() or gBS->InstallProtocolInterface 1185c08e1173703234cc2913757f237ee916087498aklu 1195c08e1173703234cc2913757f237ee916087498aklu**/ 1205c08e1173703234cc2913757f237ee916087498akluEFI_STATUS 1215c08e1173703234cc2913757f237ee916087498akluEFIAPI 1225c08e1173703234cc2913757f237ee916087498akluBdsInitialize ( 1235c08e1173703234cc2913757f237ee916087498aklu IN EFI_HANDLE ImageHandle, 1245c08e1173703234cc2913757f237ee916087498aklu IN EFI_SYSTEM_TABLE *SystemTable 1255c08e1173703234cc2913757f237ee916087498aklu ); 1265c08e1173703234cc2913757f237ee916087498aklu 1275c08e1173703234cc2913757f237ee916087498aklu/** 1285c08e1173703234cc2913757f237ee916087498aklu 1295c08e1173703234cc2913757f237ee916087498aklu Service routine for BdsInstance->Entry(). Devices are connected, the 1305c08e1173703234cc2913757f237ee916087498aklu consoles are initialized, and the boot options are tried. 1315c08e1173703234cc2913757f237ee916087498aklu 1325c08e1173703234cc2913757f237ee916087498aklu @param This Protocol Instance structure. 1335c08e1173703234cc2913757f237ee916087498aklu 1345c08e1173703234cc2913757f237ee916087498aklu**/ 1355c08e1173703234cc2913757f237ee916087498akluVOID 1365c08e1173703234cc2913757f237ee916087498akluEFIAPI 1375c08e1173703234cc2913757f237ee916087498akluBdsEntry ( 1385c08e1173703234cc2913757f237ee916087498aklu IN EFI_BDS_ARCH_PROTOCOL *This 1395c08e1173703234cc2913757f237ee916087498aklu ); 1405c08e1173703234cc2913757f237ee916087498aklu 14119bf20e11acd88a02922201f97e6d64edcd16390lgao 14219bf20e11acd88a02922201f97e6d64edcd16390lgao/** 14319bf20e11acd88a02922201f97e6d64edcd16390lgao Perform the memory test base on the memory test intensive level, 14419bf20e11acd88a02922201f97e6d64edcd16390lgao and update the memory resource. 14519bf20e11acd88a02922201f97e6d64edcd16390lgao 14619bf20e11acd88a02922201f97e6d64edcd16390lgao @param Level The memory test intensive level. 14719bf20e11acd88a02922201f97e6d64edcd16390lgao 14819bf20e11acd88a02922201f97e6d64edcd16390lgao @retval EFI_STATUS Success test all the system memory and update 14919bf20e11acd88a02922201f97e6d64edcd16390lgao the memory resource 15019bf20e11acd88a02922201f97e6d64edcd16390lgao 15119bf20e11acd88a02922201f97e6d64edcd16390lgao**/ 15219bf20e11acd88a02922201f97e6d64edcd16390lgaoEFI_STATUS 15319bf20e11acd88a02922201f97e6d64edcd16390lgaoBdsMemoryTest ( 15419bf20e11acd88a02922201f97e6d64edcd16390lgao IN EXTENDMEM_COVERAGE_LEVEL Level 15519bf20e11acd88a02922201f97e6d64edcd16390lgao ); 15619bf20e11acd88a02922201f97e6d64edcd16390lgao 15719bf20e11acd88a02922201f97e6d64edcd16390lgao/** 15819bf20e11acd88a02922201f97e6d64edcd16390lgao 15919bf20e11acd88a02922201f97e6d64edcd16390lgao This routine is called to see if there are any capsules we need to process. 16019bf20e11acd88a02922201f97e6d64edcd16390lgao If the boot mode is not UPDATE, then we do nothing. Otherwise find the 16119bf20e11acd88a02922201f97e6d64edcd16390lgao capsule HOBS and produce firmware volumes for them via the DXE service. 16219bf20e11acd88a02922201f97e6d64edcd16390lgao Then call the dispatcher to dispatch drivers from them. Finally, check 16319bf20e11acd88a02922201f97e6d64edcd16390lgao the status of the updates. 16419bf20e11acd88a02922201f97e6d64edcd16390lgao 16519bf20e11acd88a02922201f97e6d64edcd16390lgao This function should be called by BDS in case we need to do some 16619bf20e11acd88a02922201f97e6d64edcd16390lgao sort of processing even if there is no capsule to process. We 16719bf20e11acd88a02922201f97e6d64edcd16390lgao need to do this if an earlier update went away and we need to 16819bf20e11acd88a02922201f97e6d64edcd16390lgao clear the capsule variable so on the next reset PEI does not see it and 16919bf20e11acd88a02922201f97e6d64edcd16390lgao think there is a capsule available. 17019bf20e11acd88a02922201f97e6d64edcd16390lgao 17119bf20e11acd88a02922201f97e6d64edcd16390lgao @param BootMode the current boot mode 17219bf20e11acd88a02922201f97e6d64edcd16390lgao 17319bf20e11acd88a02922201f97e6d64edcd16390lgao @retval EFI_INVALID_PARAMETER boot mode is not correct for an update 17419bf20e11acd88a02922201f97e6d64edcd16390lgao @retval EFI_SUCCESS There is no error when processing capsule 17519bf20e11acd88a02922201f97e6d64edcd16390lgao 17619bf20e11acd88a02922201f97e6d64edcd16390lgao**/ 17719bf20e11acd88a02922201f97e6d64edcd16390lgaoEFI_STATUS 17819bf20e11acd88a02922201f97e6d64edcd16390lgaoBdsProcessCapsules ( 17919bf20e11acd88a02922201f97e6d64edcd16390lgao EFI_BOOT_MODE BootMode 18019bf20e11acd88a02922201f97e6d64edcd16390lgao ); 18119bf20e11acd88a02922201f97e6d64edcd16390lgao 1825c08e1173703234cc2913757f237ee916087498aklu#endif 183