From bee9dcc73a5808380d9eca5600b0f98750482e07 Mon Sep 17 00:00:00 2001 From: luojun1 Date: Fri, 12 Aug 2022 16:59:18 +0800 Subject: [PATCH] Add Kconfig option, user can specify the location of g_iob_buffer Signed-off-by: luojun1 --- mm/iob/Kconfig | 8 ++++++++ mm/iob/iob_initialize.c | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/mm/iob/Kconfig b/mm/iob/Kconfig index ecab1b9da21..b5156fa5b06 100644 --- a/mm/iob/Kconfig +++ b/mm/iob/Kconfig @@ -46,6 +46,14 @@ config IOB_ALIGNMENT The member io_head of all I/O buffers is aligned to the value specified by this configuration. +config IOB_SECTION + string "The section where iob buffer is located" + default ".bss" + depends on !ARCH_SIM + ---help--- + The section where iob buffer is located. + The section must be zero-initialized on system boot. + config IOB_NCHAINS int "Number of pre-allocated I/O buffer chain heads" default 0 if !NET_READAHEAD diff --git a/mm/iob/iob_initialize.c b/mm/iob/iob_initialize.c index 24a458f4128..36577665b61 100644 --- a/mm/iob/iob_initialize.c +++ b/mm/iob/iob_initialize.c @@ -42,6 +42,14 @@ #define IOB_BUFFER_SIZE (IOB_ALIGN_SIZE * CONFIG_IOB_NBUFFERS + \ CONFIG_IOB_ALIGNMENT - 1) +/* Improve Flexibility */ + +#ifdef CONFIG_IOB_SECTION +# define IOB_SECTION locate_data(CONFIG_IOB_SECTION) +#else +# define IOB_SECTION +#endif + /**************************************************************************** * Private Data ****************************************************************************/ @@ -51,7 +59,7 @@ * to the CONFIG_IOB_ALIGNMENT memory boundary. */ -static uint8_t g_iob_buffer[IOB_BUFFER_SIZE]; +static uint8_t g_iob_buffer[IOB_BUFFER_SIZE] IOB_SECTION; #if CONFIG_IOB_NCHAINS > 0 /* This is a pool of pre-allocated iob_qentry_s buffers */