From: wdenk Date: Wed, 8 Sep 2004 22:03:11 +0000 (+0000) Subject: * Patch by Detlev Zundel, 08 Sep 2004: X-Git-Tag: LABEL_2006_03_12_0025~499 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=eedcd078fe1434d93b84322c4e14c52f80282a41;p=oweals%2Fu-boot.git * Patch by Detlev Zundel, 08 Sep 2004: Update etags build target * Improve NetConsole support: add support for broadcast destination address and buffered input. * Cleanup compiler warnings for GCC 3.3.x and later * Fix problem in cmd_jffs2.c introduced by CFG_JFFS_SINGLE_PART patch --- diff --git a/CHANGELOG b/CHANGELOG index 0a4b951c18..4907906978 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,16 @@ Changes since U-Boot 1.1.1: ====================================================================== +* Patch by Detlev Zundel, 08 Sep 2004: + Update etags build target + +* Improve NetConsole support: add support for broadcast destination + address and buffered input. + +* Cleanup compiler warnings for GCC 3.3.x and later + +* Fix problem in cmd_jffs2.c introduced by CFG_JFFS_SINGLE_PART patch + * Add support for IDS "NC650" board * Add automatic update support for LWMON board diff --git a/Makefile b/Makefile index e27b09314b..ba52bdd377 100644 --- a/Makefile +++ b/Makefile @@ -176,6 +176,9 @@ tags: etags: etags -a `find $(SUBDIRS) include \ + lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \ + fs/cramfs fs/fat fs/fdos fs/jffs2 \ + net disk rtc dtt drivers drivers/sk98lin common \ \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)` System.map: u-boot @@ -1470,7 +1473,7 @@ clean: examples/eepro100_eeprom examples/sched \ examples/mem_to_mem_idma2intr examples/82559_eeprom rm -f tools/img2srec tools/mkimage tools/envcrc tools/gen_eth_addr - rm -f tools/mpc86x_clk + rm -f tools/mpc86x_clk tools/ncb rm -f tools/easylogo/easylogo tools/bmp_logo rm -f tools/gdb/astest tools/gdb/gdbcont tools/gdb/gdbsend rm -f tools/env/fw_printenv tools/env/fw_setenv diff --git a/board/Marvell/db64360/db64360.c b/board/Marvell/db64360/db64360.c index 7cadafd688..8e181d4e68 100644 --- a/board/Marvell/db64360/db64360.c +++ b/board/Marvell/db64360/db64360.c @@ -549,18 +549,18 @@ static void move64 (unsigned long long *src, unsigned long long *dest) #if defined (CFG_DRAM_TEST_DATA) unsigned long long pattern[] = { - 0xaaaaaaaaaaaaaaaa, - 0xcccccccccccccccc, - 0xf0f0f0f0f0f0f0f0, - 0xff00ff00ff00ff00, - 0xffff0000ffff0000, - 0xffffffff00000000, - 0x00000000ffffffff, - 0x0000ffff0000ffff, - 0x00ff00ff00ff00ff, - 0x0f0f0f0f0f0f0f0f, - 0x3333333333333333, - 0x5555555555555555 + 0xaaaaaaaaaaaaaaaaULL, + 0xccccccccccccccccULL, + 0xf0f0f0f0f0f0f0f0ULL, + 0xff00ff00ff00ff00ULL, + 0xffff0000ffff0000ULL, + 0xffffffff00000000ULL, + 0x00000000ffffffffULL, + 0x0000ffff0000ffffULL, + 0x00ff00ff00ff00ffULL, + 0x0f0f0f0f0f0f0f0fULL, + 0x3333333333333333ULL, + 0x5555555555555555ULL, }; /*********************************************************************/ diff --git a/board/Marvell/db64460/db64460.c b/board/Marvell/db64460/db64460.c index 85b2331c91..75eb5e89be 100644 --- a/board/Marvell/db64460/db64460.c +++ b/board/Marvell/db64460/db64460.c @@ -549,18 +549,18 @@ static void move64 (unsigned long long *src, unsigned long long *dest) #if defined (CFG_DRAM_TEST_DATA) unsigned long long pattern[] = { - 0xaaaaaaaaaaaaaaaa, - 0xcccccccccccccccc, - 0xf0f0f0f0f0f0f0f0, - 0xff00ff00ff00ff00, - 0xffff0000ffff0000, - 0xffffffff00000000, - 0x00000000ffffffff, - 0x0000ffff0000ffff, - 0x00ff00ff00ff00ff, - 0x0f0f0f0f0f0f0f0f, - 0x3333333333333333, - 0x5555555555555555 + 0xaaaaaaaaaaaaaaaaULL, + 0xccccccccccccccccULL, + 0xf0f0f0f0f0f0f0f0ULL, + 0xff00ff00ff00ff00ULL, + 0xffff0000ffff0000ULL, + 0xffffffff00000000ULL, + 0x00000000ffffffffULL, + 0x0000ffff0000ffffULL, + 0x00ff00ff00ff00ffULL, + 0x0f0f0f0f0f0f0f0fULL, + 0x3333333333333333ULL, + 0x5555555555555555ULL, }; /*********************************************************************/ diff --git a/board/dave/PPChameleonEVB/PPChameleonEVB.c b/board/dave/PPChameleonEVB/PPChameleonEVB.c index ffa53f8232..0bd43bd023 100644 --- a/board/dave/PPChameleonEVB/PPChameleonEVB.c +++ b/board/dave/PPChameleonEVB/PPChameleonEVB.c @@ -32,7 +32,7 @@ /* ------------------------------------------------------------------------- */ /* Prototypes */ -int gunzip(void *, int, unsigned char *, int *); +int gunzip(void *, int, unsigned char *, unsigned long *); int board_early_init_f (void) { @@ -104,7 +104,7 @@ int misc_init_r (void) unsigned long cntrl0Reg; dst = malloc(CFG_FPGA_MAX_SIZE); - if (gunzip (dst, CFG_FPGA_MAX_SIZE, (uchar *)fpgadata, (int *)&len) != 0) { + if (gunzip (dst, CFG_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) { printf ("GUNZIP ERROR - must RESET board to recover\n"); do_reset (NULL, 0, 0, NULL); } diff --git a/board/esd/ash405/ash405.c b/board/esd/ash405/ash405.c index 22b3828599..012505e4e6 100644 --- a/board/esd/ash405/ash405.c +++ b/board/esd/ash405/ash405.c @@ -47,7 +47,7 @@ const unsigned char fpgadata[] = /* Prototypes */ -int gunzip(void *, int, unsigned char *, int *); +int gunzip(void *, int, unsigned char *, unsigned long *); int board_early_init_f (void) @@ -102,7 +102,7 @@ int misc_init_r (void) int i; dst = malloc(CFG_FPGA_MAX_SIZE); - if (gunzip (dst, CFG_FPGA_MAX_SIZE, (uchar *)fpgadata, (int *)&len) != 0) { + if (gunzip (dst, CFG_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) { printf ("GUNZIP ERROR - must RESET board to recover\n"); do_reset (NULL, 0, 0, NULL); } diff --git a/board/esd/cpci405/cpci405.c b/board/esd/cpci405/cpci405.c index 1b90d0542a..bbae87beac 100644 --- a/board/esd/cpci405/cpci405.c +++ b/board/esd/cpci405/cpci405.c @@ -54,7 +54,7 @@ const unsigned char fpgadata[] = /* Prototypes */ int cpci405_version(void); -int gunzip(void *, int, unsigned char *, int *); +int gunzip(void *, int, unsigned char *, unsigned long *); int board_early_init_f (void) @@ -259,7 +259,7 @@ int misc_init_r (void) mtdcr(cntrl0, cntrl0Reg | 0x00300000); dst = malloc(CFG_FPGA_MAX_SIZE); - if (gunzip (dst, CFG_FPGA_MAX_SIZE, (uchar *)fpgadata, (int *)&len) != 0) { + if (gunzip (dst, CFG_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) { printf ("GUNZIP ERROR - must RESET board to recover\n"); do_reset (NULL, 0, 0, NULL); } diff --git a/board/esd/pci405/pci405.c b/board/esd/pci405/pci405.c index 44bfe107fe..05f59a8cc5 100644 --- a/board/esd/pci405/pci405.c +++ b/board/esd/pci405/pci405.c @@ -50,7 +50,7 @@ const unsigned char fpgadata[] = /* Prototypes */ -int gunzip(void *, int, unsigned char *, int *); +int gunzip(void *, int, unsigned char *, unsigned long *); int board_early_init_f (void) @@ -116,7 +116,7 @@ int misc_init_r (void) */ dst = malloc(CFG_FPGA_MAX_SIZE); - if (gunzip (dst, CFG_FPGA_MAX_SIZE, (uchar *)fpgadata, (int *)&len) != 0) { + if (gunzip (dst, CFG_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) { printf ("GUNZIP ERROR - must RESET board to recover\n"); do_reset (NULL, 0, 0, NULL); } diff --git a/board/esd/plu405/plu405.c b/board/esd/plu405/plu405.c index ebefa670ff..04f386f2b9 100644 --- a/board/esd/plu405/plu405.c +++ b/board/esd/plu405/plu405.c @@ -47,7 +47,7 @@ const unsigned char fpgadata[] = /* Prototypes */ -int gunzip(void *, int, unsigned char *, int *); +int gunzip(void *, int, unsigned char *, unsigned long *); int board_early_init_f (void) @@ -101,7 +101,7 @@ int misc_init_r (void) #if 1 /* test-only */ dst = malloc(CFG_FPGA_MAX_SIZE); - if (gunzip (dst, CFG_FPGA_MAX_SIZE, (uchar *)fpgadata, (int *)&len) != 0) { + if (gunzip (dst, CFG_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) { printf ("GUNZIP ERROR - must RESET board to recover\n"); do_reset (NULL, 0, 0, NULL); } diff --git a/board/esd/voh405/voh405.c b/board/esd/voh405/voh405.c index d62c570b26..d73db40eae 100644 --- a/board/esd/voh405/voh405.c +++ b/board/esd/voh405/voh405.c @@ -47,7 +47,7 @@ const unsigned char fpgadata[] = /* Prototypes */ -int gunzip(void *, int, unsigned char *, int *); +int gunzip(void *, int, unsigned char *, unsigned long *); int board_early_init_f (void) @@ -102,7 +102,7 @@ int misc_init_r (void) int i; dst = malloc(CFG_FPGA_MAX_SIZE); - if (gunzip (dst, CFG_FPGA_MAX_SIZE, (uchar *)fpgadata, (int *)&len) != 0) { + if (gunzip (dst, CFG_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) { printf ("GUNZIP ERROR - must RESET board to recover\n"); do_reset (NULL, 0, 0, NULL); } diff --git a/board/gw8260/gw8260.c b/board/gw8260/gw8260.c index 009ca3011b..163d58ccf5 100644 --- a/board/gw8260/gw8260.c +++ b/board/gw8260/gw8260.c @@ -259,18 +259,18 @@ static void move64 (unsigned long long *src, unsigned long long *dest) #if defined (CFG_DRAM_TEST_DATA) unsigned long long pattern[] = { - 0xaaaaaaaaaaaaaaaa, - 0xcccccccccccccccc, - 0xf0f0f0f0f0f0f0f0, - 0xff00ff00ff00ff00, - 0xffff0000ffff0000, - 0xffffffff00000000, - 0x00000000ffffffff, - 0x0000ffff0000ffff, - 0x00ff00ff00ff00ff, - 0x0f0f0f0f0f0f0f0f, - 0x3333333333333333, - 0x5555555555555555 + 0xaaaaaaaaaaaaaaaaULL, + 0xccccccccccccccccULL, + 0xf0f0f0f0f0f0f0f0ULL, + 0xff00ff00ff00ff00ULL, + 0xffff0000ffff0000ULL, + 0xffffffff00000000ULL, + 0x00000000ffffffffULL, + 0x0000ffff0000ffffULL, + 0x00ff00ff00ff00ffULL, + 0x0f0f0f0f0f0f0f0fULL, + 0x3333333333333333ULL, + 0x5555555555555555ULL, }; /*********************************************************************/ diff --git a/board/lwmon/lwmon.c b/board/lwmon/lwmon.c index 904e7ea98c..5b2b41a976 100644 --- a/board/lwmon/lwmon.c +++ b/board/lwmon/lwmon.c @@ -643,7 +643,7 @@ static uchar kbd_command_prefix[] = "key_cmd"; static int compare_magic (uchar *kbd_data, uchar *str) { uchar compare[KEYBD_DATALEN-1]; - uchar *nxt; + char *nxt; int i; /* Don't include modifier byte */ @@ -655,7 +655,7 @@ static int compare_magic (uchar *kbd_data, uchar *str) c = (uchar) simple_strtoul (str, (char **) (&nxt), 16); - if (str == nxt) { /* invalid character */ + if (str == (uchar *)nxt) { /* invalid character */ break; } diff --git a/board/mpl/common/common_util.c b/board/mpl/common/common_util.c index 793684d0e2..e14bccaced 100644 --- a/board/mpl/common/common_util.c +++ b/board/mpl/common/common_util.c @@ -46,7 +46,7 @@ #define FIRM_START 0xFFF00000 #endif -extern int gunzip(void *, int, uchar *, int *); +extern int gunzip(void *, int, uchar *, unsigned long *); extern int mem_test(ulong start, ulong ramsize, int quiet); #define I2C_BACKUP_ADDR 0x7C00 /* 0x200 bytes for backup */ @@ -224,7 +224,7 @@ mpl_prg_image(uchar *ld_addr) switch (hdr->ih_comp) { case IH_COMP_GZIP: puts("Uncompressing (GZIP) ... "); - rc = gunzip ((void *)(buf), IMAGE_SIZE, data, (int *)&len); + rc = gunzip ((void *)(buf), IMAGE_SIZE, data, &len); if (rc != 0) { puts("GUNZIP ERROR\n"); free(buf); diff --git a/board/trab/memory.c b/board/trab/memory.c index 5c7beb9892..97cb0f89a4 100644 --- a/board/trab/memory.c +++ b/board/trab/memory.c @@ -206,19 +206,20 @@ static void move64(unsigned long long *src, unsigned long long *dest) * */ const static unsigned long long pattern[] = { - 0xaaaaaaaaaaaaaaaa, - 0xcccccccccccccccc, - 0xf0f0f0f0f0f0f0f0, - 0xff00ff00ff00ff00, - 0xffff0000ffff0000, - 0xffffffff00000000, - 0x00000000ffffffff, - 0x0000ffff0000ffff, - 0x00ff00ff00ff00ff, - 0x0f0f0f0f0f0f0f0f, - 0x3333333333333333, - 0x5555555555555555}; -const unsigned long long otherpattern = 0x0123456789abcdef; + 0xaaaaaaaaaaaaaaaaULL, + 0xccccccccccccccccULL, + 0xf0f0f0f0f0f0f0f0ULL, + 0xff00ff00ff00ff00ULL, + 0xffff0000ffff0000ULL, + 0xffffffff00000000ULL, + 0x00000000ffffffffULL, + 0x0000ffff0000ffffULL, + 0x00ff00ff00ff00ffULL, + 0x0f0f0f0f0f0f0f0fULL, + 0x3333333333333333ULL, + 0x5555555555555555ULL, +}; +const unsigned long long otherpattern = 0x0123456789abcdefULL; static int memory_post_dataline(unsigned long long * pmem) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 421269ef2c..5aa072fbd1 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -73,7 +73,7 @@ # define CHUNKSZ (64 * 1024) #endif -int gunzip (void *, int, unsigned char *, int *); +int gunzip (void *, int, unsigned char *, unsigned long *); static void *zalloc(void *, unsigned, unsigned); static void zfree(void *, void *, unsigned); @@ -326,7 +326,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) case IH_COMP_GZIP: printf (" Uncompressing %s ... ", name); if (gunzip ((void *)ntohl(hdr->ih_load), unc_len, - (uchar *)data, (int *)&len) != 0) { + (uchar *)data, &len) != 0) { puts ("GUNZIP ERROR - must RESET board to recover\n"); SHOW_BOOT_PROGRESS (-6); do_reset (cmdtp, flag, argc, argv); @@ -1239,7 +1239,7 @@ static void zfree(void *x, void *addr, unsigned nb) #define DEFLATED 8 -int gunzip(void *dst, int dstlen, unsigned char *src, int *lenp) +int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp) { z_stream s; int r, i, flags; diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c index f7a5f9ebfd..63fddf657a 100644 --- a/common/cmd_jffs2.c +++ b/common/cmd_jffs2.c @@ -257,6 +257,12 @@ do_jffs2_chpart(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } + +U_BOOT_CMD( + chpart, 2, 0, do_jffs2_chpart, + "chpart\t- change active partition\n", + " - change active partition\n" +); #endif /* CFG_JFFS_SINGLE_PART */ /***************************************************/ @@ -282,10 +288,4 @@ U_BOOT_CMD( " - list files in a directory.\n" ); -U_BOOT_CMD( - chpart, 2, 0, do_jffs2_chpart, - "chpart\t- change active partition\n", - " - change active partition\n" -); - #endif /* CFG_CMD_JFFS2 */ diff --git a/doc/README.NetConsole b/doc/README.NetConsole index 8dc0d29197..aa13627659 100644 --- a/doc/README.NetConsole +++ b/doc/README.NetConsole @@ -6,6 +6,12 @@ serial and network input/output devices by adjusting the 'stdin' and set either of these variables to "nc". Input and output can be switched independently. +We use an environment variable 'ncip' to set the IP address and the +port of the destination. The format is :. If is +omitted, the value of 6666 is used. If the env var doesn't exist, the +broadcast address and port 6666 are used. If it is set to an IP +address of 0 (or 0.0.0.0) then no messages are sent to the network. + On the host side, please use this script to access the console: +++++++++++++++++++++++++++++++++++++++++++ @@ -19,6 +25,21 @@ nc -u ${TARGET_IP} 6666 stty icanon echo intr ^C +++++++++++++++++++++++++++++++++++++++++++ +It turned out that 'netcat' couldn't be used to listen to broadcast +packets. We developed our own tool 'ncb' (see tools directory) that +listens to broadcast packets on a given port and dumps them to the +standard output. use it as follows: + ++++++++++++++++++++++++++++++++++++++++++++ +#! /bin/bash + +stty icanon echo intr ^T +./ncb & +nc -u mpc5200 6666 +stty icanon echo intr ^C +kill 0 ++++++++++++++++++++++++++++++++++++++++++++ + For Linux, the network-based console needs special configuration. Minimally, the host IP address needs to be specified. This can be done either via the kernel command line, or by passing parameters diff --git a/drivers/i82365.c b/drivers/i82365.c index 5f44eacdde..1ac50d783a 100644 --- a/drivers/i82365.c +++ b/drivers/i82365.c @@ -429,7 +429,8 @@ static int i365_set_io_map (socket_info_t * s, struct pccard_io_map *io) u_char map, ioctl; map = io->map; - if ((map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) || + /* comment out: comparison is always false due to limited range of data type */ + if ((map > 1) || /* (io->start > 0xffff) || (io->stop > 0xffff) || */ (io->stop < io->start)) return -1; /* Turn off the window before changing anything */ diff --git a/drivers/netconsole.c b/drivers/netconsole.c index 7e19161321..6c27c08f2a 100644 --- a/drivers/netconsole.c +++ b/drivers/netconsole.c @@ -33,10 +33,17 @@ #error define CONFIG_NET_MULTI to use netconsole #endif -static uchar nc_buf = 0; /* input buffer */ +static char input_buffer[512]; +static int input_size = 0; /* char count in input buffer */ +static int input_offset = 0; /* offset to valid chars in input buffer */ static int input_recursion = 0; static int output_recursion = 0; static int net_timeout; +static uchar nc_ether[6]; /* server enet address */ +static IPaddr_t nc_ip; /* server ip */ +static short nc_port; /* source/target port */ +static const char *output_packet; /* used by first send udp */ +static int output_packet_len = 0; static void nc_wait_arp_handler (uchar * pkt, unsigned dest, unsigned src, unsigned len) @@ -47,7 +54,7 @@ static void nc_wait_arp_handler (uchar * pkt, unsigned dest, unsigned src, static void nc_handler (uchar * pkt, unsigned dest, unsigned src, unsigned len) { - if (nc_buf) + if (input_size) NetState = NETLOOP_SUCCESS; /* got input - quit net loop */ } @@ -58,23 +65,45 @@ static void nc_timeout (void) void NcStart (void) { - if (memcmp (NetServerEther, NetEtherNullAddr, 6)) { + if (!output_packet_len || memcmp (nc_ether, NetEtherNullAddr, 6)) { /* going to check for input packet */ NetSetHandler (nc_handler); NetSetTimeout (net_timeout, nc_timeout); } else { /* send arp request */ + uchar *pkt; NetSetHandler (nc_wait_arp_handler); - NetSendUDPPacket (NetServerEther, NetServerIP, 6665, 6666, 0); + pkt = (uchar *) NetTxPacket + NetEthHdrSize () + IP_HDR_SIZE; + memcpy (pkt, output_packet, output_packet_len); + NetSendUDPPacket (nc_ether, nc_ip, nc_port, nc_port, output_packet_len); } } int nc_input_packet (uchar * pkt, unsigned dest, unsigned src, unsigned len) { - if (dest != 6666 || !len) + int end, chunk; + + if (dest != nc_port || !len) return 0; /* not for us */ - nc_buf = *pkt; + if (input_size == sizeof input_buffer) + return 1; /* no space */ + if (len > sizeof input_buffer - input_size) + len = sizeof input_buffer - input_size; + + end = input_offset + input_size; + if (end > sizeof input_buffer) + end -= sizeof input_buffer; + + chunk = len; + if (end + len > sizeof input_buffer) { + chunk = sizeof input_buffer - end; + memcpy(input_buffer, pkt + chunk, len - chunk); + } + memcpy (input_buffer + end, pkt, chunk); + + input_size += len; + return 1; } @@ -85,11 +114,20 @@ static void nc_send_packet (const char *buf, int len) struct eth_device *eth; int inited = 0; uchar *pkt; + uchar *ether; + IPaddr_t ip; - if (!memcmp (NetServerEther, NetEtherNullAddr, 6)) + if ((eth = eth_get_dev ()) == NULL) { return; + } - if ((eth = eth_get_dev ()) == NULL) { + if (!memcmp (nc_ether, NetEtherNullAddr, 6)) { + if (eth->state == ETH_STATE_ACTIVE) + return; /* inside net loop */ + output_packet = buf; + output_packet_len = len; + NetLoop (NETCONS); /* wait for arp reply and send packet */ + output_packet_len = 0; return; } @@ -100,7 +138,9 @@ static void nc_send_packet (const char *buf, int len) } pkt = (uchar *) NetTxPacket + NetEthHdrSize () + IP_HDR_SIZE; memcpy (pkt, buf, len); - NetSendUDPPacket (NetServerEther, NetServerIP, 6666, 6665, len); + ether = nc_ether; + ip = nc_ip; + NetSendUDPPacket (ether, ip, nc_port, nc_port, len); if (inited) eth_halt (); @@ -108,10 +148,31 @@ static void nc_send_packet (const char *buf, int len) int nc_start (void) { - if (memcmp (NetServerEther, NetEtherNullAddr, 6)) - return 0; - - return NetLoop (NETCONS); /* wait for arp reply */ + int netmask, our_ip; + + nc_port = 6666; /* default port */ + + if (getenv ("ncip")) { + nc_ip = getenv_IPaddr ("ncip"); + if (!nc_ip) + return -1; /* ncip is 0.0.0.0 */ + char *p = strchr (getenv ("ncip"), ':'); + if (p) + nc_port = simple_strtoul (p + 1, NULL, 10); + } else + nc_ip = ~0; /* ncip is not set */ + + our_ip = getenv_IPaddr ("ipaddr"); + netmask = getenv_IPaddr ("netmask"); + + if (nc_ip == ~0 || /* 255.255.255.255 */ + ((netmask & our_ip) == (netmask & nc_ip) && /* on the same net */ + (netmask | nc_ip) == ~0)) /* broadcast to our net */ + memset (nc_ether, 0xff, sizeof nc_ether); + else + memset (nc_ether, 0, sizeof nc_ether); /* force arp request */ + + return 0; } void nc_putc (char c) @@ -146,15 +207,18 @@ int nc_getc (void) input_recursion = 1; net_timeout = 0; /* no timeout */ - while (!nc_buf) + while (!input_size) NetLoop (NETCONS); input_recursion = 0; - uchar tmp = nc_buf; + uchar c = input_buffer[input_offset]; + input_offset++; + if (input_offset >= sizeof input_buffer) + input_offset -= sizeof input_buffer; + input_size--; - nc_buf = 0; - return tmp; + return c; } int nc_tstc (void) @@ -164,7 +228,7 @@ int nc_tstc (void) if (input_recursion) return 0; - if (nc_buf) + if (input_size) return 1; eth = eth_get_dev (); @@ -174,11 +238,11 @@ int nc_tstc (void) input_recursion = 1; net_timeout = 1; - NetLoop (NETCONS); /* kind of poll */ + NetLoop (NETCONS); /* kind of poll */ input_recursion = 0; - return nc_buf != 0; + return input_size != 0; } int drv_nc_init (void) diff --git a/drivers/smiLynxEM.c b/drivers/smiLynxEM.c index 26469e2a38..94092a3e75 100644 --- a/drivers/smiLynxEM.c +++ b/drivers/smiLynxEM.c @@ -550,7 +550,7 @@ static void smiLoadCcr (struct ctfb_res_modes *var, unsigned short device_id) smiWrite (SMI_INDX_C4, 0x6b, 0x15); /* VCLK */ - freq = 1000000000000L / var -> pixclock; + freq = 1000000000000LL / var -> pixclock; FindPQ ((unsigned int)freq, &p, &q); diff --git a/include/configs/ML2.h b/include/configs/ML2.h index 5fe5d5444a..c6cc69bc23 100644 --- a/include/configs/ML2.h +++ b/include/configs/ML2.h @@ -76,12 +76,17 @@ #define CFG_LOADS_BAUD_CHANGE 1 /* allow baudrate change */ -#define CONFIG_COMMANDS ( (CONFIG_CMD_DFL & (~CFG_CMD_NET) & \ - (~CFG_CMD_RTC) & ~(CFG_CMD_PCI) & ~(CFG_CMD_I2C)) | \ +#define CONFIG_COMMANDS ((CONFIG_CMD_DFL & \ + ~( CFG_CMD_NET | \ + CFG_CMD_RTC | \ + CFG_CMD_PCI | \ + CFG_CMD_I2C \ + ) ) | \ CFG_CMD_IRQ | \ CFG_CMD_KGDB | \ CFG_CMD_BEDBUG | \ - CFG_CMD_ELF | CFG_CMD_JFFS2 ) + CFG_CMD_ELF | \ + CFG_CMD_JFFS2 ) /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ #include diff --git a/include/configs/ep8260.h b/include/configs/ep8260.h index d8db530e14..a17d035300 100644 --- a/include/configs/ep8260.h +++ b/include/configs/ep8260.h @@ -269,31 +269,31 @@ /* What U-Boot subsytems do you want enabled? */ /* */ -#define CONFIG_COMMANDS ( CFG_CMD_ALL & \ - ~CFG_CMD_BMP & \ - ~CFG_CMD_BSP & \ - ~CFG_CMD_DCR & \ - ~CFG_CMD_DHCP & \ - ~CFG_CMD_DOC & \ - ~CFG_CMD_DTT & \ - ~CFG_CMD_EEPROM & \ - ~CFG_CMD_FDC & \ - ~CFG_CMD_FDOS & \ - ~CFG_CMD_HWFLOW & \ - ~CFG_CMD_IDE & \ - ~CFG_CMD_JFFS2 & \ - ~CFG_CMD_KGDB & \ - ~CFG_CMD_MII & \ - ~CFG_CMD_MMC & \ - ~CFG_CMD_NAND & \ - ~CFG_CMD_PCI & \ - ~CFG_CMD_PCMCIA & \ - ~CFG_CMD_REISER & \ - ~CFG_CMD_SCSI & \ - ~CFG_CMD_SPI & \ - ~CFG_CMD_USB & \ - ~CFG_CMD_VFD & \ - ~CFG_CMD_XIMG ) +#define CONFIG_COMMANDS ( CFG_CMD_ALL & \ + ~( CFG_CMD_BMP | \ + CFG_CMD_BSP | \ + CFG_CMD_DCR | \ + CFG_CMD_DHCP | \ + CFG_CMD_DOC | \ + CFG_CMD_DTT | \ + CFG_CMD_EEPROM | \ + CFG_CMD_FDC | \ + CFG_CMD_FDOS | \ + CFG_CMD_HWFLOW | \ + CFG_CMD_IDE | \ + CFG_CMD_JFFS2 | \ + CFG_CMD_KGDB | \ + CFG_CMD_MII | \ + CFG_CMD_MMC | \ + CFG_CMD_NAND | \ + CFG_CMD_PCI | \ + CFG_CMD_PCMCIA | \ + CFG_CMD_REISER | \ + CFG_CMD_SCSI | \ + CFG_CMD_SPI | \ + CFG_CMD_USB | \ + CFG_CMD_VFD | \ + CFG_CMD_XIMG ) ) /* Where do the internal registers live? */ #define CFG_IMMR 0xF0000000 diff --git a/post/memory.c b/post/memory.c index 8b4263161c..0dac858ea4 100644 --- a/post/memory.c +++ b/post/memory.c @@ -206,19 +206,20 @@ static void move64(unsigned long long *src, unsigned long long *dest) * */ const static unsigned long long pattern[] = { - 0xaaaaaaaaaaaaaaaa, - 0xcccccccccccccccc, - 0xf0f0f0f0f0f0f0f0, - 0xff00ff00ff00ff00, - 0xffff0000ffff0000, - 0xffffffff00000000, - 0x00000000ffffffff, - 0x0000ffff0000ffff, - 0x00ff00ff00ff00ff, - 0x0f0f0f0f0f0f0f0f, - 0x3333333333333333, - 0x5555555555555555}; -const unsigned long long otherpattern = 0x0123456789abcdef; + 0xaaaaaaaaaaaaaaaaULL, + 0xccccccccccccccccULL, + 0xf0f0f0f0f0f0f0f0ULL, + 0xff00ff00ff00ff00ULL, + 0xffff0000ffff0000ULL, + 0xffffffff00000000ULL, + 0x00000000ffffffffULL, + 0x0000ffff0000ffffULL, + 0x00ff00ff00ff00ffULL, + 0x0f0f0f0f0f0f0f0fULL, + 0x3333333333333333ULL, + 0x5555555555555555ULL +}; +const unsigned long long otherpattern = 0x0123456789abcdefULL; static int memory_post_dataline(unsigned long long * pmem) diff --git a/tools/Makefile b/tools/Makefile index 0576a3f43e..911543031e 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -131,6 +131,10 @@ mkimage$(SFX): mkimage.o crc32.o $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ $(STRIP) $@ +ncb$(SFX): ncb.o + $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ + $(STRIP) $@ + gen_eth_addr$(SFX): gen_eth_addr.o $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ $(STRIP) $@ @@ -156,6 +160,9 @@ crc32.o: crc32.c mkimage.o: mkimage.c $(CC) -g $(CFLAGS) -c $< +ncb.o: ncb.c + $(CC) -g $(CFLAGS) -c $< + gen_eth_addr.o: gen_eth_addr.c $(CC) -g $(CFLAGS) -c $< diff --git a/tools/ncb.c b/tools/ncb.c new file mode 100644 index 0000000000..74deebb652 --- /dev/null +++ b/tools/ncb.c @@ -0,0 +1,36 @@ +#include +#include +#include +#include + +int main (int argc, char *argv[]) +{ + int s, len, o, port = 6666; + char buf[512]; + struct sockaddr_in addr; + int addr_len = sizeof addr; + + if (argc > 1) + port = atoi (argv[1]); + + s = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP); + + o = 1; + len = 4; + setsockopt (3, SOL_SOCKET, SO_REUSEADDR, &o, len); + + addr.sin_family = AF_INET; + addr.sin_port = htons (port); + addr.sin_addr.s_addr = INADDR_ANY; /* receive broadcasts */ + + bind (s, (struct sockaddr *) &addr, sizeof addr); + + for (;;) { + len = recvfrom (s, buf, sizeof buf, 0, (struct sockaddr *) &addr, &addr_len); + if (len < 0) + break; + write (1, buf, len); + } + + return 0; +}