3 * Andre Schwarz, Matrix Vision GmbH, andre.schwarz@matrix-vision.de
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #include <environment.h>
30 DECLARE_GLOBAL_DATA_PTR;
32 static char* entries_to_keep[] = {
33 "serial#", "ethaddr", "eth1addr", "model_info", "sensor_cnt",
34 "fpgadatasize", "ddr_size", "use_dhcp", "use_static_ipaddr",
35 "static_ipaddr", "static_netmask", "static_gateway",
36 "syslog", "watchdog", "netboot", "evo8serialnumber" };
38 #define MV_MAX_ENV_ENTRY_LENGTH 64
39 #define MV_KEEP_ENTRIES ARRAY_SIZE(entries_to_keep)
41 #ifndef CONFIG_ENV_IS_NOWHERE
42 void mv_reset_environment(void)
45 char *s[MV_KEEP_ENTRIES];
46 char entries[MV_KEEP_ENTRIES][MV_MAX_ENV_ENTRY_LENGTH];
48 printf("\n*** RESET ENVIRONMENT ***\n");
50 memset(entries, 0, MV_KEEP_ENTRIES * MV_MAX_ENV_ENTRY_LENGTH);
51 for (i = 0; i < MV_KEEP_ENTRIES; i++) {
52 s[i] = getenv(entries_to_keep[i]);
54 printf("save '%s' : %s\n", entries_to_keep[i], s[i]);
55 strncpy(entries[i], s[i], MV_MAX_ENV_ENTRY_LENGTH);
62 for (i = 0; i < MV_KEEP_ENTRIES; i++) {
64 printf("restore '%s' : %s\n", entries_to_keep[i], s[i]);
65 setenv(entries_to_keep[i], s[i]);
73 int mv_load_fpga(void)
77 void *fpga_data = NULL;
78 char *datastr = getenv("fpgadata");
79 char *sizestr = getenv("fpgadatasize");
81 if (getenv("skip_fpga")) {
82 printf("found 'skip_fpga' -> FPGA _not_ loaded !\n");
85 printf("loading FPGA\n");
88 fpga_data = (void *)simple_strtoul(datastr, NULL, 16);
90 data_size = (size_t)simple_strtoul(sizestr, NULL, 16);
92 printf("fpgadatasize invalid -> FPGA _not_ loaded !\n");
96 result = fpga_load(0, fpga_data, data_size);
98 show_boot_progress(0);
103 u8 *dhcp_vendorex_prep(u8 *e)
107 /* DHCP vendor-class-identifier = 60 */
108 if ((ptr = getenv("dhcp_vendor-class-identifier"))) {
114 /* DHCP_CLIENT_IDENTIFIER = 61 */
115 if ((ptr = getenv("dhcp_client_id"))) {
125 u8 *dhcp_vendorex_proc(u8 *popt)