From 2c3b5ec562c7b43a73424e1be25e2053d1edfe4f Mon Sep 17 00:00:00 2001 From: lgao4 Date: Wed, 14 Mar 2007 02:02:43 +0000 Subject: [PATCH] Clean up the gBS sevice (CopyMem, SetMem, AllocatePool, FreePool) with the corresponding APIs defined in Mde library class for these modules. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2456 6f19259b-4bc3-4df7-8a09-765794883524 --- EdkModulePkg/EdkModulePkg.fpd | 620 +++++++++++------- .../Console/ConSplitter/Dxe/ConSplitter.c | 22 +- .../ConSplitter/Dxe/ConSplitterGraphics.c | 26 +- .../GraphicsConsole/Dxe/GraphicsConsole.c | 30 +- .../Universal/Console/Terminal/Dxe/Terminal.c | 40 +- .../Universal/DataHub/DataHub/Dxe/DataHub.c | 7 +- .../Universal/DebugSupport/Dxe/DebugSupport.c | 4 +- .../DebugSupport/Dxe/DebugSupport.msa | 24 +- .../DebugSupport/Dxe/Ia32/plDebugSupport.c | 19 +- .../DebugSupport/Dxe/ipf/plDebugSupport.c | 26 +- .../DebugSupport/Dxe/x64/plDebugSupport.c | 21 +- .../Debugger/Debugport/Dxe/DebugPort.c | 54 +- .../Universal/DevicePath/Dxe/DevicePath.h | 2 +- .../Universal/DevicePath/Dxe/DevicePath.msa | 24 +- .../DevicePath/Dxe/DevicePathFromText.c | 16 +- .../DevicePath/Dxe/DevicePathToText.c | 6 +- 16 files changed, 536 insertions(+), 405 deletions(-) diff --git a/EdkModulePkg/EdkModulePkg.fpd b/EdkModulePkg/EdkModulePkg.fpd index 00c8720264..e4ce17c6f9 100644 --- a/EdkModulePkg/EdkModulePkg.fpd +++ b/EdkModulePkg/EdkModulePkg.fpd @@ -2081,249 +2081,6 @@ BS_DRIVER - - - - - - - - - - - - - PcdMaximumUnicodeStringLength - 0x00000001 - gEfiMdePkgTokenSpaceGuid - UINT32 - 4 - 1000000 - - - PcdMaximumAsciiStringLength - 0x00000002 - gEfiMdePkgTokenSpaceGuid - UINT32 - 4 - 1000000 - - - PcdMaximumLinkedListLength - 0x00000003 - gEfiMdePkgTokenSpaceGuid - UINT32 - 4 - 1000000 - - - PcdSpinLockTimeout - 0x00000004 - gEfiMdePkgTokenSpaceGuid - UINT32 - 4 - 10000000 - - - PcdReportStatusCodePropertyMask - 0x00000007 - gEfiMdePkgTokenSpaceGuid - UINT8 - 1 - 0x06 - - - PcdDebugPropertyMask - 0x00000005 - gEfiMdePkgTokenSpaceGuid - UINT8 - 1 - 0x0f - - - PcdDebugClearMemoryValue - 0x00000008 - gEfiMdePkgTokenSpaceGuid - UINT8 - 1 - 0xAF - - - PcdDebugPrintErrorLevel - 0x00000006 - gEfiMdePkgTokenSpaceGuid - UINT32 - 4 - 0x80000000 - - - - NULL - BS_DRIVER - - - - - - - - - - - - - - - PcdMaximumUnicodeStringLength - 0x00000001 - gEfiMdePkgTokenSpaceGuid - UINT32 - 4 - 1000000 - - - PcdMaximumAsciiStringLength - 0x00000002 - gEfiMdePkgTokenSpaceGuid - UINT32 - 4 - 1000000 - - - PcdMaximumLinkedListLength - 0x00000003 - gEfiMdePkgTokenSpaceGuid - UINT32 - 4 - 1000000 - - - PcdSpinLockTimeout - 0x00000004 - gEfiMdePkgTokenSpaceGuid - UINT32 - 4 - 10000000 - - - PcdReportStatusCodePropertyMask - 0x00000007 - gEfiMdePkgTokenSpaceGuid - UINT8 - 1 - 0x06 - - - PcdDebugPropertyMask - 0x00000005 - gEfiMdePkgTokenSpaceGuid - UINT8 - 1 - 0x0f - - - PcdDebugClearMemoryValue - 0x00000008 - gEfiMdePkgTokenSpaceGuid - UINT8 - 1 - 0xAF - - - PcdDebugPrintErrorLevel - 0x00000006 - gEfiMdePkgTokenSpaceGuid - UINT32 - 4 - 0x80000000 - - - - NULL - BS_DRIVER - - - - - - - - - - - - - - - PcdMaximumUnicodeStringLength - 0x00000001 - gEfiMdePkgTokenSpaceGuid - UINT32 - 4 - 1000000 - - - PcdMaximumAsciiStringLength - 0x00000002 - gEfiMdePkgTokenSpaceGuid - UINT32 - 4 - 1000000 - - - PcdMaximumLinkedListLength - 0x00000003 - gEfiMdePkgTokenSpaceGuid - UINT32 - 4 - 1000000 - - - PcdSpinLockTimeout - 0x00000004 - gEfiMdePkgTokenSpaceGuid - UINT32 - 4 - 10000000 - - - PcdReportStatusCodePropertyMask - 0x00000007 - gEfiMdePkgTokenSpaceGuid - UINT8 - 1 - 0x06 - - - PcdDebugPropertyMask - 0x00000005 - gEfiMdePkgTokenSpaceGuid - UINT8 - 1 - 0x0f - - - PcdDebugClearMemoryValue - 0x00000008 - gEfiMdePkgTokenSpaceGuid - UINT8 - 1 - 0xAF - - - PcdDebugPrintErrorLevel - 0x00000006 - gEfiMdePkgTokenSpaceGuid - UINT32 - 4 - 0x80000000 - - - - NULL - BS_DRIVER - - @@ -21147,6 +20904,383 @@ BS_DRIVER + + + + + + + + + + + + + + + + + + + + + PcdMaximumUnicodeStringLength + 0x00000001 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 1000000 + + + PcdMaximumAsciiStringLength + 0x00000002 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 1000000 + + + PcdMaximumLinkedListLength + 0x00000003 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 1000000 + + + PcdSpinLockTimeout + 0x00000004 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 10000000 + + + PcdDebugPropertyMask + 0x00000005 + gEfiMdePkgTokenSpaceGuid + UINT8 + 1 + 0x0f + + + PcdDebugClearMemoryValue + 0x00000008 + gEfiMdePkgTokenSpaceGuid + UINT8 + 1 + 0xAF + + + PcdDebugPrintErrorLevel + 0x00000006 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 0x80000000 + + + PcdReportStatusCodePropertyMask + 0x00000007 + gEfiMdePkgTokenSpaceGuid + UINT8 + 1 + 0x06 + + + + NULL + BS_DRIVER + + + + + + + + + + + + + + + + + + + + + + + PcdMaximumUnicodeStringLength + 0x00000001 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 1000000 + + + PcdMaximumAsciiStringLength + 0x00000002 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 1000000 + + + PcdMaximumLinkedListLength + 0x00000003 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 1000000 + + + PcdSpinLockTimeout + 0x00000004 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 10000000 + + + PcdDebugPropertyMask + 0x00000005 + gEfiMdePkgTokenSpaceGuid + UINT8 + 1 + 0x0f + + + PcdDebugClearMemoryValue + 0x00000008 + gEfiMdePkgTokenSpaceGuid + UINT8 + 1 + 0xAF + + + PcdDebugPrintErrorLevel + 0x00000006 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 0x80000000 + + + PcdReportStatusCodePropertyMask + 0x00000007 + gEfiMdePkgTokenSpaceGuid + UINT8 + 1 + 0x06 + + + + NULL + BS_DRIVER + + + + + + + + + + + + + + + + + + + + + + + PcdDebugPropertyMask + 0x00000005 + gEfiMdePkgTokenSpaceGuid + UINT8 + 1 + 0x0f + + + PcdDebugClearMemoryValue + 0x00000008 + gEfiMdePkgTokenSpaceGuid + UINT8 + 1 + 0xAF + + + PcdDebugPrintErrorLevel + 0x00000006 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 0x80000000 + + + PcdReportStatusCodePropertyMask + 0x00000007 + gEfiMdePkgTokenSpaceGuid + UINT8 + 1 + 0x06 + + + PcdMaximumUnicodeStringLength + 0x00000001 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 1000000 + + + PcdMaximumAsciiStringLength + 0x00000002 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 1000000 + + + PcdMaximumLinkedListLength + 0x00000003 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 1000000 + + + PcdSpinLockTimeout + 0x00000004 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 10000000 + + + + NULL + BS_DRIVER + + + + + + + + + + + + + + + + + + + + + + + + + + + + PcdDevicePathSupportDevicePathToText + 0x00010037 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + FALSE + + + PcdDevicePathSupportDevicePathFromText + 0x00010038 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + FALSE + + + PcdMaximumUnicodeStringLength + 0x00000001 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 1000000 + + + PcdMaximumAsciiStringLength + 0x00000002 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 1000000 + + + PcdMaximumLinkedListLength + 0x00000003 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 1000000 + + + PcdSpinLockTimeout + 0x00000004 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 10000000 + + + PcdDebugPropertyMask + 0x00000005 + gEfiMdePkgTokenSpaceGuid + UINT8 + 1 + 0x0f + + + PcdDebugClearMemoryValue + 0x00000008 + gEfiMdePkgTokenSpaceGuid + UINT8 + 1 + 0xAF + + + PcdDebugPrintErrorLevel + 0x00000006 + gEfiMdePkgTokenSpaceGuid + UINT32 + 4 + 0x80000000 + + + PcdReportStatusCodePropertyMask + 0x00000007 + gEfiMdePkgTokenSpaceGuid + UINT8 + 1 + 0x06 + + + + NULL + BS_DRIVER + + diff --git a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c index 34d6f266e9..7d1a3fea1d 100644 --- a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c +++ b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c @@ -1333,7 +1333,7 @@ Returns: CopyMem (Ptr, *Buffer, OldSize); if (*Buffer != NULL) { - gBS->FreePool (*Buffer); + FreePool (*Buffer); } *Buffer = Ptr; @@ -1573,7 +1573,7 @@ Returns: // // Free the old buffer // - gBS->FreePool (OldTextOutModeMap); + FreePool (OldTextOutModeMap); } return EFI_SUCCESS; @@ -1924,8 +1924,8 @@ Returns: mStdErr.TextOut.SetMode (&(mStdErr.TextOut), 0); } - gBS->FreePool (ConOutMapTable); - gBS->FreePool (StdErrMapTable); + FreePool (ConOutMapTable); + FreePool (StdErrMapTable); return EFI_SUCCESS; } @@ -1986,7 +1986,7 @@ Returns: if (ModeBuffer == NULL) { return EFI_OUT_OF_RESOURCES; } - gBS->FreePool (Private->GraphicsOutputModeBuffer); + FreePool (Private->GraphicsOutputModeBuffer); Private->GraphicsOutputModeBuffer = ModeBuffer; // @@ -2001,7 +2001,7 @@ Returns: Mode->HorizontalResolution = Info->HorizontalResolution; Mode->VerticalResolution = Info->VerticalResolution; Mode++; - gBS->FreePool (Info); + FreePool (Info); } } else { // @@ -2025,10 +2025,10 @@ Returns: if ((Info->HorizontalResolution == Mode->HorizontalResolution) && (Info->VerticalResolution == Mode->VerticalResolution)){ Match = TRUE; - gBS->FreePool (Info); + FreePool (Info); break; } - gBS->FreePool (Info); + FreePool (Info); } if (Match) { @@ -2042,7 +2042,7 @@ Returns: // // Drop the old mode buffer, assign it to a new one // - gBS->FreePool (Private->GraphicsOutputModeBuffer); + FreePool (Private->GraphicsOutputModeBuffer); Private->GraphicsOutputModeBuffer = ModeBuffer; // @@ -2305,7 +2305,7 @@ Returns: Private->TextOutQueryDataCount * sizeof (TEXT_OUT_SPLITTER_QUERY_DATA) ); - gBS->FreePool (Private->TextOutModeMap); + FreePool (Private->TextOutModeMap); Private->TextOutModeMap = NULL; TextOutList = Private->TextOutList; @@ -3033,7 +3033,7 @@ ConSplitterTextOutOutputString ( } if (BackSpaceCount) { - gBS->FreePool (TargetString); + FreePool (TargetString); } return ReturnStatus; diff --git a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c index 9726889ec8..9faeb56d12 100644 --- a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c +++ b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c @@ -192,7 +192,6 @@ ConSpliterGraphicsOutputQueryMode ( --*/ { TEXT_OUT_SPLITTER_PRIVATE_DATA *Private; - EFI_STATUS Status; TEXT_OUT_GOP_MODE *Mode; if (This == NULL || Info == NULL || SizeOfInfo == NULL || ModeNumber >= This->Mode->MaxMode) { @@ -208,13 +207,10 @@ ConSpliterGraphicsOutputQueryMode ( return EFI_NOT_STARTED; } - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION), - (VOID **) 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); @@ -282,7 +278,7 @@ Routine Description: // Free the old version // if (Private->GraphicsOutputBlt != NULL) { - gBS->FreePool (Private->GraphicsOutputBlt); + FreePool (Private->GraphicsOutputBlt); } // @@ -316,10 +312,10 @@ Routine Description: return Status; } if ((Info->HorizontalResolution == Mode->HorizontalResolution) && (Info->VerticalResolution == Mode->VerticalResolution)) { - gBS->FreePool (Info); + FreePool (Info); break; } - gBS->FreePool (Info); + FreePool (Info); } Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) NumberIndex); @@ -754,7 +750,7 @@ ConSpliterUgaDrawSetMode ( // // Free the old version // - gBS->FreePool (Private->UgaBlt); + FreePool (Private->UgaBlt); // // Allocate the virtual Blt buffer @@ -1319,7 +1315,7 @@ DevNullTextOutSetMode ( Private->DevNullColumns = Column; Private->DevNullRows = Row; - gBS->FreePool (Private->DevNullScreen); + FreePool (Private->DevNullScreen); Size = (Row * (Column + 1)) * sizeof (CHAR16); Private->DevNullScreen = AllocateZeroPool (Size); @@ -1327,7 +1323,7 @@ DevNullTextOutSetMode ( return EFI_OUT_OF_RESOURCES; } - gBS->FreePool (Private->DevNullAttributes); + FreePool (Private->DevNullAttributes); Size = Row * Column * sizeof (INT32); Private->DevNullAttributes = AllocateZeroPool (Size); @@ -1604,7 +1600,7 @@ DevNullSyncGopStdOut ( } } - gBS->FreePool (Buffer); + FreePool (Buffer); return ReturnStatus; } diff --git a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c b/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c index 3f79991f3c..d3feef8ee4 100644 --- a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c +++ b/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c @@ -320,12 +320,12 @@ GraphicsConsoleControllerDriverStart ( // Package = PreparePackages (1, NULL, FontPack); mHii->NewPack (mHii, Package, &(Private->HiiHandle)); - gBS->FreePool (Package); + FreePool (Package); // // Free the font database // - gBS->FreePool (FontPack); + FreePool (FontPack); // // If the current mode information can not be retrieved, then attemp to set the default mode @@ -350,11 +350,11 @@ GraphicsConsoleControllerDriverStart ( (Info->VerticalResolution == 600)) { Status = Private->GraphicsOutput->SetMode (Private->GraphicsOutput, ModeNumber); if (!EFI_ERROR (Status)) { - gBS->FreePool (Info); + FreePool (Info); break; } } - gBS->FreePool (Info); + FreePool (Info); } } @@ -507,8 +507,8 @@ Error: // Free private data // if (Private != NULL) { - gBS->FreePool (Private->LineBuffer); - gBS->FreePool (Private); + FreePool (Private->LineBuffer); + FreePool (Private); } } @@ -577,8 +577,8 @@ GraphicsConsoleControllerDriverStop ( // Free our instance data // if (Private != NULL) { - gBS->FreePool (Private->LineBuffer); - gBS->FreePool (Private); + FreePool (Private->LineBuffer); + FreePool (Private); } } @@ -1166,16 +1166,14 @@ GraphicsConsoleConOutSetMode ( // // Attempt to allocate a line buffer for the requested mode number // - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * ModeData->Columns * GLYPH_WIDTH * GLYPH_HEIGHT, - (VOID **) &NewLineBuffer - ); - if (EFI_ERROR (Status)) { + NewLineBuffer = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * ModeData->Columns * GLYPH_WIDTH * GLYPH_HEIGHT); + + if (NewLineBuffer == NULL) { // // The new line buffer could not be allocated, so return an error. // No changes to the state of the current console have been made, so the current console is still valid // + Status = EFI_OUT_OF_RESOURCES; goto Done; } // @@ -1191,7 +1189,7 @@ GraphicsConsoleConOutSetMode ( // If the new mode is the same as the old mode, then just return EFI_SUCCESS // if ((INT32) ModeNumber == This->Mode->Mode) { - gBS->FreePool (NewLineBuffer); + FreePool (NewLineBuffer); Status = EFI_SUCCESS; goto Done; } @@ -1201,7 +1199,7 @@ GraphicsConsoleConOutSetMode ( // This->EnableCursor (This, FALSE); - gBS->FreePool (Private->LineBuffer); + FreePool (Private->LineBuffer); } // // Assign the current line buffer to the newly allocated line buffer diff --git a/EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.c b/EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.c index 6aa70e4c95..ba113c27ad 100644 --- a/EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.c +++ b/EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.c @@ -275,7 +275,7 @@ TerminalDriverBindingStart ( } } - gBS->FreePool (OpenInfoBuffer); + FreePool (OpenInfoBuffer); if (EFI_ERROR (Status)) { return Status; } @@ -566,7 +566,7 @@ TerminalDriverBindingStart ( } if (DefaultNode != NULL) { - gBS->FreePool (DefaultNode); + FreePool (DefaultNode); } return EFI_SUCCESS; @@ -604,15 +604,15 @@ Error: } if (TerminalDevice->DevicePath != NULL) { - gBS->FreePool (TerminalDevice->DevicePath); + FreePool (TerminalDevice->DevicePath); } - gBS->FreePool (TerminalDevice); + FreePool (TerminalDevice); } } if (DefaultNode != NULL) { - gBS->FreePool (DefaultNode); + FreePool (DefaultNode); } This->Stop (This, Controller, 0, NULL); @@ -713,7 +713,7 @@ TerminalDriverBindingStop ( // Free the ParentDevicePath that was duplicated in Start() // if (!EFI_ERROR (Status)) { - gBS->FreePool (ParentDevicePath); + FreePool (ParentDevicePath); } } @@ -803,8 +803,8 @@ TerminalDriverBindingStop ( gBS->CloseEvent (TerminalDevice->TwoSecondTimeOut); gBS->CloseEvent (TerminalDevice->SimpleInput.WaitForKey); - gBS->FreePool (TerminalDevice->DevicePath); - gBS->FreePool (TerminalDevice); + FreePool (TerminalDevice->DevicePath); + FreePool (TerminalDevice); } } @@ -850,11 +850,11 @@ TerminalUpdateConsoleDevVariable ( SetTerminalDevicePath (TerminalType, ParentDevicePath, &TempDevicePath); NewVariable = AppendDevicePathInstance (Variable, TempDevicePath); if (Variable != NULL) { - gBS->FreePool (Variable); + FreePool (Variable); } if (TempDevicePath != NULL) { - gBS->FreePool (TempDevicePath); + FreePool (TempDevicePath); } Variable = NewVariable; @@ -870,7 +870,7 @@ TerminalUpdateConsoleDevVariable ( Variable ); ASSERT_EFI_ERROR (Status); - gBS->FreePool (Variable); + FreePool (Variable); return ; } @@ -932,7 +932,7 @@ TerminalRemoveConsoleDevVariable ( // Instance = GetNextDevicePathInstance (&Variable, &InstanceSize); if (Instance == NULL) { - gBS->FreePool (OriginalVariable); + FreePool (OriginalVariable); return ; } // @@ -956,7 +956,7 @@ TerminalRemoveConsoleDevVariable ( FoundOne = TRUE; } - gBS->FreePool (TempDevicePath); + FreePool (TempDevicePath); } } // @@ -966,17 +966,17 @@ TerminalRemoveConsoleDevVariable ( SavedNewVariable = NewVariable; NewVariable = AppendDevicePathInstance (NewVariable, Instance); if (SavedNewVariable != NULL) { - gBS->FreePool (SavedNewVariable); + FreePool (SavedNewVariable); } } // // Get next device path instance from Variable // - gBS->FreePool (Instance); + FreePool (Instance); Instance = GetNextDevicePathInstance (&Variable, &InstanceSize); } while (Instance != NULL); - gBS->FreePool (OriginalVariable); + FreePool (OriginalVariable); if (FoundOne) { VariableSize = GetDevicePathSize (NewVariable); @@ -992,7 +992,7 @@ TerminalRemoveConsoleDevVariable ( } if (NewVariable != NULL) { - gBS->FreePool (NewVariable); + FreePool (NewVariable); } return ; @@ -1051,7 +1051,7 @@ Returns: // // Allocate the buffer to return // - gBS->FreePool (Buffer); + FreePool (Buffer); Buffer = AllocatePool (BufferSize); if (Buffer == NULL) { *VariableSize = 0; @@ -1063,7 +1063,7 @@ Returns: Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer); if (EFI_ERROR (Status)) { BufferSize = 0; - gBS->FreePool (Buffer); + FreePool (Buffer); Buffer = NULL; } } else { @@ -1071,7 +1071,7 @@ Returns: // Variable not found or other errors met. // BufferSize = 0; - gBS->FreePool (Buffer); + FreePool (Buffer); Buffer = NULL; } diff --git a/EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.c b/EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.c index 0ff5b4fd87..dd4a5a6b51 100644 --- a/EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.c +++ b/EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.c @@ -124,8 +124,9 @@ Returns: return Status; } - Status = gBS->AllocatePool (EfiBootServicesData, TotalSize, (VOID **) &LogEntry); - if (EFI_ERROR (Status)) { + LogEntry = AllocatePool (TotalSize); + + if (LogEntry == NULL) { EfiReleaseLock (&Private->DataLock); return EFI_OUT_OF_RESOURCES; } @@ -386,7 +387,7 @@ Returns: // Search for duplicate entries // if (FindFilterDriverByEvent (&Private->FilterDriverListHead, FilterEvent) != NULL) { - gBS->FreePool (FilterDriver); + FreePool (FilterDriver); return EFI_ALREADY_STARTED; } // diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.c b/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.c index 118e9b7979..a0ec6c5934 100644 --- a/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.c +++ b/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.c @@ -96,12 +96,12 @@ Returns: EFI_OPEN_PROTOCOL_GET_PROTOCOL ); if (Status == EFI_SUCCESS && DebugSupportProtocolPtr->Isa == EFI_ISA) { - gBS->FreePool (HandlePtr); + FreePool (HandlePtr); Status = EFI_ALREADY_STARTED; goto ErrExit; } } while (NumHandles > 0); - gBS->FreePool (HandlePtr); + FreePool (HandlePtr); } // diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.msa b/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.msa index 01b61af697..5c14254a0c 100644 --- a/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.msa +++ b/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.msa @@ -7,7 +7,7 @@ 1.0 Component description file for DebugSupport module. This driver installs DebugSupport protocol for the selected processor. - 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 @@ -17,35 +17,38 @@ FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052 - IA32 X64 IPF EBC + IA32 X64 IPF false DebugSupport - + DebugLib + Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg. UefiDriverEntryPoint - + BaseMemoryLib + Recommended libary Instance is DxeMemoryLib instance in MdePkg. - + MemoryAllocationLib + Recommended libary Instance is DxeMemoryAllocationLib instance in MdePkg. UefiBootServicesTableLib - + BaseLib DebugSupport.c DebugSupport.dxs - Ia32/AsmFuncs.asm - Ia32/AsmFuncs.S + Ia32/AsmFuncs.asm + Ia32/AsmFuncs.S Ia32/plDebugSupport.h Ia32/plDebugSupport.c ipf/AsmFuncs.s @@ -60,11 +63,14 @@ - gEfiDebugSupportProtocolGuid + If the debug support protocol for this processor type is not + already installed, this protocol will be installed. Otherwise, it will + be not installed again. + gEfiLoadedImageProtocolGuid diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/plDebugSupport.c b/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/plDebugSupport.c index 289158216c..270a158b79 100644 --- a/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/plDebugSupport.c +++ b/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/plDebugSupport.c @@ -45,16 +45,15 @@ Returns: --*/ { - EFI_STATUS Status; UINT8 *StubCopy; // // First, allocate a new buffer and copy the stub code into it // - Status = gBS->AllocatePool (EfiBootServicesData, StubSize, Stub); - if (Status == EFI_SUCCESS) { + *Stub = AllocatePool (StubSize); + if (*Stub != NULL) { StubCopy = *Stub; - gBS->CopyMem (StubCopy, InterruptEntryStub, StubSize); + CopyMem (StubCopy, InterruptEntryStub, StubSize); // // Next fixup the stub code for this vector @@ -78,9 +77,11 @@ Returns: // fixup the jump target to point to the common entry // *(UINT32 *) &StubCopy[0x0e] = (UINT32) CommonIdtEntry - (UINT32) &StubCopy[StubSize]; + + return EFI_SUCCESS; } - return Status; + return EFI_OUT_OF_RESOURCES; } STATIC @@ -144,20 +145,18 @@ Arguments: Returns: EFI_SUCCESS - Other values are passed through from FreePool --*/ { BOOLEAN OldIntFlagState; - EFI_STATUS Status; OldIntFlagState = WriteInterruptFlag (0); WriteIdt (ExceptionType, &(IdtEntryTable[ExceptionType].OrigDesc)); - Status = gBS->FreePool ((VOID *) (UINTN) IdtEntryTable[ExceptionType].StubEntry); + FreePool ((VOID *) (UINTN) IdtEntryTable[ExceptionType].StubEntry); ZeroMem (&IdtEntryTable[ExceptionType], sizeof (IDT_ENTRY)); WriteInterruptFlag (OldIntFlagState); - return (Status); + return EFI_SUCCESS; } #endif @@ -405,7 +404,7 @@ Returns: ManageIdtEntryTable (NULL, ExceptionType); } - gBS->FreePool (IdtEntryTable); + FreePool (IdtEntryTable); return EFI_SUCCESS; } diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/plDebugSupport.c b/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/plDebugSupport.c index 513d71f62f..ca2a1e83d2 100644 --- a/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/plDebugSupport.c +++ b/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/plDebugSupport.c @@ -107,7 +107,7 @@ Returns: --*/ { - gBS->SetMem (IvtEntryTable, sizeof (IvtEntryTable), 0); + SetMem (IvtEntryTable, sizeof (IvtEntryTable), 0); ExternalInterruptCount = 0; return EFI_SUCCESS; } @@ -298,7 +298,7 @@ Returns: // // re-init IvtEntryTable // - gBS->SetMem (&IvtEntryTable[ExceptionType], sizeof (IVT_ENTRY), 0); + SetMem (&IvtEntryTable[ExceptionType], sizeof (IVT_ENTRY), 0); } } else { // @@ -356,15 +356,15 @@ Returns: // // copy original bundles from IVT to IvtEntryTable so we can restore them later // - gBS->CopyMem ( - IvtEntryTable[ExceptionType].OrigBundles, - B0Ptr, - sizeof (BUNDLE) * NUM_BUNDLES_IN_STUB - ); + CopyMem ( + IvtEntryTable[ExceptionType].OrigBundles, + B0Ptr, + sizeof (BUNDLE) * NUM_BUNDLES_IN_STUB + ); // // insert new B0 // - gBS->CopyMem (B0Ptr, NewBundles, sizeof (BUNDLE) * NUM_BUNDLES_IN_STUB); + CopyMem (B0Ptr, NewBundles, sizeof (BUNDLE) * NUM_BUNDLES_IN_STUB); // // fixup IVT entry so it stores its index and whether or not to chain... @@ -406,11 +406,11 @@ Returns: // // restore original bundles in IVT // - gBS->CopyMem ( - B0Ptr, - IvtEntryTable[ExceptionType].OrigBundles, - sizeof (BUNDLE) * NUM_BUNDLES_IN_STUB - ); + CopyMem ( + B0Ptr, + IvtEntryTable[ExceptionType].OrigBundles, + sizeof (BUNDLE) * NUM_BUNDLES_IN_STUB + ); InstructionCacheFlush (B0Ptr, 5); } diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/x64/plDebugSupport.c b/EdkModulePkg/Universal/DebugSupport/Dxe/x64/plDebugSupport.c index b3580a42fa..6fb4cdb542 100644 --- a/EdkModulePkg/Universal/DebugSupport/Dxe/x64/plDebugSupport.c +++ b/EdkModulePkg/Universal/DebugSupport/Dxe/x64/plDebugSupport.c @@ -44,16 +44,15 @@ Returns: --*/ { - EFI_STATUS Status; UINT8 *StubCopy; // // First, allocate a new buffer and copy the stub code into it // - Status = gBS->AllocatePool (EfiBootServicesData, StubSize, Stub); - if (Status == EFI_SUCCESS) { + *Stub = AllocatePool (StubSize); + if (*Stub != NULL) { StubCopy = *Stub; - gBS->CopyMem (StubCopy, InterruptEntryStub, StubSize); + CopyMem (StubCopy, InterruptEntryStub, StubSize); // // Next fixup the stub code for this vector @@ -75,9 +74,11 @@ Returns: // fixup the jump target to point to the common entry // *(UINT32 *) &StubCopy[0x3] = (UINT32)((UINTN) CommonIdtEntry - (UINTN) &StubCopy[StubSize]); + + return EFI_SUCCESS; } - return Status; + return EFI_OUT_OF_RESOURCES; } STATIC @@ -142,20 +143,18 @@ Arguments: Returns: EFI_SUCCESS - Other values are passed through from FreePool --*/ { BOOLEAN OldIntFlagState; - EFI_STATUS Status; - + OldIntFlagState = WriteInterruptFlag (0); WriteIdt (ExceptionType, &(IdtEntryTable[ExceptionType].OrigDesc)); - Status = gBS->FreePool ((VOID *) (UINTN) IdtEntryTable[ExceptionType].StubEntry); + FreePool ((VOID *) (UINTN) IdtEntryTable[ExceptionType].StubEntry); ZeroMem (&IdtEntryTable[ExceptionType], sizeof (IDT_ENTRY)); WriteInterruptFlag (OldIntFlagState); - return (Status); + return EFI_SUCCESS; } EFI_STATUS @@ -401,7 +400,7 @@ Returns: ManageIdtEntryTable (NULL, ExceptionType); } - gBS->FreePool (IdtEntryTable); + FreePool (IdtEntryTable); return EFI_SUCCESS; } diff --git a/EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.c b/EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.c index 88d19d4ad0..a15ec1cb30 100644 --- a/EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.c +++ b/EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.c @@ -67,7 +67,7 @@ Returns: if (Status == EFI_BUFFER_TOO_SMALL) { if (gDebugPortDevice->DebugPortVariable != NULL) { - gBS->FreePool (gDebugPortDevice->DebugPortVariable); + FreePool (gDebugPortDevice->DebugPortVariable); } DebugPortDevice->DebugPortVariable = AllocatePool (DataSize); @@ -85,31 +85,31 @@ Returns: } if (EfiIsDevicePathEnd (DevicePath)) { - gBS->FreePool (gDebugPortDevice->DebugPortVariable); + FreePool (gDebugPortDevice->DebugPortVariable); DebugPortDevice->DebugPortVariable = NULL; } else { - gBS->CopyMem ( - &DebugPortDevice->BaudRate, - &((UART_DEVICE_PATH *) DevicePath)->BaudRate, - sizeof (((UART_DEVICE_PATH *) DevicePath)->BaudRate) - ); + CopyMem ( + &DebugPortDevice->BaudRate, + &((UART_DEVICE_PATH *) DevicePath)->BaudRate, + sizeof (((UART_DEVICE_PATH *) DevicePath)->BaudRate) + ); DebugPortDevice->ReceiveFifoDepth = DEBUGPORT_UART_DEFAULT_FIFO_DEPTH; DebugPortDevice->Timeout = DEBUGPORT_UART_DEFAULT_TIMEOUT; - gBS->CopyMem ( - &DebugPortDevice->Parity, - &((UART_DEVICE_PATH *) DevicePath)->Parity, - sizeof (((UART_DEVICE_PATH *) DevicePath)->Parity) - ); - gBS->CopyMem ( - &DebugPortDevice->DataBits, - &((UART_DEVICE_PATH *) DevicePath)->DataBits, - sizeof (((UART_DEVICE_PATH *) DevicePath)->DataBits) - ); - gBS->CopyMem ( - &DebugPortDevice->StopBits, - &((UART_DEVICE_PATH *) DevicePath)->StopBits, - sizeof (((UART_DEVICE_PATH *) DevicePath)->StopBits) - ); + CopyMem ( + &DebugPortDevice->Parity, + &((UART_DEVICE_PATH *) DevicePath)->Parity, + sizeof (((UART_DEVICE_PATH *) DevicePath)->Parity) + ); + CopyMem ( + &DebugPortDevice->DataBits, + &((UART_DEVICE_PATH *) DevicePath)->DataBits, + sizeof (((UART_DEVICE_PATH *) DevicePath)->DataBits) + ); + CopyMem ( + &DebugPortDevice->StopBits, + &((UART_DEVICE_PATH *) DevicePath)->StopBits, + sizeof (((UART_DEVICE_PATH *) DevicePath)->StopBits) + ); } } } @@ -273,7 +273,7 @@ Returns: Status = EFI_UNSUPPORTED; } - gBS->FreePool (Dp1); + FreePool (Dp1); if (EFI_ERROR (Status)) { return Status; } @@ -389,7 +389,7 @@ Returns: DebugPortDP.Header.Type = MESSAGING_DEVICE_PATH; DebugPortDP.Header.SubType = MSG_VENDOR_DP; SetDevicePathNodeLength (&(DebugPortDP.Header), sizeof (DebugPortDP)); - gBS->CopyMem (&DebugPortDP.Guid, &gEfiDebugPortDevicePathGuid, sizeof (EFI_GUID)); + CopyMem (&DebugPortDP.Guid, &gEfiDebugPortDevicePathGuid, sizeof (EFI_GUID)); Dp1 = DevicePathFromHandle (ControllerHandle); if (Dp1 == NULL) { @@ -516,7 +516,7 @@ Returns: ControllerHandle ); - gBS->FreePool (gDebugPortDevice->DebugPortDevicePath); + FreePool (gDebugPortDevice->DebugPortDevicePath); return EFI_SUCCESS; } else { @@ -803,10 +803,10 @@ Returns: // Clean up allocations // if (gDebugPortDevice->DebugPortVariable != NULL) { - gBS->FreePool (gDebugPortDevice->DebugPortVariable); + FreePool (gDebugPortDevice->DebugPortVariable); } - gBS->FreePool (gDebugPortDevice); + FreePool (gDebugPortDevice); return EFI_SUCCESS; } diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h index f74a65c48b..d7311aa00a 100644 --- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h +++ b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h @@ -11,7 +11,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: - DevicePathDriver.h + DevicePath.h Abstract: Definition for Device Path Utilities driver diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.msa b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.msa index 541c01482d..bd082809e3 100644 --- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.msa +++ b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.msa @@ -6,8 +6,9 @@ 9B680FCE-AD6B-4F3A-B60B-F59899003443 1.0 Component description file for Device Path Driver. - This driver is for DevicePathUtilities, DevicePahtToText and DevicePathFromText - Copyright (c) 2006, Intel Corporation + This driver implement these three UEFI deveice path protocols ( + DevicePathUtilities, DevicePahtToText and DevicePathFromText) and install them. + 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 @@ -22,18 +23,17 @@ DevicePath - + DebugLib + Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg. - + PrintLib + Recommended libary Instance is BasePrintLib instance in MdePkg. UefiDriverEntryPoint - - UefiLib - BaseLib @@ -46,8 +46,9 @@ UefiBootServicesTableLib - + DevicePathLib + Recommended libary Instance is UefiDevicePathLib instance in MdePkg. PcdLib @@ -68,9 +69,6 @@ gEfiDebugPortProtocolGuid - - gEfiDevicePathProtocolGuid - gEfiDevicePathUtilitiesProtocolGuid @@ -103,13 +101,13 @@ - + PcdDevicePathSupportDevicePathToText gEfiEdkModulePkgTokenSpaceGuid FALSE If TRUE, then the Device Path To Text Protocol should be produced by the platform - + PcdDevicePathSupportDevicePathFromText gEfiEdkModulePkgTokenSpaceGuid FALSE diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathFromText.c b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathFromText.c index 3014b200ac..94a4a2b5b7 100644 --- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathFromText.c +++ b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathFromText.c @@ -2277,10 +2277,10 @@ ConvertTextToDeviceNode ( DeviceNode = DumpNode (DeviceNodeStr); } else { DeviceNode = DumpNode (ParamStr); - gBS->FreePool (ParamStr); + FreePool (ParamStr); } - gBS->FreePool (DeviceNodeStr); + FreePool (DeviceNodeStr); return DeviceNode; } @@ -2346,12 +2346,12 @@ ConvertTextToDevicePath ( DeviceNode = DumpNode (DeviceNodeStr); } else { DeviceNode = DumpNode (ParamStr); - gBS->FreePool (ParamStr); + FreePool (ParamStr); } NewDevicePath = AppendDeviceNodeProtocolInterface (DevicePath, DeviceNode); - gBS->FreePool (DevicePath); - gBS->FreePool (DeviceNode); + FreePool (DevicePath); + FreePool (DeviceNode); DevicePath = NewDevicePath; if (IsInstanceEnd) { @@ -2359,12 +2359,12 @@ ConvertTextToDevicePath ( SetDevicePathInstanceEndNode (DeviceNode); NewDevicePath = AppendDeviceNodeProtocolInterface (DevicePath, DeviceNode); - gBS->FreePool (DevicePath); - gBS->FreePool (DeviceNode); + FreePool (DevicePath); + FreePool (DeviceNode); DevicePath = NewDevicePath; } } - gBS->FreePool (DevicePathStr); + FreePool (DevicePathStr); return DevicePath; } diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathToText.c b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathToText.c index 03150706c7..f1365baa26 100644 --- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathToText.c +++ b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathToText.c @@ -132,7 +132,7 @@ ReallocatePool ( CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize); } - gBS->FreePool (OldPool); + FreePool (OldPool); } return NewPool; @@ -196,7 +196,7 @@ CatPrint ( Str->Len = Size - sizeof (UINT16); } - gBS->FreePool (AppendStr); + FreePool (AppendStr); return Str->Str; } @@ -1488,7 +1488,7 @@ ConvertDevicePathToText ( // // Shrink pool used for string allocation // - gBS->FreePool (UnpackDevPath); + FreePool (UnpackDevPath); NewSize = (Str.Len + 1) * sizeof (CHAR16); Str.Str = ReallocatePool (Str.Str, NewSize, NewSize); -- 2.39.2