]> git.sur5r.net Git - u-boot/blobdiff - common/init/board_init.c
SPDX: Convert all of our single license tags to Linux Kernel style
[u-boot] / common / init / board_init.c
index 193d8180a9c5aab632d7917e79ee5f35ef2aa789..526fee35ff679876aa9a14e6bdf8be674e93c69d 100644 (file)
@@ -1,26 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Code shared between SPL and U-Boot proper
  *
  * Copyright (c) 2015 Google, Inc
  * Written by Simon Glass <sjg@chromium.org>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-/*
- * It isn't trivial to figure out whether memcpy() exists. The arch-specific
- * memcpy() is not normally available in SPL due to code size.
- */
-#if !defined(CONFIG_SPL_BUILD) || \
-               (defined(CONFIG_SPL_LIBGENERIC_SUPPORT) && \
-               !defined(CONFIG_SPL_USE_ARCH_MEMCPY))
-#define _USE_MEMCPY
-#endif
-
 /* Unfortunately x86 or ARM can't compile this code as gd cannot be assigned */
 #if !defined(CONFIG_X86) && !defined(CONFIG_ARM)
 __weak void arch_setup_gd(struct global_data *gd_ptr)
@@ -56,8 +45,8 @@ __weak void arch_setup_gd(struct global_data *gd_ptr)
 ulong board_init_f_alloc_reserve(ulong top)
 {
        /* Reserve early malloc arena */
-#if defined(CONFIG_SYS_MALLOC_F)
-       top -= CONFIG_SYS_MALLOC_F_LEN;
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+       top -= CONFIG_VAL(SYS_MALLOC_F_LEN);
 #endif
        /* LAST : reserve GD (rounded up to a multiple of 16 bytes) */
        top = rounddown(top-sizeof(struct global_data), 16);
@@ -110,9 +99,6 @@ ulong board_init_f_alloc_reserve(ulong top)
 void board_init_f_init_reserve(ulong base)
 {
        struct global_data *gd_ptr;
-#ifndef _USE_MEMCPY
-       int *ptr;
-#endif
 
        /*
         * clear GD entirely and set it up.
@@ -121,12 +107,7 @@ void board_init_f_init_reserve(ulong base)
 
        gd_ptr = (struct global_data *)base;
        /* zero the area */
-#ifdef _USE_MEMCPY
        memset(gd_ptr, '\0', sizeof(*gd));
-#else
-       for (ptr = (int *)gd_ptr; ptr < (int *)(gd_ptr + 1); )
-               *ptr++ = 0;
-#endif
        /* set GD unless architecture did it already */
 #if !defined(CONFIG_ARM)
        arch_setup_gd(gd_ptr);
@@ -139,11 +120,11 @@ void board_init_f_init_reserve(ulong base)
         * Use gd as it is now properly set for all architectures.
         */
 
-#if defined(CONFIG_SYS_MALLOC_F)
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
        /* go down one 'early malloc arena' */
        gd->malloc_base = base;
        /* next alloc will be higher by one 'early malloc arena' size */
-       base += CONFIG_SYS_MALLOC_F_LEN;
+       base += CONFIG_VAL(SYS_MALLOC_F_LEN);
 #endif
 }