net: punt bd->bi_ip_addr

This field gets read in one place (by "bdinfo"), and we can replace
that with getenv("ipaddr").  After all, the bi_ip_addr field is kept
up-to-date implicitly with the value of the ipaddr env var.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
Mike Frysinger 2012-04-04 18:53:40 +00:00 committed by Joe Hershberger
parent e1902ac698
commit 50a47d0523
33 changed files with 19 additions and 109 deletions

View file

@ -38,7 +38,6 @@
typedef struct bd_info { typedef struct bd_info {
int bi_baudrate; /* serial console baudrate */ int bi_baudrate; /* serial console baudrate */
unsigned long bi_ip_addr; /* IP Address */
ulong bi_arch_number; /* unique id for this board */ ulong bi_arch_number; /* unique id for this board */
ulong bi_boot_params; /* where this board expects params */ ulong bi_boot_params; /* where this board expects params */
unsigned long bi_arm_freq; /* arm frequency */ unsigned long bi_arm_freq; /* arm frequency */

View file

@ -555,9 +555,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
arm_pci_init(); arm_pci_init();
#endif #endif
/* IP Address */
gd->bd->bi_ip_addr = getenv_IPaddr("ipaddr");
stdio_init(); /* get the devices list going. */ stdio_init(); /* get the devices list going. */
jumptable_init(); jumptable_init();

View file

@ -24,7 +24,6 @@
typedef struct bd_info { typedef struct bd_info {
unsigned long bi_baudrate; unsigned long bi_baudrate;
unsigned long bi_ip_addr;
unsigned char bi_phy_id[4]; unsigned char bi_phy_id[4];
unsigned long bi_board_number; unsigned long bi_board_number;
void *bi_boot_params; void *bi_boot_params;

View file

@ -316,8 +316,6 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
/* initialize environment */ /* initialize environment */
env_relocate(); env_relocate();
bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
stdio_init(); stdio_init();
jumptable_init(); jumptable_init();
console_init_r(); console_init_r();

View file

@ -30,7 +30,6 @@
typedef struct bd_info { typedef struct bd_info {
int bi_baudrate; /* serial console baudrate */ int bi_baudrate; /* serial console baudrate */
unsigned long bi_ip_addr; /* IP Address */
unsigned long bi_boot_params; /* where this board expects params */ unsigned long bi_boot_params; /* where this board expects params */
unsigned long bi_memstart; /* start of DRAM memory */ unsigned long bi_memstart; /* start of DRAM memory */
phys_size_t bi_memsize; /* size of DRAM memory in bytes */ phys_size_t bi_memsize; /* size of DRAM memory in bytes */

View file

@ -86,7 +86,6 @@ static void display_global_data(void)
printf(" |-jt(%p): %p\n", gd->jt, *(gd->jt)); printf(" |-jt(%p): %p\n", gd->jt, *(gd->jt));
printf(" \\-bd: %p\n", gd->bd); printf(" \\-bd: %p\n", gd->bd);
printf(" |-bi_baudrate: %x\n", bd->bi_baudrate); printf(" |-bi_baudrate: %x\n", bd->bi_baudrate);
printf(" |-bi_ip_addr: %lx\n", bd->bi_ip_addr);
printf(" |-bi_boot_params: %lx\n", bd->bi_boot_params); printf(" |-bi_boot_params: %lx\n", bd->bi_boot_params);
printf(" |-bi_memstart: %lx\n", bd->bi_memstart); printf(" |-bi_memstart: %lx\n", bd->bi_memstart);
printf(" |-bi_memsize: %lx\n", bd->bi_memsize); printf(" |-bi_memsize: %lx\n", bd->bi_memsize);
@ -325,8 +324,6 @@ static void board_net_init_r(bd_t *bd)
if ((s = getenv("bootfile")) != NULL) if ((s = getenv("bootfile")) != NULL)
copy_filename(BootFile, s, sizeof(BootFile)); copy_filename(BootFile, s, sizeof(BootFile));
bd->bi_ip_addr = getenv_IPaddr("ipaddr");
printf("Net: "); printf("Net: ");
eth_initialize(gd->bd); eth_initialize(gd->bd);
#endif #endif

View file

@ -47,7 +47,6 @@ typedef struct bd_info {
unsigned long bi_mbar_base; /* base of internal registers */ unsigned long bi_mbar_base; /* base of internal registers */
unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */ unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */
unsigned long bi_boot_params; /* where this board expects params */ unsigned long bi_boot_params; /* where this board expects params */
unsigned long bi_ip_addr; /* IP Address */
unsigned short bi_ethspeed; /* Ethernet speed in Mbps */ unsigned short bi_ethspeed; /* Ethernet speed in Mbps */
unsigned long bi_intfreq; /* Internal Freq, in MHz */ unsigned long bi_intfreq; /* Internal Freq, in MHz */
unsigned long bi_busfreq; /* Bus Freq, in MHz */ unsigned long bi_busfreq; /* Bus Freq, in MHz */

View file

@ -507,15 +507,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
/* relocate environment function pointers etc. */ /* relocate environment function pointers etc. */
env_relocate (); env_relocate ();
/*
* Fill in missing fields of bd_info.
* We do this here, where we have "normal" access to the
* environment; we used to do this still running from ROM,
* where had to use getenv_f(), which can be pretty slow when
* the environment is in EEPROM.
*/
bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
WATCHDOG_RESET (); WATCHDOG_RESET ();
#if defined(CONFIG_PCI) #if defined(CONFIG_PCI)

View file

@ -40,7 +40,6 @@ typedef struct bd_info {
unsigned long bi_flashoffset; /* reserved area for startup monitor */ unsigned long bi_flashoffset; /* reserved area for startup monitor */
unsigned long bi_sramstart; /* start of SRAM memory */ unsigned long bi_sramstart; /* start of SRAM memory */
unsigned long bi_sramsize; /* size of SRAM memory */ unsigned long bi_sramsize; /* size of SRAM memory */
unsigned long bi_ip_addr; /* IP Address */
unsigned long bi_baudrate; /* Console Baudrate */ unsigned long bi_baudrate; /* Console Baudrate */
} bd_t; } bd_t;

View file

@ -176,9 +176,6 @@ void board_init (void)
load_addr = getenv_ulong("loadaddr", 16, load_addr); load_addr = getenv_ulong("loadaddr", 16, load_addr);
#if defined(CONFIG_CMD_NET) #if defined(CONFIG_CMD_NET)
/* IP Address */
bd->bi_ip_addr = getenv_IPaddr("ipaddr");
printf("Net: "); printf("Net: ");
eth_initialize(gd->bd); eth_initialize(gd->bd);

View file

@ -33,7 +33,6 @@
typedef struct bd_info { typedef struct bd_info {
int bi_baudrate; /* serial console baudrate */ int bi_baudrate; /* serial console baudrate */
unsigned long bi_ip_addr; /* IP Address */
unsigned long bi_arch_number; /* unique id for this board */ unsigned long bi_arch_number; /* unique id for this board */
unsigned long bi_boot_params; /* where this board expects params */ unsigned long bi_boot_params; /* where this board expects params */
unsigned long bi_memstart; /* start of DRAM memory */ unsigned long bi_memstart; /* start of DRAM memory */

View file

@ -320,9 +320,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
/* relocate environment function pointers etc. */ /* relocate environment function pointers etc. */
env_relocate(); env_relocate();
/* IP Address */
bd->bi_ip_addr = getenv_IPaddr("ipaddr");
#if defined(CONFIG_PCI) #if defined(CONFIG_PCI)
/* /*
* Do pci configuration * Do pci configuration

View file

@ -40,7 +40,6 @@
typedef struct bd_info { typedef struct bd_info {
int bi_baudrate; /* serial console baudrate */ int bi_baudrate; /* serial console baudrate */
unsigned long bi_ip_addr; /* IP Address */
unsigned char bi_enetaddr[6]; /* Ethernet adress */ unsigned char bi_enetaddr[6]; /* Ethernet adress */
unsigned long bi_arch_number; /* unique id for this board */ unsigned long bi_arch_number; /* unique id for this board */
unsigned long bi_boot_params; /* where this board expects params */ unsigned long bi_boot_params; /* where this board expects params */

View file

@ -369,9 +369,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
nds32_pci_init(); nds32_pci_init();
#endif #endif
/* IP Address */
gd->bd->bi_ip_addr = getenv_IPaddr("ipaddr");
stdio_init(); /* get the devices list going. */ stdio_init(); /* get the devices list going. */
jumptable_init(); jumptable_init();

View file

@ -39,7 +39,6 @@ typedef struct bd_info {
unsigned long bi_flashoffset; /* reserved area for startup monitor */ unsigned long bi_flashoffset; /* reserved area for startup monitor */
unsigned long bi_sramstart; /* start of SRAM memory */ unsigned long bi_sramstart; /* start of SRAM memory */
unsigned long bi_sramsize; /* size of SRAM memory */ unsigned long bi_sramsize; /* size of SRAM memory */
unsigned long bi_ip_addr; /* IP Address */
unsigned long bi_baudrate; /* Console Baudrate */ unsigned long bi_baudrate; /* Console Baudrate */
} bd_t; } bd_t;

View file

@ -143,8 +143,6 @@ void board_init (void)
WATCHDOG_RESET (); WATCHDOG_RESET ();
env_relocate(); env_relocate();
bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
WATCHDOG_RESET (); WATCHDOG_RESET ();
stdio_init(); stdio_init();
jumptable_init(); jumptable_init();

View file

@ -33,7 +33,6 @@
typedef struct bd_info { typedef struct bd_info {
unsigned long bi_baudrate; /* serial console baudrate */ unsigned long bi_baudrate; /* serial console baudrate */
unsigned long bi_ip_addr; /* IP Address */
unsigned long bi_arch_number; /* unique id for this board */ unsigned long bi_arch_number; /* unique id for this board */
unsigned long bi_boot_params; /* where this board expects params */ unsigned long bi_boot_params; /* where this board expects params */
unsigned long bi_memstart; /* start of DRAM memory */ unsigned long bi_memstart; /* start of DRAM memory */

View file

@ -63,7 +63,6 @@ typedef struct bd_info {
unsigned long bi_vcofreq; /* VCO Freq, in MHz */ unsigned long bi_vcofreq; /* VCO Freq, in MHz */
#endif #endif
unsigned long bi_bootflags; /* boot / reboot flag (Unused) */ unsigned long bi_bootflags; /* boot / reboot flag (Unused) */
unsigned long bi_ip_addr; /* IP Address */
unsigned char bi_enetaddr[6]; /* OLD: see README.enetaddr */ unsigned char bi_enetaddr[6]; /* OLD: see README.enetaddr */
unsigned short bi_ethspeed; /* Ethernet speed in Mbps */ unsigned short bi_ethspeed; /* Ethernet speed in Mbps */
unsigned long bi_intfreq; /* Internal Freq, in MHz */ unsigned long bi_intfreq; /* Internal Freq, in MHz */

View file

@ -877,9 +877,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
#endif #endif
#endif /* CONFIG_CMD_NET */ #endif /* CONFIG_CMD_NET */
/* IP Address */
bd->bi_ip_addr = getenv_IPaddr("ipaddr");
WATCHDOG_RESET(); WATCHDOG_RESET();
#if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT) #if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT)

View file

@ -45,7 +45,6 @@ typedef struct bd_info {
unsigned long bi_sramstart; /* start of SRAM memory */ unsigned long bi_sramstart; /* start of SRAM memory */
unsigned long bi_sramsize; /* size of SRAM memory */ unsigned long bi_sramsize; /* size of SRAM memory */
unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */ unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */
unsigned long bi_ip_addr; /* IP Address */
unsigned short bi_ethspeed; /* Ethernet speed in Mbps */ unsigned short bi_ethspeed; /* Ethernet speed in Mbps */
unsigned long bi_intfreq; /* Internal Freq, in MHz */ unsigned long bi_intfreq; /* Internal Freq, in MHz */
unsigned long bi_busfreq; /* Bus Freq, in MHz */ unsigned long bi_busfreq; /* Bus Freq, in MHz */

View file

@ -235,9 +235,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
/* initialize environment */ /* initialize environment */
env_relocate(); env_relocate();
/* IP Address */
gd->bd->bi_ip_addr = getenv_IPaddr("ipaddr");
stdio_init(); /* get the devices list going. */ stdio_init(); /* get the devices list going. */
jumptable_init(); jumptable_init();

View file

@ -33,7 +33,6 @@ typedef struct bd_info {
unsigned long bi_flashoffset; /* reserved area for startup monitor */ unsigned long bi_flashoffset; /* reserved area for startup monitor */
unsigned long bi_sramstart; /* start of SRAM memory */ unsigned long bi_sramstart; /* start of SRAM memory */
unsigned long bi_sramsize; /* size of SRAM memory */ unsigned long bi_sramsize; /* size of SRAM memory */
unsigned long bi_ip_addr; /* IP Address */
unsigned long bi_baudrate; /* Console Baudrate */ unsigned long bi_baudrate; /* Console Baudrate */
unsigned long bi_boot_params; /* where this board expects params */ unsigned long bi_boot_params; /* where this board expects params */
} bd_t; } bd_t;

View file

@ -100,14 +100,6 @@ static int sh_mem_env_init(void)
return 0; return 0;
} }
#if defined(CONFIG_CMD_NET)
static int sh_net_init(void)
{
gd->bd->bi_ip_addr = getenv_IPaddr("ipaddr");
return 0;
}
#endif
#if defined(CONFIG_CMD_MMC) #if defined(CONFIG_CMD_MMC)
static int sh_mmc_init(void) static int sh_mmc_init(void)
{ {
@ -145,9 +137,6 @@ init_fnc_t *init_sequence[] =
#ifdef CONFIG_BOARD_LATE_INIT #ifdef CONFIG_BOARD_LATE_INIT
board_late_init, board_late_init,
#endif #endif
#if defined(CONFIG_CMD_NET)
sh_net_init, /* SH specific eth init */
#endif
#if defined(CONFIG_CMD_MMC) #if defined(CONFIG_CMD_MMC)
sh_mmc_init, sh_mmc_init,
#endif #endif

View file

@ -51,7 +51,6 @@ typedef struct bd_info {
unsigned long bi_sramstart; /* start of SRAM memory */ unsigned long bi_sramstart; /* start of SRAM memory */
unsigned long bi_sramsize; /* size of SRAM memory */ unsigned long bi_sramsize; /* size of SRAM memory */
unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */ unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */
unsigned long bi_ip_addr; /* IP Address */
unsigned short bi_ethspeed; /* Ethernet speed in Mbps */ unsigned short bi_ethspeed; /* Ethernet speed in Mbps */
unsigned long bi_intfreq; /* Internal Freq, in MHz */ unsigned long bi_intfreq; /* Internal Freq, in MHz */
unsigned long bi_busfreq; /* Bus Freq, in MHz */ unsigned long bi_busfreq; /* Bus Freq, in MHz */

View file

@ -333,8 +333,6 @@ void board_init_f(ulong bootflag)
mac_read_from_eeprom(); mac_read_from_eeprom();
#endif #endif
/* IP Address */
bd->bi_ip_addr = getenv_IPaddr("ipaddr");
#if defined(CONFIG_PCI) #if defined(CONFIG_PCI)
/* /*
* Do pci configuration * Do pci configuration

View file

@ -36,7 +36,6 @@ int set_reloc_flag_r(void);
int mem_malloc_init_r(void); int mem_malloc_init_r(void);
int init_bd_struct_r(void); int init_bd_struct_r(void);
int flash_init_r(void); int flash_init_r(void);
int init_ip_address_r(void);
int status_led_set_r(void); int status_led_set_r(void);
int set_bootfile_r(void); int set_bootfile_r(void);
int set_load_addr_r(void); int set_load_addr_r(void);

View file

@ -45,7 +45,6 @@ typedef struct bd_info {
unsigned long bi_sramstart; /* start of SRAM memory */ unsigned long bi_sramstart; /* start of SRAM memory */
unsigned long bi_sramsize; /* size of SRAM memory */ unsigned long bi_sramsize; /* size of SRAM memory */
unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */ unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */
unsigned long bi_ip_addr; /* IP Address */
unsigned short bi_ethspeed; /* Ethernet speed in Mbps */ unsigned short bi_ethspeed; /* Ethernet speed in Mbps */
unsigned long bi_intfreq; /* Internal Freq, in MHz */ unsigned long bi_intfreq; /* Internal Freq, in MHz */
unsigned long bi_busfreq; /* Bus Freq, in MHz */ unsigned long bi_busfreq; /* Bus Freq, in MHz */

View file

@ -157,9 +157,6 @@ init_fnc_t *init_sequence_r[] = {
flash_init_r, flash_init_r,
#endif #endif
env_relocate_r, env_relocate_r,
#ifdef CONFIG_CMD_NET
init_ip_address_r,
#endif
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
pci_init_r, pci_init_r,
#endif #endif

View file

@ -179,14 +179,6 @@ int flash_init_r(void)
} }
#endif #endif
int init_ip_address_r(void)
{
/* IP Address */
bd_data.bi_ip_addr = getenv_IPaddr("ipaddr");
return 0;
}
#ifdef CONFIG_STATUS_LED #ifdef CONFIG_STATUS_LED
int status_led_set_r(void) int status_led_set_r(void)
{ {

View file

@ -730,12 +730,11 @@ int do_get_bpip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* /*
* Update whole ip-addr * Update whole ip-addr
*/ */
bd->bi_ip_addr = ipaddr;
sprintf(str, "%ld.%ld.%ld.%ld", sprintf(str, "%ld.%ld.%ld.%ld",
(bd->bi_ip_addr & 0xff000000) >> 24, (ipaddr & 0xff000000) >> 24,
(bd->bi_ip_addr & 0x00ff0000) >> 16, (ipaddr & 0x00ff0000) >> 16,
(bd->bi_ip_addr & 0x0000ff00) >> 8, (ipaddr & 0x0000ff00) >> 8,
(bd->bi_ip_addr & 0x000000ff)); (ipaddr & 0x000000ff));
setenv("ipaddr", str); setenv("ipaddr", str);
printf("Updated ip_addr from bp_eeprom to %s!\n", str); printf("Updated ip_addr from bp_eeprom to %s!\n", str);
} }

View file

@ -147,7 +147,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#ifdef CONFIG_HERMES #ifdef CONFIG_HERMES
print_mhz("ethspeed", bd->bi_ethspeed); print_mhz("ethspeed", bd->bi_ethspeed);
#endif #endif
printf("IP addr = %pI4\n", &bd->bi_ip_addr); printf("IP addr = %s\n", getenv("ipaddr"));
printf("baudrate = %6ld bps\n", bd->bi_baudrate); printf("baudrate = %6ld bps\n", bd->bi_baudrate);
print_num("relocaddr", gd->relocaddr); print_num("relocaddr", gd->relocaddr);
return 0; return 0;
@ -172,7 +172,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#if defined(CONFIG_CMD_NET) #if defined(CONFIG_CMD_NET)
print_eth(0); print_eth(0);
printf("ip_addr = %pI4\n", &bd->bi_ip_addr); printf("ip_addr = %s\n", getenv("ipaddr"));
#endif #endif
printf("baudrate = %ld bps\n", bd->bi_baudrate); printf("baudrate = %ld bps\n", bd->bi_baudrate);
@ -196,7 +196,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#endif #endif
#if defined(CONFIG_CMD_NET) #if defined(CONFIG_CMD_NET)
print_eth(0); print_eth(0);
printf("ip_addr = %pI4\n", &bd->bi_ip_addr); printf("ip_addr = %s\n", getenv("ipaddr"));
#endif #endif
printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate); printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
return 0; return 0;
@ -229,7 +229,7 @@ int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
#if defined(CONFIG_CMD_NET) #if defined(CONFIG_CMD_NET)
print_eth(0); print_eth(0);
printf("ip_addr = %pI4\n", &bd->bi_ip_addr); printf("ip_addr = %s\n", getenv("ipaddr"));
#endif #endif
printf("baudrate = %6ld bps\n", bd->bi_baudrate); printf("baudrate = %6ld bps\n", bd->bi_baudrate);
return 0; return 0;
@ -275,7 +275,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_eth(3); print_eth(3);
#endif #endif
printf("ip_addr = %pI4\n", &bd->bi_ip_addr); printf("ip_addr = %s\n", getenv("ipaddr"));
#endif #endif
printf("baudrate = %ld bps\n", bd->bi_baudrate); printf("baudrate = %ld bps\n", bd->bi_baudrate);
@ -303,7 +303,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_num("flashoffset", (ulong)bd->bi_flashoffset); print_num("flashoffset", (ulong)bd->bi_flashoffset);
print_eth(0); print_eth(0);
printf("ip_addr = %pI4\n", &bd->bi_ip_addr); printf("ip_addr = %s\n", getenv("ipaddr"));
printf("baudrate = %d bps\n", bd->bi_baudrate); printf("baudrate = %d bps\n", bd->bi_baudrate);
return 0; return 0;
@ -323,7 +323,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_num("flashoffset", (ulong)bd->bi_flashoffset); print_num("flashoffset", (ulong)bd->bi_flashoffset);
print_eth(0); print_eth(0);
printf("ip_addr = %pI4\n", &bd->bi_ip_addr); printf("ip_addr = %s\n", getenv("ipaddr"));
printf("baudrate = %d bps\n", bd->bi_baudrate); printf("baudrate = %d bps\n", bd->bi_baudrate);
return 0; return 0;
@ -343,7 +343,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_num("flashoffset", (ulong)bd->bi_flashoffset); print_num("flashoffset", (ulong)bd->bi_flashoffset);
print_eth(0); print_eth(0);
printf("ip_addr = %pI4\n", &bd->bi_ip_addr); printf("ip_addr = %s\n", getenv("ipaddr"));
printf("baudrate = %lu bps\n", bd->bi_baudrate); printf("baudrate = %lu bps\n", bd->bi_baudrate);
return 0; return 0;
@ -367,7 +367,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#if defined(CONFIG_CMD_NET) #if defined(CONFIG_CMD_NET)
print_eth(0); print_eth(0);
printf("ip_addr = %pI4\n", &bd->bi_ip_addr); printf("ip_addr = %s\n", getenv("ipaddr"));
#endif #endif
printf("baudrate = %d bps\n", bd->bi_baudrate); printf("baudrate = %d bps\n", bd->bi_baudrate);
#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF)) #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
@ -403,7 +403,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#if defined(CONFIG_CMD_NET) #if defined(CONFIG_CMD_NET)
print_eth(0); print_eth(0);
printf("ip_addr = %pI4\n", &bd->bi_ip_addr); printf("ip_addr = %s\n", getenv("ipaddr"));
#endif #endif
printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate); printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
return 0; return 0;
@ -436,7 +436,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#if defined(CONFIG_CMD_NET) #if defined(CONFIG_CMD_NET)
print_eth(0); print_eth(0);
printf("ip_addr = %pI4\n", &bd->bi_ip_addr); printf("ip_addr = %s\n", getenv("ipaddr"));
print_mhz("ethspeed", bd->bi_ethspeed); print_mhz("ethspeed", bd->bi_ethspeed);
#endif #endif
printf("baudrate = %d bps\n", bd->bi_baudrate); printf("baudrate = %d bps\n", bd->bi_baudrate);
@ -461,7 +461,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#if defined(CONFIG_CMD_NET) #if defined(CONFIG_CMD_NET)
print_eth(0); print_eth(0);
printf("ip_addr = %pI4\n", &bd->bi_ip_addr); printf("ip_addr = %s\n", getenv("ipaddr"));
#endif #endif
print_num("FB base ", gd->fb_base); print_num("FB base ", gd->fb_base);
return 0; return 0;
@ -485,7 +485,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#if defined(CONFIG_CMD_NET) #if defined(CONFIG_CMD_NET)
print_eth(0); print_eth(0);
printf("ip_addr = %pI4\n", &bd->bi_ip_addr); printf("ip_addr = %s\n", getenv("ipaddr"));
#endif #endif
printf("baudrate = %d bps\n", bd->bi_baudrate); printf("baudrate = %d bps\n", bd->bi_baudrate);
@ -506,7 +506,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#if defined(CONFIG_CMD_NET) #if defined(CONFIG_CMD_NET)
print_eth(0); print_eth(0);
printf("ip_addr = %pI4\n", &bd->bi_ip_addr); printf("ip_addr = %s\n", getenv("ipaddr"));
#endif #endif
printf("baudrate = %ld bps\n", bd->bi_baudrate); printf("baudrate = %ld bps\n", bd->bi_baudrate);

View file

@ -343,21 +343,7 @@ int _do_env_set(int flag, int argc, char * const argv[])
* Some variables should be updated when the corresponding * Some variables should be updated when the corresponding
* entry in the environment is changed * entry in the environment is changed
*/ */
if (strcmp(name, "ipaddr") == 0) { if (strcmp(argv[1], "loadaddr") == 0) {
char *s = argv[2]; /* always use only one arg */
char *e;
unsigned long addr;
bd->bi_ip_addr = 0;
for (addr = 0, i = 0; i < 4; ++i) {
ulong val = s ? simple_strtoul(s, &e, 10) : 0;
addr <<= 8;
addr |= val & 0xFF;
if (s)
s = *e ? e + 1 : e;
}
bd->bi_ip_addr = htonl(addr);
return 0;
} else if (strcmp(argv[1], "loadaddr") == 0) {
load_addr = simple_strtoul(argv[2], NULL, 16); load_addr = simple_strtoul(argv[2], NULL, 16);
return 0; return 0;
} }

View file

@ -338,13 +338,11 @@ void net_auto_load(void)
static void NetInitLoop(enum proto_t protocol) static void NetInitLoop(enum proto_t protocol)
{ {
static int env_changed_id; static int env_changed_id;
bd_t *bd = gd->bd;
int env_id = get_env_id(); int env_id = get_env_id();
/* update only when the environment has changed */ /* update only when the environment has changed */
if (env_changed_id != env_id) { if (env_changed_id != env_id) {
NetOurIP = getenv_IPaddr("ipaddr"); NetOurIP = getenv_IPaddr("ipaddr");
NetCopyIP(&bd->bi_ip_addr, &NetOurIP);
NetOurGatewayIP = getenv_IPaddr("gatewayip"); NetOurGatewayIP = getenv_IPaddr("gatewayip");
NetOurSubnetMask = getenv_IPaddr("netmask"); NetOurSubnetMask = getenv_IPaddr("netmask");
NetServerIP = getenv_IPaddr("serverip"); NetServerIP = getenv_IPaddr("serverip");