* Patch by Detlev Zundel, 08 Sep 2004: LABEL_2004_09_09_0000
authorwdenk <wdenk>
Wed, 8 Sep 2004 22:03:11 +0000 (22:03 +0000)
committerwdenk <wdenk>
Wed, 8 Sep 2004 22:03:11 +0000 (22:03 +0000)
  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

25 files changed:
CHANGELOG
Makefile
board/Marvell/db64360/db64360.c
board/Marvell/db64460/db64460.c
board/dave/PPChameleonEVB/PPChameleonEVB.c
board/esd/ash405/ash405.c
board/esd/cpci405/cpci405.c
board/esd/pci405/pci405.c
board/esd/plu405/plu405.c
board/esd/voh405/voh405.c
board/gw8260/gw8260.c
board/lwmon/lwmon.c
board/mpl/common/common_util.c
board/trab/memory.c
common/cmd_bootm.c
common/cmd_jffs2.c
doc/README.NetConsole
drivers/i82365.c
drivers/netconsole.c
drivers/smiLynxEM.c
include/configs/ML2.h
include/configs/ep8260.h
post/memory.c
tools/Makefile
tools/ncb.c [new file with mode: 0644]

index 0a4b951..4907906 100644 (file)
--- 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
index e27b093..ba52bdd 100644 (file)
--- 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
index 7cadafd..8e181d4 100644 (file)
@@ -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,
 };
 
 /*********************************************************************/
index 85b2331..75eb5e8 100644 (file)
@@ -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,
 };
 
 /*********************************************************************/
index ffa53f8..0bd43bd 100644 (file)
@@ -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);
        }
index 22b3828..012505e 100644 (file)
@@ -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);
        }
index 1b90d05..bbae87b 100644 (file)
@@ -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);
                }
index 44bfe10..05f59a8 100644 (file)
@@ -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);
        }
index ebefa67..04f386f 100644 (file)
@@ -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);
        }
index d62c570..d73db40 100644 (file)
@@ -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);
        }
index 009ca30..163d58c 100644 (file)
@@ -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,
 };
 
 /*********************************************************************/
index 904e7ea..5b2b41a 100644 (file)
@@ -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;
                }
 
index 793684d..e14bcca 100644 (file)
@@ -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);
index 5c7beb9..97cb0f8 100644 (file)
@@ -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)
index 421269e..5aa072f 100644 (file)
@@ -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;
index f7a5f9e..63fddf6 100644 (file)
@@ -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 */
index 8dc0d29..aa13627 100644 (file)
@@ -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 <ip_addr>:<port>. If <port> 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
index 5f44eac..1ac50d7 100644 (file)
@@ -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 */
index 7e19161..6c27c08 100644 (file)
 #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)
index 26469e2..94092a3 100644 (file)
@@ -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);
 
index 5fe5d54..c6cc69b 100644 (file)
 #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 <cmd_confdefs.h>
index d8db530..a17d035 100644 (file)
 /* 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
index 8b42631..0dac858 100644 (file)
@@ -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)
index 0576a3f..9115430 100644 (file)
@@ -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 (file)
index 0000000..74deebb
--- /dev/null
@@ -0,0 +1,36 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <linux/in.h>
+
+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;
+}