]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
0bc4a1ac | 2 | /* |
ea882baf | 3 | * (C) Copyright 2000-2010 |
0bc4a1ac WD |
4 | * Wolfgang Denk, DENX Software Engineering, [email protected]. |
5 | * | |
6 | * (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com> | |
7 | * Andreas Heppel <[email protected]> | |
0bc4a1ac WD |
8 | */ |
9 | ||
10 | #include <common.h> | |
0bc4a1ac | 11 | #include <command.h> |
db197010 | 12 | #include <env.h> |
f3998fdc | 13 | #include <env_internal.h> |
401d1c4f | 14 | #include <asm/global_data.h> |
0bc4a1ac | 15 | #include <linux/stddef.h> |
0bc4a1ac | 16 | |
d87080b7 WD |
17 | DECLARE_GLOBAL_DATA_PTR; |
18 | ||
eeba55cb TR |
19 | /* |
20 | * Because we only ever have the default environment available we must mark | |
21 | * it as invalid. | |
22 | */ | |
23 | static int env_nowhere_init(void) | |
24 | { | |
25 | gd->env_addr = (ulong)&default_environment[0]; | |
26 | gd->env_valid = ENV_INVALID; | |
27 | ||
28 | return 0; | |
29 | } | |
30 | ||
ad3fec23 PD |
31 | static int env_nowhere_load(void) |
32 | { | |
33 | /* | |
7291332a | 34 | * for SPL, set env_valid = ENV_INVALID is enough as env_get_char() |
ad3fec23 PD |
35 | * return the default env if env_get is used |
36 | * and SPL don't used env_import to reduce its size | |
37 | * For U-Boot proper, import the default environment to allow reload. | |
38 | */ | |
39 | if (!IS_ENABLED(CONFIG_SPL_BUILD)) | |
40 | env_set_default(NULL, 0); | |
41 | ||
42 | gd->env_valid = ENV_INVALID; | |
43 | ||
44 | return 0; | |
45 | } | |
46 | ||
4415f1d1 SG |
47 | U_BOOT_ENV_LOCATION(nowhere) = { |
48 | .location = ENVL_NOWHERE, | |
eeba55cb | 49 | .init = env_nowhere_init, |
ad3fec23 | 50 | .load = env_nowhere_load, |
ac358beb | 51 | ENV_NAME("nowhere") |
4415f1d1 | 52 | }; |