From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2 1/7] Expand POST memory test to support arch-depended implementation.
Date: Tue, 28 Sep 2010 19:31:30 +0200 [thread overview]
Message-ID: <20100928173130.CDDF9D52190@gemini.denx.de> (raw)
In-Reply-To: <1285691891-32700-1-git-send-email-yorksun@freescale.com>
Dear York Sun,
In message <1285691891-32700-1-git-send-email-yorksun@freescale.com> you wrote:
> Add weak functions to enable architecture depended preparation, address
> advancing, cleaning up and error handling.
>
> Signed-off-by: York Sun <yorksun@freescale.com>
This needs some comments to explain the interfaces you are providing.
> -int memory_post_test (int flags)
> +__attribute__((weak))
> +int arch_memory_test_prepare(u32 *vstart, u32 *size, phys_addr_t *phys_offset)
phys_offset is unused here. Drop it?
> - int ret = 0;
> bd_t *bd = gd->bd;
> - unsigned long memsize = (bd->bi_memsize >= 256 << 20 ?
> - 256 << 20 : bd->bi_memsize) - (1 << 20);
> -
> + *vstart = CONFIG_SYS_SDRAM_BASE;
Blank line after declarations, please.
> + *size = (bd->bi_memsize >= 256 << 20 ?
> + 256 << 20 : bd->bi_memsize) - (1 << 20);
> /* Limit area to be tested with the board info struct */
> - if (CONFIG_SYS_SDRAM_BASE + memsize > (ulong)bd)
> - memsize = (ulong)bd - CONFIG_SYS_SDRAM_BASE;
> + if ((*vstart) + (*size) > (ulong)bd)
> + *size = (ulong)bd - CONFIG_SYS_SDRAM_BASE;
Should this eventually be
*size = (ulong)bd - *vstart;
??
> +__attribute__((weak))
> +int arch_memory_test_advance(u32 *vstart, u32 *size, phys_addr_t *phys_offset)
> +{
> + return 1;
> +}
Unused arguments?
Don't you get compiler warnings for these?
> +__attribute__((weak))
> +int arch_memory_test_cleanup(u32 *vstart, u32 *size, phys_addr_t *phys_offset)
> +{
> + return 0;
> +}
Ditto ?
> +int memory_post_test(int flags)
> +{
> + int ret = 0;
> + phys_addr_t phys_offset = 0;
> + u32 memsize, vstart;
> +
> + arch_memory_test_prepare(&vstart, &memsize, &phys_offset);
> + do {
Empty line before the do, please.
> + if (flags & POST_SLOWTEST) {
> + ret = memory_post_tests(vstart, memsize);
> + } else { /* POST_NORMAL */
> + unsigned long i;
> + for (i = 0; i < (memsize >> 20) && ret == 0; i++) {
> + if (ret == 0)
> + ret = memory_post_tests(i << 20, 0x800);
> + if (ret == 0)
> + ret = memory_post_tests((i << 20) + 0xff800, 0x800);
Line too long.
> + }
> + }
> + } while (!ret && !arch_memory_test_advance(&vstart, &memsize, &phys_offset));
> + arch_memory_test_cleanup(&vstart, &memsize, &phys_offset);
Empty line before and after, please.
> + if (ret)
> + arch_memory_failure_handle();
> return ret;
Empty line 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
It is much easier to suggest solutions when you know nothing
next prev parent reply other threads:[~2010-09-28 17:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-28 16:38 [U-Boot] [PATCH V2 1/7] Expand POST memory test to support arch-depended implementation York Sun
2010-09-28 16:38 ` [U-Boot] [PATCH V2 2/7] Adding more control to physical address mapping York Sun
2010-09-28 17:33 ` Wolfgang Denk
2010-09-28 16:38 ` [U-Boot] [PATCH V2 3/7] Add memory test feature for mpc85xx POST York Sun
2010-09-28 17:38 ` Wolfgang Denk
2010-09-28 16:38 ` [U-Boot] [PATCH V2 4/7] Fix address for POST for 85xx with CPM York Sun
2010-09-28 16:38 ` [U-Boot] [PATCH V2 5/7] Setup POST word for generic mpc85xx York Sun
2010-09-28 16:38 ` [U-Boot] [PATCH V2 6/7] Enable POST memory test for corenet_ds York Sun
2010-09-28 16:38 ` [U-Boot] [PATCH V2 7/7] Enable POST memory test for P2020DS York Sun
2010-09-28 17:31 ` Wolfgang Denk [this message]
2010-09-28 17:55 ` [U-Boot] [PATCH V2 1/7] Expand POST memory test to support arch-depended implementation York Sun
2010-09-28 18:50 ` Wolfgang Denk
2010-09-28 19:24 ` York Sun
2010-09-28 19:44 ` Wolfgang Denk
2010-09-28 18:53 ` Scott Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100928173130.CDDF9D52190@gemini.denx.de \
--to=wd@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox