TianoCore EDK2 master
Loading...
Searching...
No Matches
DevicePathTextLib.c
Go to the documentation of this file.
1
9#include <Base.h>
10
11#include <Protocol/EmuThunk.h>
12#include <Protocol/EmuGraphicsWindow.h>
13#include <Protocol/EmuBlockIo.h>
15#include <Protocol/EmuThread.h>
16
17#include <Library/BaseLib.h>
18#include <Library/DevicePathToTextLib.h>
21
38EFIAPI
40 IN OUT POOL_PRINT *Str,
41 IN VOID *DevPath,
42 IN BOOLEAN DisplayOnly,
43 IN BOOLEAN AllowShortcuts
44 )
45{
47 CHAR16 *Type;
48
49 Vendor = (EMU_VENDOR_DEVICE_PATH_NODE *)DevPath;
50 if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuThunkProtocolGuid)) {
51 CatPrint (Str, L"EmuThunk()");
52 return EFI_SUCCESS;
53 }
54
55 if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuGraphicsWindowProtocolGuid)) {
56 CatPrint (Str, L"EmuGraphics(%d)", Vendor->Instance);
57 return EFI_SUCCESS;
58 }
59
60 if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEfiSimpleFileSystemProtocolGuid)) {
61 CatPrint (Str, L"EmuFs(%d)", Vendor->Instance);
62 return EFI_SUCCESS;
63 }
64
65 if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuBlockIoProtocolGuid)) {
66 CatPrint (Str, L"EmuBlk(%d)", Vendor->Instance);
67 return EFI_SUCCESS;
68 }
69
70 if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuThreadThunkProtocolGuid)) {
71 CatPrint (Str, L"EmuThread()");
72 return EFI_SUCCESS;
73 }
74
75 return EFI_NOT_FOUND;
76}
77
88 IN CHAR16 *TextDeviceNode
89 )
90{
91 CHAR16 *Str;
92 VENDOR_DEVICE_PATH *Vendor;
93
94 Str = GetNextParamStr (&TextDeviceNode);
98 (UINT16)sizeof (VENDOR_DEVICE_PATH)
99 );
100 CopyGuid (&Vendor->Guid, &gEmuThunkProtocolGuid);
101 return (EFI_DEVICE_PATH_PROTOCOL *)Vendor;
102}
103
114 IN CHAR16 *TextDeviceNode
115 )
116{
117 CHAR16 *Str;
118 VENDOR_DEVICE_PATH *Vendor;
119
120 Str = GetNextParamStr (&TextDeviceNode);
124 (UINT16)sizeof (VENDOR_DEVICE_PATH)
125 );
126 CopyGuid (&Vendor->Guid, &gEmuThreadThunkProtocolGuid);
127 return (EFI_DEVICE_PATH_PROTOCOL *)Vendor;
128}
129
140 IN CHAR16 *TextDeviceNode
141 )
142{
143 CHAR16 *Str;
145
146 Str = GetNextParamStr (&TextDeviceNode);
150 (UINT16)sizeof (EMU_VENDOR_DEVICE_PATH_NODE)
151 );
152 CopyGuid (&Vendor->VendorDevicePath.Guid, &gEfiSimpleFileSystemProtocolGuid);
153 Vendor->Instance = (UINT32)StrDecimalToUintn (Str);
154
155 return (EFI_DEVICE_PATH_PROTOCOL *)Vendor;
156}
157
168EFIAPI
170 IN EFI_HANDLE ImageHandle,
171 IN EFI_SYSTEM_TABLE *SystemTable
172 )
173
174{
175 DevPathToTextSetVendorDevicePathFilter (DevPathToTextVendorLib);
176 DevicePathFromTextAddFilter (L"EmuThunk", DevPathFromTextEmuThunk);
177 DevicePathFromTextAddFilter (L"EmuThread", DevPathFromTextEmuThread);
178 DevicePathFromTextAddFilter (L"EmuFs", DevPathFromTextEmuFs);
179 return EFI_SUCCESS;
180}
UINTN EFIAPI StrDecimalToUintn(IN CONST CHAR16 *String)
Definition: String.c:405
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
Definition: MemLibGuid.c:73
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
Definition: MemLibGuid.c:39
EFI_STATUS EFIAPI CatPrint(IN OUT POOL_PRINT *Str, IN CHAR16 *Fmt,...)
#define HARDWARE_DEVICE_PATH
Definition: DevicePath.h:68
#define HW_VENDOR_DP
Definition: DevicePath.h:133
CHAR16 * GetNextParamStr(IN OUT CHAR16 **List)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI CreateDeviceNode(IN UINT8 NodeType, IN UINT8 NodeSubType, IN UINT16 NodeLength)
EFI_STATUS EFIAPI DevPathToTextVendorLib(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
EFI_STATUS EFIAPI DevicePathToTextLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextEmuThread(IN CHAR16 *TextDeviceNode)
EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextEmuFs(IN CHAR16 *TextDeviceNode)
EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextEmuThunk(IN CHAR16 *TextDeviceNode)
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112