\r
Copyright (C) 2014, Citrix Ltd.\r
\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
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
/**\r
Read/Write BufferSize bytes from Lba into Buffer.\r
\r
- This function is commun to XenPvBlkDxeBlockIoReadBlocks and\r
+ This function is common to XenPvBlkDxeBlockIoReadBlocks and\r
XenPvBlkDxeBlockIoWriteBlocks.\r
\r
@param This Indicates a pointer to the calling context.\r
}\r
\r
if (BufferSize % Media->BlockSize != 0) {\r
- DEBUG ((EFI_D_ERROR, "XenPvBlkDxe: Bad buffer size: 0x%X\n", BufferSize));\r
+ DEBUG ((EFI_D_ERROR, "XenPvBlkDxe: Bad buffer size: 0x%Lx\n",\r
+ (UINT64)BufferSize));\r
return EFI_BAD_BUFFER_SIZE;\r
}\r
\r
if (Lba > Media->LastBlock ||\r
(BufferSize / Media->BlockSize) - 1 > Media->LastBlock - Lba) {\r
- DEBUG ((EFI_D_ERROR, "XenPvBlkDxe: %a with invalid LBA: 0x%LX, size: 0x%x\n",\r
- IsWrite ? "Write" : "Read", Lba, BufferSize));\r
+ DEBUG ((EFI_D_ERROR,\r
+ "XenPvBlkDxe: %a with invalid LBA: 0x%Lx, size: 0x%Lx\n",\r
+ IsWrite ? "Write" : "Read", Lba, (UINT64)BufferSize));\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
}\r
\r
IoData.Dev = XEN_BLOCK_FRONT_FROM_BLOCK_IO (This);\r
- Sector = Lba * (Media->BlockSize / 512);\r
+ Sector = (UINTN)MultU64x32 (Lba, Media->BlockSize / 512);\r
\r
while (BufferSize > 0) {\r
if (((UINTN)Buffer & EFI_PAGE_MASK) == 0) {\r
Sector += IoData.Size / 512;\r
Status = XenPvBlockIo (&IoData, IsWrite);\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((EFI_D_ERROR, "XenPvBlkDxe: Error durring %a operation.\n",\r
+ DEBUG ((EFI_D_ERROR, "XenPvBlkDxe: Error during %a operation.\n",\r
IsWrite ? "write" : "read"));\r
return Status;\r
}\r
@retval EFI_SUCCESS The data was read correctly from the device.\r
@retval EFI_DEVICE_ERROR The device reported an error while performing the read.\r
@retval EFI_NO_MEDIA There is no media in the device.\r
- @retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.\r
+ @retval EFI_MEDIA_CHANGED The MediaId does not match the current device.\r
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r
or the buffer is not on proper alignment.\r
@retval EFI_WRITE_PROTECTED The device can not be written to.\r
@retval EFI_DEVICE_ERROR The device reported an error while performing the write.\r
@retval EFI_NO_MEDIA There is no media in the device.\r
- @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r
+ @retval EFI_MEDIA_CHANGED The MediaId does not match the current device.\r
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r
@retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,\r
or the buffer is not on proper alignment.\r
@param This Indicates a pointer to the calling context.\r
\r
@retval EFI_SUCCESS All outstanding data was written to the device\r
- @retval EFI_DEVICE_ERROR The device reported an error while writting back the data\r
+ @retval EFI_DEVICE_ERROR The device reported an error while writing back the data\r
@retval EFI_NO_MEDIA There is no media in the device.\r
\r
**/\r