/** @file\r
Decode an El Torito formatted CD-ROM\r
\r
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
)\r
{\r
- EFI_STATUS Status;\r
- UINT64 VolDescriptorOffset;\r
- UINT32 Lba2KB;\r
- EFI_BLOCK_IO_MEDIA *Media;\r
- CDROM_VOLUME_DESCRIPTOR *VolDescriptor;\r
- ELTORITO_CATALOG *Catalog;\r
- UINTN Check;\r
- UINTN Index;\r
- UINTN BootEntry;\r
- UINTN MaxIndex;\r
- UINT16 *CheckBuffer;\r
- CDROM_DEVICE_PATH CdDev;\r
- UINT32 SubBlockSize;\r
- UINT32 SectorCount;\r
- EFI_STATUS Found;\r
- UINT32 VolSpaceSize;\r
+ EFI_STATUS Status;\r
+ UINT64 VolDescriptorOffset;\r
+ UINT32 Lba2KB;\r
+ EFI_BLOCK_IO_MEDIA *Media;\r
+ CDROM_VOLUME_DESCRIPTOR *VolDescriptor;\r
+ ELTORITO_CATALOG *Catalog;\r
+ UINTN Check;\r
+ UINTN Index;\r
+ UINTN BootEntry;\r
+ UINTN MaxIndex;\r
+ UINT16 *CheckBuffer;\r
+ CDROM_DEVICE_PATH CdDev;\r
+ UINT32 SubBlockSize;\r
+ UINT32 SectorCount;\r
+ EFI_STATUS Found;\r
+ UINT32 VolSpaceSize;\r
+ EFI_PARTITION_INFO_PROTOCOL PartitionInfo;\r
\r
Found = EFI_NOT_FOUND;\r
Media = BlockIo->Media;\r
);\r
}\r
\r
+ ZeroMem (&PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL));\r
+ PartitionInfo.Revision = EFI_PARTITION_INFO_PROTOCOL_REVISION;\r
+ PartitionInfo.Type = PARTITION_TYPE_OTHER;\r
+\r
Status = PartitionInstallChildHandle (\r
This,\r
Handle,\r
BlockIo2,\r
DevicePath,\r
(EFI_DEVICE_PATH_PROTOCOL *) &CdDev,\r
+ &PartitionInfo,\r
Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize),\r
Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize) + CdDev.PartitionSize - 1,\r
- SubBlockSize,\r
- FALSE\r
+ SubBlockSize\r
);\r
if (!EFI_ERROR (Status)) {\r
Found = EFI_SUCCESS;\r
PartitionValidGptTable(), PartitionCheckGptEntry() routine will accept disk\r
partition content and validate the GPT table and GPT entry.\r
\r
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
)\r
{\r
- EFI_STATUS Status;\r
- UINT32 BlockSize;\r
- EFI_LBA LastBlock;\r
- MASTER_BOOT_RECORD *ProtectiveMbr;\r
- EFI_PARTITION_TABLE_HEADER *PrimaryHeader;\r
- EFI_PARTITION_TABLE_HEADER *BackupHeader;\r
- EFI_PARTITION_ENTRY *PartEntry;\r
- EFI_PARTITION_ENTRY *Entry;\r
- EFI_PARTITION_ENTRY_STATUS *PEntryStatus;\r
- UINTN Index;\r
- EFI_STATUS GptValidStatus;\r
- HARDDRIVE_DEVICE_PATH HdDev;\r
- UINT32 MediaId;\r
+ EFI_STATUS Status;\r
+ UINT32 BlockSize;\r
+ EFI_LBA LastBlock;\r
+ MASTER_BOOT_RECORD *ProtectiveMbr;\r
+ EFI_PARTITION_TABLE_HEADER *PrimaryHeader;\r
+ EFI_PARTITION_TABLE_HEADER *BackupHeader;\r
+ EFI_PARTITION_ENTRY *PartEntry;\r
+ EFI_PARTITION_ENTRY *Entry;\r
+ EFI_PARTITION_ENTRY_STATUS *PEntryStatus;\r
+ UINTN Index;\r
+ EFI_STATUS GptValidStatus;\r
+ HARDDRIVE_DEVICE_PATH HdDev;\r
+ UINT32 MediaId;\r
+ EFI_PARTITION_INFO_PROTOCOL PartitionInfo;\r
\r
ProtectiveMbr = NULL;\r
PrimaryHeader = NULL;\r
}\r
\r
ZeroMem (&HdDev, sizeof (HdDev));\r
- HdDev.Header.Type = MEDIA_DEVICE_PATH;\r
- HdDev.Header.SubType = MEDIA_HARDDRIVE_DP;\r
+ HdDev.Header.Type = MEDIA_DEVICE_PATH;\r
+ HdDev.Header.SubType = MEDIA_HARDDRIVE_DP;\r
SetDevicePathNodeLength (&HdDev.Header, sizeof (HdDev));\r
\r
- HdDev.PartitionNumber = (UINT32) Index + 1;\r
- HdDev.MBRType = MBR_TYPE_EFI_PARTITION_TABLE_HEADER;\r
- HdDev.SignatureType = SIGNATURE_TYPE_GUID;\r
- HdDev.PartitionStart = Entry->StartingLBA;\r
- HdDev.PartitionSize = Entry->EndingLBA - Entry->StartingLBA + 1;\r
+ HdDev.PartitionNumber = (UINT32) Index + 1;\r
+ HdDev.MBRType = MBR_TYPE_EFI_PARTITION_TABLE_HEADER;\r
+ HdDev.SignatureType = SIGNATURE_TYPE_GUID;\r
+ HdDev.PartitionStart = Entry->StartingLBA;\r
+ HdDev.PartitionSize = Entry->EndingLBA - Entry->StartingLBA + 1;\r
CopyMem (HdDev.Signature, &Entry->UniquePartitionGUID, sizeof (EFI_GUID));\r
\r
+ ZeroMem (&PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL));\r
+ PartitionInfo.Revision = EFI_PARTITION_INFO_PROTOCOL_REVISION;\r
+ PartitionInfo.Type = PARTITION_TYPE_GPT;\r
+ if (CompareGuid (&Entry->PartitionTypeGUID, &gEfiPartTypeSystemPartGuid)) {\r
+ PartitionInfo.System = 1;\r
+ }\r
+ CopyMem (&PartitionInfo.Info.Gpt, Entry, sizeof (EFI_PARTITION_ENTRY));\r
+\r
DEBUG ((EFI_D_INFO, " Index : %d\n", (UINT32) Index));\r
DEBUG ((EFI_D_INFO, " Start LBA : %lx\n", (UINT64) HdDev.PartitionStart));\r
DEBUG ((EFI_D_INFO, " End LBA : %lx\n", (UINT64) Entry->EndingLBA));\r
BlockIo2,\r
DevicePath,\r
(EFI_DEVICE_PATH_PROTOCOL *) &HdDev,\r
+ &PartitionInfo,\r
Entry->StartingLBA,\r
Entry->EndingLBA,\r
- BlockSize,\r
- CompareGuid(&Entry->PartitionTypeGUID, &gEfiPartTypeSystemPartGuid)\r
+ BlockSize\r
);\r
}\r
\r
the legacy boot strap code.\r
\r
Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>\r
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
)\r
{\r
- EFI_STATUS Status;\r
- MASTER_BOOT_RECORD *Mbr;\r
- UINT32 ExtMbrStartingLba;\r
- UINT32 Index;\r
- HARDDRIVE_DEVICE_PATH HdDev;\r
- HARDDRIVE_DEVICE_PATH ParentHdDev;\r
- EFI_STATUS Found;\r
- EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;\r
- EFI_DEVICE_PATH_PROTOCOL *LastDevicePathNode;\r
- UINT32 BlockSize;\r
- UINT32 MediaId;\r
- EFI_LBA LastBlock;\r
+ EFI_STATUS Status;\r
+ MASTER_BOOT_RECORD *Mbr;\r
+ UINT32 ExtMbrStartingLba;\r
+ UINT32 Index;\r
+ HARDDRIVE_DEVICE_PATH HdDev;\r
+ HARDDRIVE_DEVICE_PATH ParentHdDev;\r
+ EFI_STATUS Found;\r
+ EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;\r
+ EFI_DEVICE_PATH_PROTOCOL *LastDevicePathNode;\r
+ UINT32 BlockSize;\r
+ UINT32 MediaId;\r
+ EFI_LBA LastBlock;\r
+ EFI_PARTITION_INFO_PROTOCOL PartitionInfo;\r
\r
Found = EFI_NOT_FOUND;\r
\r
HdDev.PartitionSize = UNPACK_UINT32 (Mbr->Partition[Index].SizeInLBA);\r
CopyMem (HdDev.Signature, &(Mbr->UniqueMbrSignature[0]), sizeof (Mbr->UniqueMbrSignature));\r
\r
+ ZeroMem (&PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL));\r
+ PartitionInfo.Revision = EFI_PARTITION_INFO_PROTOCOL_REVISION;\r
+ PartitionInfo.Type = PARTITION_TYPE_MBR;\r
+ if (Mbr->Partition[Index].OSIndicator == EFI_PARTITION) {\r
+ PartitionInfo.System = 1;\r
+ }\r
+ CopyMem (&PartitionInfo.Info.Mbr, &Mbr->Partition[Index], sizeof (MBR_PARTITION_RECORD));\r
+\r
Status = PartitionInstallChildHandle (\r
This,\r
Handle,\r
BlockIo2,\r
DevicePath,\r
(EFI_DEVICE_PATH_PROTOCOL *) &HdDev,\r
+ &PartitionInfo,\r
HdDev.PartitionStart,\r
HdDev.PartitionStart + HdDev.PartitionSize - 1,\r
- MBR_SIZE,\r
- (BOOLEAN) (Mbr->Partition[Index].OSIndicator == EFI_PARTITION)\r
+ MBR_SIZE\r
);\r
\r
if (!EFI_ERROR (Status)) {\r
//\r
*((UINT32 *) &HdDev.Signature[0]) = 0;\r
\r
+ ZeroMem (&PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL));\r
+ PartitionInfo.Revision = EFI_PARTITION_INFO_PROTOCOL_REVISION;\r
+ PartitionInfo.Type = PARTITION_TYPE_MBR;\r
+ if (Mbr->Partition[0].OSIndicator == EFI_PARTITION) {\r
+ PartitionInfo.System = 1;\r
+ }\r
+ CopyMem (&PartitionInfo.Info.Mbr, &Mbr->Partition[0], sizeof (MBR_PARTITION_RECORD));\r
+\r
Status = PartitionInstallChildHandle (\r
This,\r
Handle,\r
BlockIo2,\r
DevicePath,\r
(EFI_DEVICE_PATH_PROTOCOL *) &HdDev,\r
+ &PartitionInfo,\r
HdDev.PartitionStart - ParentHdDev.PartitionStart,\r
HdDev.PartitionStart - ParentHdDev.PartitionStart + HdDev.PartitionSize - 1,\r
- MBR_SIZE,\r
- (BOOLEAN) (Mbr->Partition[0].OSIndicator == EFI_PARTITION)\r
+ MBR_SIZE\r
);\r
if (!EFI_ERROR (Status)) {\r
Found = EFI_SUCCESS;\r
of the raw block devices media. Currently "El Torito CD-ROM", Legacy\r
MBR, and GPT partition schemes are supported.\r
\r
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
&Private->BlockIo,\r
&gEfiBlockIo2ProtocolGuid,\r
&Private->BlockIo2,\r
+ &gEfiPartitionInfoProtocolGuid,\r
+ &Private->PartitionInfo,\r
Private->EspGuid,\r
NULL,\r
NULL\r
Private->DevicePath,\r
&gEfiBlockIoProtocolGuid,\r
&Private->BlockIo,\r
+ &gEfiPartitionInfoProtocolGuid,\r
+ &Private->PartitionInfo,\r
Private->EspGuid,\r
NULL,\r
NULL\r
@param[in] ParentBlockIo2 Parent BlockIo2 interface.\r
@param[in] ParentDevicePath Parent Device Path.\r
@param[in] DevicePathNode Child Device Path node.\r
+ @param[in] PartitionInfo Child Partition Information interface.\r
@param[in] Start Start Block.\r
@param[in] End End Block.\r
@param[in] BlockSize Child block size.\r
- @param[in] InstallEspGuid Flag to install EFI System Partition GUID on handle.\r
\r
@retval EFI_SUCCESS A child handle was added.\r
@retval other A child handle was not added.\r
IN EFI_BLOCK_IO2_PROTOCOL *ParentBlockIo2,\r
IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,\r
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,\r
+ IN EFI_PARTITION_INFO_PROTOCOL *PartitionInfo,\r
IN EFI_LBA Start,\r
IN EFI_LBA End,\r
- IN UINT32 BlockSize,\r
- IN BOOLEAN InstallEspGuid\r
+ IN UINT32 BlockSize\r
)\r
{\r
EFI_STATUS Status;\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- if (InstallEspGuid) {\r
+ //\r
+ // Set the PartitionInfo into Private Data.\r
+ //\r
+ CopyMem (&Private->PartitionInfo, PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL));\r
+\r
+ if ((PartitionInfo->System == 1)) {\r
Private->EspGuid = &gEfiPartTypeSystemPartGuid;\r
} else {\r
//\r
&Private->BlockIo,\r
&gEfiBlockIo2ProtocolGuid,\r
&Private->BlockIo2,\r
+ &gEfiPartitionInfoProtocolGuid,\r
+ &Private->PartitionInfo,\r
Private->EspGuid,\r
NULL,\r
NULL\r
Private->DevicePath,\r
&gEfiBlockIoProtocolGuid,\r
&Private->BlockIo,\r
+ &gEfiPartitionInfoProtocolGuid,\r
+ &Private->PartitionInfo,\r
Private->EspGuid,\r
NULL,\r
NULL\r
of the raw block devices media. Currently "El Torito CD-ROM", Legacy \r
MBR, and GPT partition schemes are supported.\r
\r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
#include <Protocol/DriverBinding.h>\r
#include <Protocol/DiskIo.h>\r
#include <Protocol/DiskIo2.h>\r
+#include <Protocol/PartitionInfo.h>\r
#include <Library/DebugLib.h>\r
#include <Library/UefiDriverEntryPoint.h>\r
#include <Library/BaseLib.h>\r
//\r
#define PARTITION_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('P', 'a', 'r', 't')\r
typedef struct {\r
- UINT64 Signature;\r
-\r
- EFI_HANDLE Handle;\r
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
- EFI_BLOCK_IO_PROTOCOL BlockIo;\r
- EFI_BLOCK_IO2_PROTOCOL BlockIo2;\r
- EFI_BLOCK_IO_MEDIA Media;\r
- EFI_BLOCK_IO_MEDIA Media2;//For BlockIO2\r
-\r
- EFI_DISK_IO_PROTOCOL *DiskIo;\r
- EFI_DISK_IO2_PROTOCOL *DiskIo2;\r
- EFI_BLOCK_IO_PROTOCOL *ParentBlockIo;\r
- EFI_BLOCK_IO2_PROTOCOL *ParentBlockIo2;\r
- UINT64 Start;\r
- UINT64 End;\r
- UINT32 BlockSize;\r
- BOOLEAN InStop;\r
-\r
- EFI_GUID *EspGuid;\r
+ UINT64 Signature;\r
+\r
+ EFI_HANDLE Handle;\r
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
+ EFI_BLOCK_IO_PROTOCOL BlockIo;\r
+ EFI_BLOCK_IO2_PROTOCOL BlockIo2;\r
+ EFI_BLOCK_IO_MEDIA Media;\r
+ EFI_BLOCK_IO_MEDIA Media2;//For BlockIO2\r
+ EFI_PARTITION_INFO_PROTOCOL PartitionInfo;\r
+\r
+ EFI_DISK_IO_PROTOCOL *DiskIo;\r
+ EFI_DISK_IO2_PROTOCOL *DiskIo2;\r
+ EFI_BLOCK_IO_PROTOCOL *ParentBlockIo;\r
+ EFI_BLOCK_IO2_PROTOCOL *ParentBlockIo2;\r
+ UINT64 Start;\r
+ UINT64 End;\r
+ UINT32 BlockSize;\r
+ BOOLEAN InStop;\r
+\r
+ EFI_GUID *EspGuid;\r
\r
} PARTITION_PRIVATE_DATA;\r
\r
@param[in] ParentBlockIo2 Parent BlockIo2 interface.\r
@param[in] ParentDevicePath Parent Device Path.\r
@param[in] DevicePathNode Child Device Path node.\r
+ @param[in] PartitionInfo Child Partition Information interface.\r
@param[in] Start Start Block.\r
@param[in] End End Block.\r
@param[in] BlockSize Child block size.\r
- @param[in] InstallEspGuid Flag to install EFI System Partition GUID on handle.\r
\r
@retval EFI_SUCCESS A child handle was added.\r
@retval other A child handle was not added.\r
IN EFI_BLOCK_IO2_PROTOCOL *ParentBlockIo2,\r
IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,\r
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,\r
+ IN EFI_PARTITION_INFO_PROTOCOL *PartitionInfo,\r
IN EFI_LBA Start,\r
IN EFI_LBA End,\r
- IN UINT32 BlockSize,\r
- IN BOOLEAN InstallEspGuid\r
+ IN UINT32 BlockSize\r
);\r
\r
/**\r
# This external input must be validated carefully to avoid security issue like\r
# buffer overflow, integer overflow.\r
#\r
-# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
## BY_START\r
## TO_START\r
gEfiDevicePathProtocolGuid\r
+ gEfiPartitionInfoProtocolGuid ## BY_START\r
gEfiDiskIoProtocolGuid ## TO_START\r
gEfiDiskIo2ProtocolGuid ## TO_START\r
\r