Skip to contentSkip to conversation

env_nand: align NAND buffers

PATCH New Stephen Warren 4 participants 7 messages Jul 30, 2012 – Sep 2, 2012 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 env_nand: align NAND buffers

From: Stephen Warren <[email protected]>

This allows cache flush/invalidate operations to succeed on the buffers.

---
 common/env_nand.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
common/env_nand.c +5 -5
index e8daec9..e635472 100644
@@ -226,7 +226,7 @@ int saveenv(void)
 int saveenv(void)
 {
 	int	ret = 0;
-	env_t	env_new;
+	ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, sizeof(env_t));
 	ssize_t	len;
 	char	*res;
 	nand_erase_options_t nand_erase_options;
@@ -238,20 +238,20 @@ int saveenv(void)
 	if (CONFIG_ENV_RANGE < CONFIG_ENV_SIZE)
 		return 1;
 
-	res = (char *)&env_new.data;
+	res = (char *)&env_new->data;
 	len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
 	if (len < 0) {
 		error("Cannot export environment: errno = %d\n", errno);
 		return 1;
 	}
-	env_new.crc = crc32(0, env_new.data, ENV_SIZE);
+	env_new->crc = crc32(0, env_new->data, ENV_SIZE);
 
 	puts("Erasing Nand...\n");
 	if (nand_erase_opts(&nand_info[0], &nand_erase_options))
 		return 1;
 
 	puts("Writing to Nand... ");
-	if (writeenv(CONFIG_ENV_OFFSET, (u_char *)&env_new)) {
+	if (writeenv(CONFIG_ENV_OFFSET, (u_char *)env_new)) {
 		puts("FAILED!\n");
 		return 1;
 	}
@@ -398,7 +398,7 @@ void env_relocate_spec(void)
 {
 #if !defined(ENV_IS_EMBEDDED)
 	int ret;
-	char buf[CONFIG_ENV_SIZE];
+	ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
 
 #if defined(CONFIG_ENV_OFFSET_OOB)
 	ret = get_nand_env_oob(&nand_info[0], &nand_env_oob_offset);
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 env_nand: align NAND buffers

Quoted 5 lines · Stephen Warren

From: Stephen Warren <[email protected]>

This allows cache flush/invalidate operations to succeed on the buffers.

Quoted 9 lines
---
 common/env_nand.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
common/env_nand.c +0 -0
index e8daec9..e635472 100644

common/env_nand.c int saveenv(void) · line 229

Quoted 5 lines
common/env_nand.c +1 -1
@@ -226,7 +226,7 @@ int saveenv(void)
 int saveenv(void)
 {
        int     ret = 0;
-       env_t   env_new;
+       ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, sizeof(env_t));

I think this should b

Quoted 39 lines
common/env_nand.c +4 -5
        ssize_t len;
        char    *res;
        nand_erase_options_t nand_erase_options;
@@ -238,20 +238,20 @@ int saveenv(void)
        if (CONFIG_ENV_RANGE < CONFIG_ENV_SIZE)
                return 1;
 
-       res = (char *)&env_new.data;
+       res = (char *)&env_new->data;
        len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
        if (len < 0) {
                error("Cannot export environment: errno = %d\n", errno);
                return 1;
        }
-       env_new.crc = crc32(0, env_new.data, ENV_SIZE);
+       env_new->crc = crc32(0, env_new->data, ENV_SIZE);
 
        puts("Erasing Nand...\n");
        if (nand_erase_opts(&nand_info[0], &nand_erase_options))
                return 1;
 
        puts("Writing to Nand... ");
-       if (writeenv(CONFIG_ENV_OFFSET, (u_char *)&env_new)) {
+       if (writeenv(CONFIG_ENV_OFFSET, (u_char *)env_new)) {
                puts("FAILED!\n");
                return 1;
        }
@@ -398,7 +398,7 @@ void env_relocate_spec(void)
 {
 #if !defined(ENV_IS_EMBEDDED)
        int ret;
-       char buf[CONFIG_ENV_SIZE];
+       ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
 
 #if defined(CONFIG_ENV_OFFSET_OOB)
        ret = get_nand_env_oob(&nand_info[0], &nand_env_oob_offset);
--

1.7.0.4

#2 lore raw

PATCH 1/1 env_nand: align NAND buffers

Dear Simon Glass,

Quoted 5 lines · In message <CAPnjgZ2gJLhmZyXB1DW=83GBdf1QNv_=Q+QfprAwCzx4Yq7_sA@mail.gmail.com>…

common/env_nand.c int saveenv(void) · line 229

Quoted 3 lines
common/env_nand.c +1 -1
-       env_t   env_new;
+       ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, sizeof(env_t));

I think this should b

Should be ... ???

Best regards,

Wolfgang Denk

Signature · 5 lines
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
Be wiser than other people if you can, but do not tell them so.
                                       -- Philip Earl of Chesterfield
#3 lore raw

PATCH 1/1 env_nand: align NAND buffers

Hi Wolfgang,

Quoted 10 lines · Wolfgang Denk

Dear Simon Glass,

Quoted 5 lines · In message <CAPnjgZ2gJLhmZyXB1DW=83GBdf1QNv_=Q+QfprAwCzx4Yq7_sA@mail.gmail.com>…

common/env_nand.c int saveenv(void) · line 229

Quoted 3 lines
common/env_nand.c +1 -1
-       env_t   env_new;
+       ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, sizeof(env_t));

I think this should b

Should be ... ???

Sorry, I started a comment, but thought better of it. It looks fine to me.

Quoted 11 lines

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 Be wiser than other people if you can, but do not tell them so.
-- Philip Earl of Chesterfield

Regards,
Simon

#4 lore raw

PATCH 1/1 env_nand: align NAND buffers

In reply to Stephen Warren
Quoted 8 lines · Stephen Warren

From: Stephen Warren <[email protected]>

This allows cache flush/invalidate operations to succeed on the buffers.

---
 common/env_nand.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

I'm assuming you want it to go with the Tegra patches and not via my tree.

-Scott

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

PATCH 1/1 env_nand: align NAND buffers

Quoted 19 lines · Tom Warren

Scott,

Quoted 17 lines

-----Original Message-----
From: Scott Wood [mailto:scottwood at freescale.com]
Sent: Monday, July 30, 2012 4:01 PM
To: Stephen Warren
Cc: Tom Warren; Simon Glass; U-Boot Mailing List; Stephen Warren
Subject: Re: [PATCH] env_nand: align NAND buffers

Quoted 8 lines · Stephen Warren

From: Stephen Warren <[email protected]>

This allows cache flush/invalidate operations to succeed on the buffers.

---
 common/env_nand.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
Quoted 4 lines
Quoted 3 lines

I'm assuming you want it to go with the Tegra patches and not via my tree.

I'm fine with taking the env_nand and cmd_nand changes thru the Tegra tree. Let me know if that's OK with you.

It's OK with me.

-Scott

#7 lore raw

PATCH 1/1 env_nand: align NAND buffers

In reply to Stephen Warren

Dear Stephen Warren,

Quoted 8 lines · In message <[email protected]> you wrote:

From: Stephen Warren <[email protected]>

This allows cache flush/invalidate operations to succeed on the buffers.

---
 common/env_nand.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
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
Violence in reality is quite different from theory.
	-- Spock, "The Cloud Minders", stardate 5818.4