public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Supreeth Venkatesh <Supreeth.Venkatesh@arm.com>
To: Eric Jin <eric.jin@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Subject: Re: [PATCH] uefi-sct/SctPkg:The original design for the 'EraseLengthGranularity' test need consider this case
Date: Mon, 15 Oct 2018 13:10:09 +0000	[thread overview]
Message-ID: <AM4PR08MB278853ECB00103A4AE6E922D80FD0@AM4PR08MB2788.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <997b7ed5-ccaa-984a-adf1-6be67d0961e8@arm.com>

FYI

On 10/15/2018 02:44 AM, Supreeth Venkatesh wrote:

Commit Message less than 80 cols please.


On 10/13/2018 04:51 PM, Eric Jin wrote:

For the SD device, no same as the eMMC, the 'EraseLengthGranularity' is 1.

Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com><mailto:supreeth.venkatesh@arm.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com><mailto:jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Jin <eric.jin@intel.com><mailto:eric.jin@intel.com>
---
  .../BlackBoxTest/EraseBlockBBTestFunction.c   | 154 +++++++++---------
  1 file changed, 78 insertions(+), 76 deletions(-)

diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBlockBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBlockBBTestFunction.c
index bc16a473..ea081625 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBlockBBTestFunction.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBlockBBTestFunction.c
@@ -214,54 +214,56 @@ BBTestEraseBlocksFunctionTest (
        }
          // Erase Blocks with non-EraseLengthGranularity blocks
