DevicePath.c revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
/* $Id$ */
/** @file
* DevicePath.c - BDS internal function define the default device path string,
* it can be replaced by platform device path.
*/
/*
* Copyright (C) 2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*
This code is based on:
Copyright (c) 2004 - 2008, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/
#include "InternalBdsLib.h"
/**
Concatenates a formatted unicode string to allocated pool.
The caller must free the resulting buffer.
@param Str Tracks the allocated pool, size in use, and amount of pool allocated.
@param Fmt The format string
@param ... The data will be printed.
@return Allocated buffer with the formatted string printed in it.
The caller must free the allocated buffer.
The buffer allocation is not packed.
**/
CHAR16 *
CatPrint (
...
)
{
}
} else {
);
}
}
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
CatPrint (
Str,
L"MemMap(%d:%lx-%lx)",
);
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
}
/**
Convert Vendor device path to device name.
@param Str The buffer store device name
@param DevPath Pointer to vendor device path
**/
)
{
case HARDWARE_DEVICE_PATH:
Type = L"Hw";
break;
case MESSAGING_DEVICE_PATH:
Type = L"Msg";
return ;
return ;
return ;
return ;
switch (FlowControlMap & 0x00000003) {
case 0:
break;
case 1:
break;
case 2:
break;
default:
break;
}
return ;
CatPrint (
Str,
L"SAS(%lx,%lx,%x,",
);
if ((Info & 0x0f) == 0) {
CatPrint (
Str,
L"%s,%s,%s,",
);
} else {
}
} else {
}
return ;
return ;
}
break;
case MEDIA_DEVICE_PATH:
Type = L"Media";
break;
default:
Type = L"?";
break;
}
if (DataLength > 0) {
CatPrint (Str, L"%02x", (UINTN) ((VENDOR_DEVICE_PATH_WITH_DATA *) Vendor)->VendorDefinedData[Index]);
}
}
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
} else {
}
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
//
// Index for HID, UID and CID strings, 0 for non-exist
//
HIDSTRIdx = 0;
UIDSTRIdx = 0;
CIDSTRIdx = 0;
//
// find HIDSTR
//
Anchor = 16;
;
}
}
//
// find UIDSTR
//
;
}
}
//
// find CIDSTR
//
;
}
}
} else {
}
} else {
}
if (UIDSTRIdx != 0) {
} else {
}
} else {
} else {
}
} else {
}
if (HIDSTRIdx != 0) {
} else {
}
if (CIDSTRIdx != 0) {
} else {
}
if (UIDSTRIdx != 0) {
} else {
}
}
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
}
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
CatPrint (
Str,
L"Ata(%s,%s)",
);
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
CatPrint (
Str,
L"UsbWwid(%x,%x,%x,\"WWID\")",
);
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
CatPrint (
Str,
L"Usb Class(%x,%x,%x,%x,%x)",
);
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
CatPrint (
Str,
L"Sata(%x,%x)",
);
} else {
CatPrint (
Str,
L"Sata(%x,%x,%x)",
);
}
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
HwAddressSize = sizeof (EFI_MAC_ADDRESS);
HwAddressSize = 6;
}
}
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
CatPrint (
Str,
L"IPv4(%d.%d.%d.%d:%d)",
);
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
CatPrint (
Str,
L"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
);
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
CatPrint (
Str,
L"Infiniband(%x,%g,%lx,%lx,%lx)",
);
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
case 0:
Parity = 'D';
break;
case 1:
Parity = 'N';
break;
case 2:
Parity = 'E';
break;
case 3:
Parity = 'O';
break;
case 4:
Parity = 'M';
break;
case 5:
Parity = 'S';
break;
default:
Parity = 'x';
break;
}
} else {
}
} else {
}
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
default:
break;
}
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
CatPrint (
Str,
L"iSCSI(%a,%x,%lx,",
);
} else {
}
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
switch (Hd->SignatureType) {
case SIGNATURE_TYPE_MBR:
CatPrint (
Str,
L"HD(Part%d,Sig%08x)",
);
break;
case SIGNATURE_TYPE_GUID:
CatPrint (
Str,
L"HD(Part%d,Sig%g)",
);
break;
default:
CatPrint (
Str,
L"HD(Part%d,MBRType=%02x,SigType=%02x)",
);
break;
}
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
CatPrint (
Str,
L"Offset(%lx,%lx)",
);
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
switch (Bbs->DeviceType) {
case BBS_TYPE_FLOPPY:
Type = L"Floppy";
break;
case BBS_TYPE_HARDDRIVE:
Type = L"Harddrive";
break;
case BBS_TYPE_CDROM:
Type = L"CDROM";
break;
case BBS_TYPE_PCMCIA:
Type = L"PCMCIA";
break;
case BBS_TYPE_USB:
Type = L"Usb";
break;
Type = L"Net";
break;
case BBS_TYPE_BEV:
Type = L"BEV";
break;
default:
Type = L"?";
break;
}
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
}
/**
Convert Device Path to a Unicode string for printing.
@param Str The buffer holding the output string.
This buffer contains the length of the
string and the maximum length reserved
for the string buffer.
@param DevPath The device path.
**/
)
{
}
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
0,
0,
}
};
/**
This function converts an input device structure to a Unicode string.
@param DevPath A pointer to the device path structure.
@return A new allocated Unicode string that represents the device path.
**/
CHAR16 *
)
{
goto Done;
}
NULL,
(VOID **) &DevPathToText
);
);
return ToText;
}
//
// Process each device path node
//
while (!IsDevicePathEnd (DevPathNode)) {
//
// Find the handler to dump this device path node
//
) {
break;
}
}
//
// If not found, use a generic function
//
if (!DumpNode) {
}
//
// Put a path separator in if needed
//
}
//
// Print this node of the device path
//
//
// Next device path node
//
}
Done:
}