summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c')
-rw-r--r--MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c51
1 files changed, 11 insertions, 40 deletions
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
index 854a5a729..3ae55de2b 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
+++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
@@ -2,7 +2,7 @@
This is an example of how a driver might export data to the HII protocol to be
later utilized by the Setup Protocol
-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
@@ -1766,44 +1766,6 @@ DriverCallback (
return Status;
}
-
-/**
- Transfer the binary device path to string.
-
- @param DevicePath The device path info.
-
- @retval Device path string info.
-
-**/
-CHAR16 *
-GenerateDevicePathString (
- EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-{
- CHAR16 *String;
- CHAR16 *TmpBuf;
- UINTN Index;
- UINT8 *Buffer;
- UINTN DevicePathSize;
-
- //
- // Compute the size of the device path in bytes
- //
- DevicePathSize = GetDevicePathSize (DevicePath);
-
- String = AllocateZeroPool ((DevicePathSize * 2 + 1) * sizeof (CHAR16));
- if (String == NULL) {
- return NULL;
- }
-
- TmpBuf = String;
- for (Index = 0, Buffer = (UINT8 *)DevicePath; Index < DevicePathSize; Index++) {
- TmpBuf += UnicodeValueToString (TmpBuf, PREFIX_ZERO | RADIX_HEX, *(Buffer++), 2);
- }
-
- return String;
-}
-
/**
Main entry for this driver.
@@ -1835,12 +1797,14 @@ 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().
@@ -1957,11 +1921,18 @@ DriverSampleInit (
}
PrivateData->HiiHandle[1] = HiiHandle[1];
+
+ Status = gBS->LocateProtocol (
+ &gEfiDevicePathToTextProtocolGuid,
+ NULL,
+ (VOID **) &PathToText
+ );
+ ASSERT_EFI_ERROR (Status);
//
// Update the device path string.
//
- NewString = GenerateDevicePathString((EFI_DEVICE_PATH_PROTOCOL*)&mHiiVendorDevicePath0);
+ NewString = PathToText->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;