public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Aaron Li" <aaron.li@intel.com>
To: devel@edk2.groups.io
Cc: Bob Feng <bob.c.feng@intel.com>, Liming Gao <gaoliming@byosoft.com.cn>
Subject: [PATCH v1 1/1] Tools/FitGen: Fix microcode alignment support
Date: Thu, 17 Sep 2020 13:58:27 +0800	[thread overview]
Message-ID: <20200917055827.11088-1-aaron.li@intel.com> (raw)

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2971

This patch is to fix a issue that "-A" option would only support
2^n Byte alignment of microcode.

Signed-off-by: Aaron Li <aaron.li@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
---
 Silicon/Intel/Tools/FitGen/FitGen.c | 2 +-
 Silicon/Intel/Tools/FitGen/FitGen.h | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitGen/FitGen.c
index c4006e69c822..4caaf70ee018 100644
--- a/Silicon/Intel/Tools/FitGen/FitGen.c
+++ b/Silicon/Intel/Tools/FitGen/FitGen.c
@@ -1176,7 +1176,7 @@ Returns:
                 // MCU might be put at 2KB alignment, if so, we need to adjust the size as 2KB alignment.
                 //
                 if (gFitTableContext.MicrocodeIsAligned) {
-                  MicrocodeSize = (*(UINT32 *)(MicrocodeBuffer + 32) + (gFitTableContext.MicrocodeAlignValue - 1)) & ~(gFitTableContext.MicrocodeAlignValue - 1);
+                  MicrocodeSize = ROUNDUP (*(UINT32 *)(MicrocodeBuffer + 32), gFitTableContext.MicrocodeAlignValue);
                 } else {
                   MicrocodeSize = (*(UINT32 *)(MicrocodeBuffer + 32));
                 }
diff --git a/Silicon/Intel/Tools/FitGen/FitGen.h b/Silicon/Intel/Tools/FitGen/FitGen.h
index abad2d8799c8..435fc26209da 100644
--- a/Silicon/Intel/Tools/FitGen/FitGen.h
+++ b/Silicon/Intel/Tools/FitGen/FitGen.h
@@ -31,7 +31,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 // Utility version information
 //
 #define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 62
+#define UTILITY_MINOR_VERSION 63
 #define UTILITY_DATE          __DATE__
 
 //
@@ -45,4 +45,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
   (ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))
 ;
 
+#define ROUNDUP(Size, Alignment) (((Size) + (Alignment) - 1) / (Alignment) * (Alignment))
+
 #endif
-- 
2.23.0.windows.1


                 reply	other threads:[~2020-09-17  5:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200917055827.11088-1-aaron.li@intel.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