From nobody Fri Dec 27 18:44:10 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502220910794417.0582048758512; Tue, 8 Aug 2017 12:35:10 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0900C21E11D63; Tue, 8 Aug 2017 12:32:51 -0700 (PDT) Received: from mail.zytor.com (terminus.zytor.com [65.50.211.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6BC962095DB90 for ; Tue, 8 Aug 2017 12:32:50 -0700 (PDT) Received: from localhost.localdomain ([IPv6:2804:7f4:c480:4886:0:0:0:4]) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id v78JWiKL019064 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Tue, 8 Aug 2017 12:32:50 -0700 X-Original-To: edk2-devel@lists.01.org From: Paulo Alcantara To: edk2-devel@lists.01.org Date: Tue, 8 Aug 2017 16:31:40 -0300 Message-Id: <20170808193143.18128-2-pcacjr@zytor.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170808193143.18128-1-pcacjr@zytor.com> References: <20170808193143.18128-1-pcacjr@zytor.com> Subject: [edk2] [PATCH 1/4] MdeModulePkg/PartitionDxe: Add UDF/ECMA-167 file system support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Dong , Liming Gao , Michael D Kinney , Laszlo Ersek , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" UDF revision 2.00 or higher is the only supported. Cc: Michael D Kinney Cc: Liming Gao Cc: Star Zeng Cc: Eric Dong Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Paulo Alcantara --- MdeModulePkg/MdeModulePkg.dec | 6 + .../Universal/Disk/PartitionDxe/Partition.c | 3 +- .../Universal/Disk/PartitionDxe/Partition.h | 41 ++- .../Universal/Disk/PartitionDxe/PartitionDxe.inf | 10 +- MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c | 335 +++++++++++++++++= ++++ MdePkg/Include/IndustryStandard/Udf.h | 78 +++++ 6 files changed, 465 insertions(+), 8 deletions(-) create mode 100644 MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c create mode 100644 MdePkg/Include/IndustryStandard/Udf.h diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 593bff357a..3bc3b65ebb 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -794,6 +794,12 @@ # @Prompt Turn on PS2 Mouse Extended Verification gEfiMdeModulePkgTokenSpaceGuid.PcdPs2MouseExtendedVerification|TRUE|BOOL= EAN|0x00010075 =20 + ## Indicates if UDF/ECMA-167 filesystem will be supported.

+ # TRUE - UDF/ECMA-167 filesystem will be supported.
+ # FALSE - UDF/ECMA-167 filesystem will not be supported.
+ # @Prompt Enable UDF/ECMA-167 filesystem support. + gEfiMdeModulePkgTokenSpaceGuid.PcdUdfFileSystemSupport|FALSE|BOOLEAN|0x0= 0010077 + ## Indicates whether 64-bit PCI MMIO BARs should degrade to 32-bit in th= e presence of an option ROM # On X64 platforms, Option ROMs may contain code that executes in the c= ontext of a legacy BIOS (CSM), # which requires that all PCI MMIO BARs are located below 4 GB diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c b/MdeModu= lePkg/Universal/Disk/PartitionDxe/Partition.c index 5a7d119b43..152bc72738 100644 --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c @@ -2,7 +2,7 @@ Partition driver that produces logical BlockIo devices from a physical BlockIo device. The logical BlockIo devices are based on the format of the raw block devices media. Currently "El Torito CD-ROM", Legacy - MBR, and GPT partition schemes are supported. + MBR, GPT partition and UDF/ECMA-167 volume schemes are supported. =20 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials @@ -45,6 +45,7 @@ PARTITION_DETECT_ROUTINE mPartitionDetectRoutineTable[] = =3D { PartitionInstallGptChildHandles, PartitionInstallElToritoChildHandles, PartitionInstallMbrChildHandles, + PartitionInstallUdfChildHandles, NULL }; =20 diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h b/MdeModu= lePkg/Universal/Disk/PartitionDxe/Partition.h index f2f6185317..a205e3e47b 100644 --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h @@ -1,8 +1,8 @@ /** @file - Partition driver that produces logical BlockIo devices from a physical=20 + Partition driver that produces logical BlockIo devices from a physical BlockIo device. The logical BlockIo devices are based on the format - of the raw block devices media. Currently "El Torito CD-ROM", Legacy=20 - MBR, and GPT partition schemes are supported. + of the raw block devices media. Currently "El Torito CD-ROM", Legacy + MBR, GPT partition and UDF/ECMA-167 volume schemes are supported. =20 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials @@ -15,8 +15,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER= EXPRESS OR IMPLIED. =20 **/ =20 -#ifndef _PARTITION_H_=20 -#define _PARTITION_H_=20 +#ifndef _PARTITION_H_ +#define _PARTITION_H_ =20 #include #include @@ -39,6 +39,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER= EXPRESS OR IMPLIED. =20 #include #include +#include =20 =20 // @@ -428,7 +429,7 @@ PartitionInstallElToritoChildHandles ( @param[in] BlockIo Parent BlockIo interface. @param[in] BlockIo2 Parent BlockIo2 interface. @param[in] DevicePath Parent Device Path. - =20 + @retval EFI_SUCCESS A child handle was added. @retval EFI_MEDIA_CHANGED Media change was detected. @retval Others MBR partition was not found. @@ -445,6 +446,34 @@ PartitionInstallMbrChildHandles ( IN EFI_DEVICE_PATH_PROTOCOL *DevicePath ); =20 +/** + Install child handles if the Handle supports UDF/ECMA-167 volume format. + + @param[in] This Calling context. + @param[in] Handle Parent Handle. + @param[in] DiskIo Parent DiskIo interface. + @param[in] DiskIo2 Parent DiskIo2 interface. + @param[in] BlockIo Parent BlockIo interface. + @param[in] BlockIo2 Parent BlockIo2 interface. + @param[in] DevicePath Parent Device Path + + + @retval EFI_SUCCESS Child handle(s) was added. + @retval EFI_MEDIA_CHANGED Media changed Detected. + @retval other no child handle was added. + +**/ +EFI_STATUS +PartitionInstallUdfChildHandles ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Handle, + IN EFI_DISK_IO_PROTOCOL *DiskIo, + IN EFI_DISK_IO2_PROTOCOL *DiskIo2, + IN EFI_BLOCK_IO_PROTOCOL *BlockIo, + IN EFI_BLOCK_IO2_PROTOCOL *BlockIo2, + IN EFI_DEVICE_PATH_PROTOCOL *DevicePath + ); + typedef EFI_STATUS (*PARTITION_DETECT_ROUTINE) ( diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf b/Md= eModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf index 48212773e8..1dfe5509a0 100644 --- a/MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf @@ -4,7 +4,7 @@ # This module produces the logical Block I/O device that represents # the bytes from Start to End of the Parent Block I/O device. # The partition of physical BlockIo device supported is one of legacy MBR= , GPT, -# and "El Torito" partitions. +# "El Torito" partitions and UDF/ECMA-167 volumes. # # Caution: This module requires additional review when modified. # This driver will have external input - disk partition. @@ -46,12 +46,14 @@ Mbr.c Gpt.c ElTorito.c + Udf.c Partition.c Partition.h =20 =20 [Packages] MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec =20 =20 [LibraryClasses] @@ -63,6 +65,7 @@ BaseLib UefiDriverEntryPoint DebugLib + PcdLib =20 =20 [Guids] @@ -86,5 +89,10 @@ gEfiDiskIoProtocolGuid ## TO_START gEfiDiskIo2ProtocolGuid ## TO_START =20 + +[FeaturePcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdUdfFileSystemSupport ## CONSUMES + + [UserExtensions.TianoCore."ExtraFiles"] PartitionDxeExtra.uni diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c b/MdeModulePkg/= Universal/Disk/PartitionDxe/Udf.c new file mode 100644 index 0000000000..333b93d666 --- /dev/null +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c @@ -0,0 +1,335 @@ +/** @file + Decode a UDF/ECMA-167 formatted media. + + Copyright (C) 2014-2017 Paulo Alcantara + + This program and the accompanying materials are licensed and made availa= ble + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WI= THOUT + WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +**/ + +#include "Partition.h" + +EFI_GUID gUdfVolumeSignatureGuid =3D { + 0xC5BD4D42, 0x1A76, 0x4996, + { 0x89, 0x56, 0x73, 0xCD, 0xA3, 0x26, 0xCD, 0x0A } +}; + +// +// The UDF/ECMA-167 file system driver only supports UDF revision 2.00 or +// higher. +// +// Note the "NSR03" identifier. +// +UDF_STANDARD_IDENTIFIER gUdfStandardIdentifiers[NR_STANDARD_IDENTIFIERS] = =3D { + { { 'B', 'E', 'A', '0', '1' } }, + { { 'N', 'S', 'R', '0', '3' } }, + { { 'T', 'E', 'A', '0', '1' } }, +}; + +typedef struct { + VENDOR_DEVICE_PATH DevicePath; + EFI_DEVICE_PATH_PROTOCOL End; +} UDF_DEVICE_PATH; + +// +// C5BD4D42-1A76-4996-8956-73CDA326CD0A +// +#define EFI_UDF_DEVICE_PATH_GUID \ + { 0xC5BD4D42, 0x1A76, 0x4996, \ + { 0x89, 0x56, 0x73, 0xCD, 0xA3, 0x26, 0xCD, 0x0A } \ + } + +UDF_DEVICE_PATH gUdfDevicePath =3D { + { { MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP, + { sizeof (VENDOR_DEVICE_PATH), 0 } }, + EFI_UDF_DEVICE_PATH_GUID + }, + { END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, + { sizeof (EFI_DEVICE_PATH_PROTOCOL), 0 } + } +}; + +EFI_STATUS +FindAnchorVolumeDescriptorPointer ( + IN EFI_BLOCK_IO_PROTOCOL *BlockIo, + IN EFI_DISK_IO_PROTOCOL *DiskIo, + OUT UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER *AnchorPoint + ) +{ + EFI_STATUS Status; + UINT32 BlockSize; + EFI_LBA EndLBA; + + BlockSize =3D BlockIo->Media->BlockSize; + EndLBA =3D BlockIo->Media->LastBlock; + + // + // Look for AVDP at LBA 256. + // + Status =3D DiskIo->ReadDisk ( + DiskIo, + BlockIo->Media->MediaId, + 256ULL * BlockSize, + sizeof (UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER), + (VOID *)AnchorPoint + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (IS_AVDP (AnchorPoint)) { + return EFI_SUCCESS; + } + + // + // Look for AVDP at last LBA - 256. + // + Status =3D DiskIo->ReadDisk ( + DiskIo, + BlockIo->Media->MediaId, + MultU64x32 (EndLBA - 256, BlockSize), + sizeof (UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER), + (VOID *)AnchorPoint + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (IS_AVDP (AnchorPoint)) { + return EFI_SUCCESS; + } + + // + // Look for AVDP at last LBA. + // + Status =3D DiskIo->ReadDisk ( + DiskIo, + BlockIo->Media->MediaId, + MultU64x32 (EndLBA, BlockSize), + sizeof (UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER), + (VOID *)AnchorPoint + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (IS_AVDP (AnchorPoint)) { + return EFI_SUCCESS; + } + + // + // No AVDP found in this media. + // + return EFI_VOLUME_CORRUPTED; +} + +EFI_STATUS +SupportUdfFileSystem ( + IN EFI_BLOCK_IO_PROTOCOL *BlockIo, + IN EFI_DISK_IO_PROTOCOL *DiskIo + ) +{ + EFI_STATUS Status; + UINT64 Offset; + UINT64 EndDiskOffset; + UDF_VOLUME_DESCRIPTOR VolDescriptor; + UDF_VOLUME_DESCRIPTOR TerminatingVolDescriptor; + UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER AnchorPoint; + + ZeroMem ((VOID *)&TerminatingVolDescriptor, sizeof (UDF_VOLUME_DESCRIPTO= R)); + + // + // Start Volume Recognition Sequence. + // + EndDiskOffset =3D MultU64x32 (BlockIo->Media->LastBlock, BlockIo->Media-= >BlockSize); + + for (Offset =3D UDF_VRS_START_OFFSET; Offset < EndDiskOffset; + Offset +=3D UDF_LOGICAL_SECTOR_SIZE) { + Status =3D DiskIo->ReadDisk ( + DiskIo, + BlockIo->Media->MediaId, + Offset, + sizeof (UDF_VOLUME_DESCRIPTOR), + (VOID *)&VolDescriptor + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (CompareMem ((VOID *)&VolDescriptor.StandardIdentifier, + (VOID *)&gUdfStandardIdentifiers[BEA_IDENTIFIER], + UDF_STANDARD_IDENTIFIER_LENGTH) =3D=3D 0) { + break; + } + + if ((CompareMem ((VOID *)&VolDescriptor.StandardIdentifier, + (VOID *)UDF_CDROM_VOLUME_IDENTIFIER, + UDF_STANDARD_IDENTIFIER_LENGTH) !=3D 0) || + CompareMem ((VOID *)&VolDescriptor, + (VOID *)&TerminatingVolDescriptor, + sizeof (UDF_VOLUME_DESCRIPTOR)) =3D=3D 0) { + return EFI_UNSUPPORTED; + } + } + + // + // Look for "NSR03" identifier in the Extended Area. + // + Offset +=3D UDF_LOGICAL_SECTOR_SIZE; + if (Offset >=3D EndDiskOffset) { + return EFI_UNSUPPORTED; + } + + Status =3D DiskIo->ReadDisk ( + DiskIo, + BlockIo->Media->MediaId, + Offset, + sizeof (UDF_VOLUME_DESCRIPTOR), + (VOID *)&VolDescriptor + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (CompareMem ((VOID *)&VolDescriptor.StandardIdentifier, + (VOID *)&gUdfStandardIdentifiers[VSD_IDENTIFIER], + UDF_STANDARD_IDENTIFIER_LENGTH) !=3D 0) { + return EFI_UNSUPPORTED; + } + + // + // Look for "TEA01" identifier in the Extended Area + // + Offset +=3D UDF_LOGICAL_SECTOR_SIZE; + if (Offset >=3D EndDiskOffset) { + return EFI_UNSUPPORTED; + } + + Status =3D DiskIo->ReadDisk ( + DiskIo, + BlockIo->Media->MediaId, + Offset, + sizeof (UDF_VOLUME_DESCRIPTOR), + (VOID *)&VolDescriptor + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (CompareMem ((VOID *)&VolDescriptor.StandardIdentifier, + (VOID *)&gUdfStandardIdentifiers[TEA_IDENTIFIER], + UDF_STANDARD_IDENTIFIER_LENGTH) !=3D 0) { + return EFI_UNSUPPORTED; + } + + Status =3D FindAnchorVolumeDescriptorPointer (BlockIo, DiskIo, &AnchorPo= int); + if (EFI_ERROR (Status)) { + return EFI_UNSUPPORTED; + } + + return EFI_SUCCESS; +} + +/** + Install child handles if the Handle supports UDF/ECMA-167 volume format. + + @param[in] This Calling context. + @param[in] Handle Parent Handle. + @param[in] DiskIo Parent DiskIo interface. + @param[in] DiskIo2 Parent DiskIo2 interface. + @param[in] BlockIo Parent BlockIo interface. + @param[in] BlockIo2 Parent BlockIo2 interface. + @param[in] DevicePath Parent Device Path + + + @retval EFI_SUCCESS Child handle(s) was added. + @retval EFI_MEDIA_CHANGED Media changed Detected. + @retval other no child handle was added. + +**/ +EFI_STATUS +PartitionInstallUdfChildHandles ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Handle, + IN EFI_DISK_IO_PROTOCOL *DiskIo, + IN EFI_DISK_IO2_PROTOCOL *DiskIo2, + IN EFI_BLOCK_IO_PROTOCOL *BlockIo, + IN EFI_BLOCK_IO2_PROTOCOL *BlockIo2, + IN EFI_DEVICE_PATH_PROTOCOL *DevicePath + ) +{ + EFI_STATUS Status; + EFI_BLOCK_IO_MEDIA *Media; + EFI_DEVICE_PATH_PROTOCOL *LastDevicePathNode; + EFI_DEVICE_PATH_PROTOCOL *DevicePathNode; + EFI_GUID *VendorDevGuid; + EFI_GUID UdfDevGuid =3D EFI_UDF_DEVICE_PATH_GUID; + EFI_PARTITION_INFO_PROTOCOL PartitionInfo; + + Media =3D BlockIo->Media; + + // + // Check if platform supports UDF file system. + // + if (!FeaturePcdGet (PcdUdfFileSystemSupport)) { + return EFI_NOT_FOUND; + } + + // + // Check if UDF logical block size is multiple of underlying device block + // size. + // + if ((UDF_LOGICAL_SECTOR_SIZE % Media->BlockSize) !=3D 0 || + (Media->BlockSize > UDF_LOGICAL_SECTOR_SIZE)) { + return EFI_NOT_FOUND; + } + + Status =3D SupportUdfFileSystem (BlockIo, DiskIo); + if (EFI_ERROR (Status)) { + return EFI_NOT_FOUND; + } + + LastDevicePathNode =3D NULL; + DevicePathNode =3D DevicePath; + while (!IsDevicePathEnd (DevicePathNode)) { + LastDevicePathNode =3D DevicePathNode; + DevicePathNode =3D NextDevicePathNode (DevicePathNode); + } + if (LastDevicePathNode) { + VendorDevGuid =3D (EFI_GUID *)((UINT8 *)LastDevicePathNode + + OFFSET_OF (VENDOR_DEVICE_PATH, Guid)); + if (DevicePathSubType (LastDevicePathNode) =3D=3D MEDIA_VENDOR_DP && + CompareGuid (VendorDevGuid, &UdfDevGuid)) { + return EFI_NOT_FOUND; + } + } + + ZeroMem (&PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL)); + PartitionInfo.Revision =3D EFI_PARTITION_INFO_PROTOCOL_REVISION; + PartitionInfo.Type =3D PARTITION_TYPE_OTHER; + + Status =3D PartitionInstallChildHandle ( + This, + Handle, + DiskIo, + DiskIo2, + BlockIo, + BlockIo2, + DevicePath, + (EFI_DEVICE_PATH_PROTOCOL *)&gUdfDevicePath, + &PartitionInfo, + 0, + Media->LastBlock, + Media->BlockSize + ); + if (!EFI_ERROR (Status)) { + Status =3D EFI_NOT_FOUND; + } + + return Status; +} diff --git a/MdePkg/Include/IndustryStandard/Udf.h b/MdePkg/Include/Industr= yStandard/Udf.h new file mode 100644 index 0000000000..d571424315 --- /dev/null +++ b/MdePkg/Include/IndustryStandard/Udf.h @@ -0,0 +1,78 @@ +/** @file + UDF/ECMA-167 Volume and File Structure Format Definition. + + Copyright (C) 2014-2017 Paulo Alcantara + + This program and the accompanying materials are licensed and made availa= ble + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WI= THOUT + WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +**/ + +#ifndef _UDF_H_ +#define _UDF_H_ + +#define UDF_LOGICAL_SECTOR_SHIFT 11 +#define UDF_LOGICAL_SECTOR_SIZE ((UINT64)(1ULL << UDF_LOGICAL_SECTOR_SHI= FT)) +#define UDF_VRS_START_OFFSET ((UINT64)(16ULL << UDF_LOGICAL_SECTOR_SH= IFT)) +#define UDF_STANDARD_IDENTIFIER_LENGTH 5 +#define UDF_CDROM_VOLUME_IDENTIFIER "CD001" + +#define _GET_TAG_ID(_Pointer) \ + (((UDF_DESCRIPTOR_TAG *) (_Pointer))->TagIdentifier) + +#define IS_PVD(_Pointer) \ + ((BOOLEAN)(_GET_TAG_ID (_Pointer) =3D=3D 1)) +#define IS_AVDP(_Pointer) \ + ((BOOLEAN)(_GET_TAG_ID (_Pointer) =3D=3D 2)) + +typedef struct { + UINT8 StandardIdentifier[UDF_STANDARD_IDENTIFIER_LENGTH]; +} UDF_STANDARD_IDENTIFIER; + +enum { + BEA_IDENTIFIER, + VSD_IDENTIFIER, + TEA_IDENTIFIER, + NR_STANDARD_IDENTIFIERS, +}; + +#pragma pack(1) + +typedef struct { + UINT16 TagIdentifier; + UINT16 DescriptorVersion; + UINT8 TagChecksum; + UINT8 Reserved; + UINT16 TagSerialNumber; + UINT16 DescriptorCRC; + UINT16 DescriptorCRCLength; + UINT32 TagLocation; +} UDF_DESCRIPTOR_TAG; + +typedef struct { + UINT32 ExtentLength; + UINT32 ExtentLocation; +} UDF_EXTENT_AD; + +typedef struct { + UINT8 StructureType; + UINT8 StandardIdentifier[UDF_STANDARD_IDENTIFIER_LENGTH]; + UINT8 StructureVersion; + UINT8 Reserved; + UINT8 StructureData[2040]; +} UDF_VOLUME_DESCRIPTOR; + +typedef struct { + UDF_DESCRIPTOR_TAG DescriptorTag; + UDF_EXTENT_AD MainVolumeDescriptorSequenceExtent; + UDF_EXTENT_AD ReserveVolumeDescriptorSequenceExtent; + UINT8 Reserved[480]; +} UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER; + +#pragma pack() + +#endif // _UDF_H_ --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel