2 Null Platform Hook Library instance.
4 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include <Protocol/EmuThunk.h>
18 #include <Protocol/EmuGraphicsWindow.h>
19 #include <Protocol/EmuBlockIo.h>
20 #include <Protocol/SimpleFileSystem.h>
21 #include <Protocol/EmuThread.h>
23 #include <Library/BaseLib.h>
24 #include <Library/DevicePathToTextLib.h>
25 #include <Library/BaseMemoryLib.h>
26 #include <Library/DevicePathLib.h>
30 Converts a Vendor device path structure to its string representative.
32 @param Str The string representative of input device.
33 @param DevPath The input device path structure.
34 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
35 of the display node is used, where applicable. If DisplayOnly
36 is FALSE, then the longer text representation of the display node
38 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
39 representation for a device node can be used, where applicable.
41 @return EFI_NOT_FOUND if no string representation exists.
42 @return EFI_SUCCESS a string representation was created.
46 DevPathToTextVendorLib (
47 IN OUT POOL_PRINT
*Str
,
49 IN BOOLEAN DisplayOnly
,
50 IN BOOLEAN AllowShortcuts
53 EMU_VENDOR_DEVICE_PATH_NODE
*Vendor
;
56 Vendor
= (EMU_VENDOR_DEVICE_PATH_NODE
*)DevPath
;
57 if (CompareGuid (&Vendor
->VendorDevicePath
.Guid
, &gEmuThunkProtocolGuid
)) {
58 CatPrint (Str
, L
"EmuThunk()");
61 if (CompareGuid (&Vendor
->VendorDevicePath
.Guid
, &gEmuGraphicsWindowProtocolGuid
)) {
62 CatPrint (Str
, L
"EmuGraphics(%d)", Vendor
->Instance
);
65 if (CompareGuid (&Vendor
->VendorDevicePath
.Guid
, &gEfiSimpleFileSystemProtocolGuid
)) {
66 CatPrint (Str
, L
"EmuFs(%d)", Vendor
->Instance
);
69 if (CompareGuid (&Vendor
->VendorDevicePath
.Guid
, &gEmuBlockIoProtocolGuid
)) {
70 CatPrint (Str
, L
"EmuBlk(%d)", Vendor
->Instance
);
73 if (CompareGuid (&Vendor
->VendorDevicePath
.Guid
, &gEmuThreadThunkProtocolGuid
)) {
74 CatPrint (Str
, L
"EmuThread()");
82 Converts a text device path node to Hardware Vendor device path structure.
84 @param TextDeviceNode The input Text device path node.
86 @return A pointer to the newly-created Hardware Vendor device path structure.
89 EFI_DEVICE_PATH_PROTOCOL
*
90 DevPathFromTextEmuThunk (
91 IN CHAR16
*TextDeviceNode
95 VENDOR_DEVICE_PATH
*Vendor
;
97 Str
= GetNextParamStr (&TextDeviceNode
);
98 Vendor
= (VENDOR_DEVICE_PATH
*) CreateDeviceNode (
101 (UINT16
) sizeof (VENDOR_DEVICE_PATH
)
103 CopyGuid (&Vendor
->Guid
, &gEmuThunkProtocolGuid
);
104 return (EFI_DEVICE_PATH_PROTOCOL
*) Vendor
;
108 Converts a text device path node to Hardware Vendor device path structure.
110 @param TextDeviceNode The input Text device path node.
112 @return A pointer to the newly-created Hardware Vendor device path structure.
115 EFI_DEVICE_PATH_PROTOCOL
*
116 DevPathFromTextEmuThread (
117 IN CHAR16
*TextDeviceNode
121 VENDOR_DEVICE_PATH
*Vendor
;
123 Str
= GetNextParamStr (&TextDeviceNode
);
124 Vendor
= (VENDOR_DEVICE_PATH
*) CreateDeviceNode (
125 HARDWARE_DEVICE_PATH
,
127 (UINT16
) sizeof (VENDOR_DEVICE_PATH
)
129 CopyGuid (&Vendor
->Guid
, &gEmuThreadThunkProtocolGuid
);
130 return (EFI_DEVICE_PATH_PROTOCOL
*) Vendor
;
134 Converts a text device path node to Hardware Vendor device path structure.
136 @param TextDeviceNode The input Text device path node.
138 @return A pointer to the newly-created Hardware Vendor device path structure.
141 EFI_DEVICE_PATH_PROTOCOL
*
142 DevPathFromTextEmuFs (
143 IN CHAR16
*TextDeviceNode
147 EMU_VENDOR_DEVICE_PATH_NODE
*Vendor
;
149 Str
= GetNextParamStr (&TextDeviceNode
);
150 Vendor
= (EMU_VENDOR_DEVICE_PATH_NODE
*) CreateDeviceNode (
151 HARDWARE_DEVICE_PATH
,
153 (UINT16
) sizeof (EMU_VENDOR_DEVICE_PATH_NODE
)
155 CopyGuid (&Vendor
->VendorDevicePath
.Guid
, &gEfiSimpleFileSystemProtocolGuid
);
156 Vendor
->Instance
= (UINT32
) StrDecimalToUintn (Str
);
158 return (EFI_DEVICE_PATH_PROTOCOL
*) Vendor
;
162 Register the Filter function
164 @param ImageHandle The firmware allocated handle for the EFI image.
165 @param SystemTable A pointer to the EFI System Table.
167 @retval EFI_SUCCESS The constructor executed correctly.
172 DevicePathToTextLibConstructor (
173 IN EFI_HANDLE ImageHandle
,
174 IN EFI_SYSTEM_TABLE
*SystemTable
178 DevPathToTextSetVendorDevicePathFilter (DevPathToTextVendorLib
);
179 DevicePathFromTextAddFilter (L
"EmuThunk", DevPathFromTextEmuThunk
);
180 DevicePathFromTextAddFilter (L
"EmuThread", DevPathFromTextEmuThread
);
181 DevicePathFromTextAddFilter (L
"EmuFs", DevPathFromTextEmuFs
);