This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

redboot exec problem and possible fix


I have encountered a situation where the RedBoot ethernet driver was
interfering with a linux kernel. After calling exec, RedBoot starts
the linux kernel. While the kernel is early in the boot process, a
packet comes in over ethernet and the ethernet controller (i82559)
would DMA the packet into what it thinks is the RedBoot driver ring
buffer. Actually, its a linux code page and bad things happen from
that point. :)

The following patch fixes the problem. Does this look like the right
way to fix this?

--Mark



Index: hal/arm/arch/current/src/redboot_linux_exec.c
===================================================================
diff -u -p -5 -r1.9 redboot_linux_exec.c
--- hal/arm/arch/current/src/redboot_linux_exec.c	2003/02/13 15:24:21	1.9
+++ hal/arm/arch/current/src/redboot_linux_exec.c	2003/03/11 15:00:02
@@ -64,10 +64,14 @@
 //==========================================================================
 
 #include <pkgconf/hal.h>
 #include <redboot.h>
 
+#ifdef CYGPKG_IO_ETH_DRIVERS
+#include <cyg/io/eth/eth_drv.h>            // Logical driver interfaces
+#endif
+
 #include <cyg/hal/hal_intr.h>
 #include <cyg/hal/hal_cache.h>
 #include CYGHWR_MEMORY_LAYOUT_H
 
 #include <cyg/hal/hal_io.h>
@@ -373,10 +377,15 @@ do_exec(int argc, char *argv[])
                     (void*)base_addr, (void*)length);
     } else if (base_addr_set && !length_set) {
         diag_printf("Length required for non-standard base address\n");
         return;
     }
+
+#ifdef CYGPKG_IO_ETH_DRIVERS
+    eth_drv_stop();
+#endif
+
     HAL_DISABLE_INTERRUPTS(oldints);
     HAL_DCACHE_SYNC();
     HAL_ICACHE_DISABLE();
     HAL_DCACHE_DISABLE();
     HAL_DCACHE_SYNC();
Index: io/eth/current/include/eth_drv.h
===================================================================
diff -u -p -5 -r1.17 eth_drv.h
--- io/eth/current/include/eth_drv.h	2002/08/26 18:05:44	1.17
+++ io/eth/current/include/eth_drv.h	2003/03/11 15:01:01
@@ -221,10 +221,11 @@ struct eth_drv_mc_list {
 #ifndef CYGPKG_NET
 extern void eth_drv_buffers_init(void);
 extern int  eth_drv_read(char *eth_hdr, char *buf, int len);
 extern void eth_drv_write(char *eth_hdr, char *buf, int len);
 extern int  eth_drv_int_vector(void);
+extern void eth_drv_stop(void);
 extern unsigned char __local_enet_addr[];
 extern struct eth_drv_sc *__local_enet_sc;
 #endif
 
 #endif // _ETH_DRV_H_
Index: io/eth/current/src/stand_alone/eth_drv.c
===================================================================
RCS file: /home/cvs/ecc/ecc/io/eth/current/src/stand_alone/eth_drv.c,v
retrieving revision 1.30
diff -u -p -5 -r1.30 eth_drv.c
--- io/eth/current/src/stand_alone/eth_drv.c	2002/05/21 21:10:11	1.30
+++ io/eth/current/src/stand_alone/eth_drv.c	2003/03/11 15:01:02
@@ -6,11 +6,11 @@
 //
 //==========================================================================
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
 // Software Foundation; either version 2 or (at your option) any later version.
 //
@@ -230,20 +230,20 @@ eth_drv_init(struct eth_drv_sc *sc, unsi
         __local_enet_sc = sc;
         eth_drv_start(sc);
     }
 }
 
-#if 0 // Not currently used.  Left in case it's needed in the future
 //
 // This [internal] function will be called to stop activity on an interface.
 //
-static void
-eth_drv_stop(struct eth_drv_sc *sc)
+void
+eth_drv_stop(void)
 {
+    struct eth_drv_sc *sc = __local_enet_sc;
+
     (sc->funs->stop)(sc);
 }
-#endif
 
 //
 // This [internal] function will be called to start activity on an interface.
 //
 static void

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]