]> git.proxmox.com Git - mirror_edk2.git/blob - InOsEmuPkg/Library/DevicePathTextLib/DevicePathTextLib.c
Add support for SerialPortLib that maps into POSIX StdIn and StdOut. Add a device...
[mirror_edk2.git] / InOsEmuPkg / Library / DevicePathTextLib / DevicePathTextLib.c
1 /** @file
2 Null Platform Hook Library instance.
3
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
9
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.
12
13 **/
14
15 #include <Base.h>
16
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>
22
23 #include <Library/DevicePathTextLib.h>
24 #include <Library/BaseMemoryLib.h>
25
26
27 /**
28 Converts a Vendor device path structure to its string representative.
29
30 @param Str The string representative of input device.
31 @param DevPath The input device path structure.
32 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
33 of the display node is used, where applicable. If DisplayOnly
34 is FALSE, then the longer text representation of the display node
35 is used.
36 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
37 representation for a device node can be used, where applicable.
38
39 @return EFI_NOT_FOUND if no string representation exists.
40 @return EFI_SUCCESS a string representation was created.
41 **/
42 EFI_STATUS
43 EFIAPI
44 DevPathToTextVendorLib (
45 IN OUT POOL_PRINT *Str,
46 IN VOID *DevPath,
47 IN BOOLEAN DisplayOnly,
48 IN BOOLEAN AllowShortcuts
49 )
50 {
51 EMU_VENDOR_DEVICE_PATH_NODE *Vendor;
52 CHAR16 *Type;
53
54 Vendor = (EMU_VENDOR_DEVICE_PATH_NODE *)DevPath;
55 if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuThunkProtocolGuid)) {
56 CatPrint (Str, L"EmuThunk()");
57 return EFI_SUCCESS;
58 }
59 if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuGraphicsWindowProtocolGuid)) {
60 CatPrint (Str, L"EmuGraphics(%d)", Vendor->Instance);
61 return EFI_SUCCESS;
62 }
63 if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEfiSimpleFileSystemProtocolGuid)) {
64 CatPrint (Str, L"EmuFs(%d)", Vendor->Instance);
65 return EFI_SUCCESS;
66 }
67 if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuBlockIoProtocolGuid)) {
68 CatPrint (Str, L"EmuBlk(%d)", Vendor->Instance);
69 return EFI_SUCCESS;
70 }
71 if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuThreadThunkProtocolGuid)) {
72 CatPrint (Str, L"EmuThread()");
73 return EFI_SUCCESS;
74 }
75
76 return EFI_NOT_FOUND;
77 }
78