[U-Boot] [PATCH 2/5] Align global_data to a 16-byte boundary

Simon Glass sjg at chromium.org
Mon Aug 3 02:10:09 CEST 2015


Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 common/board_f.c                  | 2 +-
 include/asm-generic/global_data.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/board_f.c b/common/board_f.c
index c596083..a947770 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -497,7 +497,7 @@ static int setup_machine(void)
 
 static int reserve_global_data(void)
 {
-	gd->start_addr_sp -= sizeof(gd_t);
+	gd->start_addr_sp = ALIGN(gd->start_addr_sp - sizeof(gd_t), 16);
 	gd->new_gd = (gd_t *)map_sysmem(gd->start_addr_sp, sizeof(gd_t));
 	debug("Reserving %zu Bytes for Global Data at: %08lx\n",
 			sizeof(gd_t), gd->start_addr_sp);
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 2155265..147f646 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -99,7 +99,7 @@ typedef struct global_data {
 	int pcidelay_done;
 #endif
 	struct udevice *cur_serial_dev;	/* current serial device */
-	struct arch_global_data arch;	/* architecture-specific data */
+	struct arch_global_data arch __aligned(16);	/* arch-specific data */
 } gd_t;
 #endif
 
-- 
2.5.0.rc2.392.g76e840b



More information about the U-Boot mailing list