Merge patch series "Allow showing the memory map"

Simon Glass <sjg@chromium.org> says:

This little series adds a new 'memmap' command, intended to show the
layout of memory within U-Boot and how much memory is available for
loading images.

Link: https://lore.kernel.org/r/20241021081934.289473-1-sjg@chromium.org
This commit is contained in:
Tom Rini
2024-10-25 14:22:36 -06:00
17 changed files with 347 additions and 42 deletions

View File

@@ -19,8 +19,9 @@ obj-$(CONFIG_CMD_FDT) += fdt.o
obj-$(CONFIG_CONSOLE_TRUETYPE) += font.o
obj-$(CONFIG_CMD_HISTORY) += history.o
obj-$(CONFIG_CMD_LOADM) += loadm.o
obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o
obj-$(CONFIG_CMD_MEMINFO) += meminfo.o
obj-$(CONFIG_CMD_MEMORY) += mem_copy.o
obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o
ifdef CONFIG_CMD_PCI
obj-$(CONFIG_CMD_PCI_MPS) += pci_mps.o
endif

42
test/cmd/meminfo.c Normal file
View File

@@ -0,0 +1,42 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Test for 'meminfo' command
*
* Copyright 2024 Google LLC
* Written by Simon Glass <sjg@chromium.org>
*/
#include <dm/test.h>
#include <test/cmd.h>
#include <test/ut.h>
/* Test 'meminfo' command */
static int cmd_test_meminfo(struct unit_test_state *uts)
{
ut_assertok(run_command("meminfo", 0));
ut_assert_nextline("DRAM: 256 MiB");
ut_assert_nextline_empty();
ut_assert_nextline("Region Base Size End Gap");
ut_assert_nextlinen("-");
/* For now we don't worry about checking the values */
ut_assert_nextlinen("video");
ut_assert_nextlinen("code");
ut_assert_nextlinen("malloc");
ut_assert_nextlinen("board_info");
ut_assert_nextlinen("global_data");
ut_assert_nextlinen("devicetree");
ut_assert_nextlinen("bootstage");
ut_assert_nextlinen("bloblist");
ut_assert_nextlinen("stack");
/* we expect at least one lmb line, but don't know how many */
ut_assert_nextlinen("lmb");
ut_assert_skip_to_linen("free");
ut_assert_console_end();
return 0;
}
CMD_TEST(cmd_test_meminfo, UTF_CONSOLE);