public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] km-powerpc: define CONFIG_PRAM to protect PHRAM and PNVRAM
@ 2014-07-17 12:24 Valentin Longchamp
  2014-07-17 12:47 ` Wolfgang Denk
  2014-08-13  8:24 ` [U-Boot] [PATCH v2] " Valentin Longchamp
  0 siblings, 2 replies; 7+ messages in thread
From: Valentin Longchamp @ 2014-07-17 12:24 UTC (permalink / raw)
  To: u-boot

When u-boot initializes the RAM (early in boot) it looks for the "pram"
env variable to know which is area it cannot use.

At this early boot stage, the "pram" env variable is not avaible yet
since it gets computed in set_km_env that gets called AFTER the RAM
initialization. If the "pram" env variable is not found, the default
CONFIG_PRAM value is used.

This value used to 0 (no protection at all). This patch sets it to a
value that covers PHRAM and PNVRAM that must be protected in our case.

Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
---

 include/configs/km/km-powerpc.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/configs/km/km-powerpc.h b/include/configs/km/km-powerpc.h
index 763c5ba..eb85a74 100644
--- a/include/configs/km/km-powerpc.h
+++ b/include/configs/km/km-powerpc.h
@@ -59,8 +59,9 @@
 #define CONFIG_KM_PHRAM		0x100000
 /* resereved pram area at the end of memroy [hex] */
 #define CONFIG_KM_RESERVED_PRAM	0x0
-/* enable protected RAM */
-#define CONFIG_PRAM		0
+/* set the default PRAM value to at least PNVRAM + PHRAM when pram env variable
+ * is not valid yet, which is the case for when u-boot copies itself to RAM */
+#define CONFIG_PRAM		((CONFIG_KM_PNVRAM + CONFIG_KM_PHRAM)>>10)
 
 #define CONFIG_KM_CRAMFS_ADDR	0x800000
 #define CONFIG_KM_KERNEL_ADDR	0x400000	/* 3968Kbytes */
-- 
1.8.0.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] km-powerpc: define CONFIG_PRAM to protect PHRAM and PNVRAM
  2014-07-17 12:24 [U-Boot] [PATCH] km-powerpc: define CONFIG_PRAM to protect PHRAM and PNVRAM Valentin Longchamp
@ 2014-07-17 12:47 ` Wolfgang Denk
  2014-07-18  9:10   ` Valentin Longchamp
  2014-08-13  8:24 ` [U-Boot] [PATCH v2] " Valentin Longchamp
  1 sibling, 1 reply; 7+ messages in thread
From: Wolfgang Denk @ 2014-07-17 12:47 UTC (permalink / raw)
  To: u-boot

Dear Valentin,

In message <1405599840-11984-1-git-send-email-valentin.longchamp@keymile.com> you wrote:
> When u-boot initializes the RAM (early in boot) it looks for the "pram"
> env variable to know which is area it cannot use.
> 
> At this early boot stage, the "pram" env variable is not avaible yet
> since it gets computed in set_km_env that gets called AFTER the RAM
> initialization. If the "pram" env variable is not found, the default
> CONFIG_PRAM value is used.

Note that I am not objecting against this patch, but I highly
recommend to fix your board - RAM initialization is actually pretty
late in the init sequence, and you should have a valid envionment long
before.

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
God may be subtle, but He isn't plain mean.         - Albert Einstein

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] km-powerpc: define CONFIG_PRAM to protect PHRAM and PNVRAM
  2014-07-17 12:47 ` Wolfgang Denk
@ 2014-07-18  9:10   ` Valentin Longchamp
  2014-08-12 18:03     ` York Sun
  0 siblings, 1 reply; 7+ messages in thread
From: Valentin Longchamp @ 2014-07-18  9:10 UTC (permalink / raw)
  To: u-boot

Hello Wolfgang,

On 07/17/2014 02:47 PM, Wolfgang Denk wrote:
> Dear Valentin,
> 
> In message <1405599840-11984-1-git-send-email-valentin.longchamp@keymile.com> you wrote:
>> When u-boot initializes the RAM (early in boot) it looks for the "pram"
>> env variable to know which is area it cannot use.
>>
>> At this early boot stage, the "pram" env variable is not avaible yet
>> since it gets computed in set_km_env that gets called AFTER the RAM
>> initialization. If the "pram" env variable is not found, the default
>> CONFIG_PRAM value is used.
> 
> Note that I am not objecting against this patch, but I highly
> recommend to fix your board - RAM initialization is actually pretty
> late in the init sequence, and you should have a valid envionment long
> before.
> 

