public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nate DeSimone" <nathaniel.l.desimone@intel.com>
To: devel@edk2.groups.io
Cc: Ray Ni <ray.ni@intel.com>,
	Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
Subject: [edk2-platforms] [PATCH v1] IntelSiliconPkg: Add DWORD_ALIGN macro
Date: Tue,  9 Feb 2021 11:26:44 -0800	[thread overview]
Message-ID: <20210209192644.3862-1-nathaniel.l.desimone@intel.com> (raw)

Adds a macro that rounds a given integer up to the nearest DWORD.
The config block data structure needs to be DWORD aligned. Since config blocks
are run-length encoded, the size of all config blocks therefore needs to be in
DWORD increments. This macro aids in storing arbitary data in a config block.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
 Silicon/Intel/IntelSiliconPkg/Include/Library/ConfigBlockLib.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Silicon/Intel/IntelSiliconPkg/Include/Library/ConfigBlockLib.h b/Silicon/Intel/IntelSiliconPkg/Include/Library/ConfigBlockLib.h
index 37a3968168..0233137e99 100644
--- a/Silicon/Intel/IntelSiliconPkg/Include/Library/ConfigBlockLib.h
+++ b/Silicon/Intel/IntelSiliconPkg/Include/Library/ConfigBlockLib.h
@@ -9,6 +9,8 @@
 #ifndef _CONFIG_BLOCK_LIB_H_
 #define _CONFIG_BLOCK_LIB_H_
 
+#define DWORD_ALIGN(x)   (((x) & 3) ? 0 : 1) ? x : (((x) + 4) & ((UINTN) ~0x3))
+
 /**
   Create config block table.
 
-- 
2.27.0.windows.1


                 reply	other threads:[~2021-02-09 19:26 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=20210209192644.3862-1-nathaniel.l.desimone@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