Here is a patch for "DevicePathToStr()" to display device path according to UEFI 2 specification.
The path is in the two files inc/efidevp.h and lib/dpath.c. It also add the Sata device path and removes the "/?" path for unknown device paths. Signed-off-by: Bernard Burette <bub75@users.sf.net> Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
This commit is contained in:
parent
3c62e78556
commit
1a04669a7b
@ -68,10 +68,10 @@ typedef struct _EFI_DEVICE_PATH {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Hardware Device Path (UEFI 2.4 specification, version 2.4 § 9.3.2.)
|
||||
*/
|
||||
|
||||
#define HARDWARE_DEVICE_PATH 0x01
|
||||
|
||||
#define HW_PCI_DP 0x01
|
||||
@ -84,7 +84,7 @@ typedef struct _PCI_DEVICE_PATH {
|
||||
#define HW_PCCARD_DP 0x02
|
||||
typedef struct _PCCARD_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT8 SocketNumber;
|
||||
UINT8 FunctionNumber ;
|
||||
} PCCARD_DEVICE_PATH;
|
||||
|
||||
#define HW_MEMMAP_DP 0x03
|
||||
@ -115,8 +115,9 @@ typedef struct _CONTROLLER_DEVICE_PATH {
|
||||
UINT32 Controller;
|
||||
} CONTROLLER_DEVICE_PATH;
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* ACPI Device Path (UEFI 2.4 specification, version 2.4 § 9.3.3 and 9.3.4.)
|
||||
*/
|
||||
#define ACPI_DEVICE_PATH 0x02
|
||||
|
||||
@ -136,6 +137,12 @@ typedef struct _EXPANDED_ACPI_HID_DEVICE_PATH {
|
||||
UINT8 HidStr[1];
|
||||
} EXPANDED_ACPI_HID_DEVICE_PATH;
|
||||
|
||||
#define ACPI_ADR_DP 3
|
||||
typedef struct _ACPI_ADR_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header ;
|
||||
UINT32 ADR ;
|
||||
} ACPI_ADR_DEVICE_PATH ;
|
||||
|
||||
//
|
||||
// EISA ID Macro
|
||||
// EISA ID Definition 32-bits
|
||||
@ -149,8 +156,10 @@ typedef struct _EXPANDED_ACPI_HID_DEVICE_PATH {
|
||||
|
||||
#define PNP_EISA_ID_MASK 0xffff
|
||||
#define EISA_ID_TO_NUM(_Id) ((_Id) >> 16)
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Messaging Device Path (UEFI 2.4 specification, version 2.4 § 9.3.5.)
|
||||
*/
|
||||
#define MESSAGING_DEVICE_PATH 0x03
|
||||
|
||||
@ -177,6 +186,18 @@ typedef struct _FIBRECHANNEL_DEVICE_PATH {
|
||||
UINT64 Lun;
|
||||
} FIBRECHANNEL_DEVICE_PATH;
|
||||
|
||||
/**
|
||||
* Fibre Channel Ex SubType.
|
||||
* UEFI 2.0 specification version 2.4 § 9.3.5.6.
|
||||
*/
|
||||
#define MSG_FIBRECHANNELEX_DP 21
|
||||
typedef struct _FIBRECHANNELEX_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header ;
|
||||
UINT32 Reserved ;
|
||||
UINT8 WWN[ 8 ] ; /* World Wide Name */
|
||||
UINT8 Lun[ 8 ] ; /* Logical unit, T-10 SCSI Architecture Model 4 specification */
|
||||
} FIBRECHANNELEX_DEVICE_PATH ;
|
||||
|
||||
#define MSG_1394_DP 0x04
|
||||
typedef struct _F1394_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
@ -191,6 +212,41 @@ typedef struct _USB_DEVICE_PATH {
|
||||
UINT8 Endpoint;
|
||||
} USB_DEVICE_PATH;
|
||||
|
||||
/**
|
||||
* SATA Device Path SubType.
|
||||
* UEFI 2.0 specification version 2.4 § 9.3.5.6.
|
||||
*/
|
||||
#define MSG_SATA_DP 18
|
||||
typedef struct _SATA_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header ;
|
||||
UINT16 HBAPortNumber ;
|
||||
UINT16 PortMultiplierPortNumber ;
|
||||
UINT16 Lun ; /* Logical Unit Number */
|
||||
} SATA_DEVICE_PATH ;
|
||||
|
||||
/**
|
||||
* USB WWID Device Path SubType.
|
||||
* UEFI 2.0 specification version 2.4 § 9.3.5.7.
|
||||
*/
|
||||
#define MSG_USB_WWID_DP 16
|
||||
typedef struct _USB_WWID_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header ;
|
||||
UINT16 InterfaceNumber ;
|
||||
UINT16 VendorId ;
|
||||
UINT16 ProductId ;
|
||||
CHAR16 SerialNumber[ 1 ] ; /* UTF-16 characters of the USB serial number */
|
||||
} USB_WWID_DEVICE_PATH ;
|
||||
|
||||
/**
|
||||
* Device Logical Unit SubType.
|
||||
* UEFI 2.0 specification version 2.4 § 9.3.5.8.
|
||||
*/
|
||||
#define MSG_DEVICE_LOGICAL_UNIT_DP 17
|
||||
typedef struct _DEVICE_LOGICAL_UNIT_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header ;
|
||||
UINT8 Lun ; /* Logical Unit Number */
|
||||
} DEVICE_LOGICAL_UNIT_DEVICE_PATH ;
|
||||
|
||||
#define MSG_USB_CLASS_DP 0x0F
|
||||
typedef struct _USB_CLASS_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
@ -223,6 +279,9 @@ typedef struct _IPv4_DEVICE_PATH {
|
||||
UINT16 RemotePort;
|
||||
UINT16 Protocol;
|
||||
BOOLEAN StaticIpAddress;
|
||||
/* new from UEFI version 2, code must check Length field in Header */
|
||||
EFI_IPv4_ADDRESS GatewayIpAddress ;
|
||||
EFI_IPv4_ADDRESS SubnetMask ;
|
||||
} IPv4_DEVICE_PATH;
|
||||
|
||||
#define MSG_IPv6_DP 0x0d
|
||||
@ -233,16 +292,30 @@ typedef struct _IPv6_DEVICE_PATH {
|
||||
UINT16 LocalPort;
|
||||
UINT16 RemotePort;
|
||||
UINT16 Protocol;
|
||||
BOOLEAN StaticIpAddress;
|
||||
BOOLEAN IPAddressOrigin ;
|
||||
/* new from UEFI version 2, code must check Length field in Header */
|
||||
UINT8 PrefixLength ;
|
||||
EFI_IPv6_ADDRESS GatewayIpAddress ;
|
||||
} IPv6_DEVICE_PATH;
|
||||
|
||||
/**
|
||||
* Device Logical Unit SubType.
|
||||
* UEFI 2.0 specification version 2.4 § 9.3.5.8.
|
||||
*/
|
||||
#define MSG_VLAN_DP 20
|
||||
typedef struct _VLAN_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header ;
|
||||
UINT16 VlanId ;
|
||||
} VLAN_DEVICE_PATH;
|
||||
|
||||
#define MSG_INFINIBAND_DP 0x09
|
||||
typedef struct _INFINIBAND_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 Reserved;
|
||||
UINT64 NodeGuid;
|
||||
UINT64 IocGuid;
|
||||
UINT64 DeviceId;
|
||||
UINT32 ResourceFlags ;
|
||||
UINT64 PortGid ;
|
||||
UINT64 ServiceId ;
|
||||
UINT64 TargetPortId ;
|
||||
UINT64 DeviceId ;
|
||||
} INFINIBAND_DEVICE_PATH;
|
||||
|
||||
#define MSG_UART_DP 0x0e
|
||||
@ -264,8 +337,28 @@ typedef struct _UART_DEVICE_PATH {
|
||||
#define DEVICE_PATH_MESSAGING_VT_100 \
|
||||
{ 0xdfa66065, 0xb419, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
|
||||
|
||||
#define DEVICE_PATH_MESSAGING_VT_100_PLUS \
|
||||
{ 0x7baec70b , 0x57e0 , 0x4c76 , { 0x8e , 0x87 , 0x2f , 0x9e , 0x28 , 0x08 , 0x83 , 0x43 } }
|
||||
|
||||
#define DEVICE_PATH_MESSAGING_VT_UTF8 \
|
||||
{ 0xad15a0d6 , 0x8bec , 0x4acf , { 0xa0 , 0x73 , 0xd0 , 0x1d , 0xe7 , 0x7e , 0x2d , 0x88 } }
|
||||
|
||||
#define EFI_PC_ANSI_GUID \
|
||||
{ 0xe0c14753 , 0xf9be , 0x11d2 , 0x9a , 0x0c , 0x00 , 0x90 , 0x27 , 0x3f , 0xc1 , 0x4d }
|
||||
|
||||
#define EFI_VT_100_GUID \
|
||||
{ 0xdfa66065 , 0xb419 , 0x11d3 , 0x9a , 0x2d , 0x00 , 0x90 , 0x27 , 0x3f , 0xc1 , 0x4d }
|
||||
|
||||
#define EFI_VT_100_PLUS_GUID \
|
||||
{ 0x7baec70b , 0x57e0 , 0x4c76 , 0x8e , 0x87 , 0x2f , 0x9e , 0x28 , 0x08 , 0x83 , 0x43 }
|
||||
|
||||
#define EFI_VT_UTF8_GUID \
|
||||
{ 0xad15a0d6 , 0x8bec , 0x4acf , 0xa0 , 0x73 , 0xd0 , 0x1d , 0xe7 , 0x7e , 0x2d , 0x88 }
|
||||
|
||||
|
||||
/*
|
||||
* Media Device Path (UEFI 2.4 specification, version 2.4 § 9.3.6.)
|
||||
*/
|
||||
#define MEDIA_DEVICE_PATH 0x04
|
||||
|
||||
#define MEDIA_HARDDRIVE_DP 0x01
|
||||
@ -310,8 +403,44 @@ typedef struct _MEDIA_PROTOCOL_DEVICE_PATH {
|
||||
EFI_GUID Protocol;
|
||||
} MEDIA_PROTOCOL_DEVICE_PATH;
|
||||
|
||||
/**
|
||||
* PIWG Firmware File SubType.
|
||||
* UEFI 2.0 specification version 2.4 § 9.3.6.6.
|
||||
*/
|
||||
#define MEDIA_PIWG_FW_FILE_DP 6
|
||||
typedef struct _MEDIA_FW_VOL_FILEPATH_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header ;
|
||||
EFI_GUID FvFileName ;
|
||||
} MEDIA_FW_VOL_FILEPATH_DEVICE_PATH ;
|
||||
|
||||
/**
|
||||
* PIWG Firmware Volume Device Path SubType.
|
||||
* UEFI 2.0 specification version 2.4 § 9.3.6.7.
|
||||
*/
|
||||
#define MEDIA_PIWG_FW_VOL_DP 7
|
||||
typedef struct _MEDIA_FW_VOL_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header ;
|
||||
EFI_GUID FvName ;
|
||||
} MEDIA_FW_VOL_DEVICE_PATH ;
|
||||
|
||||
/**
|
||||
* Media relative offset range device path.
|
||||
* UEFI 2.0 specification version 2.4 § 9.3.6.8.
|
||||
*/
|
||||
#define MEDIA_RELATIVE_OFFSET_RANGE_DP 8
|
||||
typedef struct _MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header ;
|
||||
UINT32 Reserved ;
|
||||
UINT64 StartingOffset ;
|
||||
UINT64 EndingOffset ;
|
||||
} MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH ;
|
||||
|
||||
|
||||
/*
|
||||
* BIOS Boot Specification Device Path (UEFI 2.4 specification, version 2.4 § 9.3.7.)
|
||||
*/
|
||||
#define BBS_DEVICE_PATH 0x05
|
||||
|
||||
#define BBS_BBS_DP 0x01
|
||||
typedef struct _BBS_BBS_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
|
@ -13,6 +13,13 @@ Abstract:
|
||||
|
||||
Revision History
|
||||
|
||||
2014/04 B.Burette - updated device path text representation, conforming to
|
||||
UEFI specification 2.4 (dec. 2013). More specifically:
|
||||
- § 9.3.5: added some media types ie. Sata()
|
||||
- § 9.6.1.2: Acpi(PNP0A03,0) makes more sense when displayed as PciRoot(0)
|
||||
- § 9.6.1.5: use commas (instead of '|') between option specific parameters
|
||||
- § 9.6.1.6: hex values in device paths must be preceded by "0x" or "0X"
|
||||
|
||||
--*/
|
||||
|
||||
#include "lib.h"
|
||||
@ -463,7 +470,7 @@ LibDevicePathToInterface (
|
||||
return Status;
|
||||
}
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathPci (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -472,10 +479,10 @@ _DevPathPci (
|
||||
PCI_DEVICE_PATH *Pci;
|
||||
|
||||
Pci = DevPath;
|
||||
CatPrint(Str, L"Pci(%x|%x)", Pci->Device, Pci->Function);
|
||||
CatPrint(Str, L"Pci(0x%x,0x%x)", Pci->Device, Pci->Function);
|
||||
}
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathPccard (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -484,10 +491,10 @@ _DevPathPccard (
|
||||
PCCARD_DEVICE_PATH *Pccard;
|
||||
|
||||
Pccard = DevPath;
|
||||
CatPrint(Str, L"Pccard(Socket%x)", Pccard->SocketNumber);
|
||||
CatPrint(Str, L"Pccard(0x%x)", Pccard-> FunctionNumber );
|
||||
}
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathMemMap (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -496,14 +503,14 @@ _DevPathMemMap (
|
||||
MEMMAP_DEVICE_PATH *MemMap;
|
||||
|
||||
MemMap = DevPath;
|
||||
CatPrint(Str, L"MemMap(%d:%x-%x)",
|
||||
CatPrint(Str, L"MemMap(%d,0x%x,0x%x)",
|
||||
MemMap->MemoryType,
|
||||
MemMap->StartingAddress,
|
||||
MemMap->EndingAddress
|
||||
);
|
||||
}
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathController (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -517,7 +524,7 @@ _DevPathController (
|
||||
);
|
||||
}
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathVendor (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -548,7 +555,10 @@ _DevPathVendor (
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
/*
|
||||
Type: 2 (ACPI Device Path) SubType: 1 (ACPI Device Path)
|
||||
*/
|
||||
static VOID
|
||||
_DevPathAcpi (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -558,14 +568,47 @@ _DevPathAcpi (
|
||||
|
||||
Acpi = DevPath;
|
||||
if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
|
||||
CatPrint(Str, L"Acpi(PNP%04x,%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);
|
||||
switch ( EISA_ID_TO_NUM( Acpi-> HID ) ) {
|
||||
case 0x301 : {
|
||||
CatPrint( Str , L"Keyboard(%d)" , Acpi-> UID ) ;
|
||||
break ;
|
||||
}
|
||||
case 0x401 : {
|
||||
CatPrint( Str , L"ParallelPort(%d)" , Acpi-> UID ) ;
|
||||
break ;
|
||||
}
|
||||
case 0x501 : {
|
||||
CatPrint( Str , L"Serial(%d)" , Acpi-> UID ) ;
|
||||
break ;
|
||||
}
|
||||
case 0x604 : {
|
||||
CatPrint( Str , L"Floppy(%d)" , Acpi-> UID ) ;
|
||||
break ;
|
||||
}
|
||||
case 0xa03 : {
|
||||
CatPrint( Str , L"PciRoot(%d)" , Acpi-> UID ) ;
|
||||
break ;
|
||||
}
|
||||
case 0xa08 : {
|
||||
CatPrint( Str , L"PcieRoot(%d)" , Acpi-> UID ) ;
|
||||
break ;
|
||||
}
|
||||
default : {
|
||||
CatPrint( Str , L"Acpi(PNP%04x" , EISA_ID_TO_NUM( Acpi-> HID ) ) ;
|
||||
if ( Acpi-> UID ) CatPrint( Str , L",%d" , Acpi-> UID ) ;
|
||||
CatPrint( Str , L")" ) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CatPrint(Str, L"Acpi(%08x,%x)", Acpi->HID, Acpi->UID);
|
||||
CatPrint( Str , L"Acpi(0x%X" , Acpi-> HID ) ;
|
||||
if ( Acpi-> UID ) CatPrint( Str , L",%d" , Acpi-> UID ) ;
|
||||
CatPrint( Str , L")" , Acpi-> HID , Acpi-> UID ) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathAtapi (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -580,7 +623,7 @@ _DevPathAtapi (
|
||||
);
|
||||
}
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathScsi (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -589,11 +632,11 @@ _DevPathScsi (
|
||||
SCSI_DEVICE_PATH *Scsi;
|
||||
|
||||
Scsi = DevPath;
|
||||
CatPrint(Str, L"Scsi(Pun%x,Lun%x)", Scsi->Pun, Scsi->Lun);
|
||||
CatPrint(Str, L"Scsi(%d,%d)", Scsi->Pun, Scsi->Lun);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathFibre (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -602,10 +645,12 @@ _DevPathFibre (
|
||||
FIBRECHANNEL_DEVICE_PATH *Fibre;
|
||||
|
||||
Fibre = DevPath;
|
||||
CatPrint(Str, L"Fibre(%lx)", Fibre->WWN);
|
||||
CatPrint( Str , L"Fibre%s(0x%016lx,0x%016lx)" ,
|
||||
DevicePathType( & Fibre-> Header ) == MSG_FIBRECHANNEL_DP ? L"" : L"Ex" ,
|
||||
Fibre-> WWN , Fibre-> Lun ) ;
|
||||
}
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPath1394 (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -619,7 +664,7 @@ _DevPath1394 (
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathUsb (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -628,11 +673,11 @@ _DevPathUsb (
|
||||
USB_DEVICE_PATH *Usb;
|
||||
|
||||
Usb = DevPath;
|
||||
CatPrint(Str, L"Usb(%x)", Usb->Port);
|
||||
CatPrint( Str , L"Usb(0x%x,0x%x)" , Usb-> Port , Usb-> Endpoint ) ;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathI2O (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -641,10 +686,10 @@ _DevPathI2O (
|
||||
I2O_DEVICE_PATH *I2O;
|
||||
|
||||
I2O = DevPath;
|
||||
CatPrint(Str, L"I2O(%x)", I2O->Tid);
|
||||
CatPrint(Str, L"I2O(0x%X)", I2O->Tid);
|
||||
}
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathMacAddr (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -656,7 +701,10 @@ _DevPathMacAddr (
|
||||
|
||||
MAC = DevPath;
|
||||
|
||||
HwAddressSize = sizeof(EFI_MAC_ADDRESS);
|
||||
/* HwAddressSize = sizeof(EFI_MAC_ADDRESS); */
|
||||
HwAddressSize = DevicePathNodeLength( & MAC-> Header ) ;
|
||||
HwAddressSize -= sizeof( MAC-> Header ) ;
|
||||
HwAddressSize -= sizeof( MAC-> IfType ) ;
|
||||
if (MAC->IfType == 0x01 || MAC->IfType == 0x00) {
|
||||
HwAddressSize = 6;
|
||||
}
|
||||
@ -666,22 +714,108 @@ _DevPathMacAddr (
|
||||
for(Index = 0; Index < HwAddressSize; Index++) {
|
||||
CatPrint(Str, L"%02x",MAC->MacAddress.Addr[Index]);
|
||||
}
|
||||
if ( MAC-> IfType != 0 ) {
|
||||
CatPrint(Str, L",%d" , MAC-> IfType ) ;
|
||||
}
|
||||
CatPrint(Str, L")");
|
||||
}
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
CatPrintIPv4(
|
||||
IN OUT POOL_PRINT * Str ,
|
||||
IN EFI_IPv4_ADDRESS * Address
|
||||
)
|
||||
{
|
||||
CatPrint( Str , L"%d.%d.%d.%d" , Address-> Addr[ 0 ] , Address-> Addr[ 1 ] ,
|
||||
Address-> Addr[ 2 ] , Address-> Addr[ 3 ] ) ;
|
||||
}
|
||||
|
||||
static BOOLEAN
|
||||
IsNotNullIPv4(
|
||||
IN EFI_IPv4_ADDRESS * Address
|
||||
)
|
||||
{
|
||||
UINT8 val ;
|
||||
val = Address-> Addr[ 0 ] | Address-> Addr[ 1 ] ;
|
||||
val |= Address-> Addr[ 2 ] | Address-> Addr[ 3 ] ;
|
||||
return val != 0 ;
|
||||
}
|
||||
|
||||
static VOID
|
||||
CatPrintNetworkProtocol(
|
||||
IN OUT POOL_PRINT * Str ,
|
||||
IN UINT16 Proto
|
||||
)
|
||||
{
|
||||
if ( Proto == 6 ) {
|
||||
CatPrint( Str , L"TCP" ) ;
|
||||
} else if ( Proto == 17 ) {
|
||||
CatPrint( Str , L"UDP" ) ;
|
||||
} else {
|
||||
CatPrint( Str , L"%d" , Proto ) ;
|
||||
}
|
||||
}
|
||||
|
||||
static VOID
|
||||
_DevPathIPv4 (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
)
|
||||
{
|
||||
IPv4_DEVICE_PATH *IP;
|
||||
BOOLEAN show ;
|
||||
|
||||
IP = DevPath;
|
||||
CatPrint(Str, L"IPv4(not-done)");
|
||||
CatPrint( Str , L"IPv4(") ;
|
||||
CatPrintIPv4( Str , & IP-> RemoteIpAddress ) ;
|
||||
CatPrint( Str , L",") ;
|
||||
CatPrintNetworkProtocol( Str , IP-> Protocol ) ;
|
||||
CatPrint( Str , L",%s" , IP-> StaticIpAddress ? L"Static" : L"DHCP" ) ;
|
||||
show = IsNotNullIPv4( & IP-> LocalIpAddress ) ;
|
||||
if ( ! show && DevicePathNodeLength( & IP-> Header ) == sizeof( IPv4_DEVICE_PATH ) ) {
|
||||
/* only version 2 includes gateway and netmask */
|
||||
show |= IsNotNullIPv4( & IP-> GatewayIpAddress ) ;
|
||||
show |= IsNotNullIPv4( & IP-> SubnetMask ) ;
|
||||
}
|
||||
if ( show ) {
|
||||
CatPrint( Str , L"," ) ;
|
||||
CatPrintIPv4( Str , & IP-> LocalIpAddress ) ;
|
||||
if ( DevicePathNodeLength( & IP-> Header ) == sizeof( IPv4_DEVICE_PATH ) ) {
|
||||
/* only version 2 includes gateway and netmask */
|
||||
show = IsNotNullIPv4( & IP-> GatewayIpAddress ) ;
|
||||
show |= IsNotNullIPv4( & IP-> SubnetMask ) ;
|
||||
if ( show ) {
|
||||
CatPrint( Str , L",") ;
|
||||
CatPrintIPv4( Str , & IP-> GatewayIpAddress ) ;
|
||||
if ( IsNotNullIPv4( & IP-> SubnetMask ) ) {
|
||||
CatPrint( Str , L",") ;
|
||||
CatPrintIPv4( Str , & IP-> SubnetMask ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
CatPrint( Str , L")") ;
|
||||
}
|
||||
|
||||
VOID
|
||||
#define CatPrintIPv6_ADD( x , y ) ( ( (UINT16) ( x ) ) << 8 | ( y ) )
|
||||
static VOID
|
||||
CatPrintIPv6(
|
||||
IN OUT POOL_PRINT * Str ,
|
||||
IN EFI_IPv6_ADDRESS * Address
|
||||
)
|
||||
{
|
||||
CatPrint( Str , L"%x:%x:%x:%x:%x:%x:%x:%x" ,
|
||||
CatPrintIPv6_ADD( Address-> Addr[ 0 ] , Address-> Addr[ 1 ] ) ,
|
||||
CatPrintIPv6_ADD( Address-> Addr[ 2 ] , Address-> Addr[ 3 ] ) ,
|
||||
CatPrintIPv6_ADD( Address-> Addr[ 4 ] , Address-> Addr[ 5 ] ) ,
|
||||
CatPrintIPv6_ADD( Address-> Addr[ 6 ] , Address-> Addr[ 7 ] ) ,
|
||||
CatPrintIPv6_ADD( Address-> Addr[ 8 ] , Address-> Addr[ 9 ] ) ,
|
||||
CatPrintIPv6_ADD( Address-> Addr[ 10 ] , Address-> Addr[ 11 ] ) ,
|
||||
CatPrintIPv6_ADD( Address-> Addr[ 12 ] , Address-> Addr[ 13 ] ) ,
|
||||
CatPrintIPv6_ADD( Address-> Addr[ 14 ] , Address-> Addr[ 15 ] ) ) ;
|
||||
}
|
||||
|
||||
static VOID
|
||||
_DevPathIPv6 (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -690,10 +824,24 @@ _DevPathIPv6 (
|
||||
IPv6_DEVICE_PATH *IP;
|
||||
|
||||
IP = DevPath;
|
||||
CatPrint(Str, L"IP-v6(not-done)");
|
||||
CatPrint( Str , L"IPv6(") ;
|
||||
CatPrintIPv6( Str , & IP-> RemoteIpAddress ) ;
|
||||
CatPrint( Str , L",") ;
|
||||
CatPrintNetworkProtocol( Str, IP-> Protocol ) ;
|
||||
CatPrint( Str , L",%s," , IP-> IPAddressOrigin ?
|
||||
( IP-> IPAddressOrigin == 1 ? L"StatelessAutoConfigure" :
|
||||
L"StatefulAutoConfigure" ) : L"Static" ) ;
|
||||
CatPrintIPv6( Str , & IP-> LocalIpAddress ) ;
|
||||
if ( DevicePathNodeLength( & IP-> Header ) == sizeof( IPv6_DEVICE_PATH ) ) {
|
||||
CatPrint( Str , L",") ;
|
||||
CatPrintIPv6( Str , & IP-> GatewayIpAddress ) ;
|
||||
CatPrint( Str , L",") ;
|
||||
CatPrint( Str , L"%d" , & IP-> PrefixLength ) ;
|
||||
}
|
||||
CatPrint( Str , L")") ;
|
||||
}
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathInfiniBand (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -702,10 +850,12 @@ _DevPathInfiniBand (
|
||||
INFINIBAND_DEVICE_PATH *InfiniBand;
|
||||
|
||||
InfiniBand = DevPath;
|
||||
CatPrint(Str, L"InfiniBand(not-done)");
|
||||
CatPrint( Str , L"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)" ,
|
||||
InfiniBand-> ResourceFlags , InfiniBand-> PortGid , InfiniBand-> ServiceId ,
|
||||
InfiniBand-> TargetPortId , InfiniBand-> DeviceId ) ;
|
||||
}
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathUart (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -746,8 +896,20 @@ _DevPathUart (
|
||||
}
|
||||
}
|
||||
|
||||
static VOID
|
||||
_DevPathSata (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
)
|
||||
{
|
||||
SATA_DEVICE_PATH * Sata ;
|
||||
|
||||
VOID
|
||||
Sata = DevPath;
|
||||
CatPrint( Str , L"Sata(0x%x,0x%x,0x%x)" , Sata-> HBAPortNumber ,
|
||||
Sata-> PortMultiplierPortNumber , Sata-> Lun ) ;
|
||||
}
|
||||
|
||||
static VOID
|
||||
_DevPathHardDrive (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -779,7 +941,7 @@ _DevPathHardDrive (
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathCDROM (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -788,10 +950,10 @@ _DevPathCDROM (
|
||||
CDROM_DEVICE_PATH *Cd;
|
||||
|
||||
Cd = DevPath;
|
||||
CatPrint(Str, L"CDROM(Entry%x)", Cd->BootEntry);
|
||||
CatPrint( Str , L"CDROM(0x%x)" , Cd-> BootEntry ) ;
|
||||
}
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathFilePath (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -803,7 +965,7 @@ _DevPathFilePath (
|
||||
CatPrint(Str, L"%s", Fp->PathName);
|
||||
}
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathMediaProtocol (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -815,7 +977,7 @@ _DevPathMediaProtocol (
|
||||
CatPrint(Str, L"%g", &MediaProt->Protocol);
|
||||
}
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathBssBss (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -839,7 +1001,7 @@ _DevPathBssBss (
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
static VOID
|
||||
_DevPathEndInstance (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
@ -848,16 +1010,64 @@ _DevPathEndInstance (
|
||||
CatPrint(Str, L",");
|
||||
}
|
||||
|
||||
VOID
|
||||
/**
|
||||
* Print unknown device node.
|
||||
* UEFI 2.4 § 9.6.1.6 table 89.
|
||||
*/
|
||||
|
||||
static VOID
|
||||
_DevPathNodeUnknown (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
)
|
||||
{
|
||||
CatPrint(Str, L"?");
|
||||
EFI_DEVICE_PATH * Path ;
|
||||
UINT8 * value ;
|
||||
int length , index ;
|
||||
Path = DevPath ;
|
||||
value = DevPath ;
|
||||
value += 4 ;
|
||||
switch ( Path-> Type ) {
|
||||
case HARDWARE_DEVICE_PATH : { /* Unknown Hardware Device Path */
|
||||
CatPrint( Str , L"HardwarePath(%d" , Path-> SubType ) ;
|
||||
break ;
|
||||
}
|
||||
case ACPI_DEVICE_PATH : { /* Unknown ACPI Device Path */
|
||||
CatPrint( Str , L"AcpiPath(%d" , Path-> SubType ) ;
|
||||
break ;
|
||||
}
|
||||
case MESSAGING_DEVICE_PATH : { /* Unknown Messaging Device Path */
|
||||
CatPrint( Str , L"Msg(%d" , Path-> SubType ) ;
|
||||
break ;
|
||||
}
|
||||
case MEDIA_DEVICE_PATH : { /* Unknown Media Device Path */
|
||||
CatPrint( Str , L"MediaPath(%d" , Path-> SubType ) ;
|
||||
break ;
|
||||
}
|
||||
case BBS_DEVICE_PATH : { /* Unknown BIOS Boot Specification Device Path */
|
||||
CatPrint( Str , L"BbsPath(%d" , Path-> SubType ) ;
|
||||
break ;
|
||||
}
|
||||
default : { /* Unknown Device Path */
|
||||
CatPrint( Str , L"Path(%d,%d" , Path-> Type , Path-> SubType ) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
length = DevicePathNodeLength( Path ) ;
|
||||
for ( index = 0 ; index < length ; index ++ ) {
|
||||
if ( index == 0 ) CatPrint( Str , L",0x" ) ;
|
||||
CatPrint( Str , L"%02x" , * value ) ;
|
||||
value ++ ;
|
||||
}
|
||||
CatPrint( Str , L")" ) ;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Table to convert "Type" and "SubType" to a "convert to text" function/
|
||||
* Entries hold "Type" and "SubType" for know values.
|
||||
* Special "SubType" 0 is used as default for known type with unknown subtype.
|
||||
*/
|
||||
struct {
|
||||
UINT8 Type;
|
||||
UINT8 SubType;
|
||||
@ -880,6 +1090,7 @@ struct {
|
||||
{ MESSAGING_DEVICE_PATH, MSG_IPv6_DP, _DevPathIPv6},
|
||||
{ MESSAGING_DEVICE_PATH, MSG_INFINIBAND_DP, _DevPathInfiniBand},
|
||||
{ MESSAGING_DEVICE_PATH, MSG_UART_DP, _DevPathUart},
|
||||
{ MESSAGING_DEVICE_PATH , MSG_SATA_DP , _DevPathSata } ,
|
||||
{ MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, _DevPathVendor},
|
||||
{ MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, _DevPathHardDrive},
|
||||
{ MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, _DevPathCDROM},
|
||||
|
Loading…
Reference in New Issue
Block a user