summaryrefslogtreecommitdiff
path: root/InOsEmuPkg
diff options
context:
space:
mode:
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-15 18:46:15 +0000
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-15 18:46:15 +0000
commita0aab286ece15e829114d6ba9a9b07ea92f691e6 (patch)
tree9276486b3b48675228bc9ad625b0941634073b64 /InOsEmuPkg
parent6a05469ceef95df2df52db83a8cff94ebfcb919f (diff)
downloadedk2-platforms-a0aab286ece15e829114d6ba9a9b07ea92f691e6.tar.xz
InOsEmuPkg: Update DevicePathTextLib to the latest MdeModulePkg patch on the mailing list.
This library is not currently used as it requires pending updates to the MdeModulePkg. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11827 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'InOsEmuPkg')
-rw-r--r--InOsEmuPkg/Library/DevicePathTextLib/DevicePathTextLib.c107
-rw-r--r--InOsEmuPkg/Library/DevicePathTextLib/DevicePathTextLib.inf9
2 files changed, 112 insertions, 4 deletions
diff --git a/InOsEmuPkg/Library/DevicePathTextLib/DevicePathTextLib.c b/InOsEmuPkg/Library/DevicePathTextLib/DevicePathTextLib.c
index 999af355aa..ba625aea78 100644
--- a/InOsEmuPkg/Library/DevicePathTextLib/DevicePathTextLib.c
+++ b/InOsEmuPkg/Library/DevicePathTextLib/DevicePathTextLib.c
@@ -20,8 +20,10 @@
#include <Protocol/SimpleFileSystem.h>
#include <Protocol/EmuThread.h>
-#include <Library/DevicePathTextLib.h>
+#include <Library/BaseLib.h>
+#include <Library/DevicePathToTextLib.h>
#include <Library/BaseMemoryLib.h>
+#include <Library/DevicePathLib.h>
/**
@@ -76,3 +78,106 @@ DevPathToTextVendorLib (
return EFI_NOT_FOUND;
}
+/**
+ Converts a text device path node to Hardware Vendor device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Hardware Vendor device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextEmuThunk (
+ IN CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *Str;
+ VENDOR_DEVICE_PATH *Vendor;
+
+ Str = GetNextParamStr (&TextDeviceNode);
+ Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ (UINT16) sizeof (VENDOR_DEVICE_PATH)
+ );
+ CopyGuid (&Vendor->Guid, &gEmuThunkProtocolGuid);
+ return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
+}
+
+/**
+ Converts a text device path node to Hardware Vendor device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Hardware Vendor device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextEmuThread (
+ IN CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *Str;
+ VENDOR_DEVICE_PATH *Vendor;
+
+ Str = GetNextParamStr (&TextDeviceNode);
+ Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ (UINT16) sizeof (VENDOR_DEVICE_PATH)
+ );
+ CopyGuid (&Vendor->Guid, &gEmuThreadThunkProtocolGuid);
+ return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
+}
+
+/**
+ Converts a text device path node to Hardware Vendor device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Hardware Vendor device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextEmuFs (
+ IN CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *Str;
+ EMU_VENDOR_DEVICE_PATH_NODE *Vendor;
+
+ Str = GetNextParamStr (&TextDeviceNode);
+ Vendor = (EMU_VENDOR_DEVICE_PATH_NODE *) CreateDeviceNode (
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ (UINT16) sizeof (EMU_VENDOR_DEVICE_PATH_NODE)
+ );
+ CopyGuid (&Vendor->VendorDevicePath.Guid, &gEfiSimpleFileSystemProtocolGuid);
+ Vendor->Instance = (UINT32) StrDecimalToUintn (Str);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
+}
+
+/**
+ Register the Filter function
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The constructor executed correctly.
+
+**/
+EFI_STATUS
+EFIAPI
+DevicePathToTextLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+
+{
+ DevPathToTextSetVendorDevicePathFilter (DevPathToTextVendorLib);
+ DevicePathFromTextAddFilter (L"EmuThunk", DevPathFromTextEmuThunk);
+ DevicePathFromTextAddFilter (L"EmuThread", DevPathFromTextEmuThread);
+ DevicePathFromTextAddFilter (L"EmuFs", DevPathFromTextEmuFs);
+ return EFI_SUCCESS;
+} \ No newline at end of file
diff --git a/InOsEmuPkg/Library/DevicePathTextLib/DevicePathTextLib.inf b/InOsEmuPkg/Library/DevicePathTextLib/DevicePathTextLib.inf
index 546cbf1d8b..2895b3963b 100644
--- a/InOsEmuPkg/Library/DevicePathTextLib/DevicePathTextLib.inf
+++ b/InOsEmuPkg/Library/DevicePathTextLib/DevicePathTextLib.inf
@@ -16,9 +16,10 @@
INF_VERSION = 0x00010005
BASE_NAME = DevicePathTextLib
FILE_GUID = DCD1F939-1732-CA4D-81B7-C757AEC84DBC
- MODULE_TYPE = BASE
+ MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.0
- LIBRARY_CLASS = DevicePathTextLib
+ LIBRARY_CLASS = NULL|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE
+ CONSTRUCTOR = DevicePathToTextLibConstructor
#
# The following information is for reference only and not required by the build tools.
@@ -35,7 +36,9 @@
InOsEmuPkg/InOsEmuPkg.dec
[LibraryClasses]
- BaseMemoryLib
+ BaseLib
+ DebugLib
+ DevicePathLib
[Protocols]
gEmuThunkProtocolGuid