]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - env/remote.c
1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2011-2012 Freescale Semiconductor, Inc.
10 #include <env_internal.h>
11 #include <asm/global_data.h>
12 #include <linux/stddef.h>
13 #include <u-boot/crc.h>
15 #ifdef ENV_IS_EMBEDDED
16 static env_t
*env_ptr
= &environment
;
17 #else /* ! ENV_IS_EMBEDDED */
18 static env_t
*env_ptr
= (env_t
*)CONFIG_ENV_ADDR
;
19 #endif /* ENV_IS_EMBEDDED */
21 DECLARE_GLOBAL_DATA_PTR
;
23 static int env_remote_init(void)
25 if (crc32(0, env_ptr
->data
, ENV_SIZE
) == env_ptr
->crc
) {
26 gd
->env_addr
= (ulong
)&(env_ptr
->data
);
27 gd
->env_valid
= ENV_VALID
;
34 #ifdef CONFIG_CMD_SAVEENV
35 static int env_remote_save(void)
37 #ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE
38 printf("Can not support the 'saveenv' when boot from SRIO or PCIE!\n");
44 #endif /* CONFIG_CMD_SAVEENV */
46 static int env_remote_load(void)
48 #ifndef ENV_IS_EMBEDDED
49 return env_import((char *)env_ptr
, 1, H_EXTERNAL
);
55 U_BOOT_ENV_LOCATION(remote
) = {
56 .location
= ENVL_REMOTE
,
58 .load
= env_remote_load
,
59 .save
= env_save_ptr(env_remote_save
),
60 .init
= env_remote_init
,