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>
24 Converts a Vendor device path structure to its string representative.
26 @param Str The string representative of input device.
27 @param DevPath The input device path structure.
28 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
29 of the display node is used, where applicable. If DisplayOnly
30 is FALSE, then the longer text representation of the display node
32 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
33 representation for a device node can be used, where applicable.
35 @return EFI_NOT_FOUND if no string representation exists.
36 @return EFI_SUCCESS a string representation was created.
40 DevPathToTextVendorLib (
41 IN OUT POOL_PRINT
*Str
,
43 IN BOOLEAN DisplayOnly
,
44 IN BOOLEAN AllowShortcuts
47 EMU_VENDOR_DEVICE_PATH_NODE
*Vendor
;
50 Vendor
= (EMU_VENDOR_DEVICE_PATH_NODE
*)DevPath
;
51 if (CompareGuid (&Vendor
->VendorDevicePath
.Guid
, &gEmuThunkProtocolGuid
)) {
52 CatPrint (Str
, L
"EmuThunk()");
55 if (CompareGuid (&Vendor
->VendorDevicePath
.Guid
, &gEmuGraphicsWindowProtocolGuid
)) {
56 CatPrint (Str
, L
"EmuGraphics(%d)", Vendor
->Instance
);
59 if (CompareGuid (&Vendor
->VendorDevicePath
.Guid
, &gEfiSimpleFileSystemProtocolGuid
)) {
60 CatPrint (Str
, L
"EmuFs(%d)", Vendor
->Instance
);
63 if (CompareGuid (&Vendor
->VendorDevicePath
.Guid
, &gEmuBlockIoProtocolGuid
)) {
64 CatPrint (Str
, L
"EmuBlk(%d)", Vendor
->Instance
);
67 if (CompareGuid (&Vendor
->VendorDevicePath
.Guid
, &gEmuThreadThunkProtocolGuid
)) {
68 CatPrint (Str
, L
"EmuThread()");
76 Converts a text device path node to Hardware Vendor device path structure.
78 @param TextDeviceNode The input Text device path node.
80 @return A pointer to the newly-created Hardware Vendor device path structure.
83 EFI_DEVICE_PATH_PROTOCOL
*
84 DevPathFromTextEmuThunk (
85 IN CHAR16
*TextDeviceNode
89 VENDOR_DEVICE_PATH
*Vendor
;
91 Str
= GetNextParamStr (&TextDeviceNode
);
92 Vendor
= (VENDOR_DEVICE_PATH
*) CreateDeviceNode (
95 (UINT16
) sizeof (VENDOR_DEVICE_PATH
)
97 CopyGuid (&Vendor
->Guid
, &gEmuThunkProtocolGuid
);
98 return (EFI_DEVICE_PATH_PROTOCOL
*) Vendor
;
102 Converts a text device path node to Hardware Vendor device path structure.
104 @param TextDeviceNode The input Text device path node.
106 @return A pointer to the newly-created Hardware Vendor device path structure.
109 EFI_DEVICE_PATH_PROTOCOL
*
110 DevPathFromTextEmuThread (
111 IN CHAR16
*TextDeviceNode
115 VENDOR_DEVICE_PATH
*Vendor
;
117 Str
= GetNextParamStr (&TextDeviceNode
);
118 Vendor
= (VENDOR_DEVICE_PATH
*) CreateDeviceNode (
119 HARDWARE_DEVICE_PATH
,
121 (UINT16
) sizeof (VENDOR_DEVICE_PATH
)
123 CopyGuid (&Vendor
->Guid
, &gEmuThreadThunkProtocolGuid
);
124 return (EFI_DEVICE_PATH_PROTOCOL
*) Vendor
;
128 Converts a text device path node to Hardware Vendor device path structure.
130 @param TextDeviceNode The input Text device path node.
132 @return A pointer to the newly-created Hardware Vendor device path structure.
135 EFI_DEVICE_PATH_PROTOCOL
*
136 DevPathFromTextEmuFs (
137 IN CHAR16
*TextDeviceNode
141 EMU_VENDOR_DEVICE_PATH_NODE
*Vendor
;
143 Str
= GetNextParamStr (&TextDeviceNode
);
144 Vendor
= (EMU_VENDOR_DEVICE_PATH_NODE
*) CreateDeviceNode (
145 HARDWARE_DEVICE_PATH
,
147 (UINT16
) sizeof (EMU_VENDOR_DEVICE_PATH_NODE
)
149 CopyGuid (&Vendor
->VendorDevicePath
.Guid
, &gEfiSimpleFileSystemProtocolGuid
);
150 Vendor
->Instance
= (UINT32
) StrDecimalToUintn (Str
);
152 return (EFI_DEVICE_PATH_PROTOCOL
*) Vendor
;
156 Register the Filter function
158 @param ImageHandle The firmware allocated handle for the EFI image.
159 @param SystemTable A pointer to the EFI System Table.
161 @retval EFI_SUCCESS The constructor executed correctly.
166 DevicePathToTextLibConstructor (
167 IN EFI_HANDLE ImageHandle
,
168 IN EFI_SYSTEM_TABLE
*SystemTable
172 DevPathToTextSetVendorDevicePathFilter (DevPathToTextVendorLib
);
173 DevicePathFromTextAddFilter (L
"EmuThunk", DevPathFromTextEmuThunk
);
174 DevicePathFromTextAddFilter (L
"EmuThread", DevPathFromTextEmuThread
);
175 DevicePathFromTextAddFilter (L
"EmuFs", DevPathFromTextEmuFs
);