2 * (C) Copyright 2011-2012 Freescale Semiconductor, Inc.
4 * SPDX-License-Identifier: GPL-2.0+
11 #include <environment.h>
12 #include <linux/stddef.h>
14 #ifdef ENV_IS_EMBEDDED
15 env_t *env_ptr = &environment;
16 #else /* ! ENV_IS_EMBEDDED */
17 env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
18 #endif /* ENV_IS_EMBEDDED */
20 DECLARE_GLOBAL_DATA_PTR;
22 #if !defined(CONFIG_ENV_OFFSET)
23 #define CONFIG_ENV_OFFSET 0
26 static int env_remote_init(void)
28 if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
29 gd->env_addr = (ulong)&(env_ptr->data);
30 gd->env_valid = ENV_VALID;
37 #ifdef CONFIG_CMD_SAVEENV
38 static int env_remote_save(void)
40 #ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE
41 printf("Can not support the 'saveenv' when boot from SRIO or PCIE!\n");
47 #endif /* CONFIG_CMD_SAVEENV */
49 static int env_remote_load(void)
51 #ifndef ENV_IS_EMBEDDED
52 env_import((char *)env_ptr, 1);
58 U_BOOT_ENV_LOCATION(remote) = {
59 .location = ENVL_REMOTE,
61 .load = env_remote_load,
62 .save = env_save_ptr(env_remote_save),
63 .init = env_remote_init,