public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sean Rhodes" <sean@starlabs.systems>
To: devel@edk2.groups.io
Cc: guo.dong@intel.com, Sean Rhodes <sean@starlabs.systems>,
	Hao A Wu <hao.a.wu@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>
Subject: [PATCH 2/2] MdeModulePkg/FaultTolerantWrite: Don't check for block alignment
Date: Fri, 11 Feb 2022 17:55:44 +0000	[thread overview]
Message-ID: <0cc5e6555e898ff6bd9c753aa7892e39e97373e1.1644602106.git.sean@starlabs.systems> (raw)
In-Reply-To: <20c774e720e2d7f1bbc1a6bff73d752b624e9bba.1644602106.git.sean@starlabs.systems>

Don't check for block alignment as it will fail for devices that are memory mapped.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
---
 .../Universal/FaultTolerantWriteDxe/FtwMisc.c | 30 +------------------
 1 file changed, 1 insertion(+), 29 deletions(-)

diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
index 661e148767..b34b8f3561 100644
--- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
+++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
@@ -1119,19 +1119,7 @@ FindFvbForFtw (
           FtwDevice->WorkBlockSize          = BlockSize;
           FtwDevice->FtwWorkSpaceBase       = (UINTN)(FtwDevice->WorkSpaceAddress - (FvbBaseAddress + FtwDevice->WorkBlockSize * (LbaIndex - 1)));
           FtwDevice->NumberOfWorkSpaceBlock = FTW_BLOCKS (FtwDevice->FtwWorkSpaceBase + FtwDevice->FtwWorkSpaceSize, FtwDevice->WorkBlockSize);
-          if (FtwDevice->FtwWorkSpaceSize >= FtwDevice->WorkBlockSize) {
-            //
-            // Check the alignment of work space address and length, they should be block size aligned when work space size is larger than one block size.
-            //
-            if (((FtwDevice->WorkSpaceAddress & (FtwDevice->WorkBlockSize - 1)) != 0) ||
-                ((FtwDevice->WorkSpaceLength & (FtwDevice->WorkBlockSize - 1)) != 0))
-            {
-              DEBUG ((DEBUG_ERROR, "Ftw: Work space address or length is not block size aligned when work space size is larger than one block size\n"));
-              FreePool (HandleBuffer);
-              ASSERT (FALSE);
-              return EFI_ABORTED;
-            }
-          } else if ((FtwDevice->FtwWorkSpaceBase + FtwDevice->FtwWorkSpaceSize) > FtwDevice->WorkBlockSize) {
+          if ((FtwDevice->FtwWorkSpaceBase + FtwDevice->FtwWorkSpaceSize) > FtwDevice->WorkBlockSize) {
             DEBUG ((DEBUG_ERROR, "Ftw: The work space range should not span blocks when work space size is less than one block size\n"));
             FreePool (HandleBuffer);
             ASSERT (FALSE);
@@ -1170,22 +1158,6 @@ FindFvbForFtw (
             return EFI_ABORTED;
           }
 
-          //
-          // Check the alignment of spare area address and length, they should be block size aligned
-          //
-          if (((FtwDevice->SpareAreaAddress & (FtwDevice->SpareBlockSize - 1)) != 0) ||
-              ((FtwDevice->SpareAreaLength & (FtwDevice->SpareBlockSize - 1)) != 0))
-          {
-            DEBUG ((DEBUG_ERROR, "Ftw: Spare area address or length is not block size aligned\n"));
-            FreePool (HandleBuffer);
-            //
-            // Report Status Code EFI_SW_EC_ABORTED.
-            //
-            REPORT_STATUS_CODE ((EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED), (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_ABORTED));
-            ASSERT (FALSE);
-            CpuDeadLoop ();
-          }
-
           break;
         }
       }
-- 
2.32.0


  reply	other threads:[~2022-02-11 17:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11 17:55 [PATCH 1/2] UefiPayloadPkg: Add support for Firmware Volume Block Protocol Sean Rhodes
2022-02-11 17:55 ` Sean Rhodes [this message]
2022-02-14 17:38 ` Guo Dong

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=0cc5e6555e898ff6bd9c753aa7892e39e97373e1.1644602106.git.sean@starlabs.systems \
    --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