Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Huajing Li <huajing.li@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Main file for Dblk shell Debug1 function.\r
\r
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
Main file for Dblk shell Debug1 function.\r
\r
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
- Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2005 - 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
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
EFI_STATUS Status;\r
SHELL_STATUS ShellStatus;\r
UINT8 *Buffer;\r
EFI_STATUS Status;\r
SHELL_STATUS ShellStatus;\r
UINT8 *Buffer;\r
+ UINT8 *OriginalBuffer;\r
UINTN BufferSize;\r
\r
ShellStatus = SHELL_SUCCESS;\r
UINTN BufferSize;\r
\r
ShellStatus = SHELL_SUCCESS;\r
}\r
\r
BufferSize = BlockIo->Media->BlockSize * BlockCount;\r
}\r
\r
BufferSize = BlockIo->Media->BlockSize * BlockCount;\r
+ if(BlockIo->Media->IoAlign == 0) {\r
+ BlockIo->Media->IoAlign = 1;\r
+ }\r
+\r
- Buffer = AllocateZeroPool(BufferSize);\r
+ OriginalBuffer = AllocateZeroPool(BufferSize + BlockIo->Media->IoAlign);\r
+ Buffer = ALIGN_POINTER (OriginalBuffer,BlockIo->Media->IoAlign);\r
} else {\r
ShellPrintEx(-1,-1,L" BlockSize: 0x%08x, BlockCount: 0x%08x\r\n", BlockIo->Media->BlockSize, BlockCount);\r
} else {\r
ShellPrintEx(-1,-1,L" BlockSize: 0x%08x, BlockCount: 0x%08x\r\n", BlockIo->Media->BlockSize, BlockCount);\r
+ OriginalBuffer = NULL;\r
+ Buffer = NULL;\r
}\r
\r
Status = BlockIo->ReadBlocks(BlockIo, BlockIo->Media->MediaId, Lba, BufferSize, Buffer);\r
}\r
\r
Status = BlockIo->ReadBlocks(BlockIo, BlockIo->Media->MediaId, Lba, BufferSize, Buffer);\r
ShellStatus = SHELL_DEVICE_ERROR;\r
}\r
\r
ShellStatus = SHELL_DEVICE_ERROR;\r
}\r
\r
- if (Buffer != NULL) {\r
- FreePool(Buffer);\r
+ if (OriginalBuffer != NULL) {\r
+ FreePool (OriginalBuffer);\r
}\r
\r
gBS->CloseProtocol(BlockIoHandle, &gEfiBlockIoProtocolGuid, gImageHandle, NULL);\r
}\r
\r
gBS->CloseProtocol(BlockIoHandle, &gEfiBlockIoProtocolGuid, gImageHandle, NULL);\r