From fa332de7493caee4d3fa22392dc6292cfbb6f224 Mon Sep 17 00:00:00 2001 From: vanjeff Date: Fri, 30 Mar 2007 06:15:19 +0000 Subject: 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 --- .../MiscSubclass/MiscSubclassDriverEntryPoint.c | 26 +- EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.c | 4 +- .../Dxe/PlatformBds/Generic/BootMaint/BBSsupport.c | 30 +- .../Dxe/PlatformBds/Generic/BootMaint/BmLib.c | 62 ++-- .../Dxe/PlatformBds/Generic/BootMaint/BootMaint.c | 42 +-- .../Dxe/PlatformBds/Generic/BootMaint/BootOption.c | 90 +++--- .../Dxe/PlatformBds/Generic/BootMaint/UpdatePage.c | 23 +- .../Dxe/PlatformBds/Generic/BootMngr/BootManager.c | 46 +-- .../PlatformBds/Generic/DeviceMngr/DeviceManager.c | 50 ++-- EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.c | 100 +++---- EdkNt32Pkg/Dxe/PlatformBds/Generic/Language.c | 30 +- EdkNt32Pkg/Dxe/PlatformBds/Generic/MemoryTest.c | 54 ++-- EdkNt32Pkg/Dxe/PlatformBds/Generic/String.c | 24 +- .../Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c | 4 +- .../Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c | 12 +- .../Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa | 3 + EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c | 30 +- EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleIn.c | 36 +-- .../Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa | 3 + EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa | 3 + EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c | 14 +- EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c | 50 +--- .../Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c | 84 +++--- .../Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa | 3 + .../Bus/SimpleFileSystem/WinNtSimpleFileSystem.c | 332 ++++++++------------- .../Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa | 3 + EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa | 3 + EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c | 37 +-- EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c | 62 ++-- .../WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c | 35 +-- .../Bus/WinNtBusDriver/WinNtBusDriver.msa | 3 + EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Cpu.c | 60 ++-- 32 files changed, 611 insertions(+), 747 deletions(-) (limited to 'EdkNt32Pkg/Dxe') 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 ( -- cgit v1.2.3