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