changeset 600:a4f75ab7f357

Provide platform specific override for Linux memory layout.
author gthomas
date Wed, 12 Feb 2003 21:05:24 +0000
parents 02a1b55c8a11
children 9a75fc7968ba
files packages/hal/arm/arch/current/ChangeLog packages/hal/arm/arch/current/src/redboot_linux_exec.c packages/hal/arm/edb7xxx/current/ChangeLog packages/hal/arm/edb7xxx/current/include/plf_io.h
diffstat 4 files changed, 50 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/packages/hal/arm/arch/current/ChangeLog
+++ b/packages/hal/arm/arch/current/ChangeLog
@@ -1,3 +1,8 @@
+2003-02-12  Gary Thomas  <gary@mlbassoc.com> inspired by
+2003-02-12  Robin Farine <robin.farine@acn-group.ch>	
+
+	* src/redboot_linux_exec.c: Allow platform to override memory layout.
+	Also, give error if no "-b" option and base/load address unknown.	
 2003-02-06  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/redboot_linux_exec.c: Make sure RAM description is sane.
--- a/packages/hal/arm/arch/current/src/redboot_linux_exec.c
+++ b/packages/hal/arm/arch/current/src/redboot_linux_exec.c
@@ -248,6 +248,23 @@ struct tag {
 // End of inclusion from <asm-arm/setup.h>
 //=========================================================================
 
+// Default memory layout - can be overridden by platform, typically in
+// <cyg/hal/plf_io.h>
+#ifndef CYGHWR_REDBOOT_LINUX_ATAG_MEM
+#define CYGHWR_REDBOOT_LINUX_ATAG_MEM(_p_)                                                      \
+    /* Next ATAG_MEM. */                                                                        \
+    _p_->hdr.size = (sizeof(struct tag_mem32) + sizeof(struct tag_header))/sizeof(long);        \
+    _p_->hdr.tag = ATAG_MEM;                                                                    \
+    /* Round up so there's only one bit set in the memory size.                                 \
+     * Don't double it if it's already a power of two, though.                                  \
+     */                                                                                         \
+    _p_->u.mem.size  = 1<<hal_msbindex(CYGMEM_REGION_ram_SIZE);                                 \
+    if (_p_->u.mem.size < CYGMEM_REGION_ram_SIZE)                                               \
+	    _p_->u.mem.size <<= 1;                                                              \
+    _p_->u.mem.start = CYGARC_PHYSICAL_ADDRESS(CYGMEM_REGION_ram);
+#endif
+
+
 // Round up a quantity to a longword (32 bit) length
 #define ROUNDUP(n) (((n)+3)&~3)
 
@@ -304,18 +321,7 @@ do_exec(int argc, char *argv[])
     params->u.core.rootdev = 0;
     params = (struct tag *)((long *)params + params->hdr.size);
     
-    /* Next ATAG_MEM. */
-    params->hdr.size = (sizeof(struct tag_mem32) + sizeof(struct tag_header))/sizeof(long);
-    params->hdr.tag = ATAG_MEM;
-    /* Round up so there's only one bit set in the memory size.
-     * Don't double it if it's already a power of two, though.
-     */
-    params->u.mem.size  = 1<<hal_msbindex(CYGMEM_REGION_ram_SIZE);
-    if (params->u.mem.size < CYGMEM_REGION_ram_SIZE)
-	    params->u.mem.size <<= 1;
-    params->u.mem.start = CYGARC_PHYSICAL_ADDRESS(CYGMEM_REGION_ram);
-    // Linux doesn't like physical RAM to start on odd boundary 
-    params->u.mem.start &= ~(params->u.mem.size-1);
+    CYGHWR_REDBOOT_LINUX_ATAG_MEM(params)
     params = (struct tag *)((long *)params + params->hdr.size);
     if (ramdisk_addr_set) {
         params->hdr.size = (sizeof(struct tag_initrd) + sizeof(struct tag_header))/sizeof(long);
@@ -354,6 +360,11 @@ do_exec(int argc, char *argv[])
         }
     }
     if (!base_addr_set) {
+        if ((base_addr == 0) || (length == 0)) {
+            // Probably not valid - don't try it
+            diag_printf("No default base address set!\n");
+            return;
+        }
         diag_printf("Using base address %p and length %p\n",
                     (void*)base_addr, (void*)length);
     } else if (base_addr_set && !length_set) {
--- a/packages/hal/arm/edb7xxx/current/ChangeLog
+++ b/packages/hal/arm/edb7xxx/current/ChangeLog
@@ -1,3 +1,7 @@
+2003-02-12  Gary Thomas  <gary@mlbassoc.com>
+
+	* include/plf_io.h: Provide proper memory layout for EDB7312.
+
 2003-02-06  Gary Thomas  <gary@mind.be>
 
 	* misc/edb7312_redboot_ROMRAM.ecm: 
--- a/packages/hal/arm/edb7xxx/current/include/plf_io.h
+++ b/packages/hal/arm/edb7xxx/current/include/plf_io.h
@@ -45,7 +45,7 @@
 //#####DESCRIPTIONBEGIN####
 //
 // Author(s):    jskov
-// Contributors: jskov
+// Contributors: jskov, gthomas
 // Date:         2002-01-28
 // Purpose:      Platform specific support routines
 // Description: 
@@ -63,5 +63,22 @@
 extern unsigned long _edb7xxx_physical_address(unsigned long addr);
 #define CYGARC_PHYSICAL_ADDRESS(x) _edb7xxx_physical_address((unsigned long) x)
 
+#if defined(CYGPKG_REDBOOT_ARM_LINUX_EXEC) && defined(CYGHWR_HAL_ARM_EDB7XXX_VARIANT_EP7312)
+#define _CYGHWR_LAYOUT_ONLY
+#include <cyg/hal/hal_platform_setup.h>
+// Describe memory layout for Linux
+#define CYGHWR_REDBOOT_LINUX_ATAG_MEM(_p_)                                                      \
+    /* Next ATAG_MEM. */                                                                        \
+    _p_->hdr.size = (sizeof(struct tag_mem32) + sizeof(struct tag_header))/sizeof(long);        \
+    _p_->hdr.tag = ATAG_MEM;                                                                    \
+    /* Round up so there's only one bit set in the memory size.                                 \
+     * Don't double it if it's already a power of two, though.                                  \
+     */                                                                                         \
+    _p_->u.mem.size  = 1<<hal_msbindex(CYGMEM_REGION_ram_SIZE);                                 \
+    if (_p_->u.mem.size < CYGMEM_REGION_ram_SIZE)                                               \
+	    _p_->u.mem.size <<= 1;                                                              \
+    _p_->u.mem.start = DRAM_PA_START;
+#endif
+
 #endif // CYGONCE_HAL_ARM_EDB7XXX_PLF_IO_H
 // EOF plf_io.h