* [U-Boot-Users] [PATCH 1/2] ppc: Cleanup get_effective_memsize() use
@ 2008-05-07 11:08 Marian Balakowicz
2008-05-07 11:10 ` [U-Boot-Users] [RFC] [PATCH 2/2] [new uImage] Avoid initrd and logbuffer area overlaps Marian Balakowicz
2008-05-09 22:14 ` [U-Boot-Users] [PATCH 1/2] ppc: Cleanup get_effective_memsize() use Wolfgang Denk
0 siblings, 2 replies; 7+ messages in thread
From: Marian Balakowicz @ 2008-05-07 11:08 UTC (permalink / raw)
To: u-boot
Removed duplicated effective memory size calculation code.
Signed-off-by: Marian Balakowicz <m8@semihalf.com>
---
lib_ppc/board.c | 11 -----------
1 files changed, 0 insertions(+), 11 deletions(-)
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index 1b8a872..4956403 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -453,18 +453,7 @@ void board_init_f (ulong bootflag)
*/
gd->ram_size -= CFG_MEM_TOP_HIDE;
-#ifndef CONFIG_MAX_MEM_MAPPED
-#define CONFIG_MAX_MEM_MAPPED (256 << 20)
-#endif
-
-#ifndef CONFIG_VERY_BIG_RAM
addr = CFG_SDRAM_BASE + get_effective_memsize();
-#else
- /* only allow stack below 256M */
- addr = CFG_SDRAM_BASE +
- (gd->ram_size > CONFIG_MAX_MEM_MAPPED) ?
- CONFIG_MAX_MEM_MAPPED : get_effective_memsize();
-#endif
#ifdef CONFIG_LOGBUFFER
#ifndef CONFIG_ALT_LB_ADDR
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot-Users] [RFC] [PATCH 2/2] [new uImage] Avoid initrd and logbuffer area overlaps
2008-05-07 11:08 [U-Boot-Users] [PATCH 1/2] ppc: Cleanup get_effective_memsize() use Marian Balakowicz
@ 2008-05-07 11:10 ` Marian Balakowicz
2008-05-09 22:16 ` Wolfgang Denk
2008-05-10 4:17 ` Stefan Roese
2008-05-09 22:14 ` [U-Boot-Users] [PATCH 1/2] ppc: Cleanup get_effective_memsize() use Wolfgang Denk
1 sibling, 2 replies; 7+ messages in thread
From: Marian Balakowicz @ 2008-05-07 11:10 UTC (permalink / raw)
To: u-boot
Add logbuffer to reserved LMB areas to prevent initrd allocation
from overlaping with it.
Make sure to use correct logbuffer base address.
Signed-off-by: Marian Balakowicz <m8@semihalf.com>
---
This patch attempts to assure that initrd allocation made during OS booting
will not destroy logbuffer area.
Please review and comment.
Cheers,
m.
common/cmd_log.c | 8 +++++++-
common/image.c | 7 +++++++
include/logbuff.h | 1 +
lib_ppc/board.c | 5 +++++
4 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/common/cmd_log.c b/common/cmd_log.c
index b9f9ba0..8e04941 100644
--- a/common/cmd_log.c
+++ b/common/cmd_log.c
@@ -66,6 +66,12 @@ static logbuff_t *log;
#endif
static char *lbuf;
+unsigned long __logbuffer_base(void)
+{
+ return CFG_SDRAM_BASE + gd->bd->bi_memsize - LOGBUFF_LEN;
+}
+unsigned long logbuffer_base (void) __attribute__((weak, alias("__logbuffer_base")));
+
void logbuff_init_ptrs (void)
{
unsigned long tag, post_word;
@@ -75,7 +81,7 @@ void logbuff_init_ptrs (void)
log = (logbuff_t *)CONFIG_ALT_LH_ADDR;
lbuf = (char *)CONFIG_ALT_LB_ADDR;
#else
- log = (logbuff_t *)(gd->bd->bi_memsize-LOGBUFF_LEN) - 1;
+ log = (logbuff_t *)(logbuffer_base ()) - 1;
lbuf = (char *)log->buf;
#endif
diff --git a/common/image.c b/common/image.c
index 0a78385..8afaccd 100644
--- a/common/image.c
+++ b/common/image.c
@@ -36,6 +36,10 @@
#include <dataflash.h>
#endif
+#ifdef CONFIG_LOGBUFFER
+#include <logbuff.h>
+#endif
+
#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
#include <rtc.h>
#endif
@@ -1017,6 +1021,9 @@ int boot_ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
initrd_high = ~0;
}
+ /* Prevent initrd from overwriting logbuffer */
+ lmb_reserve(lmb, logbuffer_base() - LOGBUFF_OVERHEAD, LOGBUFF_RESERVE);
+
debug ("## initrd_high = 0x%08lx, copy_to_ram = %d\n",
initrd_high, initrd_copy_to_ram);
diff --git a/include/logbuff.h b/include/logbuff.h
index d415729..f117c66 100644
--- a/include/logbuff.h
+++ b/include/logbuff.h
@@ -60,6 +60,7 @@ int drv_logbuff_init (void);
void logbuff_init_ptrs (void);
void logbuff_log(char *msg);
void logbuff_reset (void);
+unsigned long logbuffer_base (void);
#endif /* CONFIG_LOGBUFFER */
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index 4956403..bc49ea1 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -398,6 +398,11 @@ ulong get_effective_memsize(void)
************************************************************************
*/
+unsigned long logbuffer_base(void)
+{
+ return CFG_SDRAM_BASE + get_effective_memsize() - LOGBUFF_LEN;
+}
+
void board_init_f (ulong bootflag)
{
bd_t *bd;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot-Users] [PATCH 1/2] ppc: Cleanup get_effective_memsize() use
2008-05-07 11:08 [U-Boot-Users] [PATCH 1/2] ppc: Cleanup get_effective_memsize() use Marian Balakowicz
2008-05-07 11:10 ` [U-Boot-Users] [RFC] [PATCH 2/2] [new uImage] Avoid initrd and logbuffer area overlaps Marian Balakowicz
@ 2008-05-09 22:14 ` Wolfgang Denk
1 sibling, 0 replies; 7+ messages in thread
From: Wolfgang Denk @ 2008-05-09 22:14 UTC (permalink / raw)
To: u-boot
In message <20080507110850.10627.64684.stgit@hekate.izotz.org> you wrote:
> Removed duplicated effective memory size calculation code.
>
> Signed-off-by: Marian Balakowicz <m8@semihalf.com>
> ---
>
> lib_ppc/board.c | 11 -----------
> 1 files changed, 0 insertions(+), 11 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Every program has at least one bug and can be shortened by at least
one instruction - from which, by induction, one can deduce that every
program can be reduced to one instruction which doesn't work.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot-Users] [RFC] [PATCH 2/2] [new uImage] Avoid initrd and logbuffer area overlaps
2008-05-07 11:10 ` [U-Boot-Users] [RFC] [PATCH 2/2] [new uImage] Avoid initrd and logbuffer area overlaps Marian Balakowicz
@ 2008-05-09 22:16 ` Wolfgang Denk
2008-05-10 4:17 ` Stefan Roese
1 sibling, 0 replies; 7+ messages in thread
From: Wolfgang Denk @ 2008-05-09 22:16 UTC (permalink / raw)
To: u-boot
In message <20080507110859.10627.96876.stgit@hekate.izotz.org> you wrote:
> Add logbuffer to reserved LMB areas to prevent initrd allocation
> from overlaping with it.
>
> Make sure to use correct logbuffer base address.
>
> Signed-off-by: Marian Balakowicz <m8@semihalf.com>
---
>
> This patch attempts to assure that initrd allocation made during OS booting
> will not destroy logbuffer area.
>
> Please review and comment.
>
> Cheers,
> m.
>
> common/cmd_log.c | 8 +++++++-
> common/image.c | 7 +++++++
> include/logbuff.h | 1 +
> lib_ppc/board.c | 5 +++++
> 4 files changed, 20 insertions(+), 1 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Any sufficiently advanced technology is indistinguishable from a
rigged demo. - Andy Finkel, computer guy
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot-Users] [RFC] [PATCH 2/2] [new uImage] Avoid initrd and logbuffer area overlaps
2008-05-07 11:10 ` [U-Boot-Users] [RFC] [PATCH 2/2] [new uImage] Avoid initrd and logbuffer area overlaps Marian Balakowicz
2008-05-09 22:16 ` Wolfgang Denk
@ 2008-05-10 4:17 ` Stefan Roese
2008-05-11 23:00 ` Wolfgang Denk
1 sibling, 1 reply; 7+ messages in thread
From: Stefan Roese @ 2008-05-10 4:17 UTC (permalink / raw)
To: u-boot
On Wednesday 07 May 2008, Marian Balakowicz wrote:
> Add logbuffer to reserved LMB areas to prevent initrd allocation
> from overlaping with it.
>
> Make sure to use correct logbuffer base address.
>
> Signed-off-by: Marian Balakowicz <m8@semihalf.com>
Hmmm, this patch breaks all PPC boards without logbuffer support. Take a look
at "acadia" for example:
[stefan at kubuntu u-boot (master)]$ ./MAKEALL acadia
Configuring for acadia board...
board.c: In function 'logbuffer_base':
board.c:403: error: 'LOGBUFF_LEN' undeclared (first use in this function)
board.c:403: error: (Each undeclared identifier is reported only once
board.c:403: error: for each function it appears in.)
make[1]: *** [board.o] Error 1
make: *** [lib_ppc/libppc.a] Error 2
I tried to quickly (#ifdef around the logbuffer_base() function in
lib_ppc/board.c) fix it but it didn't work. So it would be great if you could
come up with a fix for this.
Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot-Users] [RFC] [PATCH 2/2] [new uImage] Avoid initrd and logbuffer area overlaps
2008-05-10 4:17 ` Stefan Roese
@ 2008-05-11 23:00 ` Wolfgang Denk
2008-05-12 10:56 ` Marian Balakowicz
0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Denk @ 2008-05-11 23:00 UTC (permalink / raw)
To: u-boot
Dear Marian,
in message <200805100617.43643.sr@denx.de> Stefan Roese wrote:
>
> > Add logbuffer to reserved LMB areas to prevent initrd allocation
> > from overlaping with it.
> >
> > Make sure to use correct logbuffer base address.
> >
> > Signed-off-by: Marian Balakowicz <m8@semihalf.com>
>
> Hmmm, this patch breaks all PPC boards without logbuffer support. Take a look
> at "acadia" for example:
Indeed. It is obvious that this patch was not even minimally tested.
Please see "Note 2" at http://www.denx.de/wiki/UBoot/Patches
I reverted the patch. Please resubmit after fixing the problems.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
1 1 was a race-horse, 2 2 was 1 2. When 1 1 1 1 race, 2 2 1 1 2.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot-Users] [RFC] [PATCH 2/2] [new uImage] Avoid initrd and logbuffer area overlaps
2008-05-11 23:00 ` Wolfgang Denk
@ 2008-05-12 10:56 ` Marian Balakowicz
0 siblings, 0 replies; 7+ messages in thread
From: Marian Balakowicz @ 2008-05-12 10:56 UTC (permalink / raw)
To: u-boot
Dear Wolfgang,
Wolfgang Denk wrote:
>
> in message <200805100617.43643.sr@denx.de> Stefan Roese wrote:
>>> Add logbuffer to reserved LMB areas to prevent initrd allocation
>>> from overlaping with it.
>>>
>>> Make sure to use correct logbuffer base address.
>>>
>>> Signed-off-by: Marian Balakowicz <m8@semihalf.com>
>> Hmmm, this patch breaks all PPC boards without logbuffer support. Take a look
>> at "acadia" for example:
>
> Indeed. It is obvious that this patch was not even minimally tested.
> Please see "Note 2" at http://www.denx.de/wiki/UBoot/Patches
That is true, but the patch was explicitly marked RFC, as I was hoping
to hear possible comments on the approach first.
> I reverted the patch. Please resubmit after fixing the problems.
Will do.
Cheers,
Marian
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-05-12 10:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-07 11:08 [U-Boot-Users] [PATCH 1/2] ppc: Cleanup get_effective_memsize() use Marian Balakowicz
2008-05-07 11:10 ` [U-Boot-Users] [RFC] [PATCH 2/2] [new uImage] Avoid initrd and logbuffer area overlaps Marian Balakowicz
2008-05-09 22:16 ` Wolfgang Denk
2008-05-10 4:17 ` Stefan Roese
2008-05-11 23:00 ` Wolfgang Denk
2008-05-12 10:56 ` Marian Balakowicz
2008-05-09 22:14 ` [U-Boot-Users] [PATCH 1/2] ppc: Cleanup get_effective_memsize() use Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox