X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FDisk%2FPartitionDxe%2FMbr.c;h=a35b4f2d0de86a8ab43971dac032943121704ebf;hp=393f538428d37b5005f02602ce67c6ec13fcc89b;hb=493d8e3a5e86f78ef975e18dfa5754adce9e82de;hpb=7059dad90457cda5074783411fbe9b513c7c9ae3 diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c index 393f538428..a35b4f2d0d 100644 --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c @@ -11,8 +11,8 @@ always on the first sector of a media. The first sector also contains the legacy boot strap code. -Copyright (c) 2006 - 2008, Intel Corporation.
-All rights reserved. This program and the accompanying materials +Copyright (c) 2006 - 2013, 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 http://opensource.org/licenses/bsd-license.php @@ -101,11 +101,13 @@ PartitionValidMbr ( /** Install child handles if the Handle supports MBR format. - @param This Calling context. - @param Handle Parent Handle. - @param DiskIo Parent DiskIo interface. - @param BlockIo Parent BlockIo interface. - @param DevicePath Parent Device Path. + @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 A child handle was added. @retval EFI_MEDIA_CHANGED Media change was detected. @@ -117,7 +119,9 @@ PartitionInstallMbrChildHandles ( 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 ) { @@ -131,26 +135,33 @@ PartitionInstallMbrChildHandles ( UINT32 PartitionNumber; EFI_DEVICE_PATH_PROTOCOL *DevicePathNode; EFI_DEVICE_PATH_PROTOCOL *LastDevicePathNode; + UINT32 BlockSize; + UINT32 MediaId; + EFI_LBA LastBlock; Found = EFI_NOT_FOUND; - Mbr = AllocatePool (BlockIo->Media->BlockSize); + BlockSize = BlockIo->Media->BlockSize; + MediaId = BlockIo->Media->MediaId; + LastBlock = BlockIo->Media->LastBlock; + + Mbr = AllocatePool (BlockSize); if (Mbr == NULL) { - goto Done; + return Found; } Status = DiskIo->ReadDisk ( DiskIo, - BlockIo->Media->MediaId, + MediaId, 0, - BlockIo->Media->BlockSize, + BlockSize, Mbr ); if (EFI_ERROR (Status)) { Found = Status; goto Done; } - if (!PartitionValidMbr (Mbr, BlockIo->Media->LastBlock)) { + if (!PartitionValidMbr (Mbr, LastBlock)) { goto Done; } // @@ -217,7 +228,9 @@ PartitionInstallMbrChildHandles ( This, Handle, DiskIo, + DiskIo2, BlockIo, + BlockIo2, DevicePath, (EFI_DEVICE_PATH_PROTOCOL *) &HdDev, HdDev.PartitionStart, @@ -241,9 +254,9 @@ PartitionInstallMbrChildHandles ( Status = DiskIo->ReadDisk ( DiskIo, - BlockIo->Media->MediaId, - MultU64x32 (ExtMbrStartingLba, BlockIo->Media->BlockSize), - BlockIo->Media->BlockSize, + MediaId, + MultU64x32 (ExtMbrStartingLba, BlockSize), + BlockSize, Mbr ); if (EFI_ERROR (Status)) { @@ -274,17 +287,19 @@ PartitionInstallMbrChildHandles ( *((UINT32 *) &HdDev.Signature[0]) = 0; Status = PartitionInstallChildHandle ( - This, - Handle, - DiskIo, - BlockIo, - DevicePath, - (EFI_DEVICE_PATH_PROTOCOL *) &HdDev, - HdDev.PartitionStart - ParentHdDev.PartitionStart, - HdDev.PartitionStart - ParentHdDev.PartitionStart + HdDev.PartitionSize - 1, - MBR_SIZE, - (BOOLEAN) (Mbr->Partition[0].OSIndicator == EFI_PARTITION) - ); + This, + Handle, + DiskIo, + DiskIo2, + BlockIo, + BlockIo2, + DevicePath, + (EFI_DEVICE_PATH_PROTOCOL *) &HdDev, + HdDev.PartitionStart - ParentHdDev.PartitionStart, + HdDev.PartitionStart - ParentHdDev.PartitionStart + HdDev.PartitionSize - 1, + MBR_SIZE, + (BOOLEAN) (Mbr->Partition[0].OSIndicator == EFI_PARTITION) + ); if (!EFI_ERROR (Status)) { Found = EFI_SUCCESS; }