[edk2-devel] [edk2-platforms] [PATCH v1] IntelSiliconPkg: Add DWORD_ALIGN macro

Nate DeSimone nathaniel.l.desimone at intel.com
Tue Feb 9 19:26:44 UTC 2021


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 at intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty at intel.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone at 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#71534): https://edk2.groups.io/g/devel/message/71534
Mute This Topic: https://groups.io/mt/80513741/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list