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
This commit is contained in:
andrewfish 2011-06-15 18:46:15 +00:00
parent 6a05469cee
commit a0aab286ec
2 changed files with 112 additions and 4 deletions

View File

@ -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;
}

View File

@ -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