]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/board_f.c
Allow arch-specific setting of global_data in board_init_f_mem()
[karo-tx-uboot.git] / common / board_f.c
index 84418a29b4c6f9425e3098b0626e7216ed14bbc3..247272798eb2a9560513eeacc72f15d1e89f80bc 100644 (file)
@@ -1035,16 +1035,25 @@ void board_init_f_r(void)
 }
 #endif /* CONFIG_X86 */
 
+/* Unfortunately x86 can't compile this code as gd cannot be assigned */
 #ifndef CONFIG_X86
+__weak void arch_setup_gd(struct global_data *gd_ptr)
+{
+       gd = gd_ptr;
+}
+
 ulong board_init_f_mem(ulong top)
 {
+       struct global_data *gd_ptr;
+
        /* Leave space for the stack we are running with now */
        top -= 0x40;
 
        top -= sizeof(struct global_data);
        top = ALIGN(top, 16);
-       gd = (struct global_data *)top;
-       memset((void *)gd, '\0', sizeof(*gd));
+       gd_ptr = (struct global_data *)top;
+       memset(gd_ptr, '\0', sizeof(*gd));
+       arch_setup_gd(gd_ptr);
 
 #ifdef CONFIG_SYS_MALLOC_F_LEN
        top -= CONFIG_SYS_MALLOC_F_LEN;