Skip to content

Commit

Permalink
Sync part of patches r14505, r14519 and r14558 from main trunk.
Browse files Browse the repository at this point in the history
1. Update all the code to consume the ConvertDevicePathToText, ConvertDevicePathNodeToText, ConvertTextToDevicePath and ConvertTextToDeviceNode APIs in DevicePathLib.
2. OvmfPkg: Use the new DevicePathLib for all platforms.

git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2010.SR1@14643 6f19259b-4bc3-4df7-8a09-765794883524
  • Loading branch information
vanjeff authored and vanjeff committed Sep 10, 2013
1 parent 369fb82 commit e450b5b
Show file tree
Hide file tree
Showing 56 changed files with 188 additions and 3,365 deletions.
1,542 changes: 2 additions & 1,540 deletions IntelFrameworkModulePkg/Library/GenericBdsLib/DevicePath.c

Large diffs are not rendered by default.

16 changes: 1 addition & 15 deletions IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# 2) BDS boot device connect interface;
# 3) BDS Misc interfaces for mainting boot variable, ouput string, etc.
#
# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
# 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
Expand Down Expand Up @@ -70,24 +70,11 @@
ReportStatusCodeLib

[Guids]
gEfiVT100PlusGuid ## CONSUMES ## GUID (The type of terminal)
gEfiVT100Guid ## CONSUMES ## GUID (The type of terminal)
## CONSUMES ## GUID HOB (The hob holding memory type information)
gEfiMemoryTypeInformationGuid ## CONSUMES ## GUID (The identifier of memory type information type in system table)
gEfiVTUTF8Guid ## CONSUMES ## GUID (The type of terminal)
## SOMETIMES_CONSUMES ## Variable:L"BootXX" (Boot option variable)
## CONSUMES ## Variable:L"Timeout" (The time out value in second of showing progress bar)
## SOMETIMES_CONSUMES ## Variable:L"BootOrder" (The boot option array)
## SOMETIMES_CONSUMES ## Variable:L"DriverOrder" (The driver order list)
## SOMETIMES_CONSUMES ## Variable:L"ConIn" (The device path of console in device)
## SOMETIMES_CONSUMES ## Variable:L"ConOut" (The device path of console out device)
## SOMETIMES_CONSUMES ## Variable:L"ErrOut" (The device path of error out device)
gEfiGlobalVariableGuid ## SOMETIMES_PRODUCES ## Variable:L"BootCurrent" (The boot option of current boot)
gEfiFileInfoGuid ## CONSUMES ## GUID
gEfiPcAnsiGuid ## CONSUMES ## GUID (The type of terminal)
gPerformanceProtocolGuid ## SOMETIMES_PRODUCES ## Variable:L"PerfDataMemAddr" (The ACPI address of performance data)
gEfiUartDevicePathGuid ## CONSUMES ## GUID (Identify the device path for UARD device)
gEfiSasDevicePathGuid ## CONSUMES ## GUID (Identify the device path for SAS device)
gLastEnumLangGuid ## SOMETIMES_PRODUCES ## Variable:L"LastEnumLang" (Platform language at last time enumeration.)
gHdBootDevicePathVariablGuid ## SOMETIMES_PRODUCES ## Variable:L"HDDP" (The device path of Boot file on Hard device.)
gBdsLibStringPackageGuid ## PRODUCES ## GUID (HII String PackageList Guid)
Expand All @@ -98,7 +85,6 @@
gEfiSimpleTextOutProtocolGuid # PROTOCOL CONSUMES
gEfiPciIoProtocolGuid # PROTOCOL CONSUMES
gEfiLoadedImageProtocolGuid # PROTOCOL CONSUMES
gEfiDevicePathToTextProtocolGuid # PROTOCOL SOMETIMES_CONSUMES
gEfiSimpleNetworkProtocolGuid # PROTOCOL CONSUMES
gEfiDebugPortProtocolGuid # PROTOCOL CONSUMES
gEfiSimpleTextInProtocolGuid # PROTOCOL CONSUMES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/LegacyBios.h>
#include <Protocol/SimpleTextOut.h>
#include <Protocol/SimpleNetwork.h>
#include <Protocol/DevicePathToText.h>
#include <Protocol/FirmwareVolume2.h>
#include <Protocol/PciIo.h>
#include <Protocol/AcpiS3Save.h>
Expand Down
3 changes: 1 addition & 2 deletions MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @file
Header files and data structures needed by PCI Bus module.
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
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
Expand Down Expand Up @@ -32,7 +32,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/IncompatiblePciDeviceSupport.h>
#include <Protocol/PciOverride.h>
#include <Protocol/PciEnumerationComplete.h>
#include <Protocol/DevicePathToText.h>

#include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h>
Expand Down
3 changes: 1 addition & 2 deletions MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
Original file line number Diff line number Diff line change
Expand Up @@ -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.<BR>
# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
Expand Down Expand Up @@ -97,7 +97,6 @@
gEfiPciRootBridgeIoProtocolGuid ## CONSUMED
gEfiIncompatiblePciDeviceSupportProtocolGuid ## CONSUMED
gEfiLoadFile2ProtocolGuid ## CONSUMED
gEfiDevicePathToTextProtocolGuid ## CONSUMED

[FeaturePcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdPciBusHotplugDeviceSupport
Expand Down
19 changes: 5 additions & 14 deletions MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 "));
Expand All @@ -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);
Expand Down
12 changes: 2 additions & 10 deletions MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
Original file line number Diff line number Diff line change
Expand Up @@ -1795,14 +1795,13 @@ DriverSampleInit (
BOOLEAN ActionFlag;
EFI_STRING ConfigRequestHdr;
MY_EFI_VARSTORE_DATA *VarStoreConfig;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *PathToText;

//
// Initialize the local variables.
//
ConfigRequestHdr = NULL;
NewString = NULL;
PathToText = NULL;

//
// Initialize screen dimensions for SendForm().
// Remove 3 characters from top and bottom
Expand Down Expand Up @@ -1918,18 +1917,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;
Expand Down
1 change: 0 additions & 1 deletion MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Revision History
#include <Protocol/HiiConfigAccess.h>
#include <Protocol/HiiDatabase.h>
#include <Protocol/HiiString.h>
#include <Protocol/DevicePathToText.h>

#include <Guid/MdeModuleHii.h>
#include <Library/DebugLib.h>
Expand Down
3 changes: 1 addition & 2 deletions MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
HiiLib
PrintLib
UefiLib
DevicePathLib

[Guids]
gEfiIfrTianoGuid ## CONSUMES ## Guid
Expand All @@ -70,8 +71,6 @@
gEfiHiiDatabaseProtocolGuid ## CONSUMES
gEfiSimpleTextInputExProtocolGuid ## CONSUMES

gEfiDevicePathToTextProtocolGuid ## CONSUMES

[Depex]
gEfiSimpleTextOutProtocolGuid AND gEfiHiiDatabaseProtocolGuid AND gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid

Original file line number Diff line number Diff line change
Expand Up @@ -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.<BR>
Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
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
Expand All @@ -29,7 +29,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/ComponentName2.h>
#include <Protocol/ComponentName.h>
#include <Protocol/DriverBinding.h>
#include <Protocol/DevicePathToText.h>
#include <Protocol/DevicePath.h>
#include <Protocol/PlatformDriverOverride.h>
#include <Guid/MdeModuleHii.h>
Expand Down
44 changes: 14 additions & 30 deletions MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.<BR>
Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
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
Expand Down Expand Up @@ -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"?";
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.<BR>
# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
Expand Down Expand Up @@ -95,7 +95,6 @@
gEfiFormBrowser2ProtocolGuid ## CONSUMED
gEfiHiiConfigRoutingProtocolGuid ## CONSUMED
gEfiHiiConfigAccessProtocolGuid ## PRODUCED
gEfiDevicePathToTextProtocolGuid ## CONSUMED
gEfiPlatformDriverOverrideProtocolGuid ## PRODUCED

[Depex]
Expand Down
8 changes: 6 additions & 2 deletions Nt32Pkg/Nt32Pkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
Expand Down Expand Up @@ -269,6 +269,7 @@
MdeModulePkg/Core/Dxe/DxeMain.inf {
<LibraryClasses>
NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
<BuildOptions>
*_*_IA32_CC_FLAGS =
}
Expand Down Expand Up @@ -311,7 +312,10 @@
<LibraryClasses>
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
}
MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf {
<LibraryClasses>
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
}
MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
Expand Down
1 change: 1 addition & 0 deletions Nt32Pkg/Nt32Pkg.fdf
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ APRIORI PEI {
INF Nt32Pkg/WinNtOemHookStatusCodeHandlerPei/WinNtOemHookStatusCodeHandlerPei.inf
}
APRIORI DXE {
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
INF Nt32Pkg/MetronomeDxe/MetronomeDxe.inf
}
Expand Down
52 changes: 29 additions & 23 deletions OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @file
Platform BDS customizations.
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
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
Expand Down Expand Up @@ -222,14 +222,16 @@ Routine Description:
// Print Device Path
//
DevPathStr = DevicePathToStr(DevicePath);
DEBUG((
EFI_D_INFO,
"BdsPlatform.c+%d: COM%d DevPath: %s\n",
__LINE__,
gPnp16550ComPortDeviceNode.UID + 1,
DevPathStr
));
FreePool(DevPathStr);
if (DevPathStr != NULL) {
DEBUG((
EFI_D_INFO,
"BdsPlatform.c+%d: COM%d DevPath: %s\n",
__LINE__,
gPnp16550ComPortDeviceNode.UID + 1,
DevPathStr
));
FreePool(DevPathStr);
}

BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);
BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);
Expand All @@ -249,14 +251,16 @@ Routine Description:
// Print Device Path
//
DevPathStr = DevicePathToStr(DevicePath);
DEBUG((
EFI_D_INFO,
"BdsPlatform.c+%d: COM%d DevPath: %s\n",
__LINE__,
gPnp16550ComPortDeviceNode.UID + 1,
DevPathStr
));
FreePool(DevPathStr);
if (DevPathStr != NULL) {
DEBUG((
EFI_D_INFO,
"BdsPlatform.c+%d: COM%d DevPath: %s\n",
__LINE__,
gPnp16550ComPortDeviceNode.UID + 1,
DevPathStr
));
FreePool(DevPathStr);
}

BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);
BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);
Expand Down Expand Up @@ -800,12 +804,14 @@ ConnectRecursivelyIfPciMassStorage (
// Print Device Path
//
DevPathStr = DevicePathToStr (DevicePath);
DEBUG((
EFI_D_INFO,
"Found Mass Storage device: %s\n",
DevPathStr
));
FreePool(DevPathStr);
if (DevPathStr != NULL) {
DEBUG((
EFI_D_INFO,
"Found Mass Storage device: %s\n",
DevPathStr
));
FreePool(DevPathStr);
}

Status = gBS->ConnectController (Handle, NULL, NULL, TRUE);
if (EFI_ERROR (Status)) {
Expand Down
Loading

0 comments on commit e450b5b

Please sign in to comment.