-      Token.Event = NULL;
-      Token.TransactionStatus = EFI_NOT_READY;
-      EraseStatus = EraseBlock->EraseBlocks (EraseBlock, MediaId, Lba+1, &Token, BufferSize - 2 * BlockSize);
-
-      // Read the data with 0, the first/last block should not be erased
-      ReadStatus = BlockIo->ReadBlocks (BlockIo, MediaId, Lba, BufferSize, (VOID*)Buffer2);
-      if (ReadStatus == EFI_SUCCESS) {
-        for (Index1 = 0; Index1 < BlockSize; Index1++) {
-          if (Buffer2[Index1] != 0) {
-            IsZero1 = FALSE;
-            break;
+      if (BufferSize > 2 * BlockSize) {
Magic Number 2.

+        Token.Event = NULL;
+        Token.TransactionStatus = EFI_NOT_READY;
+
+        EraseStatus = EraseBlock->EraseBlocks (EraseBlock, MediaId, Lba+1, &Token, BufferSize - 2 * BlockSize);
Magic number 2.

+
+        // Read the data with 0, the first/last block should not be erased
+        ReadStatus = BlockIo->ReadBlocks (BlockIo, MediaId, Lba, BufferSize, (VOID*)Buffer2);
+        if (ReadStatus == EFI_SUCCESS) {
+          for (Index1 = 0; Index1 < BlockSize; Index1++) {
+            if (Buffer2[Index1] != 0) {
+              IsZero1 = FALSE;
+              break;
+            }
            }
-        }
  -        for (Index1 = BlockSize; Index1 < BufferSize - BlockSize; Index1++) {
-          if (Buffer2[Index1] != 0) {
-            IsZero2 = FALSE;
-            break;
+          for (Index1 = BlockSize; Index1 < BufferSize - BlockSize; Index1++) {
+            if (Buffer2[Index1] != 0) {
+              IsZero2 = FALSE;
+              break;
+            }
            }
-        }
  -        for (Index1 = BufferSize - BlockSize; Index1 < BufferSize; Index1++) {
-          if (Buffer2[Index1] != 0) {
-            IsZero3 = FALSE;
-            break;
+          for (Index1 = BufferSize - BlockSize; Index1 < BufferSize; Index1++) {
+            if (Buffer2[Index1] != 0) {
+              IsZero3 = FALSE;
+              break;
+            }
            }
-        }
  -        if ((EraseStatus == EFI_SUCCESS) && (IsZero1 == FALSE) && (IsZero2 == TRUE) && ((IsZero3 == FALSE)))
-             AssertionType = EFI_TEST_ASSERTION_PASSED;
-        else
-          AssertionType = EFI_TEST_ASSERTION_FAILED;
+          if ((EraseStatus == EFI_SUCCESS) && (IsZero1 == FALSE) && (IsZero2 == TRUE) && ((IsZero3 == FALSE)))
Less than 80 cols.

+               AssertionType = EFI_TEST_ASSERTION_PASSED;
+          else
+            AssertionType = EFI_TEST_ASSERTION_FAILED;
            -        StandardLib->RecordAssertion (
-                       StandardLib,
-                       AssertionType,
-                       gEraseBlockBBTestFunctionAssertionGuid003,
-                       L"EraseBlocks - EraseBlocks for testing, the first/last block should not be erased",
-                       L"%a:%d:EraseBlocks Status - %r, IsZero1 - %d, IsZero2 - %d, IsZero3 - %d",
-                       __FILE__,
-                       (UINTN)__LINE__,
-                       Status,
-                       IsZero1, IsZero2, IsZero3
-                       );
+          StandardLib->RecordAssertion (
+                         StandardLib,
+                         AssertionType,
+                         gEraseBlockBBTestFunctionAssertionGuid003,
+                         L"EraseBlocks - EraseBlocks for testing, the first/last block should not be erased",
+                         L"%a:%d:EraseBlocks Status - %r, IsZero1 - %d, IsZero2 - %d, IsZero3 - %d",
+                         __FILE__,
+                         (UINTN)__LINE__,
+                         EraseStatus,
+                         IsZero1, IsZero2, IsZero3
+                         );
  +        }
        }
-
        //
        // Erase Blocks with the EraseLengthGranularity blocks
        //
@@ -453,13 +455,13 @@ BlockIo2:
        //
        // Erase Blocks with non EraseLengthGranularity blocks
        //
+      if (BufferSize > 2 * BlockSize) {
Magic Number 2.

+        Token.Event             = NULL;
+        Token.TransactionStatus = EFI_NOT_READY;
  -      Token.Event             = NULL;
-      Token.TransactionStatus = EFI_NOT_READY;
-
-      EnterEvent = 0;
+        EnterEvent = 0;
  -      Status = gtBS->CreateEvent (
+        Status = gtBS->CreateEvent (
                     EVT_NOTIFY_SIGNAL,
                     TPL_CALLBACK,
                     (EFI_EVENT_NOTIFY) NotifyFunction,
@@ -467,8 +469,8 @@ BlockIo2:
                     &Token.Event
                     );
  -      if (EFI_ERROR (Status)) {
-        StandardLib->RecordAssertion (
+        if (EFI_ERROR (Status)) {
+          StandardLib->RecordAssertion (
                         StandardLib,
                         EFI_TEST_ASSERTION_FAILED,
                         gTestGenericFailureGuid,
@@ -478,46 +480,46 @@ BlockIo2:
                         (UINTN)__LINE__,
                         Status
                         );
-        FreeAlignedPool(Buffer1);
-        FreeAlignedPool(Buffer2);
-        goto End;
-      }
+          FreeAlignedPool(Buffer1);
+          FreeAlignedPool(Buffer2);
+          goto End;
+        }
  -      EraseStatus = EraseBlock->EraseBlocks (EraseBlock, MediaId, Lba+1, &Token, BufferSize - 2 * BlockSize);
+        EraseStatus = EraseBlock->EraseBlocks (EraseBlock, MediaId, Lba+1, &Token, BufferSize - 2 * BlockSize);
Magic Number 2.

  -      while(Token.TransactionStatus == EFI_NOT_READY);
+        while(Token.TransactionStatus == EFI_NOT_READY);
  -      // Read the data with 0, the first/last block should not be erased
-      ReadStatus = BlockIo2->ReadBlocksEx (BlockIo2, MediaId, Lba, &BlockIo2Token, BufferSize, (VOID*)Buffer2);
-      if (ReadStatus == EFI_SUCCESS) {
-        for (Index1 = 0; Index1 < BlockSize; Index1++) {
-          if (Buffer2[Index1] != 0) {
-            IsZero1 = FALSE;
-            break;
+        // Read the data with 0, the first/last block should not be erased
+        ReadStatus = BlockIo2->ReadBlocksEx (BlockIo2, MediaId, Lba, &BlockIo2Token, BufferSize, (VOID*)Buffer2);
+        if (ReadStatus == EFI_SUCCESS) {
+          for (Index1 = 0; Index1 < BlockSize; Index1++) {
+            if (Buffer2[Index1] != 0) {
+              IsZero1 = FALSE;
+              break;
+            }
            }
-        }
  -        for (Index1 = BlockSize; Index1 < BufferSize - BlockSize; Index1++) {
-          if (Buffer2[Index1] != 0) {
-            IsZero2 = FALSE;
-            break;
+          for (Index1 = BlockSize; Index1 < BufferSize - BlockSize; Index1++) {
+            if (Buffer2[Index1] != 0) {
+              IsZero2 = FALSE;
+              break;
+            }
            }
-        }
  -        for (Index1 = BufferSize - BlockSize; Index1 < BufferSize; Index1++) {
-          if (Buffer2[Index1] != 0) {
-            IsZero3 = FALSE;
-            break;
+          for (Index1 = BufferSize - BlockSize; Index1 < BufferSize; Index1++) {
+            if (Buffer2[Index1] != 0) {
+              IsZero3 = FALSE;
+              break;
+            }
            }
-        }
  -        if ((EraseStatus == EFI_SUCCESS) && (IsZero1 == FALSE) && (IsZero2 == TRUE) && ((IsZero3 == FALSE)))
-             AssertionType = EFI_TEST_ASSERTION_PASSED;
-        else
-          AssertionType = EFI_TEST_ASSERTION_FAILED;
+          if ((EraseStatus == EFI_SUCCESS) && (IsZero1 == FALSE) && (IsZero2 == TRUE) && ((IsZero3 == FALSE)))
less than 80 cols.

+               AssertionType = EFI_TEST_ASSERTION_PASSED;
+          else
+            AssertionType = EFI_TEST_ASSERTION_FAILED;
            -        StandardLib->RecordAssertion (
+          StandardLib->RecordAssertion (
                         StandardLib,
                         AssertionType,
                         gEraseBlockBBTestFunctionAssertionGuid004,
@@ -525,12 +527,12 @@ BlockIo2:
                         L"%a:%d:EraseBlocks Status - %r, IsZero1 - %d, IsZero2 - %d, IsZero3 - %d",
                         __FILE__,
                         (UINTN)__LINE__,
-                       Status,
+                       EraseStatus,
                         IsZero1, IsZero2, IsZero3
                         );
  +        }
        }
-
        //
        // Erase Blocks with the EraseLengthGranularity blocks
        //


IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

  reply	other threads:[~2018-10-15 13:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-13 15:51 [PATCH] uefi-sct/SctPkg:The original design for the 'EraseLengthGranularity' test need consider this case Eric Jin
2018-10-15  1:44 ` Supreeth Venkatesh
2018-10-15 13:10   ` Supreeth Venkatesh [this message]
2018-10-15  2:08 ` Supreeth Venkatesh
2018-10-15 12:57   ` Supreeth Venkatesh
2018-10-15 13:10   ` Supreeth Venkatesh

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=AM4PR08MB278853ECB00103A4AE6E922D80FD0@AM4PR08MB2788.eurprd08.prod.outlook.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