Compare commits

..

1 Commits
boo ... sand

Author SHA1 Message Date
Simon Glass
f24263f322 sandbox: Move FDT to a different address
The FDT is near its limit and may overlap with the early-malloc region
if more things are added. Move it to a better location.

Series-to: u-boot
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:12:20 -06:00
7 changed files with 5 additions and 61 deletions

View File

@@ -75,7 +75,7 @@ config SANDBOX_BITS_PER_LONG
config SYS_FDT_LOAD_ADDR config SYS_FDT_LOAD_ADDR
hex "Address at which to load devicetree" hex "Address at which to load devicetree"
default 0x100 default 0x180000
help help
With sandbox the devicetree is loaded into the emulated RAM. This sets With sandbox the devicetree is loaded into the emulated RAM. This sets
the address that is used. There must be enough space at this address the address that is used. There must be enough space at this address

View File

@@ -998,19 +998,6 @@ struct bootflow_img *bootflow_img_add(struct bootflow *bflow, const char *fname,
return ptr; return ptr;
} }
const struct bootflow_img *bootflow_img_find(const struct bootflow *bflow,
enum bootflow_img_t type)
{
const struct bootflow_img *img;
alist_for_each(img, &bflow->images) {
if (img->type == type)
return img;
}
return NULL;
}
int bootflow_get_seq(const struct bootflow *bflow) int bootflow_get_seq(const struct bootflow *bflow)
{ {
struct bootstd_priv *std; struct bootstd_priv *std;

View File

@@ -388,7 +388,7 @@ int bootmeth_alloc_other(struct bootflow *bflow, const char *fname,
if (ret) if (ret)
return log_msg_ret("all", ret); return log_msg_ret("all", ret);
if (!bootflow_img_add(bflow, bflow->fname, type, abuf_addr(buf), if (!bootflow_img_add(bflow, bflow->fname, type, map_to_sysmem(buf),
size)) size))
return log_msg_ret("boi", -ENOMEM); return log_msg_ret("boi", -ENOMEM);

View File

@@ -83,29 +83,13 @@ static int extlinux_fill_info(struct bootflow *bflow)
log_debug("parsing bflow file size %x\n", bflow->size); log_debug("parsing bflow file size %x\n", bflow->size);
membuf_init(&mb, bflow->buf, bflow->size); membuf_init(&mb, bflow->buf, bflow->size);
membuf_putraw(&mb, bflow->size, true, &data); membuf_putraw(&mb, bflow->size, true, &data);
while (len = membuf_readline(&mb, line, sizeof(line) - 1, 0, true), len) { while (len = membuf_readline(&mb, line, sizeof(line) - 1, ' ', true), len) {
char *tok, *p = line; char *tok, *p = line;
const char *name = NULL;
if (*p == '#')
continue;
while (*p == ' ' || *p == '\t')
p++;
tok = strsep(&p, " "); tok = strsep(&p, " ");
if (p) { if (p) {
if (!strcmp("label", tok)) { if (!strcmp("label", tok)) {
name = p; bflow->os_name = strdup(p);
if (bflow->os_name)
break; /* just find the first */
} else if (!strcmp("menu", tok)) {
tok = strsep(&p, " ");
if (!strcmp("label", tok)) {
name = p;
}
}
if (name) {
free(bflow->os_name);
bflow->os_name = strdup(name);
if (!bflow->os_name) if (!bflow->os_name)
return log_msg_ret("os", -ENOMEM); return log_msg_ret("os", -ENOMEM);
} }

View File

@@ -658,11 +658,11 @@ that are mapped into that memory:
======== ======================== =============================== ======== ======================== ===============================
Addr Config Usage Addr Config Usage
======== ======================== =============================== ======== ======================== ===============================
100 CONFIG_SYS_FDT_LOAD_ADDR Device tree
b000 CONFIG_BLOBLIST_ADDR Blob list b000 CONFIG_BLOBLIST_ADDR Blob list
10000 CFG_MALLOC_F_ADDR Early memory allocation 10000 CFG_MALLOC_F_ADDR Early memory allocation
f0000 CONFIG_PRE_CON_BUF_ADDR Pre-console buffer f0000 CONFIG_PRE_CON_BUF_ADDR Pre-console buffer
100000 TCG Event log TCG Event Log 100000 TCG Event log TCG Event Log
180000CONFIG_SYS_FDT_LOAD_ADDR Device tree
200000 CONFIG_TRACE_EARLY_ADDR Early trace buffer (if enabled). Also used 200000 CONFIG_TRACE_EARLY_ADDR Early trace buffer (if enabled). Also used
400000 CONFIG_TEXT_BASE Load buffer for U-Boot (sandbox_spl only) 400000 CONFIG_TEXT_BASE Load buffer for U-Boot (sandbox_spl only)
10000000 PCI address space (see test.dts) 10000000 PCI address space (see test.dts)

View File

@@ -647,17 +647,6 @@ const char *bootflow_img_type_name(enum bootflow_img_t type);
struct bootflow_img *bootflow_img_add(struct bootflow *bflow, const char *fname, struct bootflow_img *bootflow_img_add(struct bootflow *bflow, const char *fname,
enum bootflow_img_t type, ulong addr, enum bootflow_img_t type, ulong addr,
ulong size); ulong size);
/**
* bootflow_img_find() - Find the first image of a given type
*
* @bflow: Bootflow to search
* @type: Image type to search for
* Return: Pointer to image, or NULL if not found
*/
const struct bootflow_img *bootflow_img_find(const struct bootflow *bflow,
enum bootflow_img_t type);
/** /**
* bootflow_get_seq() - Get the sequence number of a bootflow * bootflow_get_seq() - Get the sequence number of a bootflow
* *

View File

@@ -1488,22 +1488,6 @@ static int bootstd_images(struct unit_test_state *uts)
ptr = map_sysmem(img->addr, 0); ptr = map_sysmem(img->addr, 0);
ut_asserteq(0, *(ulong *)ptr); ut_asserteq(0, *(ulong *)ptr);
/* check we can find images */
bflow = alist_get(&std->bootflows, 1, struct bootflow);
img = bootflow_img_find(bflow, (enum bootflow_img_t)IH_TYPE_SCRIPT);
ut_assertnonnull(img);
ut_asserteq(IH_TYPE_SCRIPT, img->type);
ut_asserteq(map_to_sysmem(bflow->buf), img->addr);
ut_asserteq(bflow->size, img->size);
img = bootflow_img_find(bflow, BFI_LOGO);
ut_assertnonnull(img);
ut_asserteq(BFI_LOGO, img->type);
ut_asserteq(map_to_sysmem(bflow->logo), img->addr);
ut_asserteq(bflow->logo_size, img->size);
ut_assertnull(bootflow_img_find(bflow, BFI_CMDLINE));
ut_assert_console_end(); ut_assert_console_end();
return 0; return 0;