From 5230616612bfdaf388aef75a6eb921f7ca6dafcb Mon Sep 17 00:00:00 2001 From: Feng Tian Date: Wed, 29 Apr 2015 02:37:30 +0000 Subject: [PATCH] MdePkg: Add UFS (Universal Flash Storage) related definitions These definitions are defined in UEFI2.5/PI1.4 spec. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian Reviewed-by: Star Zeng git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17245 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Include/Ppi/BlockIo.h | 5 ++- MdePkg/Include/Protocol/DevicePath.h | 18 +++++++++++ MdePkg/Include/Protocol/DiskInfo.h | 11 ++++++- .../UefiDevicePathLib/DevicePathFromText.c | 32 +++++++++++++++++++ .../UefiDevicePathLib/DevicePathToText.c | 28 ++++++++++++++++ MdePkg/MdePkg.dec | 4 +++ 6 files changed, 96 insertions(+), 2 deletions(-) diff --git a/MdePkg/Include/Ppi/BlockIo.h b/MdePkg/Include/Ppi/BlockIo.h index f2980f52c0..a69419e284 100644 --- a/MdePkg/Include/Ppi/BlockIo.h +++ b/MdePkg/Include/Ppi/BlockIo.h @@ -10,7 +10,7 @@ Block I/O PPIs that are provided by the PEI ATAPI driver and PEI legacy floppy driver are the same, here we define a set of general PPIs for both drivers to use. -Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License that accompanies this distribution. The full text of the license may be found at @@ -54,6 +54,9 @@ typedef enum { IdeCDROM = 1, ///< The recovery device is an IDE CD-ROM IdeLS120 = 2, ///< The recovery device is an IDE LS-120 UsbMassStorage= 3, ///< The recovery device is a USB Mass Storage device + SD = 4, ///< The recovery device is a Secure Digital device + EMMC = 5, ///< The recovery device is a eMMC device + UfsDevice = 6, ///< The recovery device is a Universal Flash Storage device MaxDeviceType } EFI_PEI_BLOCK_DEVICE_TYPE; diff --git a/MdePkg/Include/Protocol/DevicePath.h b/MdePkg/Include/Protocol/DevicePath.h index a27ea5d420..3c9b1ec6d3 100644 --- a/MdePkg/Include/Protocol/DevicePath.h +++ b/MdePkg/Include/Protocol/DevicePath.h @@ -795,6 +795,22 @@ typedef struct { UINT64 NamespaceUuid; } NVME_NAMESPACE_DEVICE_PATH; +/// +/// Universal Flash Storage (UFS) Device Path SubType. +/// +#define MSG_UFS_DP 0x19 +typedef struct { + EFI_DEVICE_PATH_PROTOCOL Header; + /// + /// Target ID on the UFS bus (PUN). + /// + UINT8 Pun; + /// + /// Logical Unit Number (LUN). + /// + UINT8 Lun; +} UFS_DEVICE_PATH; + /// /// iSCSI Device Path SubType /// @@ -1094,6 +1110,7 @@ typedef union { SAS_DEVICE_PATH Sas; SASEX_DEVICE_PATH SasEx; NVME_NAMESPACE_DEVICE_PATH NvmeNamespace; + UFS_DEVICE_PATH Ufs; HARDDRIVE_DEVICE_PATH HardDrive; CDROM_DEVICE_PATH CD; @@ -1144,6 +1161,7 @@ typedef union { SAS_DEVICE_PATH *Sas; SASEX_DEVICE_PATH *SasEx; NVME_NAMESPACE_DEVICE_PATH *NvmeNamespace; + UFS_DEVICE_PATH *Ufs; HARDDRIVE_DEVICE_PATH *HardDrive; CDROM_DEVICE_PATH *CD; diff --git a/MdePkg/Include/Protocol/DiskInfo.h b/MdePkg/Include/Protocol/DiskInfo.h index bce27e84da..a094bc8251 100644 --- a/MdePkg/Include/Protocol/DiskInfo.h +++ b/MdePkg/Include/Protocol/DiskInfo.h @@ -2,7 +2,7 @@ Provides the basic interfaces to abstract platform information regarding an IDE controller. - Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2014, Intel Corporation. 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 @@ -73,6 +73,14 @@ typedef struct _EFI_DISK_INFO_PROTOCOL EFI_DISK_INFO_PROTOCOL; 0x3ab14680, 0x5d3f, 0x4a4d, {0xbc, 0xdc, 0xcc, 0x38, 0x0, 0x18, 0xc7, 0xf7 } \ } +/// +/// Global ID for a UFS interface. Used to fill in EFI_DISK_INFO_PROTOCOL.Interface +/// +#define EFI_DISK_INFO_UFS_INTERFACE_GUID \ + { \ + 0x4b3029cc, 0x6b98, 0x47fb, { 0xbc, 0x96, 0x76, 0xdc, 0xb8, 0x4, 0x41, 0xf0 } \ + } + /** Provides inquiry information for the controller type. @@ -205,5 +213,6 @@ extern EFI_GUID gEfiDiskInfoScsiInterfaceGuid; extern EFI_GUID gEfiDiskInfoUsbInterfaceGuid; extern EFI_GUID gEfiDiskInfoAhciInterfaceGuid; extern EFI_GUID gEfiDiskInfoNvmeInterfaceGuid; +extern EFI_GUID gEfiDiskInfoUfsInterfaceGuid; #endif diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c index 6ec0a4c0bd..f688c1af74 100644 --- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c @@ -1809,6 +1809,37 @@ DevPathFromTextNVMe ( return (EFI_DEVICE_PATH_PROTOCOL *) Nvme; } +/** + Converts a text device path node to UFS device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created UFS device path structure. + +**/ +EFI_DEVICE_PATH_PROTOCOL * +DevPathFromTextUfs ( + IN CHAR16 *TextDeviceNode + ) +{ + CHAR16 *PunStr; + CHAR16 *LunStr; + UFS_DEVICE_PATH *Ufs; + + PunStr = GetNextParamStr (&TextDeviceNode); + LunStr = GetNextParamStr (&TextDeviceNode); + Ufs = (UFS_DEVICE_PATH *) CreateDeviceNode ( + MESSAGING_DEVICE_PATH, + MSG_UFS_DP, + (UINT16) sizeof (UFS_DEVICE_PATH) + ); + + Ufs->Pun = (UINT8) Strtoi (PunStr); + Ufs->Lun = (UINT8) Strtoi (LunStr); + + return (EFI_DEVICE_PATH_PROTOCOL *) Ufs; +} + /** Converts a text device path node to Debug Port device path structure. @@ -3079,6 +3110,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevP {L"SAS", DevPathFromTextSAS }, {L"SasEx", DevPathFromTextSasEx }, {L"NVMe", DevPathFromTextNVMe }, + {L"UFS", DevPathFromTextUfs }, {L"DebugPort", DevPathFromTextDebugPort }, {L"MAC", DevPathFromTextMAC }, {L"IPv4", DevPathFromTextIPv4 }, diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c index 030001905b..2dbbddaf09 100644 --- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c @@ -731,6 +731,33 @@ DevPathToTextNVMe ( ); } +/** + Converts a UFS device path structure to its string representative. + + @param Str The string representative of input device. + @param DevPath The input device path structure. + @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation + of the display node is used, where applicable. If DisplayOnly + is FALSE, then the longer text representation of the display node + is used. + @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text + representation for a device node can be used, where applicable. + +**/ +VOID +DevPathToTextUfs ( + IN OUT POOL_PRINT *Str, + IN VOID *DevPath, + IN BOOLEAN DisplayOnly, + IN BOOLEAN AllowShortcuts + ) +{ + UFS_DEVICE_PATH *Ufs; + + Ufs = DevPath; + UefiDevicePathLibCatPrint (Str, L"UFS(0x%x,0x%x)", Ufs->Pun, Ufs->Lun); +} + /** Converts a 1394 device path structure to its string representative. @@ -1869,6 +1896,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLib {MESSAGING_DEVICE_PATH, MSG_FIBRECHANNELEX_DP, DevPathToTextFibreEx }, {MESSAGING_DEVICE_PATH, MSG_SASEX_DP, DevPathToTextSasEx }, {MESSAGING_DEVICE_PATH, MSG_NVME_NAMESPACE_DP, DevPathToTextNVMe }, + {MESSAGING_DEVICE_PATH, MSG_UFS_DP, DevPathToTextUfs }, {MESSAGING_DEVICE_PATH, MSG_1394_DP, DevPathToText1394 }, {MESSAGING_DEVICE_PATH, MSG_USB_DP, DevPathToTextUsb }, {MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP, DevPathToTextUsbWWID }, diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 04c285b610..644f2ba978 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -658,6 +658,10 @@ ## Include/Guid/GraphicsInfoHob.h gEfiGraphicsInfoHobGuid = { 0x39f62cce, 0x6825, 0x4669, { 0xbb, 0x56, 0x54, 0x1a, 0xba, 0x75, 0x3a, 0x07 }} + ## Guid for EFI_DISK_INFO_PROTOCOL.Interface to specify UFS interface. + ## Include/Protocol/DiskInfo.h + gEfiDiskInfoUfsInterfaceGuid = { 0x4b3029cc, 0x6b98, 0x47fb, { 0xbc, 0x96, 0x76, 0xdc, 0xb8, 0x4, 0x41, 0xf0 }} + [Guids.IA32, Guids.X64] ## Include/Guid/Cper.h gEfiIa32X64ErrorTypeCacheCheckGuid = { 0xA55701F5, 0xE3EF, 0x43de, { 0xAC, 0x72, 0x24, 0x9B, 0x57, 0x3F, 0xAD, 0x2C }} -- 2.39.2