]>
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 <environment.h>
11 #include <linux/stddef.h>
13 #ifdef ENV_IS_EMBEDDED
14 env_t
*env_ptr
= &environment
;
15 #else /* ! ENV_IS_EMBEDDED */
16 env_t
*env_ptr
= (env_t
*)CONFIG_ENV_ADDR
;
17 #endif /* ENV_IS_EMBEDDED */
19 DECLARE_GLOBAL_DATA_PTR
;
21 #if !defined(CONFIG_ENV_OFFSET)
22 #define CONFIG_ENV_OFFSET 0
25 static int env_remote_init(void)
27 if (crc32(0, env_ptr
->data
, ENV_SIZE
) == env_ptr
->crc
) {
28 gd
->env_addr
= (ulong
)&(env_ptr
->data
);
29 gd
->env_valid
= ENV_VALID
;
36 #ifdef CONFIG_CMD_SAVEENV
37 static int env_remote_save(void)
39 #ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE
40 printf("Can not support the 'saveenv' when boot from SRIO or PCIE!\n");
46 #endif /* CONFIG_CMD_SAVEENV */
48 static int env_remote_load(void)
50 #ifndef ENV_IS_EMBEDDED
51 return env_import((char *)env_ptr
, 1);
57 U_BOOT_ENV_LOCATION(remote
) = {
58 .location
= ENVL_REMOTE
,
60 .load
= env_remote_load
,
61 .save
= env_save_ptr(env_remote_save
),
62 .init
= env_remote_init
,