summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-20 21:44:57 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-20 21:44:57 +0000
commit2785a80d3ed7983fd576cf2c6552d16358d6a5fb (patch)
tree56eb26238dc8941806e0507c4380d8afa6716f5c /c/src/lib/libbsp
parent2008-09-20 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-2785a80d3ed7983fd576cf2c6552d16358d6a5fb.tar.bz2
2008-09-20 Joel Sherrill <joel.sherrill@oarcorp.com>
* bspgetworkarea.c: Augment to optionally know U-Boot.
Diffstat (limited to 'c/src/lib/libbsp')
-rw-r--r--c/src/lib/libbsp/shared/ChangeLog4
-rw-r--r--c/src/lib/libbsp/shared/bspgetworkarea.c30
2 files changed, 27 insertions, 7 deletions
diff --git a/c/src/lib/libbsp/shared/ChangeLog b/c/src/lib/libbsp/shared/ChangeLog
index 0084f1b7b0..775f7dcbcd 100644
--- a/c/src/lib/libbsp/shared/ChangeLog
+++ b/c/src/lib/libbsp/shared/ChangeLog
@@ -1,3 +1,7 @@
+2008-09-20 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * bspgetworkarea.c: Augment to optionally know U-Boot.
+
2008-09-18 Joel Sherrill <joel.sherrill@oarcorp.com>
* bootcard.c: Perform bsp_start() before bsp_get_work_area().
diff --git a/c/src/lib/libbsp/shared/bspgetworkarea.c b/c/src/lib/libbsp/shared/bspgetworkarea.c
index 2a5f313517..3bd67444dd 100644
--- a/c/src/lib/libbsp/shared/bspgetworkarea.c
+++ b/c/src/lib/libbsp/shared/bspgetworkarea.c
@@ -19,10 +19,18 @@
/*
* These are provided by the linkcmds for ALL of the BSPs which use this file.
*/
-extern char RamBase[];
extern char WorkAreaBase[];
extern char HeapSize[];
-extern char RamSize[];
+
+/*
+ * We may get the size information from U-Boot or the linker scripts.
+ */
+#ifdef HAS_UBOOT
+ extern bd_t bsp_uboot_board_info;
+#else
+ extern char RamBase[];
+ extern char RamSize[];
+#endif /* HAS_UBOOT */
/*
* This method returns the base address and size of the area which
@@ -36,9 +44,17 @@ void bsp_get_work_area(
size_t *heap_size
)
{
- *work_area_start = WorkAreaBase;
- *work_area_size = (uintptr_t) RamBase + (uintptr_t) RamSize -
- (uintptr_t) WorkAreaBase;
- *heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
- *heap_size = (size_t) HeapSize;
+ uintptr_t ram_end;
+
+ #ifdef HAS_UBOOT
+ ram_end = (uintptr_t) bsp_uboot_board_info.bi_memstart +
+ bsp_uboot_board_info.bi_memsize;
+ #else
+ ram_end = RamBase + (uintptr_t)RamSize;
+ #endif
+
+ *work_area_start = WorkAreaBase;
+ *work_area_size = ram_end = (uintptr_t) WorkAreaBase;
+ *heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
+ *heap_size = (size_t) HeapSize;
}