]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
* 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 0a4b951c189fa9c6e78c04b0c193beffec4f0a67..490790697829bbfe7fd84e9c81bb064c7ddc4772 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 e27b09314b4e553c51607835f30dec67913e08b2..ba52bdd37768cb06840894ccabdcb94f48eafabb 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 7cadafd688a61079060e0394f75523b4d0c4aeae..8e181d4e68cfc5ad71dd5e719463be25ef97e3d8 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 85b2331c919a77d99024a04e8f06b3d341415ca0..75eb5e89be6f98e0ad47b1767e401d3e20ec8335 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 ffa53f8232a34e7a17f8bf56ccc1e61807378d71..0bd43bd02348af7b0c65884b5deed594d8539bbb 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 22b38285995bca536abf25822bc1d390a2ac75dd..012505e4e6c92d05ad5defd0a539300d7e660641 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 1b90d0542a3112a2e513aa8793bf6df376b47478..bbae87beacd4f4fc53444fa06f651632d77238d8 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 44bfe107feb54ba8bb7abc668755cb7bf39fb1fe..05f59a8cc52b6fc2dfa70a887cf86bf86fa9856f 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 ebefa670ff7ed4fcd688f98d14f49cf5b3b4346c..04f386f2b9e25ee8378b5c9c44f6da70cbcf7139 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 d62c570b261ef02d24ac6be9352b6f2e4cfa4738..d73db40eaee8474800817e7a8fb1473504843130 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 009ca3011b8e4b16e54495787083d8f3899e0906..163d58ccf536425f9be2486cc00cc44a4c0d64e2 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 904e7ea98c53a368922fa02653986700321b2fd1..5b2b41a97603d7991bc4a129389ba5b00303196e 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 793684d0e29417bcb791832e2d19a1474f8ca380..e14bccaced18fd639a5724a33fc3b1d8ef384c65 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 5c7beb9892c950d145ec7e30b39c97a04e003a1e..97cb0f89a49ae436d714806ea78350cbabbb3533 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 421269ef2cb3f4f89b1cf37ef9aa9c9070545148..5aa072fbd11fd3816c669660f8b0f1b360b26203 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 f7a5f9ebfd47a497ab8dddaa2788328fe194afdd..63fddf657a3a4686b4df6505baea3cdbebab1750 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 8dc0d29197ec0cba86a86a55d64638e137f1d65e..aa1362765978b038328205d9870e88975181b800 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 5f44eacdde258419c2edd196e57d42dcbd5936d6..1ac50d783a8d7d23a39601f6175e42f1d7950979 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 7e19161321ac32d4555fbb4f84f8e77800d2b2d6..6c27c08f2aa5f7dc08e5d5996790109bad3439e5 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 26469e2a38aa5c3b0281aa435e41de54ee37ef7a..94092a3e757872d36fb764302d3032033aae52cc 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 5fe5d5444a644cfff3ba03583925cf294fa2a099..c6cc69bc23e389288c905ba4c3f400afeefa16a6 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 d8db530e14d983607076b7400756a0a6b32833a9..a17d035300f12e489d9bba33f531ae374ada46bd 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 8b4263161c36838fdfe740637e9e0481ce6ed643..0dac858ea49c7640c4d05356015a3b53d4184229 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 0576a3f43e70c70951f53999be3a5fba4ffb436e..911543031e93ae408e0525beca8f4c36ea13a8a6 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;
+}