From ec8cd35c80fa0b5d9cf249754780f6f3d3809160 Mon Sep 17 00:00:00 2001 From: klu2 Date: Tue, 22 Jul 2008 04:17:51 +0000 Subject: Code scrub for GenericBdsLib git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5545 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Library/GenericBdsLib/DevicePath.c | 37 ++++--------------------- 1 file changed, 6 insertions(+), 31 deletions(-) (limited to 'MdeModulePkg/Library/GenericBdsLib/DevicePath.c') diff --git a/MdeModulePkg/Library/GenericBdsLib/DevicePath.c b/MdeModulePkg/Library/GenericBdsLib/DevicePath.c index fc6d420..7435d54 100644 --- a/MdeModulePkg/Library/GenericBdsLib/DevicePath.c +++ b/MdeModulePkg/Library/GenericBdsLib/DevicePath.c @@ -15,17 +15,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "InternalBdsLib.h" - -EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid = DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL; - -EFI_GUID mEfiDevicePathMessagingSASGuid = DEVICE_PATH_MESSAGING_SAS; - - /** Adjusts the size of a previously allocated buffer. - @param OldPool A pointer to the buffer whose size is being adjusted. @param OldSize The size of the current buffer. @param NewSize The size of the new buffer. @@ -52,13 +45,12 @@ ReallocatePool ( CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize); } - gBS->FreePool (OldPool); + SafeFreePool (OldPool); } return NewPool; } - /** Concatenates a formatted unicode string to allocated pool. The caller must free the resulting buffer. @@ -116,7 +108,7 @@ CatPrint ( Str->len = StringSize - sizeof (UINT16); } - gBS->FreePool (AppendStr); + SafeFreePool (AppendStr); return Str->str; } @@ -314,22 +306,6 @@ DevPathVendor ( switch (DevicePathType (&Vendor->Header)) { case HARDWARE_DEVICE_PATH: Type = L"Hw"; -// bugbug: nt 32 specific definition -#if 0 - // - // If the device is a winntbus device, we will give it a readable device name. - // - if (CompareGuid (&Vendor->Guid, &mEfiWinNtThunkProtocolGuid)) { - CatPrint (Str, L"%s", L"WinNtBus"); - return ; - } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtGopGuid)) { - CatPrint (Str, L"%s", L"GOP"); - return ; - } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtSerialPortGuid)) { - CatPrint (Str, L"%s", L"Serial"); - return ; - } -#endif break; case MESSAGING_DEVICE_PATH: @@ -346,7 +322,7 @@ DevPathVendor ( } else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) { CatPrint (Str, L"VenUft8()"); return ; - } else if (CompareGuid (&Vendor->Guid, &mEfiDevicePathMessagingUartFlowControlGuid)) { + } else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid )) { FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *) Vendor)->FlowControlMap); switch (FlowControlMap & 0x00000003) { case 0: @@ -367,7 +343,7 @@ DevPathVendor ( return ; - } else if (CompareGuid (&Vendor->Guid, &mEfiDevicePathMessagingSASGuid)) { + } else if (CompareGuid (&Vendor->Guid, &gEfiSasDevicePathGuid)) { CatPrint ( Str, L"SAS(%lx,%lx,%x,", @@ -424,7 +400,6 @@ DevPathVendor ( CatPrint (Str, L")"); } - /** Convert Device Path to a Unicode string for printing. @@ -468,6 +443,7 @@ DevPathExtendedAcpi ( ) { ACPI_EXTENDED_HID_DEVICE_PATH *ExtendedAcpi; + // // Index for HID, UID and CID strings, 0 for non-exist // @@ -1550,7 +1526,7 @@ DevicePathToStr ( // // Shrink pool used for string allocation // - gBS->FreePool (DevPath); + SafeFreePool (DevPath); Done: NewSize = (Str.len + 1) * sizeof (CHAR16); @@ -1560,7 +1536,6 @@ Done: return Str.str; } - /** Function creates a device path data structure that identically matches the device path passed in. -- cgit v1.1