riscv: ax25: bypass malloc when spl fit boots from ram
PATCH v3 1/2 riscv: ax25: bypass malloc when spl fit boots from ram
When fit image boots from ram, the payload will be prepared in the address of SPL_LOAD_FIT_ADDRESS. In spl fit generic flow, it will malloc another memory address and copy whole fit image to this malloc address. But it is un-necessary for booting from RAM.
This patch improves this flow by declare the board_spl_fit_buffer_addr() to replace the original one. The larger image size (eq: Kernel Image 10~20MB), it can save more booting time.
---
Changes in v3
- fix aligment
- refine board_spl_fit_buffer_addr
--- arch/riscv/cpu/ax25/Makefile | 1 + arch/riscv/cpu/ax25/spl.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 arch/riscv/cpu/ax25/spl.c
arch/riscv/cpu/ax25/Makefile +1 -0
@@ -5,3 +5,4 @@ obj-y := cpu.o obj-y += cache.o +obj-y += spl.o
arch/riscv/cpu/ax25/spl.c new file +27 -0
@@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2023 Andes Technology Corporation +* Rick Chen, Andes Technology Corporation <[email protected]> +*/ +#include <common.h> +#include <cpu_func.h> +#include <hang.h> +#include <init.h> +#include <log.h> +#include <spl.h> +#include <asm/global_data.h> +#include <asm/system.h> + +DECLARE_GLOBAL_DATA_PTR ; + +#if CONFIG_IS_ENABLED (RAM_SUPPORT ) +struct legacy_img_hdr *spl_get_load_buffer (ssize_t offset,size_t size) +{ +return (void *)(CONFIG_SPL_LOAD_FIT_ADDRESS + offset); +} + +void *board_spl_fit_buffer_addr (ulong fit_size,int sectors,int bl_len) +{ +return spl_get_load_buffer (0 , sectors * bl_len); +} +#endif
Signature · 1 line
2.17.1
Quoted 17 lines · Rick Chen
When fit image boots from ram, the payload will be prepared in the address of
SPL_LOAD_FIT_ADDRESS. In spl fit generic flow, it will malloc another memory address and copy whole fit image to this malloc address. But it is un-necessary for booting from RAM.This patch improves this flow by declare the
board_spl_fit_buffer_addr()to replace the original one. The larger image size (eq: Kernel Image 10~20MB), it can save more booting time.Signed-off-by Rick Chen <[email protected]>---
Changes in v3
- fix aligment
- refineboard_spl_fit_buffer_addr
Quoted 6 lines
--- arch/riscv/cpu/ax25/Makefile | 1 + arch/riscv/cpu/ax25/spl.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 arch/riscv/cpu/ax25/spl.c