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