]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.c
Add description information for the GUID and Library class defined in DEC file
[mirror_edk2.git] / OvmfPkg / BlockMmioToBlockIoDxe / BlockIo.c
index bdd1402cc19bbde7d015f34ad784ff0c3031f85f..af9e85ed4e01829b637169a1848e3076a945b85f 100644 (file)
@@ -2,8 +2,8 @@
   The driver wrappers BlockMmio protocol instances to produce\r
   Block I/O Protocol instances.\r
 \r
-  Copyright (c) 2007 - 2010, Intel Corporation\r
-  All rights reserved. This program and the accompanying materials\r
+  Copyright (c) 2007 - 2012, 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
   http://opensource.org/licenses/bsd-license.php\r
@@ -109,11 +109,11 @@ ReadOrWriteBlocks (
   //\r
   // BufferSize must be a multiple of the intrinsic block size of the device.\r
   //\r
-  if ((BufferSize % Media->BlockSize) != 0) {\r
+  if (ModU64x32 (BufferSize, Media->BlockSize) != 0) {\r
     return EFI_BAD_BUFFER_SIZE;\r
   }\r
 \r
-  TotalBlock = BufferSize / Media->BlockSize;\r
+  TotalBlock = (UINTN) DivU64x32 (BufferSize, Media->BlockSize);\r
 \r
   //\r
   // Make sure the range to read is valid.\r
@@ -131,9 +131,9 @@ ReadOrWriteBlocks (
   }\r
 \r
   Address = Private->BlockMmio->BaseAddress;\r
-  Address += Media->BlockSize * Lba;\r
+  Address += MultU64x32 (Lba, Media->BlockSize);\r
 \r
-  Count = BufferSize / 8;\r
+  Count = BufferSize >> 3;\r
 \r
   if (ReadData) {\r
     CpuAccessFunction = Private->CpuIo->Mem.Read;\r
@@ -287,7 +287,7 @@ BlockIoInit (
   BLOCK_MMIO_TO_BLOCK_IO_DEVICE  *Private;\r
   BLOCK_MMIO_PROTOCOL            *BlockMmio;\r
 \r
-  Private = (BLOCK_MMIO_TO_BLOCK_IO_DEVICE*) AllocateZeroPool (sizeof (Private));\r
+  Private = (BLOCK_MMIO_TO_BLOCK_IO_DEVICE*) AllocateZeroPool (sizeof (*Private));\r
   ASSERT (Private != NULL);\r
 \r
   Status = gBS->LocateProtocol (\r