From fa332de7493caee4d3fa22392dc6292cfbb6f224 Mon Sep 17 00:00:00 2001 From: vanjeff Date: Fri, 30 Mar 2007 06:15:19 +0000 Subject: [PATCH] 1. Perfect libraries MSA files 2. Use MemoryAllocationLib to replace gBS memory services in EdkEt32Pkg. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2517 6f19259b-4bc3-4df7-8a09-765794883524 --- .../MiscSubclassDriverEntryPoint.c | 26 +- EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.c | 4 +- .../Generic/BootMaint/BBSsupport.c | 30 +- .../Dxe/PlatformBds/Generic/BootMaint/BmLib.c | 62 ++-- .../PlatformBds/Generic/BootMaint/BootMaint.c | 42 +-- .../Generic/BootMaint/BootOption.c | 90 ++--- .../Generic/BootMaint/UpdatePage.c | 23 +- .../Generic/BootMngr/BootManager.c | 46 +-- .../Generic/DeviceMngr/DeviceManager.c | 50 +-- .../Dxe/PlatformBds/Generic/FrontPage.c | 100 +++--- EdkNt32Pkg/Dxe/PlatformBds/Generic/Language.c | 30 +- .../Dxe/PlatformBds/Generic/MemoryTest.c | 54 +-- EdkNt32Pkg/Dxe/PlatformBds/Generic/String.c | 24 +- .../Bus/BlockIo/DriverDiagnostics.c | 4 +- .../Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c | 12 +- .../WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa | 3 + .../Dxe/WinNtThunk/Bus/Console/Console.c | 30 +- .../Dxe/WinNtThunk/Bus/Console/ConsoleIn.c | 36 +- .../WinNtThunk/Bus/Console/WinNtConsole.msa | 3 + .../Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa | 3 + .../Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c | 14 +- .../Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c | 50 +-- .../WinNtThunk/Bus/SerialIo/WinNtSerialIo.c | 84 +++-- .../WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa | 3 + .../SimpleFileSystem/WinNtSimpleFileSystem.c | 332 +++++++----------- .../WinNtSimpleFileSystem.msa | 3 + .../Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa | 3 + .../Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c | 37 +- .../Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c | 62 ++-- .../Bus/WinNtBusDriver/WinNtBusDriver.c | 35 +- .../Bus/WinNtBusDriver/WinNtBusDriver.msa | 3 + EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Cpu.c | 60 ++-- .../Library/DxeWinNtLib/DxeWinNtLib.msa | 4 +- EdkNt32Pkg/Library/EdkGenericBdsLib/BdsBoot.c | 86 ++--- .../Library/EdkGenericBdsLib/BdsConnect.c | 68 ++-- .../Library/EdkGenericBdsLib/BdsConsole.c | 50 +-- EdkNt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c | 182 +++++----- .../Library/EdkGenericBdsLib/DevicePath.c | 6 +- .../EdkGenericBdsLib/EdkGenericBdsLib.msa | 7 +- .../Library/EdkGenericBdsLib/Performance.c | 26 +- .../EdkNt32PeiPeCoffGetEntryPointLib.msa | 4 +- .../Nt32PeCoffLoaderLib.msa | 4 +- .../RuntimeDxe/FvbServices/FWBlockService.c | 140 ++++---- 43 files changed, 893 insertions(+), 1042 deletions(-) diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriverEntryPoint.c b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriverEntryPoint.c index f0e09a6152..240a24e0b8 100644 --- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriverEntryPoint.c +++ b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriverEntryPoint.c @@ -1,19 +1,19 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: MiscSubclassDriverEntryPoint.c - -Abstract: + +Abstract: This driver parses the mMiscSubclassDataTable structure and reports any generated data to the DataHub. @@ -201,7 +201,7 @@ Returns: // PackageList = PreparePackages (1, &gEfiMiscSubClassGuid, MiscSubclassStrings); EfiStatus = Hii->NewPack (Hii, PackageList, &HiiHandle); - gBS->FreePool (PackageList); + FreePool (PackageList); if (EFI_ERROR (EfiStatus)) { DEBUG ((EFI_D_ERROR, "Could not log default strings to Hii. %r\n", EfiStatus)); @@ -351,8 +351,8 @@ Routine Description: Arguments: String - Unicode string. -Returns: - UINTN of the number represented by String. +Returns: + UINTN of the number represented by String. --*/ { diff --git a/EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.c b/EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.c index 846ba8e8ed..1d6f9139c6 100644 --- a/EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.c +++ b/EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.c @@ -445,7 +445,7 @@ Returns: TmpStr = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED)); if (TmpStr != NULL) { BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", NULL); - gBS->FreePool (TmpStr); + FreePool (TmpStr); } } @@ -487,7 +487,7 @@ Returns: TmpStr = GetStringById (STRING_TOKEN (STR_BOOT_FAILED)); if (TmpStr != NULL) { BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", NULL); - gBS->FreePool (TmpStr); + FreePool (TmpStr); } } diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.c index c9f2402eb1..37c0475ba7 100644 --- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.c +++ b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.c @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -486,19 +486,19 @@ BdsDeleteAllInvalidLegacyBootOptions ( Index++; continue; } - + // // Check if BBS Description String is changed // DescStringMatch = FALSE; - + BdsBuildLegacyDevNameString ( - &LocalBbsTable[BbsIndex], - BbsIndex, - sizeof(BootDesc), + &LocalBbsTable[BbsIndex], + BbsIndex, + sizeof(BootDesc), BootDesc ); - + if (StrCmp (BootDesc, (UINT16*)(BootOptionVar + sizeof (UINT32) + sizeof (UINT16))) == 0) { DescStringMatch = TRUE; } @@ -634,7 +634,7 @@ BdsCreateOneLegacyBootOption ( ); BbsItem->BootPriority = 0x00; - gBS->FreePool (DevPath); + FreePool (DevPath); return Status; } diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BmLib.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BmLib.c index b4f6d481ce..8804b141ae 100644 --- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BmLib.c +++ b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BmLib.c @@ -1,18 +1,18 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: BmLib.c - + AgBStract: Boot Maintainence Helper functions @@ -30,13 +30,13 @@ EfiLibLocateProtocol ( Routine Description: - Find the first instance of this Protocol + Find the first instance of this Protocol in the system and return it's interface Arguments: ProtocolGuid - Provides the protocol to search for - Interface - On return, a pointer to the first interface + Interface - On return, a pointer to the first interface that matches ProtocolGuid Returns: @@ -72,7 +72,7 @@ Arguments: DeviceHandle - A handle for a device Returns: - + A valid file handle or NULL is returned --*/ @@ -118,7 +118,7 @@ EfiGrowBuffer ( Routine Description: Helper function called as part of the code needed - to allocate the proper sized buffer for various + to allocate the proper sized buffer for various EFI interfaces. Arguments: @@ -128,10 +128,10 @@ Arguments: Buffer - Current allocated buffer, or NULL BufferSize - Current buffer size needed - + Returns: - - TRUE - if the buffer was reallocated and the caller + + TRUE - if the buffer was reallocated and the caller should try the API again. --*/ @@ -182,7 +182,7 @@ Routine Description: Function returns the value of the specified variable. Arguments: - Name - A Null-terminated Unicode string that is + Name - A Null-terminated Unicode string that is the name of the vendor's variable. VendorGuid - A unique identifier for the vendor. @@ -209,7 +209,7 @@ Routine Description: Function deletes the variable specified by VarName and VarGuid. Arguments: - VarName - A Null-terminated Unicode string that is + VarName - A Null-terminated Unicode string that is the name of the vendor's variable. VendorGuid - A unique identifier for the vendor. @@ -252,7 +252,7 @@ EfiLibFileSystemVolumeLabelInfo ( Routine Description: - Function gets the file system information from an open file descriptor, + Function gets the file system information from an open file descriptor, and stores it in a buffer allocated from pool. Arguments: @@ -260,7 +260,7 @@ Arguments: Fhand - A file handle Returns: - + A pointer to a buffer with file information or NULL is returned --*/ @@ -315,7 +315,7 @@ EfiLibFileInfo ( Routine Description: - Function gets the file information from an open file descriptor, and stores it + Function gets the file information from an open file descriptor, and stores it in a buffer allocated from pool. Arguments: @@ -323,7 +323,7 @@ Arguments: Fhand - A file handle Returns: - + A pointer to a buffer with file information or NULL is returned --*/ @@ -360,7 +360,7 @@ EfiDevicePathInstanceCount ( /*++ Routine Description: - Function is used to determine the number of device path instances + Function is used to determine the number of device path instances that exist in a device path. Arguments: @@ -368,7 +368,7 @@ Arguments: Returns: - This function counts and returns the number of device path instances + This function counts and returns the number of device path instances in DevicePath. --*/ @@ -437,15 +437,15 @@ EfiLibGetStringFromToken ( /*++ Routine Description: - + Acquire the string associated with the ProducerGuid and return it. Arguments: - + ProducerGuid - The Guid to search the HII database for Token - The token value of the string to extract String - The string that is extracted - + Returns: EFI_SUCCESS - Buffer filled with the requested forms. BufferLength @@ -469,7 +469,7 @@ Returns: // HandleBufferLength = 0; HiiHandleBuffer = NULL; - + Status = gBS->LocateProtocol ( &gEfiHiiProtocolGuid, NULL, @@ -484,7 +484,7 @@ Returns: // Status = BdsLibGetHiiHandles (Hii, &HandleBufferLength, &HiiHandleBuffer); ASSERT_EFI_ERROR (Status); - + // // Get the Hii Handle that matches the StructureNode->ProducerName // @@ -518,7 +518,7 @@ Returns: *String ); - gBS->FreePool (HiiHandleBuffer); + FreePool (HiiHandleBuffer); return Status; } @@ -541,7 +541,7 @@ Arguments: Returns: TRUE The FirstTime is not later than the SecondTime. FALSE The FirstTime is later than the SecondTime. - + --*/ { if (FirstTime->Year != SecondTime->Year) { diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootMaint.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootMaint.c index 2f90e3c6b2..77b530dc57 100644 --- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootMaint.c +++ b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootMaint.c @@ -1,18 +1,18 @@ -/*++ +/*++ + +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: BootMaint.c - + Abstract: Boot Maintainence Main File @@ -58,15 +58,15 @@ Routine Description: Arguments: HiiHandle - Hii Handle of the package to be updated. - + MenuOption - The Menu whose string tokens need to be created Returns: EFI_SUCCESS - string tokens created successfully - + others - contain some errors - + --*/ { BM_MENU_ENTRY *NewMenuEntry; @@ -113,7 +113,7 @@ Routine Description: Arguments: - This - File explorer callback protocol pointer. + This - File explorer callback protocol pointer. KeyValue - Key value to identify the type of data to expect. Data - A pointer to the data being sent to the original exporting driver. Packet - A pointer to a packet of information which a driver passes back to the browser. @@ -122,7 +122,7 @@ Returns: EFI_SUCCESS - Callback ended successfully. Others - Contain some errors. - + --*/ { BMM_CALLBACK_DATA *Private; @@ -729,15 +729,15 @@ Routine Description: Arguments: ImageHandle - caller provided handle - + SystemTable - caller provided system tables Returns: EFI_SUCCESS - utility ended successfully - + others - contain some errors - + --*/ { EFI_LEGACY_BIOS_PROTOCOL *LegacyBios; @@ -849,13 +849,13 @@ Returns: // PackageList = PreparePackages (1, &gBdsStringPackGuid, bmBin); Status = Hii->NewPack (Hii, PackageList, &HiiHandle); - gBS->FreePool (PackageList); + FreePool (PackageList); BmmCallbackInfo->BmmHiiHandle = HiiHandle; PackageList = PreparePackages (1, &gBdsStringPackGuid, FEBin); Status = Hii->NewPack (Hii, PackageList, &HiiHandle); - gBS->FreePool (PackageList); + FreePool (PackageList); BmmCallbackInfo->FeHiiHandle = HiiHandle; @@ -1036,7 +1036,7 @@ Arguments: None. Returns: - None. + None. --*/ { STRING_DEPOSITORY *StringDepository; diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootOption.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootOption.c index 3fccd99e4a..b5afc7c7fe 100644 --- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootOption.c +++ b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootOption.c @@ -1,17 +1,17 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: BootOption.c - + Abstract: Provide boot option support for Application "BootMaint" @@ -19,7 +19,7 @@ Abstract: Include file system navigation, system handle selection Boot option manipulation - + Revision History --*/ @@ -42,7 +42,7 @@ Arguments: Menu type Returns: - NULL Cannot allocate memory for current menu + NULL Cannot allocate memory for current menu entry Others A valid pointer pointing to the allocated memory pool for current menu entry @@ -195,11 +195,11 @@ BOpt_GetMenuEntry ( ) /*++ Rountine Description : - Use this routine to get one particular menu entry in specified + Use this routine to get one particular menu entry in specified menu Arguments : - MenuOption The menu that we will search + MenuOption The menu that we will search MenuNumber The menunubmer that we want @@ -238,7 +238,7 @@ Routine Description protocol, Load File protocol. Building up the FileSystem Menu for user selection - All file system will be stored in FsOptionMenu + All file system will be stored in FsOptionMenu for future use. Arguments: @@ -303,7 +303,7 @@ Returns: // // If block IO exists check to see if it's remobable media // - RemovableMedia = BlkIo->Media->RemovableMedia; + RemovableMedia = BlkIo->Media->RemovableMedia; } // @@ -311,12 +311,12 @@ Returns: // MenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT); if (NULL == MenuEntry) { - SafeFreePool (SimpleFsHandle); + SafeFreePool (SimpleFsHandle); return EFI_OUT_OF_RESOURCES; } FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext; - + FileContext->Handle = SimpleFsHandle[Index]; MenuEntry->OptionNumber = Index; FileContext->FHandle = EfiLibOpenRoot (FileContext->Handle); @@ -364,7 +364,7 @@ Returns: TempStr ); OptionNumber++; - InsertTailList (&FsOptionMenu.Head, &MenuEntry->Link); + InsertTailList (&FsOptionMenu.Head, &MenuEntry->Link); } } @@ -386,7 +386,7 @@ Returns: for (Index = 0; Index < NoLoadFileHandles; Index++) { MenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT); if (NULL == MenuEntry) { - SafeFreePool (LoadFileHandle); + SafeFreePool (LoadFileHandle); return EFI_OUT_OF_RESOURCES; } @@ -494,7 +494,7 @@ Arguments: Returns: VOID - + --*/ { BM_MENU_ENTRY *MenuEntry; @@ -675,15 +675,15 @@ BOpt_GetLegacyOptions ( ) /*++ Routine Description: - + Build the LegacyFDMenu LegacyHDMenu LegacyCDMenu according to LegacyBios.GetBbsInfo(). - + Arguments: None Returns: The device info of legacy device. - + --*/ { BM_MENU_ENTRY *NewMenuEntry; @@ -832,16 +832,16 @@ BOpt_GetBootOptions ( /*++ Routine Description: - + Build the BootOptionMenu according to BootOrder Variable. - This Routine will access the Boot#### to get EFI_LOAD_OPTION - + This Routine will access the Boot#### to get EFI_LOAD_OPTION + Arguments: None Returns: The number of the Var Boot#### - + --*/ { UINTN Index; @@ -1148,7 +1148,7 @@ BOpt_IsEfiImageName ( /*++ Routine Description - Check whether current FileName point to a valid + Check whether current FileName point to a valid Efi Image File. Arguments: @@ -1157,7 +1157,7 @@ Arguments: Returns: TRUE - Is Efi Image FALSE - Not a valid Efi Image - + --*/ { // @@ -1198,7 +1198,7 @@ IsEfiAppReadFromFile ( { EFI_STATUS Status; EFI_FILE_HANDLE File; - + File = (EFI_FILE_HANDLE)FileHandle; Status = File->SetPosition (File, FileOffset); if (EFI_ERROR (Status)) { @@ -1219,15 +1219,15 @@ BOpt_IsEfiApp ( Routine Description: Check whether current FileName point to a valid Efi Application - + Arguments: Dir - Pointer to current Directory FileName - Pointer to current File name. - + Returns: TRUE - Is a valid Efi Application FALSE - not a valid Efi Application - + --*/ { EFI_STATUS Status; @@ -1268,7 +1268,7 @@ Routine Description in current system environment All valid handles in the system except those consume SimpleFs, LoadFile are stored in DriverMenu for future use. - + Arguments: None @@ -1363,13 +1363,13 @@ BOpt_GetBootOptionNumber ( /*++ Routine Description: - Get the Option Number that does not used - + Get the Option Number that does not used + Arguments: Returns: The Option Number - + --*/ { BM_MENU_ENTRY *NewMenuEntry; @@ -1415,7 +1415,7 @@ Returns: &gEfiGlobalVariableGuid, &OptionSize ); - if (NULL == OptionBuffer) + if (NULL == OptionBuffer) break; } } @@ -1440,13 +1440,13 @@ BOpt_GetDriverOptionNumber ( /*++ Routine Description: - Get the Option Number that does not used - + Get the Option Number that does not used + Arguments: Returns: The Option Number - + --*/ { BM_MENU_ENTRY *NewMenuEntry; @@ -1507,12 +1507,12 @@ BOpt_GetDriverOptions ( Routine Description: Build up all DriverOptionMenu - + Arguments: Returns: The Option Number - + --*/ { UINTN Index; @@ -1671,7 +1671,7 @@ SafeFreePool ( Routine Description: Wrap original FreePool gBS call in order to decrease code length - + Arguments: Returns: @@ -1679,7 +1679,7 @@ Returns: --*/ { if (Buffer != NULL) { - gBS->FreePool (Buffer); + FreePool (Buffer); Buffer = NULL; } } diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/UpdatePage.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/UpdatePage.c index 9c72f23768..1134c950e5 100644 --- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/UpdatePage.c +++ b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/UpdatePage.c @@ -1,18 +1,18 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: UpdatePage.c - + AgBStract: Dynamically Update the pages @@ -179,7 +179,8 @@ BootThisFile ( CHAR16 *ExitData; BDS_COMMON_OPTION *Option; - Status = gBS->AllocatePool (EfiBootServicesData, sizeof (BDS_COMMON_OPTION), &Option); + Option = AllocatePool (sizeof (BDS_COMMON_OPTION)); + Option->Description = FileContext->FileName; Option->DevicePath = FileContext->DevicePath; Option->LoadOptionsSize = 0; @@ -218,7 +219,7 @@ UpdateConCOMPage ( if (!EFI_ERROR (Status)) { for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) { NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index); - + CreateGotoOpCode ( FORM_CON_COM_SETUP_ID, NewMenuEntry->DisplayStringToken, diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManager.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManager.c index 23b8789617..77e079ee72 100644 --- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManager.c +++ b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManager.c @@ -1,15 +1,15 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php -Module Name: +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +Module Name: BootManager.c @@ -47,7 +47,7 @@ Routine Description: This is the function that is called to provide results data to the driver. This data consists of a unique key which is used to identify what data is either being passed back - or being asked for. + or being asked for. Arguments: @@ -57,7 +57,7 @@ Arguments: Data - A pointer to the data being sent to the original exporting driver. -Returns: +Returns: --*/ { @@ -170,7 +170,7 @@ Returns: // PackageList = PreparePackages (2, &BmGuid, BootManagerVfrBin, BdsStrings); Status = Hii->NewPack (Hii, PackageList, &gBootManagerHandle); - gBS->FreePool (PackageList); + FreePool (PackageList); // // This example does not implement worker functions @@ -296,20 +296,20 @@ Returns: Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0002, TRUE, UpdateData); - gBS->FreePool (UpdateData); + FreePool (UpdateData); ASSERT (gBrowser); BootMngrMenuResetRequired = FALSE; gBrowser->SendForm ( - gBrowser, - TRUE, - &gBootManagerHandle, - 1, - NULL, - NULL, - NULL, - NULL, + gBrowser, + TRUE, + &gBootManagerHandle, + 1, + NULL, + NULL, + NULL, + NULL, &BootMngrMenuResetRequired ); @@ -322,12 +322,12 @@ Returns: if (gOption == NULL) { return ; } - + // //Will leave browser, check any reset required change is applied? if yes, reset system // SetupResetReminder (); - + // // BugBug: This code looks repeated from the BDS. Need to save code space. // diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManager.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManager.c index 2da9c6fa36..7189a6e9b9 100644 --- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManager.c +++ b/EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManager.c @@ -1,15 +1,15 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php -Module Name: +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +Module Name: DeviceManager.c @@ -51,7 +51,7 @@ Routine Description: This is the function that is called to provide results data to the driver. This data consists of a unique key which is used to identify what data is either being passed back - or being asked for. + or being asked for. Arguments: @@ -61,7 +61,7 @@ Arguments: Data - A pointer to the data being sent to the original exporting driver. -Returns: +Returns: --*/ { @@ -103,7 +103,7 @@ Routine Description: Arguments: None - + Returns: --*/ @@ -120,7 +120,7 @@ Returns: PackageList = PreparePackages (1, &gBdsStringPackGuid, DeviceManagerVfrBin); Status = Hii->NewPack (Hii, PackageList, &FPCallbackInfo.DevMgrHiiHandle); - gBS->FreePool (PackageList); + FreePool (PackageList); // // This example does not implement worker functions for the NV accessor functions. Only a callback evaluator @@ -157,7 +157,7 @@ Returns: // Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) 0x0000, TRUE, UpdateData); - gBS->FreePool (UpdateData); + FreePool (UpdateData); return Status; } @@ -168,17 +168,17 @@ CallDeviceManager ( /*++ Routine Description: - + Call the browser and display the device manager Arguments: - + None - + Returns: EFI_SUCCESS - Operation is successful. EFI_INVALID_PARAMETER - If the inputs to SendForm function is not valid. - + --*/ { EFI_STATUS Status; @@ -337,7 +337,7 @@ Returns: } } - gBS->FreePool (String); + FreePool (String); CreateGotoOpCode ( 0x1000, // Device Manager Page @@ -391,7 +391,7 @@ Returns: // // Reset Buffer pointer to original location // - gBS->FreePool (Buffer); + FreePool (Buffer); } } // @@ -406,12 +406,12 @@ Returns: FPCallbackInfo.Data.VideoBIOS = 0; } else { FPCallbackInfo.Data.VideoBIOS = VideoOption[0]; - gBS->FreePool (VideoOption); + FreePool (VideoOption); } ASSERT (FPCallbackInfo.Data.VideoBIOS <= 1); - Status = gBS->AllocatePool (EfiBootServicesData, 2 * sizeof (IFR_OPTION), &IfrOptionList); + IfrOptionList = AllocatePool (2 * sizeof (IFR_OPTION)); if (IfrOptionList != NULL) { IfrOptionList[0].Flags = EFI_IFR_FLAG_INTERACTIVE; IfrOptionList[0].Key = SET_VIDEO_BIOS_TYPE_QUESTION_ID + 0x2000; @@ -437,7 +437,7 @@ Returns: UpdateData->DataCount = 4; Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) EFI_VBIOS_CLASS, TRUE, UpdateData); - gBS->FreePool (IfrOptionList); + FreePool (IfrOptionList); } BootDeviceMngrMenuResetRequired = FALSE; @@ -490,8 +490,8 @@ Returns: gCallbackKey = 4; } - gBS->FreePool (UpdateData); - gBS->FreePool (HiiHandles); + FreePool (UpdateData); + FreePool (HiiHandles); return Status; } diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.c index c659384d4d..62ffd8f1bd 100644 --- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.c +++ b/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.c @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -16,7 +16,7 @@ Module Name: Abstract: FrontPage routines to handle the callbacks and browser calls - + --*/ #include "Bds.h" @@ -53,7 +53,7 @@ Routine Description: This is the function that is called to provide results data to the driver. This data consists of a unique key which is used to identify what data is either being passed back - or being asked for. + or being asked for. Arguments: @@ -63,7 +63,7 @@ Arguments: Data - A pointer to the data being sent to the original exporting driver. -Returns: +Returns: --*/ { @@ -136,7 +136,7 @@ Returns: Lang ); - gBS->FreePool (LanguageString); + FreePool (LanguageString); gCallbackKey = 2; break; @@ -179,7 +179,7 @@ Returns: (UINTN) (((EFI_IFR_DATA_ENTRY *) (DataArray+1))->Data), 0 ); - gBS->FreePool (TmpStr); + FreePool (TmpStr); } break; @@ -198,12 +198,12 @@ InitializeFrontPage ( /*++ Routine Description: - + Initialize HII information for the FrontPage Arguments: None - + Returns: EFI_SUCCESS - The operation is successful. EFI_DEVICE_ERROR - If the dynamic opcode creation failed. @@ -254,7 +254,7 @@ Returns: Status = Hii->NewPack (Hii, PackageList, &gFrontPageHandle); - gBS->FreePool (PackageList); + FreePool (PackageList); // // There will be only one FormConfig in the system @@ -364,11 +364,11 @@ ReInitStrings: OptionCount++; } - gBS->FreePool (LanguageString); + FreePool (LanguageString); if (ReInitializeStrings) { - gBS->FreePool (StringBuffer); - gBS->FreePool (OptionList); + FreePool (StringBuffer); + FreePool (OptionList); return EFI_SUCCESS; } @@ -389,11 +389,11 @@ ReInitStrings: Hii->UpdateForm (Hii, gFrontPageHandle, (EFI_FORM_LABEL) 0x0002, TRUE, UpdateData); - gBS->FreePool (UpdateData); + FreePool (UpdateData); // - // gBS->FreePool (OptionList); + // FreePool (OptionList); // - gBS->FreePool (StringBuffer); + FreePool (StringBuffer); return Status; } @@ -404,13 +404,13 @@ CallFrontPage ( /*++ Routine Description: - + Call the browser and display the front page Arguments: - + None - + Returns: --*/ @@ -442,7 +442,7 @@ Returns: ); // // Check whether user change any option setting which needs a reset to be effective - // + // if (FrontPageMenuResetRequired) { EnableResetRequired (); } @@ -461,15 +461,15 @@ GetStringFromToken ( /*++ Routine Description: - + Acquire the string associated with the ProducerGuid and return it. Arguments: - + ProducerGuid - The Guid to search the HII database for Token - The token value of the string to extract String - The string that is extracted - + Returns: EFI_SUCCESS - The function returns EFI_SUCCESS always. @@ -529,11 +529,11 @@ Returns: ); if (EFI_ERROR (Status)) { - gBS->FreePool (*String); + FreePool (*String); *String = GetStringById (STRING_TOKEN (STR_MISSING_STRING)); } - gBS->FreePool (HiiHandleBuffer); + FreePool (HiiHandleBuffer); return EFI_SUCCESS; } @@ -545,14 +545,14 @@ ConvertProcessorToString ( /*++ Routine Description: - + Convert Processor Frequency Data to a string Arguments: - + ProcessorFrequency - The frequency data to process String - The string that is created - + Returns: --*/ @@ -590,14 +590,14 @@ ConvertMemorySizeToString ( /*++ Routine Description: - + Convert Memory Size to a string Arguments: - + MemorySize - The size of the memory to process String - The string that is created - + Returns: --*/ @@ -621,13 +621,13 @@ UpdateFrontPageStrings ( /*++ Routine Description: - + Update the banner information for the Front Page based on DataHub information Arguments: - + None - + Returns: --*/ @@ -689,7 +689,7 @@ Returns: GetStringFromToken (&Record->ProducerName, BiosVendor->BiosVersion, &NewString); TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_BIOS_VERSION; Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString); - gBS->FreePool (NewString); + FreePool (NewString); Find[0] = TRUE; } @@ -700,7 +700,7 @@ Returns: GetStringFromToken (&Record->ProducerName, SystemManufacturer->SystemProductName, &NewString); TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_COMPUTER_MODEL; Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString); - gBS->FreePool (NewString); + FreePool (NewString); Find[1] = TRUE; } @@ -711,7 +711,7 @@ Returns: GetStringFromToken (&Record->ProducerName, *ProcessorVersion, &NewString); TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_CPU_MODEL; Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString); - gBS->FreePool (NewString); + FreePool (NewString); Find[2] = TRUE; } @@ -722,7 +722,7 @@ Returns: ConvertProcessorToString (ProcessorFrequency, &NewString); TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_CPU_SPEED; Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString); - gBS->FreePool (NewString); + FreePool (NewString); Find[3] = TRUE; } @@ -730,12 +730,12 @@ Returns: (DataHeader->RecordType == EFI_MEMORY_ARRAY_START_ADDRESS_RECORD_NUMBER) ) { MemoryArray = (EFI_MEMORY_ARRAY_START_ADDRESS_DATA *) (DataHeader + 1); - ConvertMemorySizeToString((UINT32)(RShiftU64((MemoryArray->MemoryArrayEndAddress - + ConvertMemorySizeToString((UINT32)(RShiftU64((MemoryArray->MemoryArrayEndAddress - MemoryArray->MemoryArrayStartAddress + 1), 20)), &NewString); TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_MEMORY_SIZE; Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString); - gBS->FreePool (NewString); + FreePool (NewString); Find[4] = TRUE; } } @@ -753,15 +753,15 @@ PlatformBdsEnterFrontPage ( Routine Description: This function is the main entry of the platform setup entry. - The function will present the main menu of the system setup, + The function will present the main menu of the system setup, this is the platform reference part and can be customize. - + Arguments: TimeoutDefault - The fault time out value before the system continue to boot. ConnectAllHappened - The indicater to check if the connect all have already happended. - + Returns: None @@ -890,7 +890,7 @@ Returns: //Will leave browser, check any reset required change is applied? if yes, reset system // SetupResetReminder (); - + // // Automatically load current entry // Note: The following lines of code only execute when Auto boot diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/Language.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/Language.c index 21d61f1135..7057cab3de 100644 --- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/Language.c +++ b/EdkNt32Pkg/Dxe/PlatformBds/Generic/Language.c @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -16,7 +16,7 @@ Module Name: Abstract: Language settings - + Revision History --*/ @@ -311,7 +311,7 @@ Routine Description: Arguments: None - + Returns: --*/ @@ -326,7 +326,7 @@ Returns: HiiHandle = 0; Hii->NewPack (Hii, PackageList, &HiiHandle); - gBS->FreePool (PackageList); + FreePool (PackageList); } VOID @@ -336,12 +336,12 @@ InitializeLanguage ( /*++ Routine Description: - Determine the current language that will be used + Determine the current language that will be used based on language related EFI Variables Arguments: LangCodesSettingRequired - If required to set LangCode variable - + Returns: --*/ @@ -421,11 +421,11 @@ Returns: } if (LangCodes) { - gBS->FreePool (LangCodes); + FreePool (LangCodes); } if (LanguageString != NULL) { - gBS->FreePool (LanguageString); + FreePool (LanguageString); } } diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/MemoryTest.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/MemoryTest.c index d4e5bc50ef..40467c0e4f 100644 --- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/MemoryTest.c +++ b/EdkNt32Pkg/Dxe/PlatformBds/Generic/MemoryTest.c @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -38,19 +38,19 @@ PlatformBdsShowProgress ( /*++ Routine Description: - + Show progress bar with title above it. It only works in UGA mode. Arguments: - + TitleForeground - Foreground color for Title. TitleBackground - Background color for Title. Title - Title above progress bar. ProgressColor - Progress bar color. Progress - Progress (0-100) -Returns: - +Returns: + EFI_STATUS - Success update the progress bar --*/ @@ -203,19 +203,19 @@ BdsMemoryTest ( /*++ Routine Description: - - Perform the memory test base on the memory test intensive level, + + Perform the memory test base on the memory test intensive level, and update the memory resource. Arguments: - + Level - The memory test intensive level. -Returns: - +Returns: + EFI_STATUS - Success test all the system memory and update the memory resource - + --*/ { EFI_STATUS Status; @@ -274,7 +274,7 @@ Returns: &GenMemoryTest ); if (EFI_ERROR (Status)) { - gBS->FreePool (Pos); + FreePool (Pos); return EFI_SUCCESS; } @@ -291,7 +291,7 @@ Returns: // do the test, and then the status of EFI_NO_MEDIA will be returned by // "MemoryTestInit". So it does not need to test memory again, just return. // - gBS->FreePool (Pos); + FreePool (Pos); return EFI_SUCCESS; } @@ -300,7 +300,7 @@ Returns: if (TmpStr != NULL) { gST->ConOut->OutputString (gST->ConOut, TmpStr); - gBS->FreePool (TmpStr); + FreePool (TmpStr); } do { @@ -317,7 +317,7 @@ Returns: PrintXY (10, 10, NULL, NULL, TmpStr); gST->ConOut->SetCursorPosition (gST->ConOut, 0, 4); gST->ConOut->OutputString (gST->ConOut, TmpStr); - gBS->FreePool (TmpStr); + FreePool (TmpStr); } ASSERT (0); @@ -333,7 +333,7 @@ Returns: TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT)); if (TmpStr != NULL) { BdsLibOutputStrings (gST->ConOut, StrPercent, TmpStr, NULL); - gBS->FreePool (TmpStr); + FreePool (TmpStr); } TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST)); @@ -346,7 +346,7 @@ Returns: TestPercent, (UINTN) PreviousValue ); - gBS->FreePool (TmpStr); + FreePool (TmpStr); } } @@ -365,7 +365,7 @@ Returns: 100, (UINTN) PreviousValue ); - gBS->FreePool (TmpStr); + FreePool (TmpStr); } gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0); @@ -389,7 +389,7 @@ Done: TmpStr = GetStringById (STRING_TOKEN (STR_MEM_TEST_COMPLETED)); if (TmpStr != NULL) { StrCat (StrTotalMemory, TmpStr); - gBS->FreePool (TmpStr); + FreePool (TmpStr); } gST->ConOut->ClearScreen (gST->ConOut); @@ -405,7 +405,7 @@ Done: (UINTN) PreviousValue ); - gBS->FreePool (Pos); + FreePool (Pos); DataSize = sizeof (Value); Status = gRT->GetVariable ( diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/String.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/String.c index 412b7f8f17..604528d96a 100644 --- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/String.c +++ b/EdkNt32Pkg/Dxe/PlatformBds/Generic/String.c @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -36,7 +36,7 @@ InitializeStringSupport ( /*++ Routine Description: - + Initialize HII global accessor for string support Arguments: @@ -60,7 +60,7 @@ Returns: if (!EFI_ERROR (Status)) { PackageList = PreparePackages (1, &gBdsStringPackGuid, BdsStrings); Status = Hii->NewPack (Hii, PackageList, &gStringPackHandle); - gBS->FreePool (PackageList); + FreePool (PackageList); } return Status; @@ -79,7 +79,7 @@ Routine Description: Arguments: Id - String ID. - + Returns: CHAR16 * - String from ID. @@ -112,7 +112,7 @@ Returns: // // Free the old pool // - gBS->FreePool (String); + FreePool (String); // // Allocate new pool with correct value diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c index dd815789c6..83532e222b 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006, Intel Corporation +Copyright (c) 2006 - 2007, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -148,7 +148,7 @@ WinNtBlockIoDriverDiagnosticsRunDiagnostics ( if (DiagnosticType != EfiDriverDiagnosticTypeStandard) { *ErrorType = &gEfiBlockIoProtocolGuid; *BufferSize = 0x60; - gBS->AllocatePool (EfiBootServicesData, (UINTN) (*BufferSize), Buffer); + Buffer = AllocatePool ((UINTN) (*BufferSize)); CopyMem (*Buffer, L"Windows Block I/O Driver Diagnostics Failed\n", *BufferSize); return EFI_DEVICE_ERROR; } diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c index 5e7a985ed6..5666ec28ec 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c @@ -346,7 +346,7 @@ Returns: // FreeUnicodeStringTable (Private->ControllerNameTable); - gBS->FreePool (Private); + FreePool (Private); } return Status; @@ -430,12 +430,8 @@ Returns: WinNtIo->WinNtThunk->SetErrorMode (SEM_FAILCRITICALERRORS); - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (WIN_NT_BLOCK_IO_PRIVATE), - &Private - ); - ASSERT_EFI_ERROR (Status); + Private = AllocatePool (sizeof (WIN_NT_BLOCK_IO_PRIVATE)); + ASSERT (Private != NULL); EfiInitializeLock (&Private->Lock, EFI_TPL_NOTIFY); @@ -518,7 +514,7 @@ Returns: ); if (EFI_ERROR (Status)) { FreeUnicodeStringTable (Private->ControllerNameTable); - gBS->FreePool (Private); + FreePool (Private); } DEBUG ((EFI_D_INIT, "BlockDevice added: %s\n", Filename)); diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa index 305184531c..e6ba0f0bb7 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa @@ -46,6 +46,9 @@ UefiBootServicesTableLib + + MemoryAllocationLib + WinNtBlockIo.h diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c index 0027069b7a..e32ffe80d5 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -15,7 +15,7 @@ Module Name: Abstract: - Console based on Win32 APIs. + Console based on Win32 APIs. --*/ @@ -164,12 +164,8 @@ Returns: return Status; } - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (WIN_NT_SIMPLE_TEXT_PRIVATE_DATA), - &Private - ); - if (EFI_ERROR (Status)) { + Private = AllocatePool (sizeof (WIN_NT_SIMPLE_TEXT_PRIVATE_DATA)); + if (Private == NULL) { goto Done; } @@ -214,7 +210,7 @@ Done: gBS->CloseEvent (Private->SimpleTextIn.WaitForKey); } - gBS->FreePool (Private); + FreePool (Private); } return Status; @@ -300,7 +296,7 @@ Returns: // FreeUnicodeStringTable (Private->ControllerNameTable); - gBS->FreePool (Private); + FreePool (Private); } return Status; diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleIn.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleIn.c index 3af1ce6570..a4e2b3fece 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleIn.c +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleIn.c @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -15,15 +15,15 @@ Module Name: Abstract: - Console based on Win32 APIs. + Console based on Win32 APIs. This file attaches a SimpleTextIn protocol to a previously open window. - + The constructor for this protocol depends on an open window. Currently the SimpleTextOut protocol creates a window when it's constructor is called. - Thus this code must run after the constructor for the SimpleTextOut + Thus this code must run after the constructor for the SimpleTextOut protocol - + --*/ #include "Console.h" @@ -102,7 +102,7 @@ Returns: } else { return EFI_NOT_READY; } - + // // Check to see if we should return a scan code in place of Unicode character. // @@ -280,12 +280,8 @@ Returns: goto Done; } - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (INPUT_RECORD) * NtEventCount, - &InputRecord - ); - if (EFI_ERROR (Status)) { + InputRecord = AllocatePool (sizeof (INPUT_RECORD) * NtEventCount); + if (InputRecord == NULL) { Status = EFI_NOT_READY; goto Done; } @@ -315,7 +311,7 @@ Returns: Done: if (InputRecord != NULL) { - gBS->FreePool (InputRecord); + FreePool (InputRecord); } return Status; diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa index 8d8375b9d6..f60a5d1a66 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa @@ -43,6 +43,9 @@ UefiBootServicesTableLib + + MemoryAllocationLib + Console.h diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa index d820d9aea9..3874252791 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa @@ -46,6 +46,9 @@ UefiBootServicesTableLib + + MemoryAllocationLib + WinNtGopScreen.c diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c index 6013165996..bf2abc4067 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c @@ -1,6 +1,6 @@ /** @file -Copyright (c) 2006, Intel Corporation +Copyright (c) 2006 - 2007, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -125,12 +125,8 @@ WinNtGopDriverBindingStart ( // Allocate Private context data for SGO inteface. // Private = NULL; - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (GOP_PRIVATE_DATA), - &Private - ); - if (EFI_ERROR (Status)) { + Private = AllocatePool (sizeof (GOP_PRIVATE_DATA)); + if (Private == NULL) { goto Done; } // @@ -185,7 +181,7 @@ Done: FreeUnicodeStringTable (Private->ControllerNameTable); } - gBS->FreePool (Private); + FreePool (Private); } } @@ -270,7 +266,7 @@ WinNtGopDriverBindingStop ( // FreeUnicodeStringTable (Private->ControllerNameTable); - gBS->FreePool (Private); + FreePool (Private); } diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c index 47d849bd0a..89a5e4d298 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c @@ -85,7 +85,6 @@ WinNtGopQuerytMode ( OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info ) { - EFI_STATUS Status; GOP_PRIVATE_DATA *Private; Private = GOP_PRIVATE_DATA_FROM_THIS (This); @@ -94,13 +93,9 @@ WinNtGopQuerytMode ( return EFI_INVALID_PARAMETER; } - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION), - Info - ); - if (EFI_ERROR (Status)) { - return Status; + *Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION)); + if (*Info == NULL) { + return EFI_OUT_OF_RESOURCES; } *SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION); @@ -242,17 +237,13 @@ WinNtGopSetMode ( } - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * ModeData->HorizontalResolution, - &NewFillLine - ); - if (EFI_ERROR (Status)) { + NewFillLine = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * ModeData->HorizontalResolution); + if (NewFillLine == NULL) { return EFI_DEVICE_ERROR; } if (Private->FillLine != NULL) { - gBS->FreePool (Private->FillLine); + FreePool (Private->FillLine); } Private->FillLine = NewFillLine; @@ -637,7 +628,7 @@ WinNtGopThreadWindowProc ( case VK_F8: Key.ScanCode = SCAN_F8; break; case VK_F9: Key.ScanCode = SCAN_F9; break; case VK_F11: Key.ScanCode = SCAN_F11; break; - case VK_F12: Key.ScanCode = SCAN_F12; break; + case VK_F12: Key.ScanCode = SCAN_F12; break; } if (Key.ScanCode != 0) { @@ -885,8 +876,6 @@ WinNtGopConstructor ( GOP_PRIVATE_DATA *Private ) { - EFI_STATUS Status; - Private->ModeData = mGopModeData; Private->GraphicsOutput.QueryMode = WinNtGopQuerytMode; @@ -896,22 +885,15 @@ WinNtGopConstructor ( // // Allocate buffer for Graphics Output Protocol mode information // - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE), - (VOID **) &Private->GraphicsOutput.Mode - ); - if (EFI_ERROR (Status)) { - return Status; + Private->GraphicsOutput.Mode = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE)); + if (Private->GraphicsOutput.Mode == NULL) { + return EFI_OUT_OF_RESOURCES; } - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION), - (VOID **) &Private->GraphicsOutput.Mode->Info - ); - if (EFI_ERROR (Status)) { - return Status; + Private->GraphicsOutput.Mode->Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION)); + if (Private->GraphicsOutput.Mode->Info == NULL) { + return EFI_OUT_OF_RESOURCES; } + Private->GraphicsOutput.Mode->MaxMode = sizeof(mGopModeData) / sizeof(GOP_MODE_DATA); // // Till now, we have no idea about the window size. @@ -982,9 +964,9 @@ WinNtGopDestructor ( // if (Private->GraphicsOutput.Mode != NULL) { if (Private->GraphicsOutput.Mode->Info != NULL) { - gBS->FreePool (Private->GraphicsOutput.Mode->Info); + FreePool (Private->GraphicsOutput.Mode->Info); } - gBS->FreePool (Private->GraphicsOutput.Mode); + FreePool (Private->GraphicsOutput.Mode); } return EFI_SUCCESS; diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c index a4a7a32b54..3de4a86128 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -20,7 +20,7 @@ Abstract: Handle(1) - WinNtIo - DevicePath(1) - If a serial port is added to the system this driver creates a new handle. + If a serial port is added to the system this driver creates a new handle. The new handle is required, since the serial device must add an UART device pathnode. @@ -32,15 +32,15 @@ Abstract: Handle(1) - WinNtIo - DevicePath(1) - WinNtSerialPort - If the driver is unloaded Handle(2) is removed from the system and + If the driver is unloaded Handle(2) is removed from the system and gEfiWinNtSerialPortGuid is removed from Handle(1). Note: Handle(1) is any handle created by the Win NT Bus driver that is passed into the DriverBinding member functions of this driver. This driver requires - a Handle(1) to contain a WinNtIo protocol, a DevicePath protocol, and - the TypeGuid in the WinNtIo must be gEfiWinNtSerialPortGuid. - - If Handle(1) contains a gEfiWinNtSerialPortGuid protocol then the driver is + a Handle(1) to contain a WinNtIo protocol, a DevicePath protocol, and + the TypeGuid in the WinNtIo must be gEfiWinNtSerialPortGuid. + + If Handle(1) contains a gEfiWinNtSerialPortGuid protocol then the driver is loaded on the device. --*/ @@ -135,7 +135,7 @@ Returns: Status = EFI_UNSUPPORTED; goto Error; } - + // // Check the GUID to see if this is a handle type the driver supports // @@ -309,7 +309,7 @@ Returns: } } - gBS->FreePool (OpenInfoBuffer); + FreePool (OpenInfoBuffer); return Status; } @@ -334,12 +334,8 @@ Returns: // // Construct Private data // - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (WIN_NT_SERIAL_IO_PRIVATE_DATA), - &Private - ); - if (EFI_ERROR (Status)) { + Private = AllocatePool (sizeof (WIN_NT_SERIAL_IO_PRIVATE_DATA)); + if (Private == NULL) { goto Error; } @@ -474,12 +470,12 @@ Error: } if (Private->DevicePath != NULL) { - gBS->FreePool (Private->DevicePath); + FreePool (Private->DevicePath); } FreeUnicodeStringTable (Private->ControllerNameTable); - gBS->FreePool (Private); + FreePool (Private); } } @@ -592,11 +588,11 @@ Returns: } else { Private->WinNtThunk->CloseHandle (Private->NtHandle); - gBS->FreePool (Private->DevicePath); + FreePool (Private->DevicePath); FreeUnicodeStringTable (Private->ControllerNameTable); - gBS->FreePool (Private); + FreePool (Private); } } @@ -683,7 +679,7 @@ Routine Description: Arguments: - This - A pointer to the EFI_SERIAL_IO_PROTOCOL structrue. + This - A pointer to the EFI_SERIAL_IO_PROTOCOL structrue. BaudRate - The Baud rate of the serial device. ReceiveFifoDepth - The request depth of fifo on receive side. Timeout - the request timeout for a single charact. @@ -869,7 +865,7 @@ Returns: } if (Private->DevicePath != NULL) { - gBS->FreePool (Private->DevicePath); + FreePool (Private->DevicePath); } Private->DevicePath = NewDevicePath; @@ -1029,7 +1025,7 @@ Returns: if (ModemStatus & MS_RLSD_ON) { Bits |= EFI_SERIAL_CARRIER_DETECT; } - + // // Get ctrl status // @@ -1059,7 +1055,7 @@ Returns: if (Private->HardwareLoopbackEnable) { Bits |= EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE; } - + // // Get input buffer status // @@ -1145,7 +1141,7 @@ Returns: Control |= EFI_SERIAL_REQUEST_TO_SEND; WinNtSerialIoSetControl (&Private->SerialIo, Control); } - + // // Do the write // @@ -1285,10 +1281,10 @@ IsaSerialFifoFull ( Routine Description: Detect whether specific FIFO is full or not - + Arguments: Fifo SERIAL_DEV_FIFO *: A pointer to the Data Structure SERIAL_DEV_FIFO - + Returns: TRUE: the FIFO is full FALSE: the FIFO is not full @@ -1310,10 +1306,10 @@ IsaSerialFifoEmpty ( Routine Description: Detect whether specific FIFO is empty or not - + Arguments: Fifo SERIAL_DEV_FIFO *: A pointer to the Data Structure SERIAL_DEV_FIFO - + Returns: TRUE: the FIFO is empty FALSE: the FIFO is not empty @@ -1336,14 +1332,14 @@ IsaSerialFifoAdd ( Routine Description: Add data to specific FIFO - + Arguments: Fifo SERIAL_DEV_FIFO *: A pointer to the Data Structure SERIAL_DEV_FIFO - Data UINT8: the data added to FIFO - + Data UINT8: the data added to FIFO + Returns: EFI_SUCCESS: Add data to specific FIFO successfully - EFI_OUT_RESOURCE: Failed to add data because FIFO is already full + EFI_OUT_RESOURCE: Failed to add data because FIFO is already full --*/ // TODO: EFI_OUT_OF_RESOURCES - add return value to function comment @@ -1354,7 +1350,7 @@ IsaSerialFifoAdd ( if (IsaSerialFifoFull (Fifo)) { return EFI_OUT_OF_RESOURCES; } - + // // FIFO is not full can add data // @@ -1377,11 +1373,11 @@ IsaSerialFifoRemove ( Routine Description: Remove data from specific FIFO - + Arguments: Fifo SERIAL_DEV_FIFO *: A pointer to the Data Structure SERIAL_DEV_FIFO - Data UINT8*: the data removed from FIFO - + Data UINT8*: the data removed from FIFO + Returns: EFI_SUCCESS: Remove data from specific FIFO successfully EFI_OUT_RESOURCE: Failed to remove data because FIFO is empty @@ -1395,7 +1391,7 @@ IsaSerialFifoRemove ( if (IsaSerialFifoEmpty (Fifo)) { return EFI_OUT_OF_RESOURCES; } - + // // FIFO is not empty, can remove data // diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa index 63614a1d1a..e2cf66e2d1 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa @@ -47,6 +47,9 @@ DevicePathLib + + MemoryAllocationLib + WinNtSerialIo.h diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c index d55a153f9b..28fd819b1d 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006 - 2007, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -16,8 +16,8 @@ Module Name: Abstract: Produce Simple File System abstractions for directories on your PC using Win32 APIs. - The configuration of what devices to mount or emulate comes from NT - environment variables. The variables must be visible to the Microsoft* + The configuration of what devices to mount or emulate comes from NT + environment variables. The variables must be visible to the Microsoft* Developer Studio for them to work. * Other names and brands may be claimed as the property of others. @@ -142,7 +142,7 @@ Returns: for (Pointer = Str; *(Pointer + Count); Pointer++) { *Pointer = *(Pointer + Count); } - *Pointer = *(Pointer + Count); + *Pointer = *(Pointer + Count); } } @@ -284,12 +284,10 @@ Returns: goto Done; } - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE), - &Private - ); - if (EFI_ERROR (Status)) { + Private = AllocatePool (sizeof (WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE)); + if (Private == NULL) { + Status = EFI_OUT_OF_RESOURCES; + goto Done; } @@ -298,14 +296,9 @@ Returns: Private->FilePath = WinNtIo->EnvString; - Private->VolumeLabel = NULL; - Status = gBS->AllocatePool ( - EfiBootServicesData, - StrSize (L"EFI_EMULATED"), - &Private->VolumeLabel - ); - - if (EFI_ERROR (Status)) { + Private->VolumeLabel = AllocatePool (StrSize (L"EFI_EMULATED")); + if (Private->VolumeLabel == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } @@ -339,7 +332,7 @@ Done: FreeUnicodeStringTable (Private->ControllerNameTable); - gBS->FreePool (Private); + FreePool (Private); } gBS->CloseProtocol ( @@ -431,7 +424,7 @@ Returns: // FreeUnicodeStringTable (Private->ControllerNameTable); - gBS->FreePool (Private); + FreePool (Private); } return Status; @@ -489,33 +482,21 @@ Returns: Private = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (This); - PrivateFile = NULL; - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (WIN_NT_EFI_FILE_PRIVATE), - &PrivateFile - ); - if (EFI_ERROR (Status)) { + PrivateFile = AllocatePool (sizeof (WIN_NT_EFI_FILE_PRIVATE)); + if (PrivateFile == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } - PrivateFile->FileName = NULL; - Status = gBS->AllocatePool ( - EfiBootServicesData, - StrSize (Private->FilePath), - &PrivateFile->FileName - ); - if (EFI_ERROR (Status)) { + PrivateFile->FileName = AllocatePool (StrSize (Private->FilePath)); + if (PrivateFile->FileName == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } - PrivateFile->FilePath = NULL; - Status = gBS->AllocatePool ( - EfiBootServicesData, - StrSize (Private->FilePath), - &PrivateFile->FilePath - ); - if (EFI_ERROR (Status)) { + PrivateFile->FilePath = AllocatePool (StrSize (Private->FilePath)); + if (PrivateFile->FilePath == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } @@ -541,7 +522,7 @@ Returns: PrivateFile->LHandle = INVALID_HANDLE_VALUE; PrivateFile->DirHandle = INVALID_HANDLE_VALUE; PrivateFile->IsValidFindBuf = FALSE; - + *Root = &PrivateFile->EfiFile; Status = EFI_SUCCESS; @@ -550,14 +531,14 @@ Done: if (EFI_ERROR (Status)) { if (PrivateFile) { if (PrivateFile->FileName) { - gBS->FreePool (PrivateFile->FileName); + FreePool (PrivateFile->FileName); } if (PrivateFile->FilePath) { - gBS->FreePool (PrivateFile->FilePath); + FreePool (PrivateFile->FilePath); } - gBS->FreePool (PrivateFile); + FreePool (PrivateFile); } } @@ -675,13 +656,9 @@ Returns: // // Allocate buffer for FileName as the passed in FileName may be read only // - Status = gBS->AllocatePool ( - EfiBootServicesData, - StrSize (FileName), - &TempFileName - ); - if (EFI_ERROR (Status)) { - return Status; + TempFileName = AllocatePool (StrSize (FileName)); + if (TempFileName == NULL) { + return EFI_OUT_OF_RESOURCES; } StrCpy (TempFileName, FileName); FileName = TempFileName; @@ -705,7 +682,7 @@ OpenRoot: } // - // If file name does not equal to "." or "..", + // If file name does not equal to "." or "..", // then we trim the leading/trailing blanks and trailing dots // if (StrCmp (FileName, L".") != 0 && StrCmp (FileName, L"..") != 0) { @@ -722,7 +699,7 @@ OpenRoot: // // Trim trailing dots and blanks // - for (TempFileName = FileName + StrLen (FileName) - 1; + for (TempFileName = FileName + StrLen (FileName) - 1; TempFileName >= FileName && (*TempFileName == L' ' || *TempFileName == L'.'); TempFileName--) { ; @@ -733,27 +710,17 @@ OpenRoot: // // Attempt to open the file // - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (WIN_NT_EFI_FILE_PRIVATE), - &NewPrivateFile - ); - - if (EFI_ERROR (Status)) { + NewPrivateFile = AllocatePool (sizeof (WIN_NT_EFI_FILE_PRIVATE)); + if (NewPrivateFile == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } CopyMem (NewPrivateFile, PrivateFile, sizeof (WIN_NT_EFI_FILE_PRIVATE)); - NewPrivateFile->FilePath = NULL; - - Status = gBS->AllocatePool ( - EfiBootServicesData, - StrSize (PrivateFile->FileName), - &NewPrivateFile->FilePath - ); - - if (EFI_ERROR (Status)) { + NewPrivateFile->FilePath = AllocatePool (StrSize (PrivateFile->FileName)); + if (NewPrivateFile->FilePath == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } @@ -763,14 +730,9 @@ OpenRoot: StrCpy (NewPrivateFile->FilePath, PrivateFile->FilePath); } - NewPrivateFile->FileName = NULL; - Status = gBS->AllocatePool ( - EfiBootServicesData, - StrSize (NewPrivateFile->FilePath) + StrSize (L"\\") + StrSize (FileName), - &NewPrivateFile->FileName - ); - - if (EFI_ERROR (Status)) { + NewPrivateFile->FileName = AllocatePool (StrSize (NewPrivateFile->FilePath) + StrSize (L"\\") + StrSize (FileName)); + if (NewPrivateFile->FileName == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } @@ -783,7 +745,7 @@ OpenRoot: if (StrCmp (FileName, L"") != 0) { // // In case the filename becomes empty, especially after trimming dots and blanks - // + // StrCat (NewPrivateFile->FileName, L"\\"); StrCat (NewPrivateFile->FileName, FileName); } @@ -847,9 +809,9 @@ OpenRoot: if (StrCmp (NewPrivateFile->FileName, PrivateRoot->FilePath) == 0) { NewPrivateFile->IsRootDirectory = TRUE; - gBS->FreePool (NewPrivateFile->FilePath); - gBS->FreePool (NewPrivateFile->FileName); - gBS->FreePool (NewPrivateFile); + FreePool (NewPrivateFile->FilePath); + FreePool (NewPrivateFile->FileName); + FreePool (NewPrivateFile); goto OpenRoot; } @@ -861,15 +823,11 @@ OpenRoot: TempChar = *(RealFileName - 1); *(RealFileName - 1) = 0; - gBS->FreePool (NewPrivateFile->FilePath); + FreePool (NewPrivateFile->FilePath); NewPrivateFile->FilePath = NULL; - Status = gBS->AllocatePool ( - EfiBootServicesData, - StrSize (NewPrivateFile->FileName), - &NewPrivateFile->FilePath - ); - - if (EFI_ERROR (Status)) { + NewPrivateFile->FilePath = AllocatePool (StrSize (NewPrivateFile->FileName)); + if (NewPrivateFile->FilePath == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } @@ -923,13 +881,9 @@ OpenRoot: // if (NewPrivateFile->IsDirectoryPath) { - Status = gBS->AllocatePool ( - EfiBootServicesData, - StrSize (NewPrivateFile->FileName) + StrSize (L"\\*"), - &TempFileName - ); - - if (EFI_ERROR (Status)) { + TempFileName = AllocatePool (StrSize (NewPrivateFile->FileName) + StrSize (L"\\*")); + if (TempFileName == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } @@ -943,7 +897,7 @@ OpenRoot: LastError = PrivateFile->WinNtThunk->GetLastError (); if (LastError != ERROR_ALREADY_EXISTS) { - gBS->FreePool (TempFileName); + FreePool (TempFileName); Status = EFI_ACCESS_DENIED; goto Done; } @@ -1059,13 +1013,9 @@ OpenRoot: goto Done; } - Status = gBS->AllocatePool ( - EfiBootServicesData, - InfoSize, - &Info - ); - - if (EFI_ERROR (Status)) { + Info = AllocatePool (InfoSize); + if (Info == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } @@ -1081,19 +1031,19 @@ OpenRoot: } Done: ; - gBS->FreePool (FileName); + FreePool (FileName); if (EFI_ERROR (Status)) { if (NewPrivateFile) { if (NewPrivateFile->FileName) { - gBS->FreePool (NewPrivateFile->FileName); + FreePool (NewPrivateFile->FileName); } if (NewPrivateFile->FilePath) { - gBS->FreePool (NewPrivateFile->FilePath); + FreePool (NewPrivateFile->FilePath); } - gBS->FreePool (NewPrivateFile); + FreePool (NewPrivateFile); } } else { *NewHandle = &NewPrivateFile->EfiFile; @@ -1132,7 +1082,7 @@ Returns: } OldTpl = gBS->RaiseTPL (EFI_TPL_CALLBACK); - + PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This); if (PrivateFile->LHandle != INVALID_HANDLE_VALUE) { @@ -1151,13 +1101,13 @@ Returns: } if (PrivateFile->FileName) { - gBS->FreePool (PrivateFile->FileName); + FreePool (PrivateFile->FileName); } - gBS->FreePool (PrivateFile); + FreePool (PrivateFile); gBS->RestoreTPL (OldTpl); - + return EFI_SUCCESS; } @@ -1194,7 +1144,7 @@ Returns: } OldTpl = gBS->RaiseTPL (EFI_TPL_CALLBACK); - + PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This); Status = EFI_WARN_DELETE_FAILURE; @@ -1223,8 +1173,8 @@ Returns: } } - gBS->FreePool (PrivateFile->FileName); - gBS->FreePool (PrivateFile); + FreePool (PrivateFile->FileName); + FreePool (PrivateFile); gBS->RestoreTPL (OldTpl); @@ -1328,7 +1278,7 @@ Returns: } OldTpl = gBS->RaiseTPL (EFI_TPL_CALLBACK); - + PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This); if (PrivateFile->LHandle == INVALID_HANDLE_VALUE) { @@ -1344,11 +1294,7 @@ Returns: } FileInfoSize = SIZE_OF_EFI_FILE_SYSTEM_INFO; - gBS->AllocatePool ( - EfiBootServicesData, - FileInfoSize, - &FileInfo - ); + FileInfo = AllocatePool (FileInfoSize); Status = This->GetInfo ( This, @@ -1358,12 +1304,8 @@ Returns: ); if (Status == EFI_BUFFER_TOO_SMALL) { - gBS->FreePool (FileInfo); - gBS->AllocatePool ( - EfiBootServicesData, - FileInfoSize, - &FileInfo - ); + FreePool (FileInfo); + FileInfo = AllocatePool (FileInfoSize); Status = This->GetInfo ( This, &gEfiFileInfoGuid, @@ -1379,7 +1321,7 @@ Returns: FileSize = FileInfo->FileSize; - gBS->FreePool (FileInfo); + FreePool (FileInfo); if (Pos >= FileSize) { *BufferSize = 0; @@ -1545,7 +1487,7 @@ Returns: } OldTpl = gBS->RaiseTPL (EFI_TPL_CALLBACK); - + PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This); if (PrivateFile->LHandle == INVALID_HANDLE_VALUE) { @@ -1619,7 +1561,7 @@ Returns: } OldTpl = gBS->RaiseTPL (EFI_TPL_CALLBACK); - + PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This); if (PrivateFile->IsDirectoryPath) { @@ -1628,13 +1570,9 @@ Returns: goto Done; } - Status = gBS->AllocatePool ( - EfiBootServicesData, - StrSize (PrivateFile->FileName) + StrSize (L"\\*"), - &FileName - ); - - if (EFI_ERROR (Status)) { + FileName = AllocatePool (StrSize (PrivateFile->FileName) + StrSize (L"\\*")); + if (FileName == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } @@ -1653,7 +1591,7 @@ Returns: PrivateFile->IsValidFindBuf = TRUE; } - gBS->FreePool (FileName); + FreePool (FileName); Status = (PrivateFile->LHandle == INVALID_HANDLE_VALUE) ? EFI_DEVICE_ERROR : EFI_SUCCESS; } else { @@ -1956,14 +1894,10 @@ Returns: // // Try to get the drive name // - DriveName = NULL; DriveNameFound = FALSE; - Status = gBS->AllocatePool ( - EfiBootServicesData, - StrSize (PrivateFile->FilePath) + 1, - &DriveName - ); - if (EFI_ERROR (Status)) { + DriveName = AllocatePool (StrSize (PrivateFile->FilePath) + 1); + if (DriveName == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } @@ -2003,7 +1937,7 @@ Returns: &TotalClusters ); if (DriveName) { - gBS->FreePool (DriveName); + FreePool (DriveName); } if (NtStatus) { @@ -2161,16 +2095,10 @@ Returns: NewFileSystemInfo = (EFI_FILE_SYSTEM_INFO *) Buffer; - gBS->FreePool (PrivateRoot->VolumeLabel); - - PrivateRoot->VolumeLabel = NULL; - Status = gBS->AllocatePool ( - EfiBootServicesData, - StrSize (NewFileSystemInfo->VolumeLabel), - &PrivateRoot->VolumeLabel - ); - - if (EFI_ERROR (Status)) { + FreePool (PrivateRoot->VolumeLabel); + PrivateRoot->VolumeLabel = AllocatePool (StrSize (NewFileSystemInfo->VolumeLabel)); + if (PrivateRoot->VolumeLabel == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } @@ -2240,9 +2168,9 @@ Returns: goto Done; } - Status = gBS->AllocatePool (EfiBootServicesData, OldInfoSize, &OldFileInfo); - - if (EFI_ERROR (Status)) { + OldFileInfo = AllocatePool (OldInfoSize); + if (OldFileInfo == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } @@ -2252,13 +2180,9 @@ Returns: goto Done; } - Status = gBS->AllocatePool ( - EfiBootServicesData, - StrSize (PrivateFile->FileName), - &OldFileName - ); - - if (EFI_ERROR (Status)) { + OldFileName = AllocatePool (StrSize (PrivateFile->FileName)); + if (OldFileName == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } @@ -2268,13 +2192,9 @@ Returns: // Make full pathname from new filename and rootpath. // if (NewFileInfo->FileName[0] == '\\') { - Status = gBS->AllocatePool ( - EfiBootServicesData, - StrSize (PrivateRoot->FilePath) + StrSize (L"\\") + StrSize (NewFileInfo->FileName), - &NewFileName - ); - - if (EFI_ERROR (Status)) { + NewFileName = AllocatePool (StrSize (PrivateRoot->FilePath) + StrSize (L"\\") + StrSize (NewFileInfo->FileName)); + if (NewFileName == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } @@ -2282,13 +2202,9 @@ Returns: StrCat (NewFileName, L"\\"); StrCat (NewFileName, NewFileInfo->FileName + 1); } else { - Status = gBS->AllocatePool ( - EfiBootServicesData, - StrSize (PrivateFile->FilePath) + StrSize (L"\\") + StrSize (NewFileInfo->FileName), - &NewFileName - ); - - if (EFI_ERROR (Status)) { + NewFileName = AllocatePool (StrSize (PrivateFile->FilePath) + StrSize (L"\\") + StrSize (NewFileInfo->FileName)); + if (NewFileName == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } @@ -2394,30 +2310,22 @@ Returns: // // modify file name // - gBS->FreePool (PrivateFile->FileName); - - Status = gBS->AllocatePool ( - EfiBootServicesData, - StrSize (NewFileName), - &PrivateFile->FileName - ); + FreePool (PrivateFile->FileName); - if (EFI_ERROR (Status)) { + PrivateFile->FileName = AllocatePool (StrSize (NewFileName)); + if (PrivateFile->FileName == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } StrCpy (PrivateFile->FileName, NewFileName); - Status = gBS->AllocatePool ( - EfiBootServicesData, - StrSize (NewFileName) + StrSize (L"\\*"), - &TempFileName - ); + TempFileName = AllocatePool (StrSize (NewFileName) + StrSize (L"\\*")); StrCpy (TempFileName, NewFileName); if (!PrivateFile->IsDirectoryPath) { - PrivateFile->LHandle = PrivateFile->WinNtThunk->CreateFile ( + PrivateFile->LHandle = PrivateFile->WinNtThunk->CreateFile ( TempFileName, PrivateFile->IsOpenedByRead ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, @@ -2427,7 +2335,7 @@ Returns: NULL ); - gBS->FreePool (TempFileName); + FreePool (TempFileName); // // Flush buffers just in case @@ -2450,7 +2358,7 @@ Returns: StrCat (TempFileName, L"\\*"); PrivateFile->LHandle = PrivateFile->WinNtThunk->FindFirstFile (TempFileName, &FindBuf); - gBS->FreePool (TempFileName); + FreePool (TempFileName); } } else { Reopen: ; @@ -2462,11 +2370,7 @@ Reopen: ; goto Done; } - Status = gBS->AllocatePool ( - EfiBootServicesData, - StrSize (OldFileName) + StrSize (L"\\*"), - &TempFileName - ); + TempFileName = AllocatePool (StrSize (OldFileName) + StrSize (L"\\*")); StrCpy (TempFileName, OldFileName); @@ -2495,7 +2399,7 @@ Reopen: ; PrivateFile->LHandle = PrivateFile->WinNtThunk->FindFirstFile (TempFileName, &FindBuf); } - gBS->FreePool (TempFileName); + FreePool (TempFileName); goto Done; @@ -2637,15 +2541,15 @@ Reopen: ; Done: if (OldFileInfo != NULL) { - gBS->FreePool (OldFileInfo); + FreePool (OldFileInfo); } if (OldFileName != NULL) { - gBS->FreePool (OldFileName); + FreePool (OldFileName); } if (NewFileName != NULL) { - gBS->FreePool (NewFileName); + FreePool (NewFileName); } gBS->RestoreTPL (OldTpl); @@ -2696,7 +2600,7 @@ Returns: } OldTpl = gBS->RaiseTPL (EFI_TPL_CALLBACK); - + PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This); if (PrivateFile->LHandle == INVALID_HANDLE_VALUE) { diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa index 725d7d0dd2..6c0ef4867f 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa @@ -46,6 +46,9 @@ UefiBootServicesTableLib + + MemoryAllocationLib + WinNtSimpleFileSystem.h diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa index 13c38296c3..86b667bfc4 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa @@ -43,6 +43,9 @@ UefiBootServicesTableLib + + MemoryAllocationLib + WinNtUga.h diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c index a270ec7b0d..520856007d 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -19,9 +19,9 @@ Abstract: UGA is short hand for Universal Graphics Abstraction protocol. - This file is a verision of UgaIo the uses WinNtThunk system calls as an IO + This file is a verision of UgaIo the uses WinNtThunk system calls as an IO abstraction. For a PCI device WinNtIo would be replaced with - a PCI IO abstraction that abstracted a specific PCI device. + a PCI IO abstraction that abstracted a specific PCI device. --*/ @@ -137,13 +137,8 @@ Returns: // // Allocate Private context data for SGO inteface. // - Private = NULL; - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (UGA_PRIVATE_DATA), - &Private - ); - if (EFI_ERROR (Status)) { + Private = AllocatePool (sizeof (UGA_PRIVATE_DATA)); + if (Private == NULL) { goto Done; } // @@ -198,7 +193,7 @@ Done: FreeUnicodeStringTable (Private->ControllerNameTable); } - gBS->FreePool (Private); + FreePool (Private); } } @@ -287,7 +282,7 @@ Returns: // FreeUnicodeStringTable (Private->ControllerNameTable); - gBS->FreePool (Private); + FreePool (Private); } @@ -308,9 +303,9 @@ Arguments: String - Unicode string. -Returns: +Returns: - UINTN of the number represented by String. + UINTN of the number represented by String. --*/ { diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c index 7d40eb7d8b..b6c1ce26b8 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c @@ -1,22 +1,22 @@ /*++ -Copyright (c) 2006 - 2007, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: - + WinNtUgaScreen.c Abstract: - This file produces the graphics abstration of UGA. It is called by - WinNtUgaDriver.c file which deals with the EFI 1.1 driver model. + This file produces the graphics abstration of UGA. It is called by + WinNtUgaDriver.c file which deals with the EFI 1.1 driver model. This file just does graphics. --*/ @@ -72,7 +72,7 @@ WinNtUgaGetMode ( Returns: EFI_SUCCESS - Mode information returned. - EFI_NOT_STARTED - Video display is not initialized. Call SetMode () + EFI_NOT_STARTED - Video display is not initialized. Call SetMode () EFI_INVALID_PARAMETER - One of the input args was NULL. --*/ @@ -123,7 +123,7 @@ WinNtUgaSetMode ( Returns: EFI_SUCCESS - Mode information returned. - EFI_NOT_STARTED - Video display is not initialized. Call SetMode () + EFI_NOT_STARTED - Video display is not initialized. Call SetMode () EFI_INVALID_PARAMETER - One of the input args was NULL. --*/ @@ -224,17 +224,13 @@ WinNtUgaSetMode ( } - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (EFI_UGA_PIXEL) * HorizontalResolution, - &NewFillLine - ); - if (EFI_ERROR (Status)) { + NewFillLine = AllocatePool (sizeof (EFI_UGA_PIXEL) * HorizontalResolution); + if (NewFillLine == NULL) { return EFI_DEVICE_ERROR; } if (Private->FillLine != NULL) { - gBS->FreePool (Private->FillLine); + FreePool (Private->FillLine); } Private->FillLine = NewFillLine; @@ -281,19 +277,19 @@ WinNtUgaBlt ( Routine Description: Blt pixels from the rectangle (Width X Height) formed by the BltBuffer onto the graphics screen starting a location (X, Y). (0, 0) is defined as - the upper left hand side of the screen. (X, Y) can be outside of the - current screen geometry and the BltBuffer will be cliped when it is - displayed. X and Y can be negative or positive. If Width or Height is + the upper left hand side of the screen. (X, Y) can be outside of the + current screen geometry and the BltBuffer will be cliped when it is + displayed. X and Y can be negative or positive. If Width or Height is bigger than the current video screen the image will be clipped. Arguments: This - Protocol instance pointer. - X - X location on graphics screen. + X - X location on graphics screen. Y - Y location on the graphics screen. Width - Width of BltBuffer. Height - Hight of BltBuffer BltOperation - Operation to perform on BltBuffer and video memory - BltBuffer - Buffer containing data to blt into video buffer. This + BltBuffer - Buffer containing data to blt into video buffer. This buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL) SourceX - If the BltOperation is a EfiCopyBlt this is the source of the copy. For other BLT operations this argument is not @@ -301,11 +297,11 @@ WinNtUgaBlt ( SourceX - If the BltOperation is a EfiCopyBlt this is the source of the copy. For other BLT operations this argument is not used. - + Returns: EFI_SUCCESS - The palette is updated with PaletteArray. EFI_INVALID_PARAMETER - BltOperation is not valid. - EFI_DEVICE_ERROR - A hardware error occured writting to the video + EFI_DEVICE_ERROR - A hardware error occured writting to the video buffer. --*/ @@ -445,7 +441,7 @@ WinNtUgaBlt ( // we may miss some data for a short period of time this is no different than // a write combining on writes to a frame buffer. // - + Private->WinNtThunk->UpdateWindow (Private->WindowHandle); } @@ -501,7 +497,7 @@ WinNtUgaThreadWindowProc ( /*++ Routine Description: - Win32 Windows event handler. + Win32 Windows event handler. Arguments: See Win32 Book @@ -631,7 +627,7 @@ Returns: case VK_F8: Key.ScanCode = SCAN_F8; break; case VK_F9: Key.ScanCode = SCAN_F9; break; case VK_F11: Key.ScanCode = SCAN_F11; break; - case VK_F12: Key.ScanCode = SCAN_F12; break; + case VK_F12: Key.ScanCode = SCAN_F12; break; } if (Key.ScanCode != 0) { @@ -693,7 +689,7 @@ WinNtUgaThreadWinMain ( Routine Description: This thread simulates the end of WinMain () aplication. Each Winow nededs - to process it's events. The messages are dispatched to + to process it's events. The messages are dispatched to WinNtUgaThreadWindowProc (). Be very careful sine WinNtUgaThreadWinMain () and WinNtUgaThreadWindowProc () @@ -974,8 +970,8 @@ KillNtUgaThread ( /*++ Routine Description: - - This is the UGA screen's callback notification function for exit-boot-services. + + This is the UGA screen's callback notification function for exit-boot-services. All we do here is call WinNtUgaDestructor(). Arguments: diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c index 1e2b370900..b0e1c2b816 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c @@ -136,18 +136,11 @@ AllocateMemory ( IN UINTN Size ) { - EFI_STATUS Status; VOID *Buffer; - Status = gBS->AllocatePool ( - EfiBootServicesData, - Size, - (VOID *)&Buffer - ); - if (EFI_ERROR (Status)) { - ASSERT (FALSE); - return NULL; - } + Buffer = AllocatePool (Size); + ASSERT (Buffer != NULL); + return Buffer; } @@ -341,13 +334,9 @@ Returns: } if (Status != EFI_ALREADY_STARTED) { - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (WIN_NT_BUS_DEVICE), - (VOID *) &WinNtBusDevice - ); - if (EFI_ERROR (Status)) { - return Status; + WinNtBusDevice = AllocatePool (sizeof (WIN_NT_BUS_DEVICE)); + if (WinNtBusDevice == NULL) { + return EFI_OUT_OF_RESOURCES; } WinNtBusDevice->Signature = WIN_NT_BUS_DEVICE_SIGNATURE; @@ -368,7 +357,7 @@ Returns: ); if (EFI_ERROR (Status)) { FreeUnicodeStringTable (WinNtBusDevice->ControllerNameTable); - gBS->FreePool (WinNtBusDevice); + FreePool (WinNtBusDevice); return Status; } } @@ -464,7 +453,7 @@ Returns: Count ); if (WinNtDevice->DevicePath == NULL) { - gBS->FreePool (WinNtDevice); + FreePool (WinNtDevice); return EFI_OUT_OF_RESOURCES; } @@ -490,7 +479,7 @@ Returns: ); if (EFI_ERROR (Status)) { FreeUnicodeStringTable (WinNtDevice->ControllerNameTable); - gBS->FreePool (WinNtDevice); + FreePool (WinNtDevice); } else { // // Open For Child Device @@ -516,7 +505,7 @@ Returns: StartString = SubString; } - gBS->FreePool (TempStr); + FreePool (TempStr); } return EFI_SUCCESS; @@ -588,7 +577,7 @@ Returns: FreeUnicodeStringTable (WinNtBusDevice->ControllerNameTable); - gBS->FreePool (WinNtBusDevice); + FreePool (WinNtBusDevice); gBS->CloseProtocol ( ControllerHandle, @@ -652,7 +641,7 @@ Returns: // Close the child handle // FreeUnicodeStringTable (WinNtDevice->ControllerNameTable); - gBS->FreePool (WinNtDevice); + FreePool (WinNtDevice); } } diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa index 61da7b0cf3..39d6c7b2aa 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa @@ -51,6 +51,9 @@ DevicePathLib + + MemoryAllocationLib + WinNtBusDriver.h diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Cpu.c b/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Cpu.c index 05a2eebae3..c777ec7c33 100644 --- a/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Cpu.c +++ b/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Cpu.c @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -114,7 +114,7 @@ WinNtEnableInterrupt ( Routine Description: This routine provides support for emulation of the interrupt enable of the - the system. For our purposes, CPU enable is just a BOOLEAN that the Timer + the system. For our purposes, CPU enable is just a BOOLEAN that the Timer Architectural Protocol observes in order to defer behaviour while in its emulated interrupt, or timer tick. @@ -148,7 +148,7 @@ WinNtDisableInterrupt ( Routine Description: This routine provides support for emulation of the interrupt disable of the - the system. For our purposes, CPU enable is just a BOOLEAN that the Timer + the system. For our purposes, CPU enable is just a BOOLEAN that the Timer Architectural Protocol observes in order to defer behaviour while in its emulated interrupt, or timer tick. @@ -183,7 +183,7 @@ WinNtGetInterruptState ( Routine Description: This routine provides support for emulation of the interrupt disable of the - the system. For our purposes, CPU enable is just a BOOLEAN that the Timer + the system. For our purposes, CPU enable is just a BOOLEAN that the Timer Architectural Protocol observes in order to defer behaviour while in its emulated interrupt, or timer tick. @@ -223,8 +223,8 @@ WinNtInit ( Routine Description: - This routine would support generation of a CPU INIT. At - present, this code does not provide emulation. + This routine would support generation of a CPU INIT. At + present, this code does not provide emulation. Arguments: @@ -258,8 +258,8 @@ WinNtRegisterInterruptHandler ( Routine Description: - This routine would support registration of an interrupt handler. At - present, this code does not provide emulation. + This routine would support registration of an interrupt handler. At + present, this code does not provide emulation. Arguments: @@ -305,8 +305,8 @@ WinNtGetTimerValue ( Routine Description: - This routine would support querying of an on-CPU timer. At present, - this code does not provide timer emulation. + This routine would support querying of an on-CPU timer. At present, + this code does not provide timer emulation. Arguments: @@ -325,7 +325,7 @@ Returns: if (TimerValue == NULL) { return EFI_INVALID_PARAMETER; } - + // // No timer supported // @@ -345,8 +345,8 @@ WinNtSetMemoryAttributes ( Routine Description: - This routine would support querying of an on-CPU timer. At present, - this code does not provide timer emulation. + This routine would support querying of an on-CPU timer. At present, + this code does not provide timer emulation. Arguments: @@ -405,7 +405,7 @@ Returns: Status - EFI_SUCCESS - protocol instance can be published + EFI_SUCCESS - protocol instance can be published EFI_OUT_OF_RESOURCES - cannot allocate protocol data structure EFI_DEVICE_ERROR - cannot create the thread @@ -417,12 +417,8 @@ Returns: CPU_ARCH_PROTOCOL_PRIVATE *Private; VOID *Registration; - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (CPU_ARCH_PROTOCOL_PRIVATE), - &Private - ); - ASSERT_EFI_ERROR (Status); + Private = AllocatePool (sizeof (CPU_ARCH_PROTOCOL_PRIVATE)); + ASSERT (Private != NULL); Private->Signature = CPU_ARCH_PROT_PRIVATE_SIGNATURE; Private->Cpu.FlushDataCache = WinNtFlushCpuDataCache; @@ -479,7 +475,7 @@ Returns: DEBUG ((EFI_D_ERROR, "CPU Architectural Protocol Loaded\n")); - + return Status; } @@ -495,8 +491,8 @@ Routine Description: Arguments: String - Unicode string. -Returns: - UINTN of the number represented by String. +Returns: + UINTN of the number represented by String. --*/ { @@ -656,7 +652,7 @@ Returns: Status = Hii->NewPack (Hii, PackageList, &StringHandle); ASSERT (!EFI_ERROR (Status)); - gBS->FreePool (PackageList); + FreePool (PackageList); // // Store processor version data record to data hub @@ -717,7 +713,7 @@ Returns: TotalSize ); - gBS->FreePool (RecordBuffer.Raw); + FreePool (RecordBuffer.Raw); } gBS->CloseProtocol ( diff --git a/EdkNt32Pkg/Library/DxeWinNtLib/DxeWinNtLib.msa b/EdkNt32Pkg/Library/DxeWinNtLib/DxeWinNtLib.msa index 23d7157d8b..4ae0d0c10c 100644 --- a/EdkNt32Pkg/Library/DxeWinNtLib/DxeWinNtLib.msa +++ b/EdkNt32Pkg/Library/DxeWinNtLib/DxeWinNtLib.msa @@ -17,12 +17,12 @@ FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052 - IA32 X64 IPF EBC + IA32 false DxeWinNtLib - + WinNtLib diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsBoot.c b/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsBoot.c index 0c744db224..05c8e7d1e3 100644 --- a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsBoot.c +++ b/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsBoot.c @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -30,7 +30,7 @@ BdsLibDoLegacyBoot ( /*++ Routine Description: - + Boot the legacy system with the boot option Arguments: @@ -41,7 +41,7 @@ Returns: EFI_UNSUPPORTED - There is no legacybios protocol, do not support legacy boot. - + EFI_STATUS - Return the status of LegacyBios->LegacyBoot (). --*/ @@ -89,15 +89,15 @@ BdsLibBootViaBootOption ( Routine Description: - Process the boot option follow the EFI 1.1 specification and + Process the boot option follow the EFI 1.1 specification and special treat the legacy boot option with BBS_DEVICE_PATH. Arguments: Option - The boot option need to be processed - - DevicePath - The device path which describe where to load - the boot image or the legcy BBS device path + + DevicePath - The device path which describe where to load + the boot image or the legcy BBS device path to boot the legacy OS ExitDataSize - Returned directly from gBS->StartImage () @@ -167,7 +167,7 @@ Returns: // Signal the EFI_EVENT_SIGNAL_READY_TO_BOOT event // EfiSignalEventReadyToBoot (); - + // // Set Boot Current // @@ -240,7 +240,7 @@ Returns: BlkIo->Media->BlockSize, Buffer ); - gBS->FreePool (Buffer); + FreePool (Buffer); } } @@ -324,8 +324,8 @@ BdsBootByDiskSignatureAndPartition ( Routine Description: Check to see if a hard ware device path was passed in. If it was then search - all the block IO devices for the passed in hard drive device path. - + all the block IO devices for the passed in hard drive device path. + Arguments: Option - The current processing boot option. @@ -347,7 +347,7 @@ Returns: EFI_SUCCESS - Status from gBS->StartImage (), or BootByDiskSignatureAndPartition () - + EFI_NOT_FOUND - If the Device Path is not found in the system --*/ @@ -406,7 +406,7 @@ Returns: // find HardDriver device path node // while (!IsDevicePathEnd (DevicePath)) { - if ((DevicePathType (DevicePath) == MEDIA_DEVICE_PATH) && + if ((DevicePathType (DevicePath) == MEDIA_DEVICE_PATH) && (DevicePathSubType (DevicePath) == MEDIA_HARDDRIVE_DP) ) { BlockIoHdDevicePath = DevicePath; @@ -460,7 +460,7 @@ Returns: } } - gBS->FreePool (BlockIoBuffer); + FreePool (BlockIoBuffer); return Status; } @@ -532,7 +532,7 @@ Returns: &BootOptionSize ); if (NULL == BootOptionVar) { - gBS->FreePool (BootOrder); + FreePool (BootOrder); return EFI_OUT_OF_RESOURCES; } @@ -549,11 +549,11 @@ Returns: if ((OptionDevicePathSize == DevicePathSize) && (CompareMem (DevicePath, OptionDevicePath, DevicePathSize) == 0)) { BdsDeleteBootOption (BootOrder[Index], BootOrder, &BootOrderSize); - gBS->FreePool (BootOptionVar); + FreePool (BootOptionVar); break; } - gBS->FreePool (BootOptionVar); + FreePool (BootOptionVar); Index++; } @@ -565,7 +565,7 @@ Returns: BootOrder ); - gBS->FreePool (BootOrder); + FreePool (BootOrder); return Status; } @@ -636,7 +636,7 @@ Returns: &BootOptionSize ); if (NULL == BootOptionVar) { - gBS->FreePool (BootOrder); + FreePool (BootOrder); return EFI_OUT_OF_RESOURCES; } @@ -652,7 +652,7 @@ Returns: // if ((DevicePathType (OptionDevicePath) == BBS_DEVICE_PATH) && (DevicePathSubType (OptionDevicePath) == BBS_BBS_DP)) { - gBS->FreePool (BootOptionVar); + FreePool (BootOptionVar); Index++; continue; } @@ -664,7 +664,7 @@ Returns: TempDevicePath = EfiNextDevicePathNode (TempDevicePath); } // - // Skip the boot option that point to a file, since the device path in + // Skip the boot option that point to a file, since the device path in // removable media boot option doesn't contains a file name. // if (((DevicePathType (LastDeviceNode) == MEDIA_DEVICE_PATH) && @@ -673,7 +673,7 @@ Returns: // Skip boot option for internal Shell, it's always valid // (EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) LastDeviceNode) != NULL)) { - gBS->FreePool (BootOptionVar); + FreePool (BootOptionVar); Index++; continue; } @@ -721,7 +721,7 @@ Returns: BootOrder[Index] = 0xffff; } - gBS->FreePool (BootOptionVar); + FreePool (BootOptionVar); Index++; } @@ -743,7 +743,7 @@ Returns: BootOrder ); - gBS->FreePool (BootOrder); + FreePool (BootOrder); return Status; } @@ -877,7 +877,7 @@ Returns: } if (NumberFileSystemHandles) { - gBS->FreePool (FileSystemHandles); + FreePool (FileSystemHandles); } // // Parse Network Boot Device @@ -904,7 +904,7 @@ Returns: } if (NumberLoadFileHandles) { - gBS->FreePool (LoadFileHandles); + FreePool (LoadFileHandles); } // // Check if we have on flash shell @@ -946,7 +946,7 @@ Returns: } if (FvHandleCount) { - gBS->FreePool (FvHandleBuffer); + FreePool (FvHandleBuffer); } // // Make sure every boot only have one time @@ -966,13 +966,13 @@ BdsLibBuildOptionFromHandle ( /*++ Routine Description: - + Build the boot option with the handle parsed in - + Arguments: Handle - The handle which present the device path to create boot option - + BdsBootOptionList - The header of the link list which indexed all current boot options @@ -1002,14 +1002,14 @@ BdsLibBuildOptionFromShell ( /*++ Routine Description: - + Build the on flash shell boot option with the handle parsed in - + Arguments: Handle - The handle which present the device path to create on flash shell boot option - + BdsBootOptionList - The header of the link list which indexed all current boot options @@ -1044,13 +1044,13 @@ BdsLibBootNext ( /*++ Routine Description: - + Boot from the EFI1.1 spec defined "BootNext" variable - + Arguments: None - + Returns: None diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsConnect.c b/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsConnect.c index 9c649f1f82..772b339f9b 100644 --- a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsConnect.c +++ b/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsConnect.c @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -26,12 +26,12 @@ BdsLibConnectAll ( /*++ Routine Description: - + This function will connect all the system driver to controller first, and then special connect the default console, this make sure all the system controller avialbe and the platform default console connected. - + Arguments: None @@ -66,12 +66,12 @@ BdsLibGenericConnectAll ( /*++ Routine Description: - + This function will connect all the system drivers to all controllers - first, and then connect all the console devices the system current + first, and then connect all the console devices the system current have. After this we should get all the device work and console avariable if the system have console device. - + Arguments: None @@ -100,7 +100,7 @@ Routine Description: path node. If the handle associate with one device path node can not be created success, then still give one chance to do the dispatch, which load the missing drivers if possible. - + Arguments: DevicePathToConnect - The device path which will be connected, it can @@ -108,12 +108,12 @@ Arguments: Returns: - EFI_SUCCESS - All handles associate with every device path + EFI_SUCCESS - All handles associate with every device path node have been created - + EFI_OUT_OF_RESOURCES - There is no resource to create new handles - - EFI_NOT_FOUND - Create the handle associate with one device + + EFI_NOT_FOUND - Create the handle associate with one device path node failed --*/ @@ -206,7 +206,7 @@ Returns: } while (DevicePath != NULL); if (CopyOfDevicePath != NULL) { - gBS->FreePool (CopyOfDevicePath); + FreePool (CopyOfDevicePath); } // // All handle with DevicePath exists in the handle database @@ -224,7 +224,7 @@ Routine Description: This function will connect all current system handles recursively. The connection will finish until every handle's child handle created if it have. - + Arguments: None @@ -232,8 +232,8 @@ Arguments: Returns: EFI_SUCCESS - All handles and it's child handle have been connected - - EFI_STATUS - Return the status of gBS->LocateHandleBuffer(). + + EFI_STATUS - Return the status of gBS->LocateHandleBuffer(). --*/ { @@ -257,7 +257,7 @@ Returns: Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE); } - gBS->FreePool (HandleBuffer); + FreePool (HandleBuffer); return EFI_SUCCESS; } @@ -272,7 +272,7 @@ Routine Description: This function will disconnect all current system handles. The disconnection will finish until every handle have been disconnected. - + Arguments: None @@ -280,8 +280,8 @@ Arguments: Returns: EFI_SUCCESS - All handles have been disconnected - - EFI_STATUS - Return the status of gBS->LocateHandleBuffer(). + + EFI_STATUS - Return the status of gBS->LocateHandleBuffer(). --*/ { @@ -308,7 +308,7 @@ Returns: Status = gBS->DisconnectController (HandleBuffer[Index], NULL, NULL); } - gBS->FreePool (HandleBuffer); + FreePool (HandleBuffer); return EFI_SUCCESS; } @@ -321,19 +321,19 @@ BdsLibConnectAllDriversToAllControllers ( Routine Description: - Connects all drivers to all controllers. + Connects all drivers to all controllers. This function make sure all the current system driver will manage the correspoinding controllers if have. And at the same time, make - sure all the system controllers have driver to manage it if have. - + sure all the system controllers have driver to manage it if have. + Arguments: - + None - + Returns: - + None - + --*/ { EFI_STATUS Status; diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsConsole.c b/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsConsole.c index 47a79ff34e..96a1f4b9fd 100644 --- a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsConsole.c +++ b/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsConsole.c @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -25,9 +25,9 @@ IsNvNeed ( ) { CHAR16 *Ptr; - + Ptr = ConVarName; - + // // If the variable includes "Dev" at last, we consider // it does not support NV attribute. @@ -35,7 +35,7 @@ IsNvNeed ( while (*Ptr) { Ptr++; } - + if ((*(Ptr - 3) == 'D') && (*(Ptr - 2) == 'e') && (*(Ptr - 1) == 'v')) { return FALSE; } else { @@ -53,7 +53,7 @@ BdsLibUpdateConsoleVariable ( Routine Description: - This function update console variable based on ConVarName, it can + This function update console variable based on ConVarName, it can add or remove one specific console device path from the variable Arguments: @@ -71,8 +71,8 @@ Arguments: Returns: EFI_UNSUPPORTED - Add or remove the same device path. - - EFI_SUCCESS - Success add or remove the device path from + + EFI_SUCCESS - Success add or remove the device path from the console variable. --*/ @@ -103,12 +103,12 @@ Returns: &gEfiGlobalVariableGuid, &DevicePathSize ); - + // // Initialize NewDevicePath // NewDevicePath = VarConsole; - + // // If ExclusiveDevicePath is even the part of the instance in VarConsole, delete it. // In the end, NewDevicePath is the final device path. @@ -134,7 +134,7 @@ Returns: BdsLibSafeFreePool(TempNewDevicePath); } } - + // // The attribute for ConInDev, ConOutDev and ErrOutDev does not include NV. // @@ -149,7 +149,7 @@ Returns: // Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS; } - + // // Finally, Update the variable of the default console by NewDevicePath // @@ -192,7 +192,7 @@ Arguments: Returns: EFI_NOT_FOUND - There is not any console devices connected success - + EFI_SUCCESS - Success connect any one instance of the console device path base on the variable ConVarName. @@ -250,7 +250,7 @@ Returns: BdsLibSafeFreePool(Instance); } while (CopyOfDevicePath != NULL); - gBS->FreePool (StartDevicePath); + FreePool (StartDevicePath); if (DeviceExist == FALSE) { return EFI_NOT_FOUND; @@ -346,7 +346,7 @@ BdsLibConnectAllDefaultConsoles ( Routine Description: - This function will connect console device base on the console + This function will connect console device base on the console device variable ConIn, ConOut and ErrOut. Arguments: @@ -357,7 +357,7 @@ Returns: EFI_SUCCESS - At least one of the ConIn and ConOut device have been connected success. - + EFI_STATUS - Return the status of BdsLibConnectConsoleVariable (). --*/ @@ -370,12 +370,12 @@ Returns: // // Because possibly the platform is legacy free, in such case, - // ConIn devices (Serial Port and PS2 Keyboard ) does not exist, + // ConIn devices (Serial Port and PS2 Keyboard ) does not exist, // so we need not check the status. - // + // BdsLibConnectConsoleVariable (L"ConIn"); - // + // // It seems impossible not to have any ConOut device on platform, // so we check the status here. // diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c b/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c index 6a3ec058bf..e0b5d08c96 100644 --- a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c +++ b/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006 - 2007, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -31,7 +31,7 @@ BdsLibGetTimeout ( /*++ Routine Description: - + Return the default value for system Timeout variable. Arguments: @@ -39,7 +39,7 @@ Arguments: None Returns: - + Timeout value. --*/ @@ -85,7 +85,7 @@ BdsLibLoadDrivers ( /*++ Routine Description: - + The function will go through the driver optoin link list, load and start every driver the driver optoin device path point to. @@ -94,7 +94,7 @@ Arguments: BdsDriverLists - The header of the current driver option link list Returns: - + None --*/ @@ -198,7 +198,7 @@ BdsLibRegisterNewOption ( /*++ Routine Description: - + This function will register the new boot#### or driver#### option base on the VariableName. The new registered boot#### or driver#### will be linked to BdsOptionList and also update to the VariableName. After the boot#### or @@ -207,18 +207,18 @@ Routine Description: Arguments: BdsOptionList - The header of the boot#### or driver#### link list - + DevicePath - The device path which the boot#### or driver#### option present - + String - The description of the boot#### or driver#### - + VariableName - Indicate if the boot#### or driver#### option Returns: - + EFI_SUCCESS - The boot#### or driver#### have been success registered - + EFI_STATUS - Return the status of gRT->SetVariable (). --*/ @@ -249,11 +249,13 @@ Returns: ZeroMem (OptionName, sizeof (OptionName)); TempOptionSize = 0; + TempOptionPtr = BdsLibGetVariableAndSize ( VariableName, &gEfiGlobalVariableGuid, &TempOptionSize ); + // // Compare with current option variable // @@ -290,8 +292,8 @@ Returns: // // Got the option, so just return // - gBS->FreePool (OptionPtr); - gBS->FreePool (TempOptionPtr); + FreePool (OptionPtr); + FreePool (TempOptionPtr); return EFI_SUCCESS; } else { // @@ -302,7 +304,7 @@ Returns: } } - gBS->FreePool (OptionPtr); + FreePool (OptionPtr); } OptionSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (String) + GetDevicePathSize (DevicePath); @@ -342,12 +344,12 @@ Returns: OptionPtr ); if (EFI_ERROR (Status) || UpdateBootDevicePath) { - gBS->FreePool (OptionPtr); - gBS->FreePool (TempOptionPtr); + FreePool (OptionPtr); + FreePool (TempOptionPtr); return Status; } - gBS->FreePool (OptionPtr); + FreePool (OptionPtr); // // Update the option order variable @@ -363,13 +365,15 @@ Returns: OptionOrderPtr ); if (EFI_ERROR (Status)) { - gBS->FreePool (TempOptionPtr); - gBS->FreePool (OptionOrderPtr); + FreePool (TempOptionPtr); + FreePool (OptionOrderPtr); return Status; } - gBS->FreePool (TempOptionPtr); - gBS->FreePool (OptionOrderPtr); + if (TempOptionPtr != NULL) { + FreePool (TempOptionPtr); + } + FreePool (OptionOrderPtr); return EFI_SUCCESS; } @@ -383,9 +387,9 @@ BdsLibVariableToOption ( Routine Description: - Build the boot#### or driver#### option from the VariableName, the + Build the boot#### or driver#### option from the VariableName, the build boot#### or driver#### will also be linked to BdsCommonOptionList - + Arguments: BdsCommonOptionList - The header of the boot#### or driver#### option link list @@ -482,12 +486,12 @@ Returns: // if ((Option->Attribute & LOAD_OPTION_ACTIVE) == LOAD_OPTION_ACTIVE) { InsertTailList (BdsCommonOptionList, &Option->Link); - gBS->FreePool (Variable); + FreePool (Variable); return Option; } - gBS->FreePool (Variable); - gBS->FreePool (Option); + FreePool (Variable); + FreePool (Option); return NULL; } @@ -553,7 +557,7 @@ Returns: } - gBS->FreePool (OptionOrder); + FreePool (OptionOrder); return EFI_SUCCESS; } @@ -631,7 +635,7 @@ Routine Description: Free pool safely. Arguments: - + Buffer - The allocated pool entry to free Returns: @@ -641,7 +645,7 @@ Returns: --*/ { if (Buffer != NULL) { - gBS->FreePool (Buffer); + FreePool (Buffer); Buffer = NULL; } } @@ -665,7 +669,7 @@ Arguments: Returns: - This function will remove the device path instances in Multi which partly + This function will remove the device path instances in Multi which partly match with the Single, and return the result device path. If there is no remaining device path as a result, this function will return NULL. @@ -675,24 +679,24 @@ Returns: EFI_DEVICE_PATH_PROTOCOL *NewDevicePath; EFI_DEVICE_PATH_PROTOCOL *TempNewDevicePath; UINTN InstanceSize; - UINTN SingleDpSize; - UINTN Size; - + UINTN SingleDpSize; + UINTN Size; + NewDevicePath = NULL; TempNewDevicePath = NULL; if (Multi == NULL || Single == NULL) { return Multi; } - + Instance = GetNextDevicePathInstance (&Multi, &InstanceSize); SingleDpSize = GetDevicePathSize (Single) - END_DEVICE_PATH_LENGTH; InstanceSize -= END_DEVICE_PATH_LENGTH; while (Instance != NULL) { - Size = (SingleDpSize < InstanceSize) ? SingleDpSize : InstanceSize; - + Size = (SingleDpSize < InstanceSize) ? SingleDpSize : InstanceSize; + if ((CompareMem (Instance, Single, Size) != 0)) { // // Append the device path instance which does not match with Single @@ -705,7 +709,7 @@ Returns: Instance = GetNextDevicePathInstance (&Multi, &InstanceSize); InstanceSize -= END_DEVICE_PATH_LENGTH; } - + return NewDevicePath; } @@ -730,9 +734,9 @@ Arguments: Returns: TRUE - If the Single is contained within Multi - + FALSE - The Single is not match within Multi - + --*/ { @@ -756,11 +760,11 @@ Returns: // return success // if (CompareMem (Single, DevicePathInst, Size) == 0) { - gBS->FreePool (DevicePathInst); + FreePool (DevicePathInst); return TRUE; } - gBS->FreePool (DevicePathInst); + FreePool (DevicePathInst); DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size); } @@ -788,7 +792,7 @@ Arguments: Returns: EFI_SUCCESS - Success print out the string using ConOut. - + EFI_STATUS - Return the status of the ConOut->OutputString (). --*/ @@ -821,7 +825,7 @@ Returns: // // Following are BDS Lib functions which contain all the code about setup browser reset reminder feature. -// Setup Browser reset reminder feature is that an reset reminder will be given before user leaves the setup browser if +// Setup Browser reset reminder feature is that an reset reminder will be given before user leaves the setup browser if // user change any option setting which needs a reset to be effective, and the reset will be applied according to the user selection. // @@ -832,7 +836,7 @@ EnableResetReminderFeature ( /*++ Routine Description: - + Enable the setup browser reset reminder feature. This routine is used in platform tip. If the platform policy need the feature, use the routine to enable it. @@ -847,7 +851,7 @@ Returns: --*/ { mFeaturerSwitch = TRUE; -} +} VOID DisableResetReminderFeature ( @@ -856,10 +860,10 @@ DisableResetReminderFeature ( /*++ Routine Description: - + Disable the setup browser reset reminder feature. This routine is used in platform tip. If the platform policy do not want the feature, use the routine to disable it. - + Arguments: VOID @@ -871,7 +875,7 @@ Returns: --*/ { mFeaturerSwitch = FALSE; -} +} VOID EnableResetRequired ( @@ -880,10 +884,10 @@ EnableResetRequired ( /*++ Routine Description: - + Record the info that a reset is required. - A module boolean variable is used to record whether a reset is required. - + A module boolean variable is used to record whether a reset is required. + Arguments: VOID @@ -895,7 +899,7 @@ Returns: --*/ { mResetRequired = TRUE; -} +} VOID DisableResetRequired ( @@ -906,7 +910,7 @@ DisableResetRequired ( Routine Description: Record the info that no reset is required. - A module boolean variable is used to record whether a reset is required. + A module boolean variable is used to record whether a reset is required. Arguments: @@ -919,7 +923,7 @@ Returns: --*/ { mResetRequired = FALSE; -} +} BOOLEAN IsResetReminderFeatureEnable ( @@ -928,7 +932,7 @@ IsResetReminderFeatureEnable ( /*++ Routine Description: - + Check whether platform policy enable the reset reminder feature. The default is enabled. Arguments: @@ -951,9 +955,9 @@ IsResetRequired ( /*++ Routine Description: - + Check if user changed any option setting which needs a system reset to be effective. - + Arguments: VOID @@ -974,9 +978,9 @@ SetupResetReminder ( /*++ Routine Description: - + Check whether a reset is needed, and finish the reset reminder feature. - If a reset is needed, Popup a menu to notice user, and finish the feature + If a reset is needed, Popup a menu to notice user, and finish the feature according to the user selection. Arguments: @@ -991,9 +995,9 @@ Returns: { EFI_STATUS Status; EFI_FORM_BROWSER_PROTOCOL *Browser; - EFI_INPUT_KEY Key; + EFI_INPUT_KEY Key; CHAR16 *StringBuffer1; - CHAR16 *StringBuffer2; + CHAR16 *StringBuffer2; // @@ -1001,28 +1005,28 @@ Returns: // if (IsResetReminderFeatureEnable ()) { if (IsResetRequired ()) { - + Status = gBS->LocateProtocol ( &gEfiFormBrowserProtocolGuid, NULL, &Browser - ); - + ); + StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16)); ASSERT (StringBuffer1 != NULL); StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16)); - ASSERT (StringBuffer2 != NULL); + ASSERT (StringBuffer2 != NULL); StrCpy (StringBuffer1, L"Configuration changed. Reset to apply it Now ? "); - StrCpy (StringBuffer2, L"Enter (YES) / Esc (NO)"); + StrCpy (StringBuffer2, L"Enter (YES) / Esc (NO)"); // // Popup a menu to notice user - // + // do { Browser->CreatePopUp (2, TRUE, 0, NULL, &Key, StringBuffer1, StringBuffer2); - } while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN)); - - gBS->FreePool (StringBuffer1); - gBS->FreePool (StringBuffer2); + } while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN)); + + FreePool (StringBuffer1); + FreePool (StringBuffer2); // // If the user hits the YES Response key, reset // @@ -1030,9 +1034,9 @@ Returns: gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); } gST->ConOut->ClearScreen (gST->ConOut); - } - } -} + } + } +} EFI_STATUS BdsLibGetHiiHandles ( @@ -1050,7 +1054,7 @@ Routine Description: Arguments: This - A pointer to the EFI_HII_PROTOCOL instance. - HandleBufferLength - On input, a pointer to the length of the handle buffer. On output, + HandleBufferLength - On input, a pointer to the length of the handle buffer. On output, the length of the handle buffer that is required for the handles found. HiiHandleBuffer - Pointer to an array of EFI_HII_PROTOCOL instances returned. @@ -1059,19 +1063,19 @@ Returns: EFI_SUCCESS - Get an array of EFI_HII_PROTOCOL instances successfully. EFI_INVALID_PARAMETER - Hii is NULL. EFI_NOT_FOUND - Database not found. - + --*/ { UINT16 TempBufferLength; EFI_STATUS Status; - + TempBufferLength = 0; - + // // Try to find the actual buffer size for HiiHandle Buffer. // Status = Hii->FindHandles (Hii, &TempBufferLength, *HiiHandleBuffer); - + if (Status == EFI_BUFFER_TOO_SMALL) { *HiiHandleBuffer = AllocateZeroPool (TempBufferLength); Status = Hii->FindHandles (Hii, &TempBufferLength, *HiiHandleBuffer); @@ -1080,9 +1084,9 @@ Returns: // ASSERT_EFI_ERROR (Status); } - + *HandleBufferLength = TempBufferLength; - + return Status; - + } diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/DevicePath.c b/EdkNt32Pkg/Library/EdkGenericBdsLib/DevicePath.c index 5a80471927..e893046c4e 100644 --- a/EdkNt32Pkg/Library/EdkGenericBdsLib/DevicePath.c +++ b/EdkNt32Pkg/Library/EdkGenericBdsLib/DevicePath.c @@ -71,7 +71,7 @@ Returns: CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize); } - gBS->FreePool (OldPool); + FreePool (OldPool); } return NewPool; @@ -137,7 +137,7 @@ Returns: Str->len = strsize - sizeof (UINT16); } - gBS->FreePool (AppendStr); + FreePool (AppendStr); return Str->str; } @@ -1059,7 +1059,7 @@ DevicePathToStr ( // // Shrink pool used for string allocation // - gBS->FreePool (DevPath); + FreePool (DevPath); Done: NewSize = (Str.len + 1) * sizeof (CHAR16); diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.msa b/EdkNt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.msa index 0357fcb69c..d9420e4385 100644 --- a/EdkNt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.msa +++ b/EdkNt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.msa @@ -6,7 +6,7 @@ 1ec995b2-d15b-44f6-abd2-050ea7dd37d2 1.0 EDK Generic BDS Common APIs Library Instance. - The library instance provides common library routines help in + The library instance provides common library routines help in performance measurement, device path debug print, boot device selections, boot device connection, console supports in BDS phase and boot from boot device. @@ -20,12 +20,12 @@ FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052 - IA32 X64 IPF EBC + IA32 false EdkGenericBdsLib - + EdkGenericBdsLib @@ -76,7 +76,6 @@ Performance.h Performance.c BdsMisc.c - Ipf/ShadowRom.c diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/Performance.c b/EdkNt32Pkg/Library/EdkGenericBdsLib/Performance.c index f0ac12e0d6..2d157aebb3 100644 --- a/EdkNt32Pkg/Library/EdkGenericBdsLib/Performance.c +++ b/EdkNt32Pkg/Library/EdkGenericBdsLib/Performance.c @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -33,7 +33,7 @@ GetShortPdbFileName ( /*++ Routine Description: - + Arguments: Returns: @@ -176,13 +176,13 @@ WriteBootToOsPerformanceData ( /*++ Routine Description: - + Allocates a block of memory and writes performance data of booting to OS into it. Arguments: - + None - + Returns: None @@ -328,7 +328,7 @@ Returns: } } - gBS->FreePool (Handles); + FreePool (Handles); // // Get inserted performance data diff --git a/EdkNt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.msa b/EdkNt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.msa index 624f928e7d..79fc9ec7c7 100644 --- a/EdkNt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.msa +++ b/EdkNt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.msa @@ -17,12 +17,12 @@ FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052 - IA32 X64 IPF EBC + IA32 false EdkNt32PeiPeCoffGetEntryPointLib - + PeCoffGetEntryPointLib diff --git a/EdkNt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.msa b/EdkNt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.msa index e57dff1dc8..1a76e04341 100644 --- a/EdkNt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.msa +++ b/EdkNt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.msa @@ -17,12 +17,12 @@ FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052 - IA32 X64 IPF EBC + IA32 false Nt32PeCoffLoaderLib - + EdkPeCoffLoaderLib diff --git a/EdkNt32Pkg/RuntimeDxe/FvbServices/FWBlockService.c b/EdkNt32Pkg/RuntimeDxe/FvbServices/FWBlockService.c index 8824dc412a..e71fadaa1c 100644 --- a/EdkNt32Pkg/RuntimeDxe/FvbServices/FWBlockService.c +++ b/EdkNt32Pkg/RuntimeDxe/FvbServices/FWBlockService.c @@ -1,18 +1,18 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: FWBlockService.c - + Abstract: Revision History @@ -81,14 +81,14 @@ Routine Description: date items to there virtual address. mFvbModuleGlobal->FvInstance[FVB_PHYSICAL] - Physical copy of instance data - mFvbModuleGlobal->FvInstance[FVB_VIRTUAL] - Virtual pointer to common + mFvbModuleGlobal->FvInstance[FVB_VIRTUAL] - Virtual pointer to common instance data. Arguments: (Standard EFI notify event - EFI_EVENT_NOTIFY) -Returns: +Returns: None @@ -138,7 +138,7 @@ Arguments: FwhInstance - The EFI_FW_VOL_INSTANCE fimrware instance structure Virtual - Whether CPU is in virtual or physical mode -Returns: +Returns: EFI_SUCCESS - Successfully returns EFI_INVALID_PARAMETER - Instance not found @@ -182,14 +182,14 @@ Routine Description: Arguments: Instance - The FV instance whose base address is going to be returned - Address - Pointer to a caller allocated EFI_PHYSICAL_ADDRESS + Address - Pointer to a caller allocated EFI_PHYSICAL_ADDRESS that on successful return, contains the base address - of the firmware volume. + of the firmware volume. Global - Pointer to ESAL_FWB_GLOBAL that contains all instance data Virtual - Whether CPU is in virtual or physical mode -Returns: +Returns: EFI_SUCCESS - Successfully returns EFI_INVALID_PARAMETER - Instance not found @@ -222,14 +222,14 @@ Routine Description: resulting attributes in output parameter Arguments: - Instance - The FV instance whose attributes is going to be + Instance - The FV instance whose attributes is going to be returned Attributes - Output buffer which contains attributes Global - Pointer to ESAL_FWB_GLOBAL that contains all instance data Virtual - Whether CPU is in virtual or physical mode -Returns: +Returns: EFI_SUCCESS - Successfully returns EFI_INVALID_PARAMETER - Instance not found @@ -266,7 +266,7 @@ Routine Description: Arguments: Instance - The FV instance which the Lba belongs to Lba - The logical block address - LbaAddress - On output, contains the physical starting address + LbaAddress - On output, contains the physical starting address of the Lba LbaLength - On output, contains the length of the block NumOfBlocks - A pointer to a caller allocated UINTN in which the @@ -277,7 +277,7 @@ Arguments: instance data Virtual - Whether CPU is in virtual or physical mode -Returns: +Returns: EFI_SUCCESS - Successfully returns EFI_INVALID_PARAMETER - Instance not found @@ -369,14 +369,14 @@ Arguments: instance data Virtual - Whether CPU is in virtual or physical mode -Returns: - EFI_SUCCESS - The firmware volume was read successfully and +Returns: + EFI_SUCCESS - The firmware volume was read successfully and contents are in Buffer EFI_BAD_BUFFER_SIZE - Read attempted across a LBA boundary. On output, NumBytes contains the total number of bytes returned in Buffer EFI_ACCESS_DENIED - The firmware volume is in the ReadDisabled state - EFI_DEVICE_ERROR - The block device is not functioning correctly and + EFI_DEVICE_ERROR - The block device is not functioning correctly and could not be read EFI_INVALID_PARAMETER - Instance not found, or NumBytes, Buffer are NULL @@ -455,13 +455,13 @@ Arguments: instance data Virtual - Whether CPU is in virtual or physical mode -Returns: +Returns: EFI_SUCCESS - The firmware volume was written successfully EFI_BAD_BUFFER_SIZE - Write attempted across a LBA boundary. On output, NumBytes contains the total number of bytes actually written EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state - EFI_DEVICE_ERROR - The block device is not functioning correctly and + EFI_DEVICE_ERROR - The block device is not functioning correctly and could not be written EFI_INVALID_PARAMETER - Instance not found, or NumBytes, Buffer are NULL @@ -533,10 +533,10 @@ Arguments: instance data Virtual - Whether CPU is in virtual or physical mode -Returns: +Returns: EFI_SUCCESS - The erase request was successfully completed EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state - EFI_DEVICE_ERROR - The block device is not functioning correctly and + EFI_DEVICE_ERROR - The block device is not functioning correctly and could not be written. Firmware device may have been partially erased EFI_INVALID_PARAMETER - Instance not found @@ -596,7 +596,7 @@ Routine Description: Arguments: Instance - The FV instance to be erased StartLba - The starting logical block index to be erased - OffsetStartLba - Offset into the starting block at which to + OffsetStartLba - Offset into the starting block at which to begin erasing LastLba - The last logical block index to be erased OffsetStartLba - Offset into the last block at which to end erasing @@ -604,10 +604,10 @@ Arguments: instance data Virtual - Whether CPU is in virtual or physical mode -Returns: +Returns: EFI_SUCCESS - The firmware volume was erased successfully EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state - EFI_DEVICE_ERROR - The block device is not functioning correctly and + EFI_DEVICE_ERROR - The block device is not functioning correctly and could not be written. Firmware device may have been partially erased EFI_INVALID_PARAMETER - Instance not found @@ -681,13 +681,13 @@ FvbSetVolumeAttributes ( /*++ Routine Description: - Modifies the current settings of the firmware volume according to the + Modifies the current settings of the firmware volume according to the input parameter, and returns the new setting of the volume Arguments: - Instance - The FV instance whose attributes is going to be + Instance - The FV instance whose attributes is going to be modified - Attributes - On input, it is a pointer to EFI_FVB_ATTRIBUTES + Attributes - On input, it is a pointer to EFI_FVB_ATTRIBUTES containing the desired firmware volume settings. On successful return, it contains the new settings of the firmware volume @@ -695,7 +695,7 @@ Arguments: instance data Virtual - Whether CPU is in virtual or physical mode -Returns: +Returns: EFI_SUCCESS - Successfully returns EFI_ACCESS_DENIED - The volume setting is locked and cannot be modified EFI_INVALID_PARAMETER - Instance not found, or The attributes requested are @@ -801,7 +801,7 @@ Arguments: Returns: -Returns: +Returns: EFI_SUCCESS - Successfully returns --*/ @@ -836,8 +836,8 @@ Arguments: returned. All blocks in this range have a size of BlockSize -Returns: - EFI_SUCCESS - The firmware volume was read successfully and +Returns: + EFI_SUCCESS - The firmware volume was read successfully and contents are in Buffer --*/ @@ -872,7 +872,7 @@ Arguments: This - Calling context Attributes - output buffer which contains attributes -Returns: +Returns: EFI_SUCCESS - Successfully returns --*/ @@ -899,7 +899,7 @@ Arguments: This - Calling context Attributes - output buffer which contains attributes -Returns: +Returns: EFI_SUCCESS - Successfully returns --*/ @@ -915,28 +915,28 @@ EFI_STATUS EFIAPI FvbProtocolEraseBlocks ( IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, - ... + ... ) /*++ Routine Description: - The EraseBlock() function erases one or more blocks as denoted by the + The EraseBlock() function erases one or more blocks as denoted by the variable argument list. The entire parameter list of blocks must be verified - prior to erasing any blocks. If a block is requested that does not exist - within the associated firmware volume (it has a larger index than the last + prior to erasing any blocks. If a block is requested that does not exist + within the associated firmware volume (it has a larger index than the last block of the firmware volume), the EraseBlock() function must return EFI_INVALID_PARAMETER without modifying the contents of the firmware volume. Arguments: This - Calling context - ... - Starting LBA followed by Number of Lba to erase. + ... - Starting LBA followed by Number of Lba to erase. a -1 to terminate the list. -Returns: +Returns: EFI_SUCCESS - The erase request was successfully completed EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state - EFI_DEVICE_ERROR - The block device is not functioning correctly and + EFI_DEVICE_ERROR - The block device is not functioning correctly and could not be written. Firmware device may have been partially erased @@ -1037,13 +1037,13 @@ Arguments: output, indicates the actual number of bytes written Buffer - Buffer containing source data for the write. -Returns: +Returns: EFI_SUCCESS - The firmware volume was written successfully EFI_BAD_BUFFER_SIZE - Write attempted across a LBA boundary. On output, NumBytes contains the total number of bytes actually written EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state - EFI_DEVICE_ERROR - The block device is not functioning correctly and + EFI_DEVICE_ERROR - The block device is not functioning correctly and could not be written EFI_INVALID_PARAMETER - NumBytes or Buffer are NULL @@ -1085,14 +1085,14 @@ Arguments: output, indicates the actual number of bytes Read Buffer - Buffer containing source data for the Read. -Returns: - EFI_SUCCESS - The firmware volume was read successfully and +Returns: + EFI_SUCCESS - The firmware volume was read successfully and contents are in Buffer EFI_BAD_BUFFER_SIZE - Read attempted across a LBA boundary. On output, NumBytes contains the total number of bytes returned in Buffer EFI_ACCESS_DENIED - The firmware volume is in the ReadDisabled state - EFI_DEVICE_ERROR - The block device is not functioning correctly and + EFI_DEVICE_ERROR - The block device is not functioning correctly and could not be read EFI_INVALID_PARAMETER - NumBytes or Buffer are NULL @@ -1125,15 +1125,15 @@ Routine Description: Arguments: This - Calling context StartLba - The starting logical block index to be erased - OffsetStartLba - Offset into the starting block at which to + OffsetStartLba - Offset into the starting block at which to begin erasing LastLba - The last logical block index to be erased OffsetStartLba - Offset into the last block at which to end erasing -Returns: +Returns: EFI_SUCCESS - The firmware volume was erased successfully EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state - EFI_DEVICE_ERROR - The block device is not functioning correctly and + EFI_DEVICE_ERROR - The block device is not functioning correctly and could not be written. Firmware device may have been partially erased @@ -1167,7 +1167,7 @@ Routine Description: Arguments: FwVolHeader - A pointer to a firmware volume header -Returns: +Returns: EFI_SUCCESS - The firmware volume is consistent EFI_NOT_FOUND - The firmware volume has corrupted. So it is not an FV @@ -1252,12 +1252,8 @@ Returns: // Allocate runtime services data for global variable, which contains // the private data of all firmware volume block instances // - Status = gBS->AllocatePool ( - EfiRuntimeServicesData, - sizeof (ESAL_FWB_GLOBAL), - &mFvbModuleGlobal - ); - ASSERT_EFI_ERROR (Status); + mFvbModuleGlobal = AllocateRuntimePool (sizeof (ESAL_FWB_GLOBAL)); + ASSERT (mFvbModuleGlobal != NULL); // // Calculate the total size for all firmware volume block instances @@ -1306,12 +1302,8 @@ Returns: // the private data of each FV instance. But in virtual mode or in physical // mode, the address of the the physical memory may be different. // - Status = gBS->AllocatePool ( - EfiRuntimeServicesData, - BufferSize, - &mFvbModuleGlobal->FvInstance[FVB_PHYSICAL] - ); - ASSERT_EFI_ERROR (Status); + mFvbModuleGlobal->FvInstance[FVB_PHYSICAL] = AllocateRuntimePool (BufferSize); + ASSERT (mFvbModuleGlobal->FvInstance[FVB_PHYSICAL] != NULL); // // Make a virtual copy of the FvInstance pointer. @@ -1392,12 +1384,8 @@ Returns: // // Add a FVB Protocol Instance // - Status = gBS->AllocatePool ( - EfiRuntimeServicesData, - sizeof (EFI_FW_VOL_BLOCK_DEVICE), - &FvbDevice - ); - ASSERT_EFI_ERROR (Status); + FvbDevice = AllocateRuntimePool (sizeof (EFI_FW_VOL_BLOCK_DEVICE)); + ASSERT (FvbDevice != NULL); CopyMem (FvbDevice, &mFvbDeviceTemplate, sizeof (EFI_FW_VOL_BLOCK_DEVICE)); @@ -1481,12 +1469,8 @@ Returns: // // Allocate for scratch space, an intermediate buffer for FVB extention // - Status = gBS->AllocatePool ( - EfiRuntimeServicesData, - MaxLbaSize, - &mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL] - ); - ASSERT_EFI_ERROR (Status); + mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL] = AllocateRuntimePool (MaxLbaSize); + ASSERT (mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL] != NULL); mFvbModuleGlobal->FvbScratchSpace[FVB_VIRTUAL] = mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL]; -- 2.39.2