From: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
To: Eric Jin <eric.jin@intel.com>, edk2-devel@lists.01.org
Subject: Re: [edk2-test][Patch 1/1] uefi-sct/SctPkg: Size in EraseBlocks() is in bytes
Date: Mon, 18 Mar 2019 14:44:45 -0500 [thread overview]
Message-ID: <365c74dea999e06ebfd663b8ac47ad51c5f41ae7.camel@arm.com> (raw)
In-Reply-To: <20190311052947.3960-1-eric.jin@intel.com>
On Mon, 2019-03-11 at 13:29 +0800, Eric Jin wrote:
> The erase size used in current test is blocks number,
Please reword. Block number or number of blocks?
> and should be corrected to the size in bytes to be
> erased. According to UEFI spec, it must be a multiple
> of the physical block size of the device, even the
> EraseLengthGranularity blocks for some device.
Please reword.
Suggestion:
Currently, EFI_ERASE_BLOCK_PROTOCOL test to validate erase
functionality of a device incorrectly used "BlockNumber" which does not
reflect the actual size in bytes to be erased.
This patch corrects this by calculating size in bytes to be erased
using "EraseLengthGranularity" and "BlockSize".
or Something similar.
With that
Reviewed-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Jin <eric.jin@intel.com>
> ---
> uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBl
> ockBBTestConformance.c | 25 +++++++++++++------------
> 1 file changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBl
> ockBBTestConformance.c b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBl
> ockBBTestConformance.c
> index df057b26667f..a6156b988f44 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBl
> ockBBTestConformance.c
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBl
> ockBBTestConformance.c
> @@ -1,7 +1,7 @@
> /** @file
>
> Copyright 2017 Unified EFI, Inc.<BR>
> - Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2017 - 2019, Intel Corporation. All rights
> reserved.<BR>
>
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of
> the BSD License
> @@ -51,8 +51,8 @@ BBTestEraseBlocksConformanceTest (
> UINT32 BlockSize;
> UINT32 IoAlign;
> EFI_LBA LastBlock;
> -
> - UINT32 BlockNumber;
> + UINT32 EraseLengthGranularity;
> + UINTN EraseSize;
>
> EFI_ERASE_BLOCK_TOKEN Token;
>
> @@ -121,10 +121,11 @@ BBTestEraseBlocksConformanceTest (
> IoAlign = Media->IoAlign;
> LastBlock = Media->LastBlock;
>
> - BlockNumber = (UINT32) MINIMUM(LastBlock,
> MAX_NUMBER_OF_READ_BLOCK_BUFFER);
> + EraseLengthGranularity = EraseBlock->EraseLengthGranularity;
> + EraseSize = (UINTN)SctMultU64x32
> (EraseLengthGranularity, BlockSize);
>
> if (MediaPresent == FALSE) {
> - Status = EraseBlock->EraseBlocks(EraseBlock, MediaId, 0, &Token,
> BlockNumber);
> + Status = EraseBlock->EraseBlocks(EraseBlock, MediaId, 0, &Token,
> EraseSize);
> if (Status == EFI_NO_MEDIA)
> AssertionType = EFI_TEST_ASSERTION_PASSED;
> else
> @@ -141,7 +142,7 @@ BBTestEraseBlocksConformanceTest (
> Status
> );
>
> - Status = EraseBlock->EraseBlocks(EraseBlock, MediaId, LastBlock
> + 1, &Token, BlockNumber);
> + Status = EraseBlock->EraseBlocks(EraseBlock, MediaId, LastBlock
> + 1, &Token, EraseSize);
> if (Status == EFI_NO_MEDIA)
> AssertionType = EFI_TEST_ASSERTION_PASSED;
> else
> @@ -158,7 +159,7 @@ BBTestEraseBlocksConformanceTest (
> Status
> );
>
> - Status = EraseBlock->EraseBlocks(EraseBlock, MediaId, LastBlock
> - 10, &Token, BlockNumber + 1);
> + Status = EraseBlock->EraseBlocks(EraseBlock, MediaId, LastBlock
> - 10, &Token, EraseSize + 1);
> if (Status == EFI_NO_MEDIA)
> AssertionType = EFI_TEST_ASSERTION_PASSED;
> else
> @@ -177,7 +178,7 @@ BBTestEraseBlocksConformanceTest (
>
> } else {
> if (ReadOnly == TRUE) {
> - Status = EraseBlock->EraseBlocks(EraseBlock, MediaId, 0,
> &Token, BlockNumber);
> + Status = EraseBlock->EraseBlocks(EraseBlock, MediaId, 0,
> &Token, EraseSize);
> if (Status == EFI_WRITE_PROTECTED)
> AssertionType = EFI_TEST_ASSERTION_PASSED;
> else
> @@ -195,7 +196,7 @@ BBTestEraseBlocksConformanceTest (
> );
>
> } else {
> - Status = EraseBlock->EraseBlocks(EraseBlock, MediaId + 1, 0,
> &Token, BlockNumber);
> + Status = EraseBlock->EraseBlocks(EraseBlock, MediaId + 1, 0,
> &Token, EraseSize);
> if (Status == EFI_MEDIA_CHANGED)
> AssertionType = EFI_TEST_ASSERTION_PASSED;
> else
> @@ -212,7 +213,7 @@ BBTestEraseBlocksConformanceTest (
> Status
> );
>
> - Status = EraseBlock->EraseBlocks(EraseBlock, MediaId + 1,
> LastBlock + 1, &Token, BlockNumber);
> + Status = EraseBlock->EraseBlocks(EraseBlock, MediaId + 1,
> LastBlock + 1, &Token, EraseSize);
> if (Status == EFI_MEDIA_CHANGED)
> AssertionType = EFI_TEST_ASSERTION_PASSED;
> else
> @@ -229,7 +230,7 @@ BBTestEraseBlocksConformanceTest (
> Status
> );
>
> - Status = EraseBlock->EraseBlocks(EraseBlock, MediaId + 1,
> LastBlock - 10, &Token, BlockNumber + 1);
> + Status = EraseBlock->EraseBlocks(EraseBlock, MediaId + 1,
> LastBlock - 10, &Token, EraseSize + 1);
> if (Status == EFI_MEDIA_CHANGED)
> AssertionType = EFI_TEST_ASSERTION_PASSED;
> else
> @@ -246,7 +247,7 @@ BBTestEraseBlocksConformanceTest (
> Status
> );
>
> - Status = EraseBlock->EraseBlocks(EraseBlock, MediaId,
> LastBlock + 1, &Token, BlockNumber);
> + Status = EraseBlock->EraseBlocks(EraseBlock, MediaId,
> LastBlock + 1, &Token, EraseSize);
> if (Status == EFI_INVALID_PARAMETER)
> AssertionType = EFI_TEST_ASSERTION_PASSED;
> else
next prev parent reply other threads:[~2019-03-18 19:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-11 5:29 [edk2-test][Patch 1/1] uefi-sct/SctPkg: Size in EraseBlocks() is in bytes Eric Jin
2019-03-18 19:44 ` Supreeth Venkatesh [this message]
2019-03-22 7:16 ` Jin, Eric
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=365c74dea999e06ebfd663b8ac47ad51c5f41ae7.camel@arm.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox