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>
12 #include <u-boot/crc.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 static int env_remote_init(void)
24 if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
25 gd->env_addr = (ulong)&(env_ptr->data);
26 gd->env_valid = ENV_VALID;
33 #ifdef CONFIG_CMD_SAVEENV
34 static int env_remote_save(void)
36 #ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE
37 printf("Can not support the 'saveenv' when boot from SRIO or PCIE!\n");
43 #endif /* CONFIG_CMD_SAVEENV */
45 static int env_remote_load(void)
47 #ifndef ENV_IS_EMBEDDED
48 return env_import((char *)env_ptr, 1);
54 U_BOOT_ENV_LOCATION(remote) = {
55 .location = ENVL_REMOTE,
57 .load = env_remote_load,
58 .save = env_save_ptr(env_remote_save),
59 .init = env_remote_init,