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