Maybe my commit message is unclear about this. You are right, at the RAM
initialization time, there is a valid environment, and that's the case on our
board too.

However, at the very first boot on a board, the environment is empty (or
unvalid) and the default one is used where this "pram" env variable is not
defined. That's why the CONFIG_PRAM is used in this case and it should be
defined. This is not going to be the case at any later boot if a valid
environment (with pram defined) is found and used.

Best regards,

Valentin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] km-powerpc: define CONFIG_PRAM to protect PHRAM and PNVRAM
  2014-07-18  9:10   ` Valentin Longchamp
@ 2014-08-12 18:03     ` York Sun
  2014-08-13  6:13       ` Valentin Longchamp
  0 siblings, 1 reply; 7+ messages in thread
From: York Sun @ 2014-08-12 18:03 UTC (permalink / raw)
  To: u-boot

On 07/18/2014 02:10 AM, Valentin Longchamp wrote:
> Hello Wolfgang,
> 
> On 07/17/2014 02:47 PM, Wolfgang Denk wrote:
>> Dear Valentin,
>>
>> In message <1405599840-11984-1-git-send-email-valentin.longchamp@keymile.com> you wrote:
>>> When u-boot initializes the RAM (early in boot) it looks for the "pram"
>>> env variable to know which is area it cannot use.
>>>
>>> At this early boot stage, the "pram" env variable is not avaible yet
>>> since it gets computed in set_km_env that gets called AFTER the RAM
>>> initialization. If the "pram" env variable is not found, the default
>>> CONFIG_PRAM value is used.
>>
>> Note that I am not objecting against this patch, but I highly
>> recommend to fix your board - RAM initialization is actually pretty
>> late in the init sequence, and you should have a valid envionment long
>> before.
>>
> 
> Maybe my commit message is unclear about this. You are right, at the RAM
> initialization time, there is a valid environment, and that's the case on our
> board too.
> 
> However, at the very first boot on a board, the environment is empty (or
> unvalid) and the default one is used where this "pram" env variable is not
> defined. That's why the CONFIG_PRAM is used in this case and it should be
> defined. This is not going to be the case at any later boot if a valid
> environment (with pram defined) is found and used.
> 
> Best regards,
> 


Valentin,

How about you update the commit message to
explain you are defining the default CONFIG_PRAM for your board in case "pram"
variable is not available?

York

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] km-powerpc: define CONFIG_PRAM to protect PHRAM and PNVRAM
  2014-08-12 18:03     ` York Sun
@ 2014-08-13  6:13       ` Valentin Longchamp
  0 siblings, 0 replies; 7+ messages in thread
From: Valentin Longchamp @ 2014-08-13  6:13 UTC (permalink / raw)
  To: u-boot

Hi York,

On 08/12/2014 08:03 PM, York Sun wrote:
> On 07/18/2014 02:10 AM, Valentin Longchamp wrote:
>> Hello Wolfgang,
>>
>> On 07/17/2014 02:47 PM, Wolfgang Denk wrote:
>>> Dear Valentin,
>>>
>>> In message <1405599840-11984-1-git-send-email-valentin.longchamp@keymile.com> you wrote:
>>>> When u-boot initializes the RAM (early in boot) it looks for the "pram"
>>>> env variable to know which is area it cannot use.
>>>>
>>>> At this early boot stage, the "pram" env variable is not avaible yet
>>>> since it gets computed in set_km_env that gets called AFTER the RAM
>>>> initialization. If the "pram" env variable is not found, the default
>>>> CONFIG_PRAM value is used.
>>>
>>> Note that I am not objecting against this patch, but I highly
>>> recommend to fix your board - RAM initialization is actually pretty
>>> late in the init sequence, and you should have a valid envionment long
>>> before.
>>>
>>
>> Maybe my commit message is unclear about this. You are right, at the RAM
>> initialization time, there is a valid environment, and that's the case on our
>> board too.
>>
>> However, at the very first boot on a board, the environment is empty (or
>> unvalid) and the default one is used where this "pram" env variable is not
>> defined. That's why the CONFIG_PRAM is used in this case and it should be
>> defined. This is not going to be the case at any later boot if a valid
>> environment (with pram defined) is found and used.
>>
>> Best regards,
>>
> 
> 
> Valentin,
> 
> How about you update the commit message to
> explain you are defining the default CONFIG_PRAM for your board in case "pram"
> variable is not available?
> 

OK, I will do ... even though the commit message already does already state
that, just with more details when and why (there was just a missing precision
here, "when no valid environment was found") the "pram" env variable can be
undefined and why it is important for us to have such a value. But maybe that's
too much information ?

Valentin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v2] km-powerpc: define CONFIG_PRAM to protect PHRAM and PNVRAM
  2014-07-17 12:24 [U-Boot] [PATCH] km-powerpc: define CONFIG_PRAM to protect PHRAM and PNVRAM Valentin Longchamp
  2014-07-17 12:47 ` Wolfgang Denk
@ 2014-08-13  8:24 ` Valentin Longchamp
  2014-08-20 19:38   ` York Sun
  1 sibling, 1 reply; 7+ messages in thread
From: Valentin Longchamp @ 2014-08-13  8:24 UTC (permalink / raw)
  To: u-boot

When u-boot initializes the RAM (early in boot) it looks for the "pram"
env variable to know which is area it cannot use. If the "pram" env variable
is not found, the default CONFIG_PRAM value is used.

This value used to be 0 (no protection at all). This patch sets it to a
value that covers PHRAM and PNVRAM that must be protected in our case.

Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
Signed-off-by: Holger Brunck <holger.brunck@keymile.com>

---

Changes in v2:
- simplify the commit message for more clarity.

 include/configs/km/km-powerpc.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/configs/km/km-powerpc.h b/include/configs/km/km-powerpc.h
index 763c5ba..eb85a74 100644
--- a/include/configs/km/km-powerpc.h
+++ b/include/configs/km/km-powerpc.h
@@ -59,8 +59,9 @@
 #define CONFIG_KM_PHRAM		0x100000
 /* resereved pram area at the end of memroy [hex] */
 #define CONFIG_KM_RESERVED_PRAM	0x0
-/* enable protected RAM */
-#define CONFIG_PRAM		0
+/* set the default PRAM value to at least PNVRAM + PHRAM when pram env variable
+ * is not valid yet, which is the case for when u-boot copies itself to RAM */
+#define CONFIG_PRAM		((CONFIG_KM_PNVRAM + CONFIG_KM_PHRAM)>>10)
 
 #define CONFIG_KM_CRAMFS_ADDR	0x800000
 #define CONFIG_KM_KERNEL_ADDR	0x400000	/* 3968Kbytes */
-- 
1.8.0.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v2] km-powerpc: define CONFIG_PRAM to protect PHRAM and PNVRAM
  2014-08-13  8:24 ` [U-Boot] [PATCH v2] " Valentin Longchamp
@ 2014-08-20 19:38   ` York Sun
  0 siblings, 0 replies; 7+ messages in thread
From: York Sun @ 2014-08-20 19:38 UTC (permalink / raw)
  To: u-boot

On 08/13/2014 01:24 AM, Valentin Longchamp wrote:
> When u-boot initializes the RAM (early in boot) it looks for the "pram"
> env variable to know which is area it cannot use. If the "pram" env variable
> is not found, the default CONFIG_PRAM value is used.
> 
> This value used to be 0 (no protection at all). This patch sets it to a
> value that covers PHRAM and PNVRAM that must be protected in our case.
> 
> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
> 
> ---
> 
> Changes in v2:
> - simplify the commit message for more clarity.

Applied to u-boot-mpc85xx master branch, awaiting for upstream.

York

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-08-20 19:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-17 12:24 [U-Boot] [PATCH] km-powerpc: define CONFIG_PRAM to protect PHRAM and PNVRAM Valentin Longchamp
2014-07-17 12:47 ` Wolfgang Denk
2014-07-18  9:10   ` Valentin Longchamp
2014-08-12 18:03     ` York Sun
2014-08-13  6:13       ` Valentin Longchamp
2014-08-13  8:24 ` [U-Boot] [PATCH v2] " Valentin Longchamp
2014-08-20 19:38   ` York Sun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox