This is the mail archive of the ecos-patches@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]

PowerPC - better handlng of RedBoot 'exec' command


Like on the ARM, one basic routine for all platforms - avoids 
code duplication and makes keeping the Linux kernel in step easier :-)

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates
Index: hal/powerpc/adder/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/adder/current/ChangeLog,v
retrieving revision 1.11
diff -u -5 -p -r1.11 ChangeLog
--- hal/powerpc/adder/current/ChangeLog	24 Jul 2003 20:24:06 -0000	1.11
+++ hal/powerpc/adder/current/ChangeLog	28 Aug 2003 14:18:38 -0000
@@ -1,5 +1,16 @@
+2003-08-28  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c: Obsolete file - removed.
+
+	* src/plf_redboot_linux_exec.c: New file - platform specifics
+	for booting Linux kernel from RedBoot.
+
+	* cdl/hal_powerpc_adder.cdl: Linux booting from RedBoot is 
+	now supported at the architecture level.  Changes to support 
+	architecture/platform layering.
+
 2003-07-18  Nick Garnett  <nickg@balti.calivar.com>
 
 	* cdl/hal_powerpc_adder.cdl:
         Changed values for CYGNUM_HAL_RTC_NUMERATOR,
         CYGNUM_HAL_RTC_DENOMINATOR and CYGNUM_HAL_RTC_PERIOD to
Index: hal/powerpc/adder/current/cdl/hal_powerpc_adder.cdl
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/adder/current/cdl/hal_powerpc_adder.cdl,v
retrieving revision 1.8
diff -u -5 -p -r1.8 hal_powerpc_adder.cdl
--- hal/powerpc/adder/current/cdl/hal_powerpc_adder.cdl	19 Aug 2003 17:29:46 -0000	1.8
+++ hal/powerpc/adder/current/cdl/hal_powerpc_adder.cdl	28 Aug 2003 14:04:32 -0000
@@ -325,19 +325,19 @@ cdl_package CYGPKG_HAL_POWERPC_ADDER {
         active_if     CYGPKG_REDBOOT
         description   "
             This option lists the target's requirements for a valid Redboot
             configuration."
 
-        cdl_option CYGSEM_REDBOOT_HAL_LINUX_BOOT {
+        cdl_option CYGSEM_REDBOOT_PLF_LINUX_BOOT {
             active_if      CYGBLD_BUILD_REDBOOT_WITH_EXEC
             display        "Support booting Linux via RedBoot"
             flavor         bool
             default_value  1
             description    "
                This option enables RedBoot to support booting of a Linux kernel."
 
-            compile -library=libextras.a redboot_linux_exec.c
+            compile plf_redboot_linux_exec.c
         }
 
         cdl_option CYGBLD_BUILD_REDBOOT_BIN {
             display       "Build Redboot ROM binary image"
             active_if     CYGBLD_BUILD_REDBOOT
Index: hal/powerpc/adder/current/src/plf_redboot_linux_exec.c
===================================================================
RCS file: hal/powerpc/adder/current/src/plf_redboot_linux_exec.c
diff -N hal/powerpc/adder/current/src/plf_redboot_linux_exec.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ hal/powerpc/adder/current/src/plf_redboot_linux_exec.c	28 Aug 2003 14:56:48 -0000
@@ -0,0 +1,80 @@
+//==========================================================================
+//
+//      plf_redboot_linux_boot.c
+//
+//      Platform support for RedBoot command to boot Linux
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+// Copyright (C) 2002, 2003 Gary Thomas
+//
+// 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.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    gthomas
+// Contributors: 
+// Date:         2003-08-28
+// Purpose:      
+// Description:  
+//              
+// This code is part of RedBoot (tm).
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <cyg/hal/hal_arch.h>
+#include <cyg/hal/hal_if.h>
+#include <cyg/hal/hal_intr.h>
+#include <cyg/hal/hal_cache.h>
+#include <cyg/hal/ppc_regs.h>
+#include <cyg/hal/redboot_linux_exec.h>
+
+//
+// Export system configuration - used when booting a Linux kernel
+// Note: this function is expected to set up the fields which are
+// platform/variant dependent.  It may also override any of the
+// architecture common fields (like memory layout, etc) as appropriate
+//
+externC void 
+plf_redboot_linux_exec(bd_t *board_info)
+{
+    board_info->bi_intfreq	= CYGHWR_HAL_POWERPC_BOARD_SPEED*1000000;
+    board_info->bi_busfreq	= 66*1000000;
+    board_info->bi_flashbase    = 0xFE000000;
+    board_info->bi_flashsize    = 0x00800000;
+    board_info->bi_flashwidth   = 16;
+}
+
+//=========================================================================
+// EOF plf_redboot_linux_exec.c
Index: hal/powerpc/adder/current/src/redboot_linux_exec.c
===================================================================
RCS file: hal/powerpc/adder/current/src/redboot_linux_exec.c
diff -N hal/powerpc/adder/current/src/redboot_linux_exec.c
--- hal/powerpc/adder/current/src/redboot_linux_exec.c	11 Mar 2003 17:14:14 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,281 +0,0 @@
-//==========================================================================
-//
-//      redboot_linux_boot.c
-//
-//      RedBoot command to boot Linux
-//
-//==========================================================================
-//####ECOSGPLCOPYRIGHTBEGIN####
-// -------------------------------------------
-// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
-// Copyright (C) 2002 Gary Thomas
-//
-// 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.
-//
-// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-//
-// As a special exception, if other files instantiate templates or use macros
-// or inline functions from this file, or you compile this file and link it
-// with other works to produce a work based on this file, this file does not
-// by itself cause the resulting work to be covered by the GNU General Public
-// License. However the source code for this file must still be made available
-// in accordance with section (3) of the GNU General Public License.
-//
-// This exception does not invalidate any other reasons why a work based on
-// this file might be covered by the GNU General Public License.
-//
-// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
-// at http://sources.redhat.com/ecos/ecos-license/
-// -------------------------------------------
-//####ECOSGPLCOPYRIGHTEND####
-//####OTHERCOPYRIGHTBEGIN####
-//
-//  The structure definitions below are taken from include/ppc/platforms/am860.h in
-//  the Linux kernel, Copyright (c) 2002 Gary Thomas, Copyright (c) 1997 Dan Malek. 
-//  Their presence here is for the express purpose of communication with the Linux 
-//  kernel being booted and is considered 'fair use' by the original author and
-//  are included with their permission.
-//
-//####OTHERCOPYRIGHTEND####
-//==========================================================================
-//#####DESCRIPTIONBEGIN####
-//
-// Author(s):    msalter
-// Contributors: gthomas,msalter
-// Date:         2002-01-14
-// Purpose:      
-// Description:  
-//              
-// This code is part of RedBoot (tm).
-//
-//####DESCRIPTIONEND####
-//
-//==========================================================================
-
-#include <redboot.h>
-#include <pkgconf/hal_powerpc_quicc.h>
-
-#include <cyg/hal/hal_arch.h>
-#include <cyg/hal/hal_if.h>
-#include <cyg/hal/hal_intr.h>
-#include <cyg/hal/hal_cache.h>
-
-#ifdef CYGPKG_REDBOOT_NETWORKING
-#include <net/net.h>
-#endif
-
-#ifdef CYGPKG_IO_ETH_DRIVERS
-#include <cyg/io/eth/eth_drv.h>            // Logical driver interfaces
-#endif
-
-#ifdef CYGSEM_REDBOOT_HAL_LINUX_BOOT
-
-#include CYGHWR_MEMORY_LAYOUT_H
-
-//=========================================================================
-
-// Exported CLI function(s)
-static void do_exec(int argc, char *argv[]);
-RedBoot_cmd("exec", 
-            "Execute a Linux image - with MMU off", 
-            "[-w timeout]\n"
-            "        [-c \"kernel command line\"] [<entry_point>]",
-            do_exec
-    );
-
-//=========================================================================
-// Imported from Linux kernel include/asm-ppc/am860.h
-//   Copyright (c) 2002 Gary Thomas (gary@chez-thomas.org)
-//   Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
-//   Used with permission of author(s).
-
-
-/* A Board Information structure that is given to a program when
- * RedBoot starts it up.
- */
-typedef struct bd_info {
-	unsigned int	bi_tag;		/* Should be 0x42444944 "BDID" */
-	unsigned int	bi_size;	/* Size of this structure */
-	unsigned int	bi_revision;	/* revision of this structure */
-	unsigned int	bi_bdate;	/* EPPCbug date, i.e. 0x11061997 */
-	unsigned int	bi_memstart;	/* Memory start address */
-	unsigned int	bi_memsize;	/* Memory (end) size in bytes */
-	unsigned int	bi_intfreq;	/* Internal Freq, in Hz */
-	unsigned int	bi_busfreq;	/* Bus Freq, in Hz */
-	unsigned int	bi_clun;	/* Boot device controller */
-	unsigned int	bi_dlun;	/* Boot device logical dev */
-	unsigned char	bi_enetaddr[6];
-	unsigned int	bi_baudrate;
-        unsigned char   *bi_cmdline;
-} bd_t;
-
-//
-// Execute a Linux kernel - this is a RedBoot CLI command
-//
-static void 
-do_exec(int argc, char *argv[])
-{
-    unsigned long entry;
-    bool wait_time_set, cmd_line_set;
-    int  wait_time;
-    char *cmd_line;
-    char *cline;
-    struct option_info opts[2];
-    hal_virtual_comm_table_t *__chan;
-    int baud_rate;
-
-    bd_t *board_info;
-    CYG_INTERRUPT_STATE oldints;
-    unsigned long sp = CYGMEM_REGION_ram+CYGMEM_REGION_ram_SIZE;
-    
-    init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&wait_time, (bool *)&wait_time_set, "wait timeout");
-    init_opts(&opts[1], 'c', true, OPTION_ARG_TYPE_STR, 
-              (void **)&cmd_line, (bool *)&cmd_line_set, "kernel command line");
-    entry = entry_address;  // Default from last 'load' operation
-    if (!scan_opts(argc, argv, 1, opts, 2, (void *)&entry, OPTION_ARG_TYPE_NUM, 
-                   "[physical] starting address")) {
-        return;
-    }
-
-    // Determine baud rate on current console
-    __chan = CYGACC_CALL_IF_CONSOLE_PROCS();
-    baud_rate = CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_GETBAUD);
-    if (baud_rate <= 0) {
-        baud_rate = CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD;
-    }
-
-    // Make a little space at the top of the stack, and align to
-    // 64-bit boundary.
-    sp = (sp-128) & ~7;  // The Linux boot code uses this space for FIFOs
-    
-    // Copy the commandline onto the stack, and set the SP to just below it.
-    if (cmd_line_set) {
-	int len,i;
-
-	// get length of string
-	for( len = 0; cmd_line[len] != '\0'; len++ );
-
-	// decrement sp by length of string and align to
-	// word boundary.
-	sp = (sp-(len+1)) & ~3;
-
-	// assign this SP value to command line start
-	cline = (char *)sp;
-
-	// copy command line over.
-	for( i = 0; i < len; i++ )
-	    cline[i] = cmd_line[i];
-	cline[len] = '\0';
-
-    } else {
-        cline = (char *)NULL;
-    }
-    
-    // Set up parameter struct at top of stack
-    sp = sp-sizeof(bd_t);
-    board_info = (bd_t *)sp;
-    memset(board_info, sizeof(*board_info), 0);
-    
-    board_info->bi_tag		= 0x42444944;
-    board_info->bi_size		= sizeof(board_info);
-    board_info->bi_revision	= 1;
-    board_info->bi_bdate	= 0x06012002;
-    board_info->bi_memstart	= CYGMEM_REGION_ram;
-    board_info->bi_memsize	= CYGMEM_REGION_ram_SIZE;
-    board_info->bi_intfreq	= CYGHWR_HAL_POWERPC_BOARD_SPEED*1000000;
-    board_info->bi_busfreq	= 66*1000000;
-    board_info->bi_clun		= 0;  // ????
-    board_info->bi_dlun		= 0;  // ????
-    board_info->bi_baudrate     = baud_rate;
-    board_info->bi_cmdline      = cline;
-#ifdef CYGPKG_REDBOOT_NETWORKING
-    memcpy(board_info->bi_enetaddr, __local_enet_addr, sizeof(enet_addr_t));
-#endif
-
-    // adjust SP to 64 bit boundary, and leave a little space
-    // between it and the commandline for PowerPC calling
-    // conventions.
-	
-    sp = (sp-32)&~7;
-
-    if (wait_time_set) {
-        int script_timeout_ms = wait_time * 1000;
-#ifdef CYGFUN_REDBOOT_BOOT_SCRIPT
-        unsigned char *hold_script = script;
-        script = (unsigned char *)0;
-#endif
-        diag_printf("About to start execution at %p - abort with ^C within %d seconds\n",
-                    (void *)entry, wait_time);
-        while (script_timeout_ms >= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT) {
-            int res;
-            char line[80];
-            res = _rb_gets(line, sizeof(line), CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT);
-            if (res == _GETS_CTRLC) {
-#ifdef CYGFUN_REDBOOT_BOOT_SCRIPT
-                script = hold_script;  // Re-enable script
-#endif
-                return;
-            }
-            script_timeout_ms -= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT;
-        }
-    }
-
-#ifdef CYGPKG_IO_ETH_DRIVERS
-    eth_drv_stop();
-#endif
-
-    // Disable interrupts
-    HAL_DISABLE_INTERRUPTS(oldints);
-
-    // Put the caches to sleep.
-    HAL_DCACHE_SYNC();
-    HAL_ICACHE_DISABLE();
-    HAL_DCACHE_DISABLE();
-    HAL_DCACHE_SYNC();
-    HAL_ICACHE_INVALIDATE_ALL();
-    HAL_DCACHE_INVALIDATE_ALL();
-
-//    diag_printf("entry %08x, sp %08x, info %08x, cmd line %08x, baud %d\n",
-//		entry, sp, board_info, cline, baud_rate);
-//    breakpoint();
-    
-    // Call into Linux
-    __asm__ volatile (        
-	               // Start by disabling MMU - the mappings are
-	               // 1-1 so this should not cause any problems
-	               "mfmsr	3\n"
-		       "li      4,0xFFFFFFCF\n"
-		       "and	3,3,4\n"
-		       "sync\n"
-		       "mtmsr	3\n"
-		       "sync\n"
-
-		       // Now set up parameters to jump into linux
-
-		       "mtlr	%0\n"		// set entry address in LR
-		       "mr	1,%1\n"		// set stack pointer
-		       "mr	3,%2\n"		// set board info in R3
-		       "mr	4,%3\n"		// set command line in R4
-		       "blr          \n"	// jump into linux
-		       :
-		       : "r"(entry),"r"(sp),"r"(board_info),"r"(cline)
-		       : "r3", "r4"
-	             
-	             );
-}
-
-#endif // CYGSEM_REDBOOT_HAL_LINUX_BOOT
-
-//=========================================================================
-// EOF redboot_linux_exec.c
Index: hal/powerpc/arch/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/arch/current/ChangeLog,v
retrieving revision 1.51
diff -u -5 -p -r1.51 ChangeLog
--- hal/powerpc/arch/current/ChangeLog	19 Aug 2003 17:29:46 -0000	1.51
+++ hal/powerpc/arch/current/ChangeLog	28 Aug 2003 14:18:36 -0000
@@ -1,5 +1,14 @@
+2003-08-28  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c: New file - architecture level
+	support for booting Linux kernel from RedBoot.
+
+	* cdl/hal_powerpc.cdl: Linux booting from RedBoot is 
+	now supported at the architecture level.  Changes to support 
+	architecture/platform layering.
+
 2003-08-19  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/hal_intr.c (hal_IRQ_init): Precalculate clock tick per
 	microsecond (us) ratio to reduce overheads in delay.  Without
 	this, delays of small numbers of microseconds were inaccurate.
Index: hal/powerpc/arch/current/cdl/hal_powerpc.cdl
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/arch/current/cdl/hal_powerpc.cdl,v
retrieving revision 1.5
diff -u -5 -p -r1.5 hal_powerpc.cdl
--- hal/powerpc/arch/current/cdl/hal_powerpc.cdl	24 Dec 2002 16:04:18 -0000	1.5
+++ hal/powerpc/arch/current/cdl/hal_powerpc.cdl	28 Aug 2003 13:49:37 -0000
@@ -166,10 +166,21 @@ cdl_package CYGPKG_HAL_POWERPC {
             Enable this option to put \"walls\" around the exception
             frames. This can ease analyzing the stack contents when
             debugging."
     }
 
+    cdl_option CYGSEM_REDBOOT_HAL_LINUX_BOOT {
+        active_if      { CYGSEM_REDBOOT_PLF_LINUX_BOOT == 1 }
+        display        "Support booting Linux via RedBoot"
+        flavor         bool
+        default_value  1
+        description    "
+           This option enables RedBoot to support booting of a Linux kernel."
+
+        compile -library=libextras.a redboot_linux_exec.c
+    }
+
     cdl_component CYGPKG_HAL_POWERPC_OPTIONS {
         display "PowerPC build options"
         flavor  none
         no_define
         description   "
Index: hal/powerpc/arch/current/include/redboot_linux_exec.h
===================================================================
RCS file: hal/powerpc/arch/current/include/redboot_linux_exec.h
diff -N hal/powerpc/arch/current/include/redboot_linux_exec.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ hal/powerpc/arch/current/include/redboot_linux_exec.h	28 Aug 2003 14:56:11 -0000
@@ -0,0 +1,100 @@
+//==========================================================================
+//
+//      redboot_linux_boot.h
+//
+//      RedBoot interfaces with Linux kernel
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+// Copyright (C) 2002, 2003 Gary Thomas
+//
+// 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.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//####OTHERCOPYRIGHTBEGIN####
+//
+//  The structure definitions below are taken from include/asm-/redboot.h in
+//  the Linux kernel, Copyright (c) 2002, 2003 Gary Thomas, Copyright (c) 1997 Dan Malek. 
+//  Their presence here is for the express purpose of communication with the Linux 
+//  kernel being booted and is considered 'fair use' by the original author and
+//  are included with their permission.
+//
+//####OTHERCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    gthomas
+// Contributors: 
+// Date:         2003-08-28
+// Purpose:      
+// Description:  
+//              
+// This code is part of RedBoot (tm).
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+//=========================================================================
+// Imported from Linux kernel include/asm-ppc/redboot.h
+//   Copyright (c) 2002, 2003 Gary Thomas (<gary@mlbassoc.com>
+//   Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
+//   Used with permission of author(s).
+
+
+/* A Board Information structure that is given to a program when
+ * RedBoot starts it up.  Note: not all fields make sense for all
+ * architectures and it's up to the platform specific code to fill
+ * in the details.
+ */
+typedef struct bd_info {
+    unsigned int   bi_tag;        /* Should be 0x42444944 "BDID" */
+    unsigned int   bi_size;       /* Size of this structure */
+    unsigned int   bi_revision;   /* revision of this structure */
+    unsigned int   bi_bdate;      /* bootstrap date, i.e. 0x11061997 */
+    unsigned int   bi_memstart;   /* Memory start address */
+    unsigned int   bi_memsize;    /* Memory (end) size in bytes */
+    unsigned int   bi_intfreq;    /* Internal Freq, in Hz */
+    unsigned int   bi_busfreq;    /* Bus Freq, in Hz */
+    unsigned int   bi_cpmfreq;    /* CPM Freq, in Hz */
+    unsigned int   bi_brgfreq;    /* BRG Freq, in Hz */
+    unsigned int   bi_vco;        /* VCO Out from PLL */
+    unsigned int   bi_pci_freq;   /* PCI Freq, in Hz */
+    unsigned int   bi_baudrate;   /* Default console baud rate */
+    unsigned int   bi_immr;       /* IMMR when called from boot rom */
+    unsigned char  bi_enetaddr[6];
+    unsigned int   bi_flashbase;  /* Physical address of FLASH memory */
+    unsigned int   bi_flashsize;  /* Length of FLASH memory */
+    int            bi_flashwidth; /* Width (8,16,32,64) */
+    unsigned char *bi_cmdline;    /* Pointer to command line */
+} bd_t;
+
+externC void plf_redboot_linux_exec(bd_t *info);
+
Index: hal/powerpc/arch/current/src/redboot_linux_exec.c
===================================================================
RCS file: hal/powerpc/arch/current/src/redboot_linux_exec.c
diff -N hal/powerpc/arch/current/src/redboot_linux_exec.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ hal/powerpc/arch/current/src/redboot_linux_exec.c	28 Aug 2003 15:21:01 -0000
@@ -0,0 +1,250 @@
+//==========================================================================
+//
+//      redboot_linux_boot.c
+//
+//      RedBoot command to boot Linux
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+// Copyright (C) 2002, 2003 Gary Thomas
+//
+// 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.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//####OTHERCOPYRIGHTBEGIN####
+//
+//  The structure definitions below are taken from include/asm-/redboot.h in
+//  the Linux kernel, Copyright (c) 2002, 2003 Gary Thomas, Copyright (c) 1997 Dan Malek. 
+//  Their presence here is for the express purpose of communication with the Linux 
+//  kernel being booted and is considered 'fair use' by the original author and
+//  are included with their permission.
+//
+//####OTHERCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    msalter
+// Contributors: gthomas,msalter
+// Date:         2002-01-14
+// Purpose:      
+// Description:  
+//              
+// This code is part of RedBoot (tm).
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <redboot.h>
+
+#include <cyg/hal/hal_arch.h>
+#include <cyg/hal/hal_if.h>
+#include <cyg/hal/hal_intr.h>
+#include <cyg/hal/hal_cache.h>
+
+#ifdef CYGPKG_REDBOOT_NETWORKING
+#include <net/net.h>
+#endif
+
+#ifdef CYGPKG_IO_ETH_DRIVERS
+#include <cyg/io/eth/eth_drv.h>            // Logical driver interfaces
+#endif
+
+#include CYGHWR_MEMORY_LAYOUT_H
+
+#include <cyg/hal/redboot_linux_exec.h>
+
+//=========================================================================
+
+// Exported CLI function(s)
+static void do_exec(int argc, char *argv[]);
+RedBoot_cmd("exec", 
+            "Execute a Linux image - with MMU off", 
+            "[-w timeout]\n"
+            "        [-c \"kernel command line\"] [<entry_point>]",
+            do_exec
+    );
+
+//
+// Execute a Linux kernel - this is a RedBoot CLI command
+//
+static void 
+do_exec(int argc, char *argv[])
+{
+    unsigned long entry;
+    bool wait_time_set, cmd_line_set;
+    int  wait_time;
+    char *cmd_line;
+    char *cline;
+    struct option_info opts[2];
+    hal_virtual_comm_table_t *__chan;
+    int baud_rate;
+
+    bd_t *board_info;
+    CYG_INTERRUPT_STATE oldints;
+    unsigned long sp = CYGMEM_REGION_ram+CYGMEM_REGION_ram_SIZE;
+    
+    init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM, 
+              (void **)&wait_time, (bool *)&wait_time_set, "wait timeout");
+    init_opts(&opts[1], 'c', true, OPTION_ARG_TYPE_STR, 
+              (void **)&cmd_line, (bool *)&cmd_line_set, "kernel command line");
+    entry = entry_address;  // Default from last 'load' operation
+    if (!scan_opts(argc, argv, 1, opts, 2, (void *)&entry, OPTION_ARG_TYPE_NUM, 
+                   "[physical] starting address")) {
+        return;
+    }
+
+    // Determine baud rate on current console
+    __chan = CYGACC_CALL_IF_CONSOLE_PROCS();
+    baud_rate = CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_GETBAUD);
+    if (baud_rate <= 0) {
+        baud_rate = CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD;
+    }
+
+    // Make a little space at the top of the stack, and align to
+    // 64-bit boundary.
+    sp = (sp-128) & ~7;  // The Linux boot code uses this space for FIFOs
+    
+    // Copy the commandline onto the stack, and set the SP to just below it.
+    if (cmd_line_set) {
+	int len,i;
+
+	// get length of string
+	for( len = 0; cmd_line[len] != '\0'; len++ );
+
+	// decrement sp by length of string and align to
+	// word boundary.
+	sp = (sp-(len+1)) & ~3;
+
+	// assign this SP value to command line start
+	cline = (char *)sp;
+
+	// copy command line over.
+	for( i = 0; i < len; i++ )
+	    cline[i] = cmd_line[i];
+	cline[len] = '\0';
+
+    } else {
+        cline = (char *)NULL;
+    }
+    
+    // Set up parameter struct at top of stack
+    sp = sp-sizeof(bd_t);
+    board_info = (bd_t *)sp;
+    memset(board_info, sizeof(*board_info), 0);
+    
+    board_info->bi_tag		= 0x42444944;
+    board_info->bi_size		= sizeof(board_info);
+    board_info->bi_revision	= 1;
+    board_info->bi_bdate	= 0x06012002;
+    board_info->bi_memstart	= CYGMEM_REGION_ram;
+    board_info->bi_memsize	= CYGMEM_REGION_ram_SIZE;
+    board_info->bi_baudrate     = baud_rate;
+    board_info->bi_cmdline      = cline;
+#ifdef CYGPKG_REDBOOT_NETWORKING
+    memcpy(board_info->bi_enetaddr, __local_enet_addr, sizeof(enet_addr_t));
+#endif
+    // Call platform specific code to fill in the platform/architecture specific details
+    plf_redboot_linux_exec(board_info);
+
+    // adjust SP to 64 byte boundary, and leave a little space
+    // between it and the commandline for PowerPC calling
+    // conventions.
+	
+    sp = (sp-64)&~63;
+
+    if (wait_time_set) {
+        int script_timeout_ms = wait_time * 1000;
+#ifdef CYGFUN_REDBOOT_BOOT_SCRIPT
+        unsigned char *hold_script = script;
+        script = (unsigned char *)0;
+#endif
+        diag_printf("About to start execution at %p - abort with ^C within %d seconds\n",
+                    (void *)entry, wait_time);
+        while (script_timeout_ms >= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT) {
+            int res;
+            char line[80];
+            res = _rb_gets(line, sizeof(line), CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT);
+            if (res == _GETS_CTRLC) {
+#ifdef CYGFUN_REDBOOT_BOOT_SCRIPT
+                script = hold_script;  // Re-enable script
+#endif
+                return;
+            }
+            script_timeout_ms -= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT;
+        }
+    }
+
+#ifdef CYGPKG_IO_ETH_DRIVERS
+    eth_drv_stop();
+#endif
+
+    // Disable interrupts
+    HAL_DISABLE_INTERRUPTS(oldints);
+
+    // Put the caches to sleep.
+    HAL_DCACHE_SYNC();
+    HAL_ICACHE_DISABLE();
+    HAL_DCACHE_DISABLE();
+    HAL_DCACHE_SYNC();
+    HAL_ICACHE_INVALIDATE_ALL();
+    HAL_DCACHE_INVALIDATE_ALL();
+
+//    diag_printf("entry %08x, sp %08x, info %08x, cmd line %08x, baud %d\n",
+//		entry, sp, board_info, cline, baud_rate);
+//    breakpoint();
+    
+    // Call into Linux
+    __asm__ volatile (        
+	               // Start by disabling MMU - the mappings are
+	               // 1-1 so this should not cause any problems
+	               "mfmsr	3\n"
+		       "li      4,0xFFFFFFCF\n"
+		       "and	3,3,4\n"
+		       "sync\n"
+		       "mtmsr	3\n"
+		       "sync\n"
+
+		       // Now set up parameters to jump into linux
+
+		       "mtlr	%0\n"		// set entry address in LR
+		       "mr	1,%1\n"		// set stack pointer
+		       "mr	3,%2\n"		// set board info in R3
+		       "mr	4,%3\n"		// set command line in R4
+		       "blr          \n"	// jump into linux
+		       :
+		       : "r"(entry),"r"(sp),"r"(board_info),"r"(cline)
+		       : "r3", "r4"
+	             
+	             );
+}
+
+//=========================================================================
+// EOF redboot_linux_exec.c
Index: hal/powerpc/csb281/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/csb281/current/ChangeLog,v
retrieving revision 1.11
diff -u -5 -p -r1.11 ChangeLog
--- hal/powerpc/csb281/current/ChangeLog	24 Jul 2003 20:24:07 -0000	1.11
+++ hal/powerpc/csb281/current/ChangeLog	28 Aug 2003 14:16:56 -0000
@@ -1,5 +1,16 @@
+2003-08-28  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c: Obsolete file - removed.
+
+	* src/plf_redboot_linux_exec.c: New file - platform specifics
+	for booting Linux kernel from RedBoot.
+
+	* cdl/hal_powerpc_csb281.cdl: Linux booting from RedBoot is 
+	now supported at the architecture level.  Changes to support 
+	architecture/platform layering.
+
 2003-07-18  Nick Garnett  <nickg@balti.calivar.com>
 
 	* cdl/hal_powerpc_csb281.cdl:
         Changed values for CYGNUM_HAL_RTC_NUMERATOR,
         CYGNUM_HAL_RTC_DENOMINATOR and CYGNUM_HAL_RTC_PERIOD to
Index: hal/powerpc/csb281/current/cdl/hal_powerpc_csb281.cdl
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/csb281/current/cdl/hal_powerpc_csb281.cdl,v
retrieving revision 1.4
diff -u -5 -p -r1.4 hal_powerpc_csb281.cdl
--- hal/powerpc/csb281/current/cdl/hal_powerpc_csb281.cdl	24 Jul 2003 20:24:07 -0000	1.4
+++ hal/powerpc/csb281/current/cdl/hal_powerpc_csb281.cdl	28 Aug 2003 14:03:18 -0000
@@ -389,18 +389,19 @@ cdl_package CYGPKG_HAL_POWERPC_CSB281 {
         active_if     CYGPKG_REDBOOT
         description   "
             This option lists the target's requirements for a valid Redboot
             configuration."
 
-        cdl_option CYGSEM_REDBOOT_HAL_LINUX_BOOT {
+        cdl_option CYGSEM_REDBOOT_PLF_LINUX_BOOT {
+            active_if      CYGBLD_BUILD_REDBOOT_WITH_EXEC
             display        "Support booting Linux via RedBoot"
             flavor         bool
             default_value  1
             description    "
                This option enables RedBoot to support booting of a Linux kernel."
 
-            compile -library=libextras.a redboot_linux_exec.c
+            compile plf_redboot_linux_exec.c
         }
 
         cdl_option CYGBLD_BUILD_REDBOOT_BIN {
             display       "Build Redboot ROM binary image"
             active_if     CYGBLD_BUILD_REDBOOT
Index: hal/powerpc/csb281/current/src/plf_redboot_linux_exec.c
===================================================================
RCS file: hal/powerpc/csb281/current/src/plf_redboot_linux_exec.c
diff -N hal/powerpc/csb281/current/src/plf_redboot_linux_exec.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ hal/powerpc/csb281/current/src/plf_redboot_linux_exec.c	28 Aug 2003 14:03:59 -0000
@@ -0,0 +1,77 @@
+//==========================================================================
+//
+//      plf_redboot_linux_boot.c
+//
+//      Platform support for RedBoot command to boot Linux
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+// Copyright (C) 2002, 2003 Gary Thomas
+//
+// 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.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    gthomas
+// Contributors: 
+// Date:         2003-08-28
+// Purpose:      
+// Description:  
+//              
+// This code is part of RedBoot (tm).
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <cyg/hal/hal_arch.h>
+#include <cyg/hal/hal_if.h>
+#include <cyg/hal/hal_intr.h>
+#include <cyg/hal/hal_cache.h>
+#include <cyg/hal/ppc_regs.h>
+#include <cyg/hal/redboot_linux_exec.h>
+
+//
+// Export system configuration - used when booting a Linux kernel
+// Note: this function is expected to set up the fields which are
+// platform/variant dependent.  It may also override any of the
+// architecture common fields (like memory layout, etc) as appropriate
+//
+externC void 
+plf_redboot_linux_exec(bd_t *board_info)
+{
+    board_info->bi_intfreq	= CYGHWR_HAL_POWERPC_CPU_SPEED*1000000;
+    board_info->bi_busfreq	= CYGHWR_HAL_POWERPC_MEM_SPEED*1000000;
+}
+
+//=========================================================================
+// EOF plf_redboot_linux_exec.c
Index: hal/powerpc/csb281/current/src/redboot_linux_exec.c
===================================================================
RCS file: hal/powerpc/csb281/current/src/redboot_linux_exec.c
diff -N hal/powerpc/csb281/current/src/redboot_linux_exec.c
--- hal/powerpc/csb281/current/src/redboot_linux_exec.c	11 Mar 2003 17:14:14 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,279 +0,0 @@
-//==========================================================================
-//
-//      redboot_linux_boot.c
-//
-//      RedBoot command to boot Linux
-//
-//==========================================================================
-//####ECOSGPLCOPYRIGHTBEGIN####
-// -------------------------------------------
-// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
-// Copyright (C) 2002 Gary Thomas
-//
-// 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.
-//
-// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-//
-// As a special exception, if other files instantiate templates or use macros
-// or inline functions from this file, or you compile this file and link it
-// with other works to produce a work based on this file, this file does not
-// by itself cause the resulting work to be covered by the GNU General Public
-// License. However the source code for this file must still be made available
-// in accordance with section (3) of the GNU General Public License.
-//
-// This exception does not invalidate any other reasons why a work based on
-// this file might be covered by the GNU General Public License.
-//
-// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
-// at http://sources.redhat.com/ecos/ecos-license/
-// -------------------------------------------
-//####ECOSGPLCOPYRIGHTEND####
-//####OTHERCOPYRIGHTBEGIN####
-//
-//  The structure definitions below are taken from include/ppc/platforms/am860.h in
-//  the Linux kernel, Copyright (c) 2002 Gary Thomas, Copyright (c) 1997 Dan Malek. 
-//  Their presence here is for the express purpose of communication with the Linux 
-//  kernel being booted and is considered 'fair use' by the original author and
-//  are included with their permission.
-//
-//####OTHERCOPYRIGHTEND####
-//==========================================================================
-//#####DESCRIPTIONBEGIN####
-//
-// Author(s):    msalter
-// Contributors: gthomas,msalter
-// Date:         2002-01-14
-// Purpose:      
-// Description:  
-//              
-// This code is part of RedBoot (tm).
-//
-//####DESCRIPTIONEND####
-//
-//==========================================================================
-
-#include <redboot.h>
-#include <cyg/hal/hal_arch.h>
-#include <cyg/hal/hal_if.h>
-#include <cyg/hal/hal_intr.h>
-#include <cyg/hal/hal_cache.h>
-
-#ifdef CYGPKG_REDBOOT_NETWORKING
-#include <net/net.h>
-#endif
-
-#ifdef CYGPKG_IO_ETH_DRIVERS
-#include <cyg/io/eth/eth_drv.h>            // Logical driver interfaces
-#endif
-
-#ifdef CYGSEM_REDBOOT_HAL_LINUX_BOOT
-
-#include CYGHWR_MEMORY_LAYOUT_H
-
-//=========================================================================
-
-// Exported CLI function(s)
-static void do_exec(int argc, char *argv[]);
-RedBoot_cmd("exec", 
-            "Execute a Linux image - with MMU off", 
-            "[-w timeout]\n"
-            "        [-c \"kernel command line\"] [<entry_point>]",
-            do_exec
-    );
-
-//=========================================================================
-// Imported from Linux kernel include/asm-ppc/am860.h
-//   Copyright (c) 2002 Gary Thomas (gary@chez-thomas.org)
-//   Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
-//   Used with permission of author(s).
-
-
-/* A Board Information structure that is given to a program when
- * RedBoot starts it up.
- */
-typedef struct bd_info {
-	unsigned int	bi_tag;		/* Should be 0x42444944 "BDID" */
-	unsigned int	bi_size;	/* Size of this structure */
-	unsigned int	bi_revision;	/* revision of this structure */
-	unsigned int	bi_bdate;	/* EPPCbug date, i.e. 0x11061997 */
-	unsigned int	bi_memstart;	/* Memory start address */
-	unsigned int	bi_memsize;	/* Memory (end) size in bytes */
-	unsigned int	bi_intfreq;	/* Internal Freq, in Hz */
-	unsigned int	bi_busfreq;	/* Bus Freq, in Hz */
-	unsigned int	bi_clun;	/* Boot device controller */
-	unsigned int	bi_dlun;	/* Boot device logical dev */
-	unsigned char	bi_enetaddr[6];
-	unsigned int	bi_baudrate;
-        unsigned char   *bi_cmdline;
-} bd_t;
-
-//
-// Execute a Linux kernel - this is a RedBoot CLI command
-//
-static void 
-do_exec(int argc, char *argv[])
-{
-    unsigned long entry;
-    bool wait_time_set, cmd_line_set;
-    int  wait_time;
-    char *cmd_line;
-    char *cline;
-    struct option_info opts[2];
-    hal_virtual_comm_table_t *__chan;
-    int baud_rate;
-
-    bd_t *board_info;
-    CYG_INTERRUPT_STATE oldints;
-    unsigned long sp = CYGMEM_REGION_ram+CYGMEM_REGION_ram_SIZE;
-    
-    init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&wait_time, (bool *)&wait_time_set, "wait timeout");
-    init_opts(&opts[1], 'c', true, OPTION_ARG_TYPE_STR, 
-              (void **)&cmd_line, (bool *)&cmd_line_set, "kernel command line");
-    entry = entry_address;  // Default from last 'load' operation
-    if (!scan_opts(argc, argv, 1, opts, 2, (void *)&entry, OPTION_ARG_TYPE_NUM, 
-                   "[physical] starting address")) {
-        return;
-    }
-
-    // Determine baud rate on current console
-    __chan = CYGACC_CALL_IF_CONSOLE_PROCS();
-    baud_rate = CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_GETBAUD);
-    if (baud_rate <= 0) {
-        baud_rate = CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD;
-    }
-
-    // Make a little space at the top of the stack, and align to
-    // 64-bit boundary.
-    sp = (sp-128) & ~7;  // The Linux boot code uses this space for FIFOs
-    
-    // Copy the commandline onto the stack, and set the SP to just below it.
-    if (cmd_line_set) {
-	int len,i;
-
-	// get length of string
-	for( len = 0; cmd_line[len] != '\0'; len++ );
-
-	// decrement sp by length of string and align to
-	// word boundary.
-	sp = (sp-(len+1)) & ~3;
-
-	// assign this SP value to command line start
-	cline = (char *)sp;
-
-	// copy command line over.
-	for( i = 0; i < len; i++ )
-	    cline[i] = cmd_line[i];
-	cline[len] = '\0';
-
-    } else {
-        cline = (char *)NULL;
-    }
-    
-    // Set up parameter struct at top of stack
-    sp = sp-sizeof(bd_t);
-    board_info = (bd_t *)sp;
-    memset(board_info, sizeof(*board_info), 0);
-    
-    board_info->bi_tag		= 0x42444944;
-    board_info->bi_size		= sizeof(board_info);
-    board_info->bi_revision	= 1;
-    board_info->bi_bdate	= 0x06012002;
-    board_info->bi_memstart	= CYGMEM_REGION_ram;
-    board_info->bi_memsize	= CYGMEM_REGION_ram_SIZE;
-    board_info->bi_intfreq	= CYGHWR_HAL_POWERPC_CPU_SPEED*1000000;
-    board_info->bi_busfreq	= CYGHWR_HAL_POWERPC_MEM_SPEED*1000000;
-    board_info->bi_clun		= 0;  // ????
-    board_info->bi_dlun		= 0;  // ????
-    board_info->bi_baudrate     = baud_rate;
-    board_info->bi_cmdline      = cline;
-#ifdef CYGPKG_REDBOOT_NETWORKING
-    memcpy(board_info->bi_enetaddr, __local_enet_addr, sizeof(enet_addr_t));
-#endif
-
-    // adjust SP to 64 bit boundary, and leave a little space
-    // between it and the commandline for PowerPC calling
-    // conventions.
-	
-    sp = (sp-32)&~7;
-
-    if (wait_time_set) {
-        int script_timeout_ms = wait_time * 1000;
-#ifdef CYGFUN_REDBOOT_BOOT_SCRIPT
-        unsigned char *hold_script = script;
-        script = (unsigned char *)0;
-#endif
-        diag_printf("About to start execution at %p - abort with ^C within %d seconds\n",
-                    (void *)entry, wait_time);
-        while (script_timeout_ms >= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT) {
-            int res;
-            char line[80];
-            res = _rb_gets(line, sizeof(line), CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT);
-            if (res == _GETS_CTRLC) {
-#ifdef CYGFUN_REDBOOT_BOOT_SCRIPT
-                script = hold_script;  // Re-enable script
-#endif
-                return;
-            }
-            script_timeout_ms -= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT;
-        }
-    }
-
-#ifdef CYGPKG_IO_ETH_DRIVERS
-    eth_drv_stop();
-#endif
-
-    // Disable interrupts
-    HAL_DISABLE_INTERRUPTS(oldints);
-
-    // Put the caches to sleep.
-    HAL_DCACHE_SYNC();
-    HAL_ICACHE_DISABLE();
-    HAL_DCACHE_DISABLE();
-    HAL_DCACHE_SYNC();
-    HAL_ICACHE_INVALIDATE_ALL();
-    HAL_DCACHE_INVALIDATE_ALL();
-
-//    diag_printf("entry %08x, sp %08x, info %08x, cmd line %08x, baud %d\n",
-//		entry, sp, board_info, cline, baud_rate);
-//    breakpoint();
-    
-    // Call into Linux
-    __asm__ volatile (        
-	               // Start by disabling MMU - the mappings are
-	               // 1-1 so this should not cause any problems
-	               "mfmsr	3\n"
-		       "li      4,0xFFFFFFCF\n"
-		       "and	3,3,4\n"
-		       "sync\n"
-		       "mtmsr	3\n"
-		       "sync\n"
-
-		       // Now set up parameters to jump into linux
-
-		       "mtlr	%0\n"		// set entry address in LR
-		       "mr	1,%1\n"		// set stack pointer
-		       "mr	3,%2\n"		// set board info in R3
-		       "mr	4,%3\n"		// set command line in R4
-		       "blr          \n"	// jump into linux
-		       :
-		       : "r"(entry),"r"(sp),"r"(board_info),"r"(cline)
-		       : "r3", "r4"
-	             
-	             );
-}
-
-#endif // CYGSEM_REDBOOT_HAL_LINUX_BOOT
-
-//=========================================================================
-// EOF redboot_linux_exec.c
Index: hal/powerpc/mbx/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/mbx/current/ChangeLog,v
retrieving revision 1.36
diff -u -5 -p -r1.36 ChangeLog
--- hal/powerpc/mbx/current/ChangeLog	24 Jul 2003 20:24:08 -0000	1.36
+++ hal/powerpc/mbx/current/ChangeLog	28 Aug 2003 14:17:13 -0000
@@ -1,5 +1,16 @@
+2003-08-28  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c: Obsolete file - removed.
+
+	* src/plf_redboot_linux_exec.c: New file - platform specifics
+	for booting Linux kernel from RedBoot.
+
+	* cdl/hal_powerpc_mbx.cdl: Linux booting from RedBoot is 
+	now supported at the architecture level.  Changes to support 
+	architecture/platform layering.
+
 2003-07-18  Nick Garnett  <nickg@balti.calivar.com>
 
 	* cdl/hal_powerpc_mbx.cdl:
         Changed values for CYGNUM_HAL_RTC_NUMERATOR,
         CYGNUM_HAL_RTC_DENOMINATOR and CYGNUM_HAL_RTC_PERIOD to
Index: hal/powerpc/mbx/current/cdl/hal_powerpc_mbx.cdl
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/mbx/current/cdl/hal_powerpc_mbx.cdl,v
retrieving revision 1.18
diff -u -5 -p -r1.18 hal_powerpc_mbx.cdl
--- hal/powerpc/mbx/current/cdl/hal_powerpc_mbx.cdl	24 Jul 2003 20:24:08 -0000	1.18
+++ hal/powerpc/mbx/current/cdl/hal_powerpc_mbx.cdl	28 Aug 2003 14:01:38 -0000
@@ -304,19 +304,19 @@ cdl_package CYGPKG_HAL_POWERPC_MBX {
         active_if     CYGPKG_REDBOOT
         description   "
             This option lists the target's requirements for a valid Redboot
             configuration."
 
-        cdl_option CYGSEM_REDBOOT_HAL_LINUX_BOOT {
+        cdl_option CYGSEM_REDBOOT_PLF_LINUX_BOOT {
             active_if      CYGBLD_BUILD_REDBOOT_WITH_EXEC
             display        "Support booting Linux via RedBoot"
             flavor         bool
             default_value  1
             description    "
                This option enables RedBoot to support booting of a Linux kernel."
 
-            compile -library=libextras.a redboot_linux_exec.c
+            compile plf_redboot_linux_exec.c
         }
 	
         cdl_option CYGBLD_BUILD_REDBOOT_BIN {
             display       "Build Redboot ROM binary image"
             active_if     CYGBLD_BUILD_REDBOOT
Index: hal/powerpc/mbx/current/src/plf_redboot_linux_exec.c
===================================================================
RCS file: hal/powerpc/mbx/current/src/plf_redboot_linux_exec.c
diff -N hal/powerpc/mbx/current/src/plf_redboot_linux_exec.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ hal/powerpc/mbx/current/src/plf_redboot_linux_exec.c	28 Aug 2003 14:02:55 -0000
@@ -0,0 +1,77 @@
+//==========================================================================
+//
+//      plf_redboot_linux_boot.c
+//
+//      Platform support for RedBoot command to boot Linux
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+// Copyright (C) 2002, 2003 Gary Thomas
+//
+// 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.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    gthomas
+// Contributors: 
+// Date:         2003-08-28
+// Purpose:      
+// Description:  
+//              
+// This code is part of RedBoot (tm).
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <cyg/hal/hal_arch.h>
+#include <cyg/hal/hal_if.h>
+#include <cyg/hal/hal_intr.h>
+#include <cyg/hal/hal_cache.h>
+#include <cyg/hal/ppc_regs.h>
+#include <cyg/hal/redboot_linux_exec.h>
+
+//
+// Export system configuration - used when booting a Linux kernel
+// Note: this function is expected to set up the fields which are
+// platform/variant dependent.  It may also override any of the
+// architecture common fields (like memory layout, etc) as appropriate
+//
+externC void 
+plf_redboot_linux_exec(bd_t *board_info)
+{
+    board_info->bi_intfreq	= CYGHWR_HAL_POWERPC_BOARD_SPEED;
+    board_info->bi_busfreq	= 66; // ????
+}
+
+//=========================================================================
+// EOF plf_redboot_linux_exec.c
Index: hal/powerpc/mbx/current/src/redboot_linux_exec.c
===================================================================
RCS file: hal/powerpc/mbx/current/src/redboot_linux_exec.c
diff -N hal/powerpc/mbx/current/src/redboot_linux_exec.c
--- hal/powerpc/mbx/current/src/redboot_linux_exec.c	11 Mar 2003 17:14:14 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,319 +0,0 @@
-//==========================================================================
-//
-//      redboot_linux_boot.c
-//
-//      RedBoot command to boot Linux
-//
-//==========================================================================
-//####ECOSGPLCOPYRIGHTBEGIN####
-// -------------------------------------------
-// This file is part of eCos, the Embedded Configurable Operating System.
-// 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.
-//
-// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-//
-// As a special exception, if other files instantiate templates or use macros
-// or inline functions from this file, or you compile this file and link it
-// with other works to produce a work based on this file, this file does not
-// by itself cause the resulting work to be covered by the GNU General Public
-// License. However the source code for this file must still be made available
-// in accordance with section (3) of the GNU General Public License.
-//
-// This exception does not invalidate any other reasons why a work based on
-// this file might be covered by the GNU General Public License.
-//
-// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
-// at http://sources.redhat.com/ecos/ecos-license/
-// -------------------------------------------
-//####ECOSGPLCOPYRIGHTEND####
-//####OTHERCOPYRIGHTBEGIN####
-//
-//  The structure definitions below are taken from include/asm-ppc/mbx.h in
-//  the Linux kernel, Copyright (c) 1997 Dan Malek. Their presence
-//  here is for the express purpose of communication with the Linux kernel
-//  being booted and is considered 'fair use' by the original author and
-//  are included with his permission.
-//
-//####OTHERCOPYRIGHTEND####
-//==========================================================================
-//#####DESCRIPTIONBEGIN####
-//
-// Author(s):    msalter
-// Contributors: gthomas,msalter
-// Date:         2002-01-14
-// Purpose:      
-// Description:  
-//              
-// This code is part of RedBoot (tm).
-//
-//####DESCRIPTIONEND####
-//
-//==========================================================================
-
-#include <redboot.h>
-#include CYGBLD_HAL_TARGET_H
-#include CYGBLD_HAL_PLATFORM_H
-
-#include <cyg/hal/hal_intr.h>
-#include <cyg/hal/hal_cache.h>
-
-#ifdef CYGPKG_IO_ETH_DRIVERS
-#include <cyg/io/eth/eth_drv.h>            // Logical driver interfaces
-#endif
-
-#ifdef CYGSEM_REDBOOT_HAL_LINUX_BOOT
-
-#include CYGHWR_MEMORY_LAYOUT_H
-
-//=========================================================================
-
-// Exported CLI function(s)
-static void do_exec(int argc, char *argv[]);
-RedBoot_cmd("exec", 
-            "Execute an image - with MMU off", 
-            "[-w timeout]\n"
-            "        [-r <ramdisk addr> [-s <ramdisk length>]]\n"
-            "        [-c \"kernel command line\"] [<entry_point>]",
-            do_exec
-    );
-
-//=========================================================================
-// Imported from Linux kernel include/asm-ppc/mbx.h
-//   Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
-//   Used with permission of author.
-
-
-/* A Board Information structure that is given to a program when
- * EPPC-Bug starts it up.
- */
-typedef struct bd_info {
-	unsigned int	bi_tag;		/* Should be 0x42444944 "BDID" */
-	unsigned int	bi_size;	/* Size of this structure */
-	unsigned int	bi_revision;	/* revision of this structure */
-	unsigned int	bi_bdate;	/* EPPCbug date, i.e. 0x11061997 */
-	unsigned int	bi_memstart;	/* Memory start address */
-	unsigned int	bi_memsize;	/* Memory (end) size in bytes */
-	unsigned int	bi_intfreq;	/* Internal Freq, in Hz */
-	unsigned int	bi_busfreq;	/* Bus Freq, in Hz */
-	unsigned int	bi_clun;	/* Boot device controller */
-	unsigned int	bi_dlun;	/* Boot device logical dev */
-
-	/* These fields are not part of the board information structure
-	 * provided by the boot rom.  They are filled in by embed_config.c
-	 * so we have the information consistent with other platforms.
-	 */
-	unsigned char	bi_enetaddr[6];
-	unsigned int	bi_baudrate;
-} bd_t;
-
-/* Memory map for the MBX as configured by EPPC-Bug.  We could reprogram
- * The SIU and PCI bridge, and try to use larger MMU pages, but the
- * performance gain is not measureable and it certainly complicates the
- * generic MMU model.
- *
- * In a effort to minimize memory usage for embedded applications, any
- * PCI driver or ISA driver must request or map the region required by
- * the device.  For convenience (and since we can map up to 4 Mbytes with
- * a single page table page), the MMU initialization will map the
- * NVRAM, Status/Control registers, CPM Dual Port RAM, and the PCI
- * Bridge CSRs 1:1 into the kernel address space.
- */
-#define PCI_ISA_IO_ADDR		((unsigned)0x80000000)
-#define PCI_ISA_IO_SIZE		((unsigned int)(512 * 1024 * 1024))
-#define PCI_IDE_ADDR		((unsigned)0x81000000)
-#define PCI_ISA_MEM_ADDR	((unsigned)0xc0000000)
-#define PCI_ISA_MEM_SIZE	((unsigned int)(512 * 1024 * 1024))
-#define PCMCIA_MEM_ADDR		((unsigned int)0xe0000000)
-#define PCMCIA_MEM_SIZE		((unsigned int)(64 * 1024 * 1024))
-#define PCMCIA_DMA_ADDR		((unsigned int)0xe4000000)
-#define PCMCIA_DMA_SIZE		((unsigned int)(64 * 1024 * 1024))
-#define PCMCIA_ATTRB_ADDR	((unsigned int)0xe8000000)
-#define PCMCIA_ATTRB_SIZE	((unsigned int)(64 * 1024 * 1024))
-#define PCMCIA_IO_ADDR		((unsigned int)0xec000000)
-#define PCMCIA_IO_SIZE		((unsigned int)(64 * 1024 * 1024))
-#define NVRAM_ADDR		((unsigned int)0xfa000000)
-#define NVRAM_SIZE		((unsigned int)(1 * 1024 * 1024))
-#define MBX_CSR_ADDR		((unsigned int)0xfa100000)
-#define MBX_CSR_SIZE		((unsigned int)(1 * 1024 * 1024))
-#define IMAP_ADDR		((unsigned int)0xfa200000)
-#define IMAP_SIZE		((unsigned int)(64 * 1024))
-#define PCI_CSR_ADDR		((unsigned int)0xfa210000)
-#define PCI_CSR_SIZE		((unsigned int)(64 * 1024))
-
-/* Map additional physical space into well known virtual addresses.  Due
- * to virtual address mapping, these physical addresses are not accessible
- * in a 1:1 virtual to physical mapping.
- */
-#define ISA_IO_VIRT_ADDR	((unsigned int)0xfa220000)
-#define ISA_IO_VIRT_SIZE	((unsigned int)64 * 1024)
-
-/* Interrupt assignments.
- * These are defined (and fixed) by the MBX hardware implementation.
- */
-#define POWER_FAIL_INT	SIU_IRQ0	/* Power fail */
-#define TEMP_HILO_INT	SIU_IRQ1	/* Temperature sensor */
-#define QSPAN_INT	SIU_IRQ2	/* PCI Bridge (DMA CTLR?) */
-#define ISA_BRIDGE_INT	SIU_IRQ3	/* All those PC things */
-#define COMM_L_INT	SIU_IRQ6	/* MBX Comm expansion connector pin */
-#define STOP_ABRT_INT	SIU_IRQ7	/* Stop/Abort header pin */
-
-/* The MBX uses the 8259.
-*/
-#define NR_8259_INTS	16
-
-// End of imported data/structures
-//=========================================================================
-
-#define MBX_CSR_COM1            0x02  // COM1 enabled
-
-//
-// Execute a Linux kernel - this is a RedBoot CLI command
-//
-static void 
-do_exec(int argc, char *argv[])
-{
-    unsigned long entry;
-    bool wait_time_set;
-    int  wait_time;
-    bool cmd_line_set, ramdisk_addr_set, ramdisk_size_set;
-    unsigned long ramdisk_addr, ramdisk_size;
-    char *cmd_line;
-    char *cline;
-    struct option_info opts[6];
-    
-    bd_t *board_info;
-
-    CYG_INTERRUPT_STATE oldints;
-    unsigned long sp = CYGMEM_REGION_ram+CYGMEM_REGION_ram_SIZE;
-    
-    init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&wait_time, (bool *)&wait_time_set, "wait timeout");
-    init_opts(&opts[1], 'c', true, OPTION_ARG_TYPE_STR, 
-              (void **)&cmd_line, (bool *)&cmd_line_set, "kernel command line");
-    init_opts(&opts[2], 'r', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&ramdisk_addr, (bool *)&ramdisk_addr_set, "ramdisk_addr");
-    init_opts(&opts[3], 's', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&ramdisk_size, (bool *)&ramdisk_size_set, "ramdisk_size");
-    if (!scan_opts(argc, argv, 1, opts, 4, (void *)&entry, OPTION_ARG_TYPE_NUM, 
-                   "[physical] starting address"))
-    {
-        return;
-    }
-
-    // Make a little space at the top of the stack, and align to
-    // 64-bit boundary.
-    sp = (sp-8) & ~7;
-    
-    // Set up parameter struct at top of stack
-
-    sp = sp-sizeof(bd_t);
-    
-    board_info = (bd_t *)sp;
-    
-    board_info->bi_tag		= 0x42444944;
-    board_info->bi_size		= sizeof(board_info);
-    board_info->bi_revision	= 1;
-    board_info->bi_bdate	= 0x11061997;
-    board_info->bi_memstart	= CYGMEM_REGION_ram;
-    board_info->bi_memsize	= CYGMEM_REGION_ram_SIZE;
-    board_info->bi_intfreq	= CYGHWR_HAL_POWERPC_BOARD_SPEED;
-    board_info->bi_busfreq	= 66; // ????
-    board_info->bi_clun		= 0;  // ????
-    board_info->bi_dlun		= 0;  // ????
-
-    // Copy the commandline onto the stack, and set the SP to just below it.
-
-    // If no cmd_line set in args, set it to empty string.
-    if( !cmd_line_set )
-	cmd_line = "";
-    
-    {
-	int len,i;
-
-	// get length of string
-	for( len = 0; cmd_line[len] != '\0'; len++ );
-
-	// decrement sp by length of string and align to
-	// word boundary.
-	sp = (sp-(len+1)) & ~3;
-
-	// assign this SP value to command line start
-	cline = (char *)sp;
-
-	// copy command line over.
-	for( i = 0; i < len; i++ )
-	    cline[i] = cmd_line[i];
-	cline[len] = '\0';
-
-	// adjust SP to 64 bit boundary, and leave a little space
-	// between it and the commandline for PowerPC calling
-	// conventions.
-	
-	sp = (sp-32)&~7;
-    
-    }
-
-#ifdef CYGPKG_IO_ETH_DRIVERS
-    eth_drv_stop();
-#endif
-
-    // Disable interrupts
-    HAL_DISABLE_INTERRUPTS(oldints);
-
-    // Put the caches to sleep.
-    HAL_DCACHE_SYNC();
-    HAL_ICACHE_DISABLE();
-    HAL_DCACHE_DISABLE();
-    HAL_DCACHE_SYNC();
-    HAL_ICACHE_INVALIDATE_ALL();
-    HAL_DCACHE_INVALIDATE_ALL();
-
-//    diag_printf("entry %08x sp %08x bi %08x cl %08x\n",
-//		entry,sp,board_info,cline);
-//    breakpoint();
-    
-    // Call into Linux
-    *(volatile unsigned char *)MBX_CSR_ADDR |= MBX_CSR_COM1;  // Magic that says COM1 enabled
-    __asm__ volatile (        
-                       // Linux seems to want the I/O mapped at 0xFA200000
-                       "lis     3,0xFA20\n"
-                       "mtspr   638,3\n"
-
-	               // Start by disabling MMU - the mappings are
-	               // 1-1 so this should not cause any problems
-	               "mfmsr	3\n"
-		       "li      4,0xFFFFFFCF\n"
-		       "and	3,3,4\n"
-		       "sync\n"
-		       "mtmsr	3\n"
-		       "sync\n"
-
-		       // Now set up parameters to jump into linux
-
-		       "mtlr	%0\n"		// set entry address in LR
-		       "mr	1,%1\n"		// set stack pointer
-		       "mr	3,%2\n"		// set board info in R3
-		       "mr	4,%3\n"		// set command line in R4
-		       "blr          \n"	// jump into linux
-		       :
-		       : "r"(entry),"r"(sp),"r"(board_info),"r"(cline)
-		       : "r3", "r4"
-	             
-	             );
-}
-
-#endif // CYGSEM_REDBOOT_HAL_LINUX_BOOT
-
-//=========================================================================
-// EOF redboot_linux_exec.c
Index: hal/powerpc/rattler/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/rattler/current/ChangeLog,v
retrieving revision 1.2
diff -u -5 -p -r1.2 ChangeLog
--- hal/powerpc/rattler/current/ChangeLog	26 Aug 2003 17:04:03 -0000	1.2
+++ hal/powerpc/rattler/current/ChangeLog	28 Aug 2003 14:18:37 -0000
@@ -1,5 +1,16 @@
+2003-08-28  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c: Obsolete file - removed.
+
+	* src/plf_redboot_linux_exec.c: New file - platform specifics
+	for booting Linux kernel from RedBoot.
+
+	* cdl/hal_powerpc_rattler.cdl: Linux booting from RedBoot is 
+	now supported at the architecture level.  Changes to support 
+	architecture/platform layering.
+
 2003-08-26  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/rattler.S: 
 	* src/hal_aux.c: Add PCI initialization - agent mode only.
 
Index: hal/powerpc/rattler/current/cdl/hal_powerpc_rattler.cdl
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/rattler/current/cdl/hal_powerpc_rattler.cdl,v
retrieving revision 1.1
diff -u -5 -p -r1.1 hal_powerpc_rattler.cdl
--- hal/powerpc/rattler/current/cdl/hal_powerpc_rattler.cdl	19 Aug 2003 17:29:48 -0000	1.1
+++ hal/powerpc/rattler/current/cdl/hal_powerpc_rattler.cdl	28 Aug 2003 14:04:32 -0000
@@ -350,19 +350,19 @@ cdl_package CYGPKG_HAL_POWERPC_RATTLER {
         active_if     CYGPKG_REDBOOT
         description   "
             This option lists the target's requirements for a valid Redboot
             configuration."
 
-        cdl_option CYGSEM_REDBOOT_HAL_LINUX_BOOT {
+        cdl_option CYGSEM_REDBOOT_PLF_LINUX_BOOT {
             active_if      CYGBLD_BUILD_REDBOOT_WITH_EXEC
             display        "Support booting Linux via RedBoot"
             flavor         bool
             default_value  1
             description    "
                This option enables RedBoot to support booting of a Linux kernel."
 
-            compile -library=libextras.a redboot_linux_exec.c
+            compile plf_redboot_linux_exec.c
         }
 
         cdl_option CYGBLD_BUILD_REDBOOT_BIN {
             display       "Build Redboot ROM binary image"
             active_if     CYGBLD_BUILD_REDBOOT
Index: hal/powerpc/rattler/current/src/plf_redboot_linux_exec.c
===================================================================
RCS file: hal/powerpc/rattler/current/src/plf_redboot_linux_exec.c
diff -N hal/powerpc/rattler/current/src/plf_redboot_linux_exec.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ hal/powerpc/rattler/current/src/plf_redboot_linux_exec.c	28 Aug 2003 14:56:48 -0000
@@ -0,0 +1,83 @@
+//==========================================================================
+//
+//      plf_redboot_linux_boot.c
+//
+//      Platform support for RedBoot command to boot Linux
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+// Copyright (C) 2002, 2003 Gary Thomas
+//
+// 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.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    gthomas
+// Contributors: 
+// Date:         2003-08-28
+// Purpose:      
+// Description:  
+//              
+// This code is part of RedBoot (tm).
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <cyg/hal/hal_arch.h>
+#include <cyg/hal/hal_if.h>
+#include <cyg/hal/hal_intr.h>
+#include <cyg/hal/hal_cache.h>
+#include <cyg/hal/ppc_regs.h>
+#include <cyg/hal/redboot_linux_exec.h>
+
+//
+// Export system configuration - used when booting a Linux kernel
+// Note: this function is expected to set up the fields which are
+// platform/variant dependent.  It may also override any of the
+// architecture common fields (like memory layout, etc) as appropriate
+//
+externC void 
+plf_redboot_linux_exec(bd_t *board_info)
+{
+    board_info->bi_intfreq	= CYGHWR_HAL_POWERPC_CPU_SPEED*1000000;
+    board_info->bi_busfreq	= CYGHWR_HAL_POWERPC_BUS_SPEED*1000000;
+    board_info->bi_cpmfreq	= CYGHWR_HAL_POWERPC_CPM_SPEED*1000000;
+    board_info->bi_brgfreq      = ((CYGHWR_HAL_POWERPC_CPM_SPEED*2)*1000000)/16;
+    board_info->bi_immr         = (unsigned int)IMM;
+    board_info->bi_flashbase    = 0xFE000000;
+    board_info->bi_flashsize    = 0x00800000;
+    board_info->bi_flashwidth   = 16;
+}
+
+//=========================================================================
+// EOF plf_redboot_linux_exec.c
Index: hal/powerpc/rattler/current/src/redboot_linux_exec.c
===================================================================
RCS file: hal/powerpc/rattler/current/src/redboot_linux_exec.c
diff -N hal/powerpc/rattler/current/src/redboot_linux_exec.c
--- hal/powerpc/rattler/current/src/redboot_linux_exec.c	19 Aug 2003 17:29:49 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,282 +0,0 @@
-//==========================================================================
-//
-//      redboot_linux_boot.c
-//
-//      RedBoot command to boot Linux
-//
-//==========================================================================
-//####ECOSGPLCOPYRIGHTBEGIN####
-// -------------------------------------------
-// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
-// Copyright (C) 2002, 2003 Gary Thomas
-//
-// 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.
-//
-// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-//
-// As a special exception, if other files instantiate templates or use macros
-// or inline functions from this file, or you compile this file and link it
-// with other works to produce a work based on this file, this file does not
-// by itself cause the resulting work to be covered by the GNU General Public
-// License. However the source code for this file must still be made available
-// in accordance with section (3) of the GNU General Public License.
-//
-// This exception does not invalidate any other reasons why a work based on
-// this file might be covered by the GNU General Public License.
-//
-// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
-// at http://sources.redhat.com/ecos/ecos-license/
-// -------------------------------------------
-//####ECOSGPLCOPYRIGHTEND####
-//####OTHERCOPYRIGHTBEGIN####
-//
-//  The structure definitions below are taken from arch/ppc/platforms/rattler8260.h in
-//  the Linux kernel, Copyright (c) 2002, 2003 Gary Thomas, Copyright (c) 1997 Dan Malek. 
-//  Their presence here is for the express purpose of communication with the Linux 
-//  kernel being booted and is considered 'fair use' by the original author and
-//  are included with their permission.
-//
-//####OTHERCOPYRIGHTEND####
-//==========================================================================
-//#####DESCRIPTIONBEGIN####
-//
-// Author(s):    msalter
-// Contributors: gthomas,msalter
-// Date:         2002-01-14
-// Purpose:      
-// Description:  
-//              
-// This code is part of RedBoot (tm).
-//
-//####DESCRIPTIONEND####
-//
-//==========================================================================
-
-#include <redboot.h>
-
-#include <cyg/hal/hal_arch.h>
-#include <cyg/hal/hal_if.h>
-#include <cyg/hal/hal_intr.h>
-#include <cyg/hal/hal_cache.h>
-
-#ifdef CYGPKG_REDBOOT_NETWORKING
-#include <net/net.h>
-#endif
-
-#ifdef CYGPKG_IO_ETH_DRIVERS
-#include <cyg/io/eth/eth_drv.h>            // Logical driver interfaces
-#endif
-
-#ifdef CYGSEM_REDBOOT_HAL_LINUX_BOOT
-
-#include CYGHWR_MEMORY_LAYOUT_H
-
-//=========================================================================
-
-// Exported CLI function(s)
-static void do_exec(int argc, char *argv[]);
-RedBoot_cmd("exec", 
-            "Execute a Linux image - with MMU off", 
-            "[-w timeout]\n"
-            "        [-c \"kernel command line\"] [<entry_point>]",
-            do_exec
-    );
-
-//=========================================================================
-// Imported from Linux kernel arch/ppc/platforms/rattler8260.h
-//   Copyright (c) 2002, 2003 Gary Thomas (<gary@mlbassoc.com>
-//   Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
-//   Used with permission of author(s).
-
-
-/* A Board Information structure that is given to a program when
- * RedBoot starts it up.
- */
-typedef struct bd_info {
-	unsigned int	bi_tag;		/* Should be 0x42444944 "BDID" */
-	unsigned int	bi_size;	/* Size of this structure */
-	unsigned int	bi_revision;	/* revision of this structure */
-	unsigned int	bi_bdate;	/* EPPCbug date, i.e. 0x11061997 */
-	unsigned int	bi_memstart;	/* Memory start address */
-	unsigned int	bi_memsize;	/* Memory (end) size in bytes */
-	unsigned int	bi_intfreq;	/* Internal Freq, in Hz */
-	unsigned int	bi_busfreq;	/* Bus Freq, in Hz */
-	unsigned int	bi_cpmfreq;	/* CPM Freq, in Hz */
-	unsigned int	bi_brgfreq;	/* BRG Freq, in Hz */
-	unsigned int	bi_vco;		/* VCO Out from PLL */
-	unsigned int	bi_baudrate;	/* Default console baud rate */
-	unsigned int	bi_immr;	/* IMMR when called from boot rom */
-	unsigned char	bi_enetaddr[6];
-        unsigned char   *bi_cmdline;    /*  Pointer to command line */
-} bd_t;
-
-//
-// Execute a Linux kernel - this is a RedBoot CLI command
-//
-static void 
-do_exec(int argc, char *argv[])
-{
-    unsigned long entry;
-    bool wait_time_set, cmd_line_set;
-    int  wait_time;
-    char *cmd_line;
-    char *cline;
-    struct option_info opts[2];
-    hal_virtual_comm_table_t *__chan;
-    int baud_rate;
-
-    bd_t *board_info;
-    CYG_INTERRUPT_STATE oldints;
-    unsigned long sp = CYGMEM_REGION_ram+CYGMEM_REGION_ram_SIZE;
-    
-    init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&wait_time, (bool *)&wait_time_set, "wait timeout");
-    init_opts(&opts[1], 'c', true, OPTION_ARG_TYPE_STR, 
-              (void **)&cmd_line, (bool *)&cmd_line_set, "kernel command line");
-    entry = entry_address;  // Default from last 'load' operation
-    if (!scan_opts(argc, argv, 1, opts, 2, (void *)&entry, OPTION_ARG_TYPE_NUM, 
-                   "[physical] starting address")) {
-        return;
-    }
-
-    // Determine baud rate on current console
-    __chan = CYGACC_CALL_IF_CONSOLE_PROCS();
-    baud_rate = CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_GETBAUD);
-    if (baud_rate <= 0) {
-        baud_rate = CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD;
-    }
-
-    // Make a little space at the top of the stack, and align to
-    // 64-bit boundary.
-    sp = (sp-128) & ~7;  // The Linux boot code uses this space for FIFOs
-    
-    // Copy the commandline onto the stack, and set the SP to just below it.
-    if (cmd_line_set) {
-	int len,i;
-
-	// get length of string
-	for( len = 0; cmd_line[len] != '\0'; len++ );
-
-	// decrement sp by length of string and align to
-	// word boundary.
-	sp = (sp-(len+1)) & ~3;
-
-	// assign this SP value to command line start
-	cline = (char *)sp;
-
-	// copy command line over.
-	for( i = 0; i < len; i++ )
-	    cline[i] = cmd_line[i];
-	cline[len] = '\0';
-
-    } else {
-        cline = (char *)NULL;
-    }
-    
-    // Set up parameter struct at top of stack
-    sp = sp-sizeof(bd_t);
-    board_info = (bd_t *)sp;
-    memset(board_info, sizeof(*board_info), 0);
-    
-    board_info->bi_tag		= 0x42444944;
-    board_info->bi_size		= sizeof(board_info);
-    board_info->bi_revision	= 1;
-    board_info->bi_bdate	= 0x06012002;
-    board_info->bi_memstart	= CYGMEM_REGION_ram;
-    board_info->bi_memsize	= CYGMEM_REGION_ram_SIZE;
-    board_info->bi_intfreq	= CYGHWR_HAL_POWERPC_CPU_SPEED*1000000;
-    board_info->bi_busfreq	= CYGHWR_HAL_POWERPC_BUS_SPEED*1000000;
-    board_info->bi_cpmfreq	= CYGHWR_HAL_POWERPC_CPM_SPEED*1000000;
-    board_info->bi_brgfreq      = ((CYGHWR_HAL_POWERPC_CPM_SPEED*2)*1000000)/16;
-    board_info->bi_baudrate     = baud_rate;
-    board_info->bi_cmdline      = cline;
-#ifdef CYGPKG_REDBOOT_NETWORKING
-    memcpy(board_info->bi_enetaddr, __local_enet_addr, sizeof(enet_addr_t));
-#endif
-
-    // adjust SP to 64 bit boundary, and leave a little space
-    // between it and the commandline for PowerPC calling
-    // conventions.
-	
-    sp = (sp-32)&~7;
-
-    if (wait_time_set) {
-        int script_timeout_ms = wait_time * 1000;
-#ifdef CYGFUN_REDBOOT_BOOT_SCRIPT
-        unsigned char *hold_script = script;
-        script = (unsigned char *)0;
-#endif
-        diag_printf("About to start execution at %p - abort with ^C within %d seconds\n",
-                    (void *)entry, wait_time);
-        while (script_timeout_ms >= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT) {
-            int res;
-            char line[80];
-            res = _rb_gets(line, sizeof(line), CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT);
-            if (res == _GETS_CTRLC) {
-#ifdef CYGFUN_REDBOOT_BOOT_SCRIPT
-                script = hold_script;  // Re-enable script
-#endif
-                return;
-            }
-            script_timeout_ms -= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT;
-        }
-    }
-
-#ifdef CYGPKG_IO_ETH_DRIVERS
-    eth_drv_stop();
-#endif
-
-    // Disable interrupts
-    HAL_DISABLE_INTERRUPTS(oldints);
-
-    // Put the caches to sleep.
-    HAL_DCACHE_SYNC();
-    HAL_ICACHE_DISABLE();
-    HAL_DCACHE_DISABLE();
-    HAL_DCACHE_SYNC();
-    HAL_ICACHE_INVALIDATE_ALL();
-    HAL_DCACHE_INVALIDATE_ALL();
-
-//    diag_printf("entry %08x, sp %08x, info %08x, cmd line %08x, baud %d\n",
-//		entry, sp, board_info, cline, baud_rate);
-//    breakpoint();
-    
-    // Call into Linux
-    __asm__ volatile (        
-	               // Start by disabling MMU - the mappings are
-	               // 1-1 so this should not cause any problems
-	               "mfmsr	3\n"
-		       "li      4,0xFFFFFFCF\n"
-		       "and	3,3,4\n"
-		       "sync\n"
-		       "mtmsr	3\n"
-		       "sync\n"
-
-		       // Now set up parameters to jump into linux
-
-		       "mtlr	%0\n"		// set entry address in LR
-		       "mr	1,%1\n"		// set stack pointer
-		       "mr	3,%2\n"		// set board info in R3
-		       "mr	4,%3\n"		// set command line in R4
-		       "blr          \n"	// jump into linux
-		       :
-		       : "r"(entry),"r"(sp),"r"(board_info),"r"(cline)
-		       : "r3", "r4"
-	             
-	             );
-}
-
-#endif // CYGSEM_REDBOOT_HAL_LINUX_BOOT
-
-//=========================================================================
-// EOF redboot_linux_exec.c
Index: hal/powerpc/viper/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/viper/current/ChangeLog,v
retrieving revision 1.26
diff -u -5 -p -r1.26 ChangeLog
--- hal/powerpc/viper/current/ChangeLog	19 Aug 2003 17:29:49 -0000	1.26
+++ hal/powerpc/viper/current/ChangeLog	28 Aug 2003 14:18:37 -0000
@@ -1,5 +1,16 @@
+2003-08-28  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c: Obsolete file - removed.
+
+	* src/plf_redboot_linux_exec.c: New file - platform specifics
+	for booting Linux kernel from RedBoot.
+
+	* cdl/hal_powerpc_viper.cdl: Linux booting from RedBoot is 
+	now supported at the architecture level.  Changes to support 
+	architecture/platform layering.
+
 2003-08-19  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/viper.S: 
 	* cdl/hal_powerpc_viper.cdl: Support new model Viper which
 	has slightly different layout and 16bit FLASH (instead of 8bit)
Index: hal/powerpc/viper/current/cdl/hal_powerpc_viper.cdl
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/viper/current/cdl/hal_powerpc_viper.cdl,v
retrieving revision 1.16
diff -u -5 -p -r1.16 hal_powerpc_viper.cdl
--- hal/powerpc/viper/current/cdl/hal_powerpc_viper.cdl	19 Aug 2003 17:29:49 -0000	1.16
+++ hal/powerpc/viper/current/cdl/hal_powerpc_viper.cdl	28 Aug 2003 14:04:04 -0000
@@ -324,19 +324,19 @@ cdl_package CYGPKG_HAL_POWERPC_VIPER {
         active_if     CYGPKG_REDBOOT
         description   "
             This option lists the target's requirements for a valid Redboot
             configuration."
 
-        cdl_option CYGSEM_REDBOOT_HAL_LINUX_BOOT {
+        cdl_option CYGSEM_REDBOOT_PLF_LINUX_BOOT {
             active_if      CYGBLD_BUILD_REDBOOT_WITH_EXEC
             display        "Support booting Linux via RedBoot"
             flavor         bool
             default_value  1
             description    "
                This option enables RedBoot to support booting of a Linux kernel."
 
-            compile -library=libextras.a redboot_linux_exec.c
+            compile plf_redboot_linux_exec.c
         }
 
         cdl_option CYGBLD_BUILD_REDBOOT_BIN {
             display       "Build Redboot ROM binary image"
             active_if     CYGBLD_BUILD_REDBOOT
Index: hal/powerpc/viper/current/src/plf_redboot_linux_exec.c
===================================================================
RCS file: hal/powerpc/viper/current/src/plf_redboot_linux_exec.c
diff -N hal/powerpc/viper/current/src/plf_redboot_linux_exec.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ hal/powerpc/viper/current/src/plf_redboot_linux_exec.c	28 Aug 2003 14:55:40 -0000
@@ -0,0 +1,84 @@
+//==========================================================================
+//
+//      plf_redboot_linux_boot.c
+//
+//      Platform support for RedBoot command to boot Linux
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+// Copyright (C) 2002, 2003 Gary Thomas
+//
+// 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.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    gthomas
+// Contributors: 
+// Date:         2003-08-28
+// Purpose:      
+// Description:  
+//              
+// This code is part of RedBoot (tm).
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <cyg/hal/hal_arch.h>
+#include <cyg/hal/hal_if.h>
+#include <cyg/hal/hal_intr.h>
+#include <cyg/hal/hal_cache.h>
+#include <cyg/hal/ppc_regs.h>
+#include <cyg/hal/redboot_linux_exec.h>
+
+//
+// Export system configuration - used when booting a Linux kernel
+// Note: this function is expected to set up the fields which are
+// platform/variant dependent.  It may also override any of the
+// architecture common fields (like memory layout, etc) as appropriate
+//
+externC void 
+plf_redboot_linux_exec(bd_t *board_info)
+{
+    board_info->bi_intfreq	= CYGHWR_HAL_POWERPC_BOARD_SPEED*1000000;
+    board_info->bi_busfreq	= 66*1000000;
+    board_info->bi_flashbase    = 0xFE000000;
+    board_info->bi_flashsize    = 0x00800000;
+#ifdef CYGHWR_HAL_POWERPC_VIPER_II
+    board_info->bi_flashwidth   = 16;
+#else
+    board_info->bi_flashwidth   = 8;
+#endif
+}
+
+//=========================================================================
+// EOF plf_redboot_linux_exec.c
Index: hal/powerpc/viper/current/src/redboot_linux_exec.c
===================================================================
RCS file: hal/powerpc/viper/current/src/redboot_linux_exec.c
diff -N hal/powerpc/viper/current/src/redboot_linux_exec.c
--- hal/powerpc/viper/current/src/redboot_linux_exec.c	11 Mar 2003 17:14:15 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,281 +0,0 @@
-//==========================================================================
-//
-//      redboot_linux_boot.c
-//
-//      RedBoot command to boot Linux
-//
-//==========================================================================
-//####ECOSGPLCOPYRIGHTBEGIN####
-// -------------------------------------------
-// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
-// Copyright (C) 2002 Gary Thomas
-//
-// 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.
-//
-// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-//
-// As a special exception, if other files instantiate templates or use macros
-// or inline functions from this file, or you compile this file and link it
-// with other works to produce a work based on this file, this file does not
-// by itself cause the resulting work to be covered by the GNU General Public
-// License. However the source code for this file must still be made available
-// in accordance with section (3) of the GNU General Public License.
-//
-// This exception does not invalidate any other reasons why a work based on
-// this file might be covered by the GNU General Public License.
-//
-// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
-// at http://sources.redhat.com/ecos/ecos-license/
-// -------------------------------------------
-//####ECOSGPLCOPYRIGHTEND####
-//####OTHERCOPYRIGHTBEGIN####
-//
-//  The structure definitions below are taken from include/ppc/platforms/am860.h in
-//  the Linux kernel, Copyright (c) 2002 Gary Thomas, Copyright (c) 1997 Dan Malek. 
-//  Their presence here is for the express purpose of communication with the Linux 
-//  kernel being booted and is considered 'fair use' by the original author and
-//  are included with their permission.
-//
-//####OTHERCOPYRIGHTEND####
-//==========================================================================
-//#####DESCRIPTIONBEGIN####
-//
-// Author(s):    msalter
-// Contributors: gthomas,msalter
-// Date:         2002-01-14
-// Purpose:      
-// Description:  
-//              
-// This code is part of RedBoot (tm).
-//
-//####DESCRIPTIONEND####
-//
-//==========================================================================
-
-#include <redboot.h>
-#include <pkgconf/hal_powerpc_quicc.h>
-
-#include <cyg/hal/hal_arch.h>
-#include <cyg/hal/hal_if.h>
-#include <cyg/hal/hal_intr.h>
-#include <cyg/hal/hal_cache.h>
-
-#ifdef CYGPKG_REDBOOT_NETWORKING
-#include <net/net.h>
-#endif
-
-#ifdef CYGPKG_IO_ETH_DRIVERS
-#include <cyg/io/eth/eth_drv.h>            // Logical driver interfaces
-#endif
-
-#ifdef CYGSEM_REDBOOT_HAL_LINUX_BOOT
-
-#include CYGHWR_MEMORY_LAYOUT_H
-
-//=========================================================================
-
-// Exported CLI function(s)
-static void do_exec(int argc, char *argv[]);
-RedBoot_cmd("exec", 
-            "Execute a Linux image - with MMU off", 
-            "[-w timeout]\n"
-            "        [-c \"kernel command line\"] [<entry_point>]",
-            do_exec
-    );
-
-//=========================================================================
-// Imported from Linux kernel include/asm-ppc/am860.h
-//   Copyright (c) 2002 Gary Thomas (gary@chez-thomas.org)
-//   Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
-//   Used with permission of author(s).
-
-
-/* A Board Information structure that is given to a program when
- * RedBoot starts it up.
- */
-typedef struct bd_info {
-	unsigned int	bi_tag;		/* Should be 0x42444944 "BDID" */
-	unsigned int	bi_size;	/* Size of this structure */
-	unsigned int	bi_revision;	/* revision of this structure */
-	unsigned int	bi_bdate;	/* EPPCbug date, i.e. 0x11061997 */
-	unsigned int	bi_memstart;	/* Memory start address */
-	unsigned int	bi_memsize;	/* Memory (end) size in bytes */
-	unsigned int	bi_intfreq;	/* Internal Freq, in Hz */
-	unsigned int	bi_busfreq;	/* Bus Freq, in Hz */
-	unsigned int	bi_clun;	/* Boot device controller */
-	unsigned int	bi_dlun;	/* Boot device logical dev */
-	unsigned char	bi_enetaddr[6];
-	unsigned int	bi_baudrate;
-        unsigned char   *bi_cmdline;
-} bd_t;
-
-//
-// Execute a Linux kernel - this is a RedBoot CLI command
-//
-static void 
-do_exec(int argc, char *argv[])
-{
-    unsigned long entry;
-    bool wait_time_set, cmd_line_set;
-    int  wait_time;
-    char *cmd_line;
-    char *cline;
-    struct option_info opts[2];
-    hal_virtual_comm_table_t *__chan;
-    int baud_rate;
-
-    bd_t *board_info;
-    CYG_INTERRUPT_STATE oldints;
-    unsigned long sp = CYGMEM_REGION_ram+CYGMEM_REGION_ram_SIZE;
-    
-    init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&wait_time, (bool *)&wait_time_set, "wait timeout");
-    init_opts(&opts[1], 'c', true, OPTION_ARG_TYPE_STR, 
-              (void **)&cmd_line, (bool *)&cmd_line_set, "kernel command line");
-    entry = entry_address;  // Default from last 'load' operation
-    if (!scan_opts(argc, argv, 1, opts, 2, (void *)&entry, OPTION_ARG_TYPE_NUM, 
-                   "[physical] starting address")) {
-        return;
-    }
-
-    // Determine baud rate on current console
-    __chan = CYGACC_CALL_IF_CONSOLE_PROCS();
-    baud_rate = CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_GETBAUD);
-    if (baud_rate <= 0) {
-        baud_rate = CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD;
-    }
-
-    // Make a little space at the top of the stack, and align to
-    // 64-bit boundary.
-    sp = (sp-128) & ~7;  // The Linux boot code uses this space for FIFOs
-    
-    // Copy the commandline onto the stack, and set the SP to just below it.
-    if (cmd_line_set) {
-	int len,i;
-
-	// get length of string
-	for( len = 0; cmd_line[len] != '\0'; len++ );
-
-	// decrement sp by length of string and align to
-	// word boundary.
-	sp = (sp-(len+1)) & ~3;
-
-	// assign this SP value to command line start
-	cline = (char *)sp;
-
-	// copy command line over.
-	for( i = 0; i < len; i++ )
-	    cline[i] = cmd_line[i];
-	cline[len] = '\0';
-
-    } else {
-        cline = (char *)NULL;
-    }
-    
-    // Set up parameter struct at top of stack
-    sp = sp-sizeof(bd_t);
-    board_info = (bd_t *)sp;
-    memset(board_info, sizeof(*board_info), 0);
-    
-    board_info->bi_tag		= 0x42444944;
-    board_info->bi_size		= sizeof(board_info);
-    board_info->bi_revision	= 1;
-    board_info->bi_bdate	= 0x06012002;
-    board_info->bi_memstart	= CYGMEM_REGION_ram;
-    board_info->bi_memsize	= CYGMEM_REGION_ram_SIZE;
-    board_info->bi_intfreq	= CYGHWR_HAL_POWERPC_BOARD_SPEED*1000000;
-    board_info->bi_busfreq	= 66*1000000;
-    board_info->bi_clun		= 0;  // ????
-    board_info->bi_dlun		= 0;  // ????
-    board_info->bi_baudrate     = baud_rate;
-    board_info->bi_cmdline      = cline;
-#ifdef CYGPKG_REDBOOT_NETWORKING
-    memcpy(board_info->bi_enetaddr, __local_enet_addr, sizeof(enet_addr_t));
-#endif
-
-    // adjust SP to 64 bit boundary, and leave a little space
-    // between it and the commandline for PowerPC calling
-    // conventions.
-	
-    sp = (sp-32)&~7;
-
-    if (wait_time_set) {
-        int script_timeout_ms = wait_time * 1000;
-#ifdef CYGFUN_REDBOOT_BOOT_SCRIPT
-        unsigned char *hold_script = script;
-        script = (unsigned char *)0;
-#endif
-        diag_printf("About to start execution at %p - abort with ^C within %d seconds\n",
-                    (void *)entry, wait_time);
-        while (script_timeout_ms >= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT) {
-            int res;
-            char line[80];
-            res = _rb_gets(line, sizeof(line), CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT);
-            if (res == _GETS_CTRLC) {
-#ifdef CYGFUN_REDBOOT_BOOT_SCRIPT
-                script = hold_script;  // Re-enable script
-#endif
-                return;
-            }
-            script_timeout_ms -= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT;
-        }
-    }
-
-#ifdef CYGPKG_IO_ETH_DRIVERS
-    eth_drv_stop();
-#endif
-
-    // Disable interrupts
-    HAL_DISABLE_INTERRUPTS(oldints);
-
-    // Put the caches to sleep.
-    HAL_DCACHE_SYNC();
-    HAL_ICACHE_DISABLE();
-    HAL_DCACHE_DISABLE();
-    HAL_DCACHE_SYNC();
-    HAL_ICACHE_INVALIDATE_ALL();
-    HAL_DCACHE_INVALIDATE_ALL();
-
-//    diag_printf("entry %08x, sp %08x, info %08x, cmd line %08x, baud %d\n",
-//		entry, sp, board_info, cline, baud_rate);
-//    breakpoint();
-    
-    // Call into Linux
-    __asm__ volatile (        
-	               // Start by disabling MMU - the mappings are
-	               // 1-1 so this should not cause any problems
-	               "mfmsr	3\n"
-		       "li      4,0xFFFFFFCF\n"
-		       "and	3,3,4\n"
-		       "sync\n"
-		       "mtmsr	3\n"
-		       "sync\n"
-
-		       // Now set up parameters to jump into linux
-
-		       "mtlr	%0\n"		// set entry address in LR
-		       "mr	1,%1\n"		// set stack pointer
-		       "mr	3,%2\n"		// set board info in R3
-		       "mr	4,%3\n"		// set command line in R4
-		       "blr          \n"	// jump into linux
-		       :
-		       : "r"(entry),"r"(sp),"r"(board_info),"r"(cline)
-		       : "r3", "r4"
-	             
-	             );
-}
-
-#endif // CYGSEM_REDBOOT_HAL_LINUX_BOOT
-
-//=========================================================================
-// EOF redboot_linux_exec.c

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