2 Null Platform Hook Library instance.
4 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <Protocol/EmuThunk.h>
12 #include <Protocol/EmuGraphicsWindow.h>
13 #include <Protocol/EmuBlockIo.h>
14 #include <Protocol/SimpleFileSystem.h>
15 #include <Protocol/EmuThread.h>
17 #include <Library/BaseLib.h>
18 #include <Library/DevicePathToTextLib.h>
19 #include <Library/BaseMemoryLib.h>
20 #include <Library/DevicePathLib.h>
23 Converts a Vendor device path structure to its string representative.
25 @param Str The string representative of input device.
26 @param DevPath The input device path structure.
27 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
28 of the display node is used, where applicable. If DisplayOnly
29 is FALSE, then the longer text representation of the display node
31 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
32 representation for a device node can be used, where applicable.
34 @return EFI_NOT_FOUND if no string representation exists.
35 @return EFI_SUCCESS a string representation was created.
39 DevPathToTextVendorLib (
40 IN OUT POOL_PRINT
*Str
,
42 IN BOOLEAN DisplayOnly
,
43 IN BOOLEAN AllowShortcuts
46 EMU_VENDOR_DEVICE_PATH_NODE
*Vendor
;
49 Vendor
= (EMU_VENDOR_DEVICE_PATH_NODE
*)DevPath
;
50 if (CompareGuid (&Vendor
->VendorDevicePath
.Guid
, &gEmuThunkProtocolGuid
)) {
51 CatPrint (Str
, L
"EmuThunk()");
55 if (CompareGuid (&Vendor
->VendorDevicePath
.Guid
, &gEmuGraphicsWindowProtocolGuid
)) {
56 CatPrint (Str
, L
"EmuGraphics(%d)", Vendor
->Instance
);
60 if (CompareGuid (&Vendor
->VendorDevicePath
.Guid
, &gEfiSimpleFileSystemProtocolGuid
)) {
61 CatPrint (Str
, L
"EmuFs(%d)", Vendor
->Instance
);
65 if (CompareGuid (&Vendor
->VendorDevicePath
.Guid
, &gEmuBlockIoProtocolGuid
)) {
66 CatPrint (Str
, L
"EmuBlk(%d)", Vendor
->Instance
);
70 if (CompareGuid (&Vendor
->VendorDevicePath
.Guid
, &gEmuThreadThunkProtocolGuid
)) {
71 CatPrint (Str
, L
"EmuThread()");
79 Converts a text device path node to Hardware Vendor device path structure.
81 @param TextDeviceNode The input Text device path node.
83 @return A pointer to the newly-created Hardware Vendor device path structure.
86 EFI_DEVICE_PATH_PROTOCOL
*
87 DevPathFromTextEmuThunk (
88 IN CHAR16
*TextDeviceNode
92 VENDOR_DEVICE_PATH
*Vendor
;
94 Str
= GetNextParamStr (&TextDeviceNode
);
95 Vendor
= (VENDOR_DEVICE_PATH
*)CreateDeviceNode (
98 (UINT16
)sizeof (VENDOR_DEVICE_PATH
)
100 CopyGuid (&Vendor
->Guid
, &gEmuThunkProtocolGuid
);
101 return (EFI_DEVICE_PATH_PROTOCOL
*)Vendor
;
105 Converts a text device path node to Hardware Vendor device path structure.
107 @param TextDeviceNode The input Text device path node.
109 @return A pointer to the newly-created Hardware Vendor device path structure.
112 EFI_DEVICE_PATH_PROTOCOL
*
113 DevPathFromTextEmuThread (
114 IN CHAR16
*TextDeviceNode
118 VENDOR_DEVICE_PATH
*Vendor
;
120 Str
= GetNextParamStr (&TextDeviceNode
);
121 Vendor
= (VENDOR_DEVICE_PATH
*)CreateDeviceNode (
122 HARDWARE_DEVICE_PATH
,
124 (UINT16
)sizeof (VENDOR_DEVICE_PATH
)
126 CopyGuid (&Vendor
->Guid
, &gEmuThreadThunkProtocolGuid
);
127 return (EFI_DEVICE_PATH_PROTOCOL
*)Vendor
;
131 Converts a text device path node to Hardware Vendor device path structure.
133 @param TextDeviceNode The input Text device path node.
135 @return A pointer to the newly-created Hardware Vendor device path structure.
138 EFI_DEVICE_PATH_PROTOCOL
*
139 DevPathFromTextEmuFs (
140 IN CHAR16
*TextDeviceNode
144 EMU_VENDOR_DEVICE_PATH_NODE
*Vendor
;
146 Str
= GetNextParamStr (&TextDeviceNode
);
147 Vendor
= (EMU_VENDOR_DEVICE_PATH_NODE
*)CreateDeviceNode (
148 HARDWARE_DEVICE_PATH
,
150 (UINT16
)sizeof (EMU_VENDOR_DEVICE_PATH_NODE
)
152 CopyGuid (&Vendor
->VendorDevicePath
.Guid
, &gEfiSimpleFileSystemProtocolGuid
);
153 Vendor
->Instance
= (UINT32
)StrDecimalToUintn (Str
);
155 return (EFI_DEVICE_PATH_PROTOCOL
*)Vendor
;
159 Register the Filter function
161 @param ImageHandle The firmware allocated handle for the EFI image.
162 @param SystemTable A pointer to the EFI System Table.
164 @retval EFI_SUCCESS The constructor executed correctly.
169 DevicePathToTextLibConstructor (
170 IN EFI_HANDLE ImageHandle
,
171 IN EFI_SYSTEM_TABLE
*SystemTable
175 DevPathToTextSetVendorDevicePathFilter (DevPathToTextVendorLib
);
176 DevicePathFromTextAddFilter (L
"EmuThunk", DevPathFromTextEmuThunk
);
177 DevicePathFromTextAddFilter (L
"EmuThread", DevPathFromTextEmuThread
);
178 DevicePathFromTextAddFilter (L
"EmuFs", DevPathFromTextEmuFs
);