1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2011-2012 Freescale Semiconductor, Inc.
10 #include <env_internal.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 static int env_remote_init(void)
23 if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
24 gd->env_addr = (ulong)&(env_ptr->data);
25 gd->env_valid = ENV_VALID;
32 #ifdef CONFIG_CMD_SAVEENV
33 static int env_remote_save(void)
35 #ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE
36 printf("Can not support the 'saveenv' when boot from SRIO or PCIE!\n");
42 #endif /* CONFIG_CMD_SAVEENV */
44 static int env_remote_load(void)
46 #ifndef ENV_IS_EMBEDDED
47 return env_import((char *)env_ptr, 1);
53 U_BOOT_ENV_LOCATION(remote) = {
54 .location = ENVL_REMOTE,
56 .load = env_remote_load,
57 .save = env_save_ptr(env_remote_save),
58 .init = env_remote_init,