summaryrefslogtreecommitdiff
path: root/OvmfPkg/Library
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2013-07-26 03:14:08 +0000
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2013-07-26 03:14:08 +0000
commit863986b3c8e67736d361b68e293d01e6f92f825c (patch)
tree15cf067d949655c9defeeeaa78eeea6050845b64 /OvmfPkg/Library
parent4d0a30a494599226450bf69ad9d6fc689f61712e (diff)
downloadedk2-863986b3c8e67736d361b68e293d01e6f92f825c.zip
edk2-863986b3c8e67736d361b68e293d01e6f92f825c.tar.gz
edk2-863986b3c8e67736d361b68e293d01e6f92f825c.tar.bz2
Update all the code to consume the ConvertDevicePathToText, ConvertDevicePathNodeToText, ConvertTextToDevicePath and ConvertTextToDeviceNode APIs in DevicePathLib.
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Elvin Li <elvin.li@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Guo Dong <guo.dong@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14505 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/Library')
-rw-r--r--OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c52
-rw-r--r--OvmfPkg/Library/PlatformBdsLib/QemuBootOrder.c32
2 files changed, 38 insertions, 46 deletions
diff --git a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
index 781b415..ba6af2c 100644
--- a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
@@ -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
@@ -209,14 +209,16 @@ Returns:
// 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);
@@ -236,14 +238,16 @@ Returns:
// 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);
@@ -799,12 +803,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)) {
diff --git a/OvmfPkg/Library/PlatformBdsLib/QemuBootOrder.c b/OvmfPkg/Library/PlatformBdsLib/QemuBootOrder.c
index 9f94e24..c9b8556 100644
--- a/OvmfPkg/Library/PlatformBdsLib/QemuBootOrder.c
+++ b/OvmfPkg/Library/PlatformBdsLib/QemuBootOrder.c
@@ -1,7 +1,7 @@
/** @file
Rewrite the BootOrder NvVar based on QEMU's "bootorder" fw_cfg file.
- Copyright (C) 2012, Red Hat, Inc.
+ Copyright (C) 2012 - 2013, Red Hat, Inc.
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
@@ -20,7 +20,7 @@
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/BaseLib.h>
#include <Library/PrintLib.h>
-#include <Protocol/DevicePathToText.h>
+#include <Library/DevicePathLib.h>
#include <Guid/GlobalVariable.h>
@@ -866,18 +866,17 @@ BOOLEAN
Match (
IN CONST CHAR16 *Translated,
IN UINTN TranslatedLength,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN CONST EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
CHAR16 *Converted;
BOOLEAN Result;
- Converted = DevPathToText->ConvertDevicePathToText (
- DevicePath,
- FALSE, // DisplayOnly
- FALSE // AllowShortcuts
- );
+ Converted = ConvertDevicePathToText (
+ DevicePath,
+ FALSE, // DisplayOnly
+ FALSE // AllowShortcuts
+ );
if (Converted == NULL) {
return FALSE;
}
@@ -933,9 +932,6 @@ SetBootOrderFromQemu (
)
{
RETURN_STATUS Status;
-
- EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText;
-
FIRMWARE_CONFIG_ITEM FwCfgItem;
UINTN FwCfgSize;
CHAR8 *FwCfg;
@@ -946,15 +942,6 @@ SetBootOrderFromQemu (
UINTN TranslatedSize;
CHAR16 Translated[TRANSLATION_OUTPUT_SIZE];
- Status = gBS->LocateProtocol (
- &gEfiDevicePathToTextProtocolGuid,
- NULL, // optional registration key
- (VOID **) &DevPathToText
- );
- if (Status != EFI_SUCCESS) {
- return Status;
- }
-
Status = QemuFwCfgFindFile ("bootorder", &FwCfgItem, &FwCfgSize);
if (Status != RETURN_SUCCESS) {
return Status;
@@ -1019,8 +1006,7 @@ SetBootOrderFromQemu (
Match (
Translated,
TranslatedSize, // contains length, not size, in CHAR16's here
- BootOption->DevicePath,
- DevPathToText
+ BootOption->DevicePath
)
) {
//