From 863986b3c8e67736d361b68e293d01e6f92f825c Mon Sep 17 00:00:00 2001 From: Ruiyu Ni Date: Fri, 26 Jul 2013 03:14:08 +0000 Subject: Update all the code to consume the ConvertDevicePathToText, ConvertDevicePathNodeToText, ConvertTextToDevicePath and ConvertTextToDeviceNode APIs in DevicePathLib. Signed-off-by: Ruiyu Ni Reviewed-by: Feng Tian Reviewed-by: Elvin Li Reviewed-by: Eric Dong Reviewed-by: Star Zeng Reviewed-by: Jaben Carsey Reviewed-by: Guo Dong git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14505 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h | 3 +- MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf | 3 +- MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c | 19 +++------- .../Universal/DriverSampleDxe/DriverSample.c | 11 +----- .../Universal/DriverSampleDxe/DriverSample.h | 1 - .../Universal/DriverSampleDxe/DriverSampleDxe.inf | 2 +- .../InternalPlatDriOverrideDxe.h | 3 +- .../PlatformDriOverrideDxe/PlatDriOverrideDxe.c | 44 +++++++--------------- .../PlatformDriOverrideDxe.inf | 3 +- 9 files changed, 25 insertions(+), 64 deletions(-) (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h index 348ce392e6..fc62a251c2 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h @@ -1,7 +1,7 @@ /** @file Header files and data structures needed by PCI Bus module. -Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2013, 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 @@ -32,7 +32,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include #include #include diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf index 8c557f2fd7..34eb672df1 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf @@ -5,7 +5,7 @@ # space for these devices. Please use PCD feature flag PcdPciBusHotplugDeviceSupport to enable # hot plug supporting. # -# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2013, 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 @@ -97,7 +97,6 @@ gEfiPciRootBridgeIoProtocolGuid ## CONSUMED gEfiIncompatiblePciDeviceSupportProtocolGuid ## CONSUMED gEfiLoadFile2ProtocolGuid ## CONSUMED - gEfiDevicePathToTextProtocolGuid ## CONSUMED [FeaturePcd] gEfiMdeModulePkgTokenSpaceGuid.PcdPciBusHotplugDeviceSupport diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c index a5cea9e52a..b3d91a8d30 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c @@ -290,7 +290,6 @@ DumpResourceMap ( PCI_RESOURCE_NODE *ChildPMem32Node; PCI_RESOURCE_NODE *ChildMem64Node; PCI_RESOURCE_NODE *ChildPMem64Node; - EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *ToText; CHAR16 *Str; DEBUG ((EFI_D_INFO, "PciBus: Resource Map for ")); @@ -309,19 +308,11 @@ DumpResourceMap ( Bridge->BusNumber, Bridge->DeviceNumber, Bridge->FunctionNumber )); } else { - Status = gBS->LocateProtocol ( - &gEfiDevicePathToTextProtocolGuid, - NULL, - (VOID **) &ToText - ); - Str = NULL; - if (!EFI_ERROR (Status)) { - Str = ToText->ConvertDevicePathToText ( - DevicePathFromHandle (Bridge->Handle), - FALSE, - FALSE - ); - } + Str = ConvertDevicePathToText ( + DevicePathFromHandle (Bridge->Handle), + FALSE, + FALSE + ); DEBUG ((EFI_D_INFO, "Root Bridge %s\n", Str != NULL ? Str : L"")); if (Str != NULL) { FreePool (Str); diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c index cb2cbe7932..d79a81a6d9 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c +++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c @@ -1798,14 +1798,12 @@ DriverSampleInit ( MY_EFI_VARSTORE_DATA *VarStoreConfig; EFI_INPUT_KEY HotKey; EFI_FORM_BROWSER_EXTENSION_PROTOCOL *FormBrowserEx; - EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *PathToText; // // Initialize the local variables. // ConfigRequestHdr = NULL; NewString = NULL; - PathToText = NULL; // // Initialize screen dimensions for SendForm(). @@ -1922,18 +1920,11 @@ DriverSampleInit ( } PrivateData->HiiHandle[1] = HiiHandle[1]; - - Status = gBS->LocateProtocol ( - &gEfiDevicePathToTextProtocolGuid, - NULL, - (VOID **) &PathToText - ); - ASSERT_EFI_ERROR (Status); // // Update the device path string. // - NewString = PathToText->ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL*)&mHiiVendorDevicePath0, FALSE, FALSE); + NewString = ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL*)&mHiiVendorDevicePath0, FALSE, FALSE); if (HiiSetString (HiiHandle[0], STRING_TOKEN (STR_DEVICE_PATH), NewString, NULL) == 0) { DriverSampleUnload (ImageHandle); return EFI_OUT_OF_RESOURCES; diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h index cd546bf388..29870c0f1f 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h +++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h @@ -32,7 +32,6 @@ Revision History #include #include #include -#include #include #include diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf b/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf index 36511e66d0..1affe874bc 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf +++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf @@ -55,6 +55,7 @@ HiiLib PrintLib UefiLib + DevicePathLib [Guids] gEfiIfrTianoGuid ## CONSUMES ## Guid @@ -70,7 +71,6 @@ gEfiHiiDatabaseProtocolGuid ## CONSUMES gEfiSimpleTextInputExProtocolGuid ## CONSUMES gEfiFormBrowserExProtocolGuid ## CONSUMES - gEfiDevicePathToTextProtocolGuid ## CONSUMES [Depex] gEfiSimpleTextOutProtocolGuid AND gEfiHiiDatabaseProtocolGuid AND gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid diff --git a/MdeModulePkg/Universal/PlatformDriOverrideDxe/InternalPlatDriOverrideDxe.h b/MdeModulePkg/Universal/PlatformDriOverrideDxe/InternalPlatDriOverrideDxe.h index 60113fee12..75af763522 100644 --- a/MdeModulePkg/Universal/PlatformDriOverrideDxe/InternalPlatDriOverrideDxe.h +++ b/MdeModulePkg/Universal/PlatformDriOverrideDxe/InternalPlatDriOverrideDxe.h @@ -2,7 +2,7 @@ Ihe internal heder file includes the required Protocol/Guid/Library and the shared function APIs. -Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2013, 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 @@ -29,7 +29,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include #include #include #include diff --git a/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c b/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c index 9c0064df29..ab254a0b45 100644 --- a/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c +++ b/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c @@ -13,7 +13,7 @@ 4. It save all the mapping info in NV variables which will be consumed by platform override protocol driver to publish the platform override protocol. -Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2013, 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 @@ -104,45 +104,29 @@ HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath = { }; /** - Converting a given device to an unicode string. - - This function will dependent on gEfiDevicePathToTextProtocolGuid, if protocol - does not installed, then return unknown device path L"?" directly. - + Converting a given device to an unicode string. + @param DevPath Given device path instance @return Converted string from given device path. - @retval L"?" Can not locate gEfiDevicePathToTextProtocolGuid protocol for converting. + @retval L"?" Converting failed. **/ CHAR16 * DevicePathToStr ( IN EFI_DEVICE_PATH_PROTOCOL *DevPath ) { - EFI_STATUS Status; - EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText; - CHAR16 *ToText; - - if (DevPath == NULL) { - return L""; - } - - Status = gBS->LocateProtocol ( - &gEfiDevicePathToTextProtocolGuid, - NULL, - (VOID **) &DevPathToText - ); - if (!EFI_ERROR (Status)) { - ToText = DevPathToText->ConvertDevicePathToText ( - DevPath, - FALSE, - TRUE - ); - ASSERT (ToText != NULL); - return ToText; + CHAR16 *Text; + Text = ConvertDevicePathToText ( + DevPath, + FALSE, + TRUE + ); + if (Text == NULL) { + return AllocateCopyPool (sizeof (L"?"), L"?"); + } else { + return Text; } - - return L"?"; } /** diff --git a/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatformDriOverrideDxe.inf b/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatformDriOverrideDxe.inf index bf333d29df..9702f249b5 100644 --- a/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatformDriOverrideDxe.inf +++ b/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatformDriOverrideDxe.inf @@ -16,7 +16,7 @@ # 4. It save all the mapping info in NV variables for the following boot, # which will be consumed by GetDriver API of the produced the platform override protocol. # -# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2013, 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 @@ -95,7 +95,6 @@ gEfiFormBrowser2ProtocolGuid ## CONSUMED gEfiHiiConfigRoutingProtocolGuid ## CONSUMED gEfiHiiConfigAccessProtocolGuid ## PRODUCED - gEfiDevicePathToTextProtocolGuid ## CONSUMED gEfiPlatformDriverOverrideProtocolGuid ## PRODUCED [Depex] -- cgit v1.2.3