This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
NET - improve initialization
- From: Gary Thomas <gary at mlbassoc dot com>
- To: eCos patches <ecos-patches at sources dot redhat dot com>
- Date: 04 May 2003 11:39:26 -0600
- Subject: NET - improve initialization
- Organization: MLB Associates
Since some systems seem to have lots of problems with messages during
initialization (they go off into the weeds...)
Index: devs/eth/powerpc/fec/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/devs/eth/powerpc/fec/current/ChangeLog,v
retrieving revision 1.17
diff -u -5 -p -r1.17 ChangeLog
--- devs/eth/powerpc/fec/current/ChangeLog 28 Mar 2003 18:21:02 -0000 1.17
+++ devs/eth/powerpc/fec/current/ChangeLog 4 May 2003 17:27:28 -0000
@@ -1,5 +1,12 @@
+2003-05-04 Gary Thomas <gary@mlbassoc.com>
+
+ * src/if_fec.c:
+ * cdl/fec_eth_drivers.cdl: Add control over use of LED display, since
+ it may interfere with some user programs. Also, debug I/O during
+ network intialization seems frail, so force it to be disabled.
+
2003-03-28 Gary Thomas <gary@mlbassoc.com>
* src/if_fec.c: Use new CPM/DPRAM buffer allocation scheme. Also,
better handling when aligning buffers to cache lines.
Index: devs/eth/powerpc/fec/current/cdl/fec_eth_drivers.cdl
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/devs/eth/powerpc/fec/current/cdl/fec_eth_drivers.cdl,v
retrieving revision 1.7
diff -u -5 -p -r1.7 fec_eth_drivers.cdl
--- devs/eth/powerpc/fec/current/cdl/fec_eth_drivers.cdl 20 Jan 2003 11:13:55 -0000 1.7
+++ devs/eth/powerpc/fec/current/cdl/fec_eth_drivers.cdl 4 May 2003 17:09:54 -0000
@@ -62,10 +62,13 @@ cdl_package CYGPKG_DEVS_ETH_POWERPC_FEC
implements CYGHWR_NET_DRIVER_ETH0
implements CYGINT_IO_ETH_MULTICAST
include_dir .
include_files ; # none _exported_ whatsoever
+ # Debug I/O during network stack initialization is not reliable
+ requires { CYGPKG_NET_FORCE_SERIAL_CONSOLE == 1 }
+
description "Fast ethernet driver for PowerPC MPC8xxT boards."
compile -library=libextras.a if_fec.c
cdl_option CYGNUM_DEVS_ETH_POWERPC_FEC_BD_OFFSET {
display "Buffer descriptors offset in PRAM"
@@ -119,10 +122,22 @@ cdl_package CYGPKG_DEVS_ETH_POWERPC_FEC
default_value { "Auto" }
description "
This option specifies initial mode for the physical
link. The PHY will be reset and then set to this mode."
}
+ }
+
+ cdl_component CYGSEM_DEVS_ETH_POWERPC_FEC_STATUS_LEDS {
+ display "Display I/O status via LEDs"
+ flavor bool
+ default_value 1
+ description "
+ If this option is set, and the platform defines LED access
+ functions, then I/O status will be displayed using the LEDs.
+ In particular, varying LEDs will be illuminated while the
+ device is busy transmitting a buffer, or handing an input
+ packet."
}
cdl_component CYGPKG_DEVS_ETH_POWERPC_FEC_OPTIONS {
display "MPC8xx FEC ethernet driver build options"
flavor none
Index: devs/eth/powerpc/fec/current/src/if_fec.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/devs/eth/powerpc/fec/current/src/if_fec.c,v
retrieving revision 1.16
diff -u -5 -p -r1.16 if_fec.c
--- devs/eth/powerpc/fec/current/src/if_fec.c 28 Mar 2003 18:21:02 -0000 1.16
+++ devs/eth/powerpc/fec/current/src/if_fec.c 4 May 2003 16:57:30 -0000
@@ -155,10 +155,11 @@ static void fec_eth_int(struct
#ifndef FEC_EPPC_BD_OFFSET
#define FEC_EPPC_BD_OFFSET CYGNUM_DEVS_ETH_POWERPC_FEC_BD_OFFSET
#endif
+#ifdef CYGSEM_DEVS_ETH_POWERPC_FEC_STATUS_LEDS
// LED activity [exclusive of hardware bits]
#ifndef _get_led
#define _get_led()
#define _set_led(v)
#endif
@@ -177,10 +178,14 @@ set_led(int bit)
static void
clear_led(int bit)
{
_set_led(_get_led() & ~(1<<bit));
}
+#else
+#define set_led(b)
+#define clear_led(b)
+#endif
#ifdef _FEC_USE_INTS
// This ISR is called when the ethernet interrupt occurs
static int
fec_eth_isr(cyg_vector_t vector, cyg_addrword_t data, HAL_SavedRegisters *regs)
Index: net/bsd_tcpip/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos-opt/net/net/bsd_tcpip/current/ChangeLog,v
retrieving revision 1.21
diff -u -5 -p -r1.21 ChangeLog
--- net/bsd_tcpip/current/ChangeLog 23 Apr 2003 08:54:13 -0000 1.21
+++ net/bsd_tcpip/current/ChangeLog 4 May 2003 17:32:14 -0000
@@ -1,5 +1,13 @@
+2003-05-04 Gary Thomas <gary@mlbassoc.com>
+
+ * src/ecos/support.c:
+ * cdl/freebsd_net.cdl: Add option to force initialization [debug]
+ messages to go to a serial console. This seems to be necessary
+ on some hardware as the init sequence can totally foul up a
+ network [debug] connection.
+
2003-04-11 Michael Checky <Michael_Checky@Thermoking.com>
* cdl/freebsd_net.cdl: Deleted the 'CYGPKG_NET_FREEBSD_STACK_BUILD_TESTS'
component because these tests are in the net.cdl component
'CYGPKG_NET_BUILD_TESTS' and selecting this option in freebsd_net.cdl
Index: net/bsd_tcpip/current/cdl/freebsd_net.cdl
===================================================================
RCS file: /misc/cvsfiles/ecos-opt/net/net/bsd_tcpip/current/cdl/freebsd_net.cdl,v
retrieving revision 1.4
diff -u -5 -p -r1.4 freebsd_net.cdl
--- net/bsd_tcpip/current/cdl/freebsd_net.cdl 11 Apr 2003 18:00:19 -0000 1.4
+++ net/bsd_tcpip/current/cdl/freebsd_net.cdl 4 May 2003 17:30:59 -0000
@@ -195,10 +195,22 @@ cdl_package CYGPKG_NET_FREEBSD_STACK {
LOG_EMERG 0x4000 - emergency conditions
LOG_CRIT 0x8000 - critical error
"
}
+ cdl_option CYGPKG_NET_FORCE_SERIAL_CONSOLE {
+ display "Force use of serial console during initialization"
+ flavor bool
+ default_value 0
+ description "
+ Trying to print initialization messages can fail if the
+ console channel is a network connection (via RedBoot).
+ Use of this option forces the stack to use a serial
+ port during this phase for safety. It can be used
+ if the network drivers are unstable at this point."
+ }
+
cdl_option CYGPKG_NET_MEM_USAGE {
display "Memory designated for networking buffers."
flavor data
default_value 256*1024
description "
Index: net/bsd_tcpip/current/src/ecos/support.c
===================================================================
RCS file: /misc/cvsfiles/ecos-opt/net/net/bsd_tcpip/current/src/ecos/support.c,v
retrieving revision 1.6
diff -u -5 -p -r1.6 support.c
--- net/bsd_tcpip/current/src/ecos/support.c 23 Apr 2003 08:54:13 -0000 1.6
+++ net/bsd_tcpip/current/src/ecos/support.c 4 May 2003 17:07:53 -0000
@@ -12,11 +12,11 @@
// copyright disclaimers included herein.
//
// Portions created by Red Hat are
// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
//
-// Copyright (C) 2002 Gary Thomas
+// Copyright (C) 2002, 2003 Gary Thomas
// Copyright (C) 2003 Andrew Lunn
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
@@ -67,11 +67,11 @@
#include <net/netisr.h>
#include <cyg/infra/diag.h>
#include <cyg/hal/hal_intr.h>
#include <cyg/kernel/kapi.h>
-
+#include <cyg/hal/hal_if.h>
#include <cyg/infra/cyg_ass.h>
#if !CYGPKG_NET_DRIVER_FRAMEWORK // Interface
#error At least one network driver framework must be defined!
#else
@@ -830,13 +830,24 @@ SYSINIT(devs, SI_SUB_DEVICES, SI_ORDER_F
void
cyg_net_init(void)
{
static int _init = false;
struct init_tab_entry *init_entry;
+#ifdef CYGPKG_NET_FORCE_SERIAL_CONSOLE
+ int orig_console =
+ CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
+#endif
if (_init) return;
+#ifdef CYGPKG_NET_FORCE_SERIAL_CONSOLE
+ // Force default serial console during system initialization
+ // This avoids problems with debug messages occurring while the
+ // networking subsystem is being setup.
+ CYGACC_CALL_IF_SET_CONSOLE_COMM(0);
+#endif
+
cyg_do_net_init(); // Just forces linking in the initializer/constructor
// Initialize interrupt "flags"
cyg_flag_init(&netint_flags);
// Initialize timeouts and net service thread (pseudo-DSRs)
cyg_alarm_timeout_init();
@@ -865,10 +876,15 @@ cyg_net_init(void)
}
log(LOG_INIT, "[%s] Done\n", __FUNCTION__);
// Done
_init = true;
+
+#ifdef CYGPKG_NET_FORCE_SERIAL_CONSOLE
+ // Revert to the original console, which might be a network connection
+ CYGACC_CALL_IF_SET_CONSOLE_COMM(orig_console);
+#endif
}
#include <net/if.h>
#include <net/netdb.h>
--
------------------------------------------------------------
Gary Thomas |
MLB Associates | Consulting for the
+1 (970) 229-1963 | Embedded world
http://www.mlbassoc.com/ |
email: <gary@mlbassoc.com> |
gpg: http://www.chez-thomas.org/gary/gpg_key.asc
------------------------------------------------------------