X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EdkModulePkg%2FUniversal%2FDisk%2FPartition%2FDxe%2FMbr.c;h=ce6b0d535388adda8f6cfebf6c6e0c37dd99e43f;hp=07e3cbe4591e295ca62961aded6611121f8560af;hb=c7c02fabf120cc1aeccd0cb0fc7f8671fa1cb25e;hpb=878ddf1fc3540a715f63594ed22b6929e881afb4 diff --git a/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c b/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c index 07e3cbe459..ce6b0d5353 100644 --- a/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c +++ b/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c @@ -30,7 +30,6 @@ Abstract: --*/ #include "Partition.h" -#include "Mbr.h" BOOLEAN PartitionValidMbr ( @@ -109,7 +108,7 @@ Returns: return MbrValid; } -BOOLEAN +EFI_STATUS PartitionInstallMbrChildHandles ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Handle, @@ -130,8 +129,9 @@ Arguments: DevicePath - Parent Device Path Returns: - EFI_SUCCESS - If a child handle was added - other - A child handle was not added + EFI_SUCCESS - If a child handle was added + EFI_MEDIA_CHANGED - Media changed Detected + !EFI_SUCCESS - Not found MBR partition. --*/ { @@ -141,13 +141,13 @@ Returns: UINTN Index; HARDDRIVE_DEVICE_PATH HdDev; HARDDRIVE_DEVICE_PATH ParentHdDev; - BOOLEAN Found; + EFI_STATUS Found; UINT32 PartitionNumber; EFI_DEVICE_PATH_PROTOCOL *DevicePathNode; EFI_DEVICE_PATH_PROTOCOL *LastDevicePathNode; Mbr = NULL; - Found = FALSE; + Found = EFI_NOT_FOUND; Mbr = AllocatePool (BlockIo->Media->BlockSize); if (Mbr == NULL) { @@ -162,6 +162,7 @@ Returns: Mbr ); if (EFI_ERROR (Status) || !PartitionValidMbr (Mbr, BlockIo->Media->LastBlock)) { + Found = Status; goto Done; } // @@ -209,7 +210,7 @@ Returns: continue; } - if (Mbr->Partition[Index].OSIndicator == 0xEE) { + if (Mbr->Partition[Index].OSIndicator == PMBR_GPT_PARTITION) { // // This is the guard MBR for the GPT. If you ever see a GPT disk with zero partitions you can get here. // We can not produce an MBR BlockIo for this device as the MBR spans the GPT headers. So formating @@ -238,7 +239,7 @@ Returns: ); if (!EFI_ERROR (Status)) { - Found = TRUE; + Found = EFI_SUCCESS; } } } else { @@ -258,6 +259,7 @@ Returns: Mbr ); if (EFI_ERROR (Status)) { + Found = Status; goto Done; } @@ -265,6 +267,11 @@ Returns: break; } + if ((Mbr->Partition[0].OSIndicator == EXTENDED_DOS_PARTITION) || + (Mbr->Partition[0].OSIndicator == EXTENDED_WINDOWS_PARTITION)) { + ExtMbrStartingLba = UNPACK_UINT32 (Mbr->Partition[0].StartingLBA); + continue; + } HdDev.PartitionNumber = PartitionNumber ++; HdDev.PartitionStart = UNPACK_UINT32 (Mbr->Partition[0].StartingLBA) + ExtMbrStartingLba + ParentHdDev.PartitionStart; HdDev.PartitionSize = UNPACK_UINT32 (Mbr->Partition[0].SizeInLBA); @@ -291,11 +298,11 @@ Returns: (BOOLEAN) (Mbr->Partition[0].OSIndicator == EFI_PARTITION) ); if (!EFI_ERROR (Status)) { - Found = TRUE; + Found = EFI_SUCCESS; } - if (Mbr->Partition[1].OSIndicator != EXTENDED_DOS_PARTITION && - Mbr->Partition[1].OSIndicator != EXTENDED_WINDOWS_PARTITION + if ((Mbr->Partition[1].OSIndicator != EXTENDED_DOS_PARTITION) && + (Mbr->Partition[1].OSIndicator != EXTENDED_WINDOWS_PARTITION) ) { break; }