[PATCH 0/2] sandbox: provide memory reservations

Currently we are not able to test reservations on the sandbox. Memory reservations may be either be created in ft_board_setup() or via the device tree. This series implements both types of reservations for the sandbox.
Further patches will be needed to implement an actual test which could be based on the 'bootefi hello' and 'efidebug memmap' commands.
Heinrich Schuchardt (2): sandbox: add reserved-memory node in device tree sandbox: implement ft_board_setup()
arch/Kconfig | 1 + arch/sandbox/dts/sandbox.dts | 19 +++++++++++++++++++ arch/sandbox/dts/sandbox64.dts | 20 ++++++++++++++++++++ board/sandbox/sandbox.c | 6 ++++++ 4 files changed, 46 insertions(+)
-- 2.25.1

For testing the handling of memory reservations create a reserved-memory node in sandbox.dts and sandbox64.dts.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- arch/sandbox/dts/sandbox.dts | 19 +++++++++++++++++++ arch/sandbox/dts/sandbox64.dts | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+)
diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts index 4dd82f6a32..d2e8cd8319 100644 --- a/arch/sandbox/dts/sandbox.dts +++ b/arch/sandbox/dts/sandbox.dts @@ -20,6 +20,25 @@ reg = <0 CONFIG_SYS_SDRAM_SIZE>; };
+ reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + reservation_test0 { + size = <0x4000>; + alignment = <0x2000>; + }; + + reservation_test1: restest@a000 { + reg = <0x00d0a000 0x2000>; + }; + + reservation_test2: restest@7000 { + reg = <0x00d07000 0x1000>; + }; + }; + cros_ec: cros-ec { reg = <0 0>; u-boot,dm-pre-reloc; diff --git a/arch/sandbox/dts/sandbox64.dts b/arch/sandbox/dts/sandbox64.dts index 5c95cee9d7..56dd703a1e 100644 --- a/arch/sandbox/dts/sandbox64.dts +++ b/arch/sandbox/dts/sandbox64.dts @@ -20,6 +20,26 @@ reg = /bits/ 64 <0 CONFIG_SYS_SDRAM_SIZE>; };
+ reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + reservation_test_size { + size = <0 0x4000>; + alignment = <0 0x2000>; + }; + + reservation_test@a000 { + reg = <0 0x00d0a000 0 0x2000>; + }; + + reservation_test@7000 { + reg = <0 0x00d07000 0 0x1000>; + }; + }; + + /* ... */ cros_ec: cros-ec { reg = <0 0 0 0>; u-boot,dm-pre-reloc; -- 2.25.1

On Sat, 14 Mar 2020 at 05:13, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
For testing the handling of memory reservations create a reserved-memory node in sandbox.dts and sandbox64.dts.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
arch/sandbox/dts/sandbox.dts | 19 +++++++++++++++++++ arch/sandbox/dts/sandbox64.dts | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+)
Reviewed-by: Simon Glass sjg@chromum.org

On Sat, 14 Mar 2020 at 05:13, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
For testing the handling of memory reservations create a reserved-memory node in sandbox.dts and sandbox64.dts.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
arch/sandbox/dts/sandbox.dts | 19 +++++++++++++++++++ arch/sandbox/dts/sandbox64.dts | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+)
Reviewed-by: Simon Glass sjg@chromum.org
Applied to u-boot-dm/next, thanks!

Currently we are not able to test reservations created by ft_board_setup().
Implement ft_board_setup() to create an arbitrary reservation and enable OF_BOARD_SETUP.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- arch/Kconfig | 1 + board/sandbox/sandbox.c | 6 ++++++ 2 files changed, 7 insertions(+)
diff --git a/arch/Kconfig b/arch/Kconfig index ae9c93ed7b..91e049b322 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -96,6 +96,7 @@ config SANDBOX select DM_SPI_FLASH select HAVE_BLOCK_DEVICE select LZO + select OF_BOARD_SETUP select PCI_ENDPOINT select SPI select SUPPORT_OF_CONTROL diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c index 0c3d245dff..51881b025d 100644 --- a/board/sandbox/sandbox.c +++ b/board/sandbox/sandbox.c @@ -58,6 +58,12 @@ int board_init(void) return 0; }
+int ft_board_setup(void *fdt, bd_t *bd) +{ + /* Create an arbitrary reservation to allow testing OF_BOARD_SETUP.*/ + return fdt_add_mem_rsv(fdt, 0x00d02000, 0x4000); +} + #ifdef CONFIG_BOARD_LATE_INIT int board_late_init(void) { -- 2.25.1

On Sat, 14 Mar 2020 at 05:13, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Currently we are not able to test reservations created by ft_board_setup().
Implement ft_board_setup() to create an arbitrary reservation and enable OF_BOARD_SETUP.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
arch/Kconfig | 1 + board/sandbox/sandbox.c | 6 ++++++ 2 files changed, 7 insertions(+)
Reviewed-by: Simon Glass sjg@chromum.org

On Sat, 14 Mar 2020 at 05:13, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Currently we are not able to test reservations created by ft_board_setup().
Implement ft_board_setup() to create an arbitrary reservation and enable OF_BOARD_SETUP.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
arch/Kconfig | 1 + board/sandbox/sandbox.c | 6 ++++++ 2 files changed, 7 insertions(+)
Reviewed-by: Simon Glass sjg@chromum.org
Applied to u-boot-dm/next, thanks!
participants (3)
-
Heinrich Schuchardt
-
Simon Glass
-
sjg@google.com