common/env_embedded.c: drop support for CONFIG_SYS_USE_PPCENV
[oweals/u-boot.git] / common / env_embedded.c
1 /*
2  * (C) Copyright 2001
3  * Erik Theisen,  Wave 7 Optics, etheisen@mindspring.com.
4  *
5  * SPDX-License-Identifier:     GPL-2.0+
6  */
7
8 #include <linux/kconfig.h>
9
10 #ifndef __ASSEMBLY__
11 #define __ASSEMBLY__                    /* Dirty trick to get only #defines */
12 #endif
13 #define __ASM_STUB_PROCESSOR_H__        /* don't include asm/processor. */
14 #include <config.h>
15 #undef  __ASSEMBLY__
16 #include <environment.h>
17 #include <linux/stringify.h>
18
19 /* Handle HOSTS that have prepended crap on symbol names, not TARGETS. */
20 #if defined(__APPLE__)
21 /* Leading underscore on symbols */
22 #  define SYM_CHAR "_"
23 #else /* No leading character on symbols */
24 #  define SYM_CHAR
25 #endif
26
27 /*
28  * Generate embedded environment table
29  * inside U-Boot image, if needed.
30  */
31 #if defined(ENV_IS_EMBEDDED) || defined(CONFIG_BUILD_ENVCRC)
32 /*
33  * Put the environment in the .text section when we are building
34  * U-Boot proper.  The host based program "tools/envcrc" does not need
35  * a seperate section.
36  */
37 #if defined(USE_HOSTCC) /* Native for 'tools/envcrc' */
38 #  define __PPCENV__    /*XXX DO_NOT_DEL_THIS_COMMENT*/
39 #  define __PPCTEXT__   /*XXX DO_NOT_DEL_THIS_COMMENT*/
40
41 #else /* Environment is embedded in U-Boot's .text section */
42 /* XXX - This only works with GNU C */
43 #  define __PPCENV__    __attribute__ ((section(".text")))
44 #  define __PPCTEXT__   __attribute__ ((section(".text")))
45 #endif
46
47 /*
48  * Macros to generate global absolutes.
49  */
50 #if defined(__bfin__)
51 # define GEN_SET_VALUE(name, value)     \
52         asm(".set " GEN_SYMNAME(name) ", " GEN_VALUE(value))
53 #else
54 # define GEN_SET_VALUE(name, value)     \
55         asm(GEN_SYMNAME(name) " = " GEN_VALUE(value))
56 #endif
57 #define GEN_SYMNAME(str)        SYM_CHAR #str
58 #define GEN_VALUE(str)          #str
59 #define GEN_ABS(name, value)                    \
60         asm(".globl " GEN_SYMNAME(name));       \
61         GEN_SET_VALUE(name, value)
62
63 /*
64  * Check to see if we are building with a
65  * computed CRC.  Otherwise define it as ~0.
66  */
67 #if !defined(ENV_CRC)
68 #  define ENV_CRC       (~0)
69 #endif
70
71 #define DEFAULT_ENV_INSTANCE_EMBEDDED
72 #include <env_default.h>
73
74 #ifdef CONFIG_ENV_ADDR_REDUND
75 env_t redundand_environment __PPCENV__ = {
76         0,              /* CRC Sum: invalid */
77         0,              /* Flags:   invalid */
78         {
79         "\0"
80         }
81 };
82 #endif  /* CONFIG_ENV_ADDR_REDUND */
83
84 /*
85  * These will end up in the .text section
86  * if the environment strings are embedded
87  * in the image.  When this is used for
88  * tools/envcrc, they are placed in the
89  * .data/.sdata section.
90  *
91  */
92 unsigned long env_size __PPCTEXT__ = sizeof(env_t);
93
94 /*
95  * Add in absolutes.
96  */
97 GEN_ABS(env_offset, CONFIG_ENV_OFFSET);
98
99 #endif /* ENV_IS_EMBEDDED */