request_sdram_region: print error message
Subsystems (2)
RFC 1/1 request_sdram_region: print error message
I have found that MIPS memory misconfiguration leads to request_sdram_region() errors. But mem_malloc_resource() has no error checks for request_sdram_region() result. MIPS memory mapping needs additional changes this commit is just RFC on request_sdram_region().
Can we embed error message into request_sdram_region()?
The commid introduce necessary chages but I have no idea how to change this part of arch/arm/cpu/mmu.c:
if (!request_sdram_region("ttb", (unsigned long)ttb, SZ_16K))
/*
* This can mean that:
* - the early MMU code has put the ttb into a place
* which we don't have inside our available memory
* - Somebody else has occupied the ttb region which means
* the ttb will get corrupted.
*/
pr_crit("Critical Error: Can't request SDRAM region for ttb at %p\n",
ttb);
--- arch/arm/cpu/cpu.c | 3 +-- arch/arm/lib32/bootm.c | 7 +------ arch/arm/lib32/bootz.c | 1 - arch/mips/lib/cpu-probe.c | 3 +-- arch/ppc/mach-mpc5xxx/cpu.c | 5 +---- common/elf.c | 1 - common/memory.c | 5 +++++ common/uimage.c | 5 ----- 8 files changed, 9 insertions(+), 21 deletions(-)
arch/arm/cpu/cpu.c +1 -2
@@ -113,8 +113,7 @@ extern unsigned long arm_stack_top;static int arm_request_stack (void ) { -if (!request_sdram_region ("stack" , arm_stack_top -STACK_SIZE ,STACK_SIZE )) -pr_err ("Error: Cannot request SDRAM region for stack\n" ); +request_sdram_region ("stack" , arm_stack_top -STACK_SIZE ,STACK_SIZE );return 0 ; }
arch/arm/lib32/bootm.c +1 -6
@@ -382,8 +382,6 @@ static int do_bootz_linux(struct image_data *data) data->os_res =request_sdram_region ("zimage" , load_address, image_size);if (!data->os_res) { -pr_err ("bootm/zImage: failed to request memory at 0x%lx to 0x%lx (%zu).\n" , - load_address, load_address + image_size, image_size); ret = -ENOMEM ; goto err_out; }
@@ -506,14 +504,11 @@ static int do_bootm_aimage(struct image_data *data) cmp = &header->kernel; data->os_res =request_sdram_region ("akernel" , cmp->load_addr, cmp->size);if (!data->os_res) { -pr_err ("Cannot request region 0x%08x - 0x%08x, using default load address\n" , - cmp->load_addr, cmp->size); +pr_err ("using default load address\n" ); data->os_address = mem_start +PAGE_ALIGN (cmp->size *4 ); data->os_res =request_sdram_region ("akernel" , data->os_address, cmp->size);if (!data->os_res) { -pr_err ("Cannot request region 0x%08x - 0x%08x\n" , - cmp->load_addr, cmp->size); ret = -ENOMEM ; goto err_out; }
arch/arm/lib32/bootz.c +0 -1
@@ -87,7 +87,6 @@ static int do_bootz(int argc, char *argv[]) res =request_sdram_region ("zimage" , bank->start +SZ_8M , end);if (!res) { -printf ("can't request region for kernel\n" ); goto err_out1; } }
arch/mips/lib/cpu-probe.c +1 -2
@@ -169,8 +169,7 @@ unsigned long mips_stack_top;static int mips_request_stack (void ) { -if (!request_sdram_region ("stack" , mips_stack_top -STACK_SIZE ,STACK_SIZE )) -pr_err ("Error: Cannot request SDRAM region for stack\n" ); +request_sdram_region ("stack" , mips_stack_top -STACK_SIZE ,STACK_SIZE );return 0 ; }
arch/ppc/mach-mpc5xxx/cpu.c +1 -4
@@ -68,11 +68,8 @@ static int mpc5xxx_reserve_region(void)/* keep this in sync with the assembler routines setting up the stack */ r =request_sdram_region ("stack" , _text_base -STACK_SIZE ,STACK_SIZE ); -if (r ==NULL ) { -pr_err ("Failed to request stack region at: 0x%08lx/0x%08lx\n" , - _text_base -STACK_SIZE , _text_base -1 ); +if (r ==NULL )return -EBUSY ; - }return 0 ; }
common/elf.c +0 -1
@@ -22,7 +22,6 @@ static int elf_request_region(struct elf_image *elf, resource_size_t start, r =xzalloc (sizeof (*r)); r_new =request_sdram_region ("elf_section" , start, size);if (!r_new) { -pr_err ("Failed to request region: %pa %pa\n" , &start, &size);return -EINVAL ; }
common/memory.c +5 -0
@@ -153,6 +153,7 @@ struct resource *request_sdram_region(const char *name, resource_size_t start, resource_size_t size) {struct memory_bank *bank; +resource_size_t rsize;for_each_memory_bank (bank) {struct resource *res;
@@ -163,6 +164,10 @@ struct resource *request_sdram_region(const char *name, resource_size_t start,return res; } + rsize = start + size -1 ; +pr_err ("Cannot request SDRAM region %pa - %pa for %s\n" , + &start, &rsize, name); +return NULL ; }
common/uimage.c +0 -5
@@ -355,9 +355,6 @@ static int uimage_sdram_flush(void *buf, unsigned int len) uimage_resource =request_sdram_region ("uimage" , start, size);if (!uimage_resource) { -resource_size_t prsize = start + size -1 ; -printf ("unable to request SDRAM %pa - %pa\n" , - &start, &prsize);return -ENOMEM ; } }
@@ -386,8 +383,6 @@ struct resource *file_to_sdram(const char *filename, unsigned long adr)while (1 ) { res =request_sdram_region ("image" , adr, size);if (!res) { -printf ("unable to request SDRAM 0x%08lx-0x%08lx\n" , - adr, adr + size -1 ); goto out; }
Signature · 7 lines
2.20.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 7 lines · Antony Pavlov
I have found that MIPS memory misconfiguration leads to
request_sdram_region()errors. Butmem_malloc_resource()has no error checks forrequest_sdram_region()result. MIPS memory mapping needs additional changes this commit is just RFC onrequest_sdram_region().Can we embed error message into
request_sdram_region()?
In create_vector_table() failure of request_sdram_region() is expected and not an error, so putting an error message into request_sdram_region() is not a good idea. What we could do though is to print an error message based on a "verbose" input flag.
Quoted 4 lines
The commid introduce necessary chages but I have no idea how to change this part of
arch/arm/cpu/mmu.c:
Quoted 10 lines
if (!request_sdram_region("ttb", (unsigned long)ttb,
SZ_16K))
/*
* This can mean that:
* - the early MMU code has put the ttb into a place
* which we don't have inside our available memory
* - Somebody else has occupied the ttb region which means
* the ttb will get corrupted.
*/
pr_crit("Critical Error: Can't request SDRAM region for ttb at %p\n",
ttb);
I think the message should stay like it is.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox