2 * Code shared between SPL and U-Boot proper
4 * Copyright (c) 2015 Google, Inc
5 * Written by Simon Glass <sjg@chromium.org>
7 * SPDX-License-Identifier: GPL-2.0+
12 DECLARE_GLOBAL_DATA_PTR;
14 /* Unfortunately x86 can't compile this code as gd cannot be assigned */
16 __weak void arch_setup_gd(struct global_data *gd_ptr)
20 #endif /* !CONFIG_X86 */
22 ulong board_init_f_mem(ulong top)
24 struct global_data *gd_ptr;
26 /* Leave space for the stack we are running with now */
29 top -= sizeof(struct global_data);
31 gd_ptr = (struct global_data *)top;
32 memset(gd_ptr, '\0', sizeof(*gd));
33 arch_setup_gd(gd_ptr);
35 #if defined(CONFIG_SYS_MALLOC_F)
36 top -= CONFIG_SYS_MALLOC_F_LEN;
37 gd->malloc_base = top;