<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
HI Samer,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
    Sorry for the slow reply, In EMMC's case, it allowed storage firmware erase to "1" to be a valid behavior (please reference the spec of emmc JESD84-B51/6.6.9), so once verification team use kind of this device, the test case will always failed. To avoid
 this problem, I think this change is required.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Thanks!!</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Arvin</div>
<div>
<div id="appendonsend"></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size: 11pt;"><b>寄件者:</b> Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com><br>
<b>寄件日期:</b> 2020年11月12日 上午 04:56<br>
<b>收件者:</b> devel@edk2.groups.io <devel@edk2.groups.io>; Chen, ArvinX <arvinx.chen@intel.com><br>
<b>副本:</b> G Edhaya Chandran <Edhaya.Chandran@arm.com>; Jin, Eric <eric.jin@intel.com>; Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>; gaoliming@byosoft.com.cn <gaoliming@byosoft.com.cn><br>
<b>主旨:</b> RE: [edk2-devel] [PATCH 2/2] uefi-sct/SctPkg: Correct BBTestEraseBlocks behavior (EFI_BLOCK_IO_PROTOCOL)</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Hi Chen,<br>
<br>
The UEFI Specification 2.8ErrataB (page 575) states that " It is the intention of the EraseBlocks() operation to be at least as performant as writing zeroes to each of the specified LBA locations while ensuring the equivalent security."<br>
<br>
So while not explicitly saying that Erase should "erase to 0", it implies that at least is the intention. Do we know that erasing to "1" is a valid behavior?<br>
<br>
<br>
<br>
> -----Original Message-----<br>
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chen,<br>
> ArvinX via groups.io<br>
> Sent: Monday, November 2, 2020 5:00 AM<br>
> To: devel@edk2.groups.io<br>
> Cc: G Edhaya Chandran <Edhaya.Chandran@arm.com>; Eric Jin<br>
> <eric.jin@intel.com><br>
> Subject: [edk2-devel] [PATCH 2/2] uefi-sct/SctPkg: Correct<br>
> BBTestEraseBlocks behavior (EFI_BLOCK_IO_PROTOCOL)<br>
><br>
> REF: <a href="https://bugzilla.tianocore.org/show_bug.cgi?id=3022">https://bugzilla.tianocore.org/show_bug.cgi?id=3022</a><br>
><br>
><br>
><br>
> The storage device erase behavior may have two possibilities:<br>
><br>
>  1.Write all data into "0"<br>
><br>
>  2.Write all data into "1"<br>
><br>
> but now tool behavior can only check case 1 (Write all data into "0"),<br>
><br>
> so we need add the other case into SCT tool to correct the test behavior.<br>
><br>
><br>
><br>
> Cc: G Edhaya Chandran <Edhaya.Chandran@arm.com><br>
><br>
> Cc: Eric Jin <eric.jin@intel.com><br>
><br>
> Signed-off-by: ArvinX Chen <arvinx.chen@intel.com><br>
><br>
> ---<br>
><br>
>  .../BlackBoxTest/EraseBlockBBTestFunction.c   | 55 +++++++++++++++----<br>
><br>
>  1 file changed, 43 insertions(+), 12 deletions(-)<br>
><br>
><br>
><br>
> diff --git a/uefi-<br>
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBlock<br>
> BBTestFunction.c b/uefi-<br>
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBlock<br>
> BBTestFunction.c<br>
><br>
> index cbf43e1d..dbbb70c6 100644<br>
><br>
> --- a/uefi-<br>
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBlock<br>
> BBTestFunction.c<br>
><br>
> +++ b/uefi-<br>
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBlock<br>
> BBTestFunction.c<br>
><br>
> @@ -71,6 +71,7 @@ BBTestEraseBlocksFunctionTest (<br>
><br>
>    UINT64                                Index;<br>
><br>
>    UINTN                                 Index1;<br>
><br>
>    UINTN                                 Remainder;<br>
><br>
> +  UINT64                                EraseCounter;<br>
><br>
><br>
><br>
>    EFI_ERASE_BLOCK_TOKEN                 Token;<br>
><br>
>    EFI_BLOCK_IO2_TOKEN                   BlockIo2Token;<br>
><br>
> @@ -223,26 +224,41 @@ BBTestEraseBlocksFunctionTest (<br>
><br>
>          // Read the data with 0, the first/last block should not be erased<br>
><br>
>          ReadStatus = BlockIo->ReadBlocks (BlockIo, MediaId, Lba, BufferSize,<br>
> (VOID*)Buffer2);<br>
><br>
>          if (ReadStatus == EFI_SUCCESS) {<br>
><br>
> -          for (Index1 = 0; Index1 < BlockSize; Index1++) {<br>
><br>
> -            if (Buffer2[Index1] != 0) {<br>
><br>
> +          for (Index1 = 0, EraseCounter = 0; Index1 < BlockSize; Index1++) {<br>
><br>
> +            if (Buffer2[Index1] != 0x00 && Buffer2[Index1] != 0xFF) {<br>
><br>
>                IsZero1 = FALSE;<br>
><br>
>                break;<br>
><br>
> +            } else if (Buffer2[Index1] == 0x00) {<br>
><br>
> +              EraseCounter++;<br>
><br>
>              }<br>
><br>
>            }<br>
><br>
> +          if (EraseCounter!=0 && EraseCounter!=BlockSize) {<br>
><br>
> +            IsZero1 = FALSE;<br>
><br>
> +          }<br>
><br>
><br>
><br>
> -          for (Index1 = BlockSize; Index1 < BufferSize - BlockSize; Index1++) {<br>
><br>
> -            if (Buffer2[Index1] != 0) {<br>
><br>
> +          for (Index1 = BlockSize, EraseCounter = 0; Index1 < BufferSize -<br>
> BlockSize; Index1++) {<br>
><br>
> +            if (Buffer2[Index1] != 0x00 && Buffer2[Index1] != 0xFF) {<br>
><br>
>                IsZero2 = FALSE;<br>
><br>
>                break;<br>
><br>
> +            } else if (Buffer2[Index1] == 0x00) {<br>
><br>
> +              EraseCounter++;<br>
><br>
>              }<br>
><br>
>            }<br>
><br>
> +          if (EraseCounter!=0 && EraseCounter!=(BufferSize - (BlockSize*2))) {<br>
><br>
> +            IsZero2 = FALSE;<br>
><br>
> +          }<br>
><br>
><br>
><br>
> -          for (Index1 = BufferSize - BlockSize; Index1 < BufferSize; Index1++) {<br>
><br>
> -            if (Buffer2[Index1] != 0) {<br>
><br>
> +          for (Index1 = BufferSize - BlockSize, EraseCounter = 0; Index1 <<br>
> BufferSize; Index1++) {<br>
><br>
> +            if (Buffer2[Index1] != 0x00 && Buffer2[Index1] != 0xFF) {<br>
><br>
>                IsZero3 = FALSE;<br>
><br>
>                break;<br>
><br>
> +            } else if (Buffer2[Index1] == 0x00) {<br>
><br>
> +              EraseCounter++;<br>
><br>
>              }<br>
><br>
>            }<br>
><br>
> +          if (EraseCounter!=0 && EraseCounter!=BlockSize) {<br>
><br>
> +            IsZero3 = FALSE;<br>
><br>
> +          }<br>
><br>
><br>
><br>
>            if ((EraseStatus == EFI_SUCCESS) && (IsZero1 == FALSE) && (IsZero2 ==<br>
> TRUE) && ((IsZero3 == FALSE)))<br>
><br>
>              AssertionType = EFI_TEST_ASSERTION_PASSED;<br>
><br>
> @@ -492,26 +508,41 @@ BlockIo2:<br>
><br>
>          // Read the data with 0, the first/last block should not be erased<br>
><br>
>          ReadStatus = BlockIo2->ReadBlocksEx (BlockIo2, MediaId, Lba,<br>
> &BlockIo2Token, BufferSize, (VOID*)Buffer2);<br>
><br>
>          if (ReadStatus == EFI_SUCCESS) {<br>
><br>
> -          for (Index1 = 0; Index1 < BlockSize; Index1++) {<br>
><br>
> -            if (Buffer2[Index1] != 0) {<br>
><br>
> +          for (Index1 = 0, EraseCounter = 0; Index1 < BlockSize; Index1++) {<br>
><br>
> +            if (Buffer2[Index1] != 0x00 && Buffer2[Index1] != 0xFF) {<br>
><br>
>                IsZero1 = FALSE;<br>
><br>
>                break;<br>
><br>
> +            } else if (Buffer2[Index1] == 0x00) {<br>
><br>
> +              EraseCounter++;<br>
><br>
>              }<br>
><br>
>            }<br>
><br>
> +          if (EraseCounter!=0 && EraseCounter!=BlockSize) {<br>
><br>
> +            IsZero1 = FALSE;<br>
><br>
> +          }<br>
><br>
><br>
><br>
> -          for (Index1 = BlockSize; Index1 < BufferSize - BlockSize; Index1++) {<br>
><br>
> -            if (Buffer2[Index1] != 0) {<br>
><br>
> +          for (Index1 = BlockSize, EraseCounter = 0; Index1 < BufferSize -<br>
> BlockSize; Index1++) {<br>
><br>
> +            if (Buffer2[Index1] != 0x00 && Buffer2[Index1] != 0xFF) {<br>
><br>
>                IsZero2 = FALSE;<br>
><br>
>                break;<br>
><br>
> +            } else if (Buffer2[Index1] == 0x00) {<br>
><br>
> +              EraseCounter++;<br>
><br>
>              }<br>
><br>
>            }<br>
><br>
> +          if (EraseCounter!=0 && EraseCounter!=(BufferSize - (BlockSize*2))) {<br>
><br>
> +            IsZero2 = FALSE;<br>
><br>
> +          }<br>
><br>
><br>
><br>
> -          for (Index1 = BufferSize - BlockSize; Index1 < BufferSize; Index1++) {<br>
><br>
> -            if (Buffer2[Index1] != 0) {<br>
><br>
> +          for (Index1 = BufferSize - BlockSize, EraseCounter = 0; Index1 <<br>
> BufferSize; Index1++) {<br>
><br>
> +            if (Buffer2[Index1] != 0x00 && Buffer2[Index1] != 0xFF) {<br>
><br>
>                IsZero3 = FALSE;<br>
><br>
>                break;<br>
><br>
> +            } else if (Buffer2[Index1] == 0x00) {<br>
><br>
> +              EraseCounter++;<br>
><br>
>              }<br>
><br>
>            }<br>
><br>
> +          if (EraseCounter!=0 && EraseCounter!=BlockSize) {<br>
><br>
> +            IsZero3 = FALSE;<br>
><br>
> +          }<br>
><br>
><br>
><br>
>            if ((EraseStatus == EFI_SUCCESS) && (IsZero1 == FALSE) && (IsZero2 ==<br>
> TRUE) && ((IsZero3 == FALSE)))<br>
><br>
>              AssertionType = EFI_TEST_ASSERTION_PASSED;<br>
><br>
> --<br>
><br>
> 2.26.2.windows.1<br>
><br>
><br>
><br>
><br>
><br>
> -=-=-=-=-=-=<br>
> Groups.io Links: You receive all messages sent to this group.<br>
> View/Reply Online (#66857): <a href="https://edk2.groups.io/g/devel/message/66857">
https://edk2.groups.io/g/devel/message/66857</a><br>
> Mute This Topic: <a href="https://groups.io/mt/77977762/1945644">https://groups.io/mt/77977762/1945644</a><br>
> Group Owner: devel+owner@edk2.groups.io<br>
> Unsubscribe: <a href="https://edk2.groups.io/g/devel/unsub">https://edk2.groups.io/g/devel/unsub</a> [samer.el-haj-<br>
> mahmoud@arm.com]<br>
> -=-=-=-=-=-=<br>
><br>
<br>
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.<br>
</div>
</span></font></div>
</div>
</body>
</html>


 <div width="1" style="color:white;clear:both">_._,_._,_</div> <hr> Groups.io Links:<p>   You receive all messages sent to this group.    <p> <a target="_blank" href="https://edk2.groups.io/g/devel/message/67647">View/Reply Online (#67647)</a> |    |  <a target="_blank" href="https://groups.io/mt/78311020/1813853">Mute This Topic</a>  | <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>    <a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> | <a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |  <a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>  [edk2-devel-archive@redhat.com]<br> <div width="1" style="color:white;clear:both">_._,_._,_</div>