1
0
Fork 0
mirror of https://github.com/u-boot/u-boot.git synced 2025-04-23 22:14:54 +00:00

Merge patch series "Syncing up on skip-at-start"

Simon Glass <sjg@chromium.org> says:

This series has the skip-at-start change and a few fixes.

Sadly it also includes a revert for the dm_probe_devices() patch, since
it breaks jerry (RK3288). I will need to investigate way.

It is based on -next and I can send a PR if desired.

https://source.denx.de/u-boot/custodians/u-boot-dm/-/pipelines/24835

Link: https://lore.kernel.org/r/20250226162621.2681677-1-sjg@chromium.org
This commit is contained in:
Tom Rini 2025-03-04 08:22:19 -06:00
commit 78f8c8c58f
10 changed files with 67 additions and 48 deletions
arch/x86
cpu/intel_common
lib/fsp2
common
configs
drivers/core
tools/binman

View file

@ -31,6 +31,7 @@ static int locate_vbt(char **vbtp, int *sizep)
size = vbt.size;
if (size > sizeof(vbt_data))
return log_msg_ret("vbt", -E2BIG);
vbt.image_pos += CONFIG_ROM_SIZE;
ret = spi_flash_read_dm(dev, vbt.image_pos, size, vbt_data);
if (ret)
return log_msg_ret("read", ret);

View file

@ -107,7 +107,6 @@ int fsp_locate_fsp(enum fsp_type_t type, struct binman_entry *entry,
bool use_spi_flash, struct udevice **devp,
struct fsp_header **hdrp, ulong *rom_offsetp)
{
ulong mask = CONFIG_ROM_SIZE - 1;
struct udevice *dev;
ulong rom_offset = 0;
uint map_size;
@ -141,7 +140,7 @@ int fsp_locate_fsp(enum fsp_type_t type, struct binman_entry *entry,
if (ret)
return log_msg_ret("binman entry", ret);
if (!use_spi_flash)
rom_offset = (map_base & mask) - CONFIG_ROM_SIZE;
rom_offset = map_base + CONFIG_ROM_SIZE;
} else {
ret = -ENOENT;
if (false)

View file

@ -822,13 +822,13 @@ static int initf_dm(void)
bootstage_start(BOOTSTAGE_ID_ACCUM_DM_F, "dm_f");
ret = dm_init_and_scan(true);
bootstage_accum(BOOTSTAGE_ID_ACCUM_DM_F);
if (ret)
return ret;
ret = dm_autoprobe();
if (ret)
return ret;
bootstage_accum(BOOTSTAGE_ID_ACCUM_DM_F);
if (IS_ENABLED(CONFIG_TIMER_EARLY)) {
ret = dm_timer_init();

View file

@ -33,7 +33,9 @@ CONFIG_DISTRO_DEFAULTS=y
CONFIG_SYS_PBSIZE=1024
CONFIG_SILENT_CONSOLE=y
CONFIG_BLOBLIST=y
CONFIG_BLOBLIST_FIXED=y
# CONFIG_SPL_BLOBLIST is not set
CONFIG_BLOBLIST_ADDR=0x43d00000
# CONFIG_SPL_FRAMEWORK is not set
CONFIG_SPL_FOOTPRINT_LIMIT=y
CONFIG_SPL_MAX_FOOTPRINT=0x3800

View file

@ -295,22 +295,29 @@ void *dm_priv_to_rw(void *priv)
* all its children recursively to do the same.
*
* @dev: Device to (maybe) probe
* @pre_reloc_only: Probe only devices marked with the DM_FLAG_PRE_RELOC flag
* Return 0 if OK, -ve on error
*/
static int dm_probe_devices(struct udevice *dev)
static int dm_probe_devices(struct udevice *dev, bool pre_reloc_only)
{
ofnode node = dev_ofnode(dev);
struct udevice *child;
int ret;
if (pre_reloc_only &&
(!ofnode_valid(node) || !ofnode_pre_reloc(node)) &&
!(dev->driver->flags & DM_FLAG_PRE_RELOC))
goto probe_children;
if (dev_get_flags(dev) & DM_FLAG_PROBE_AFTER_BIND) {
int ret;
ret = device_probe(dev);
if (ret)
return ret;
}
probe_children:
list_for_each_entry(child, &dev->child_head, sibling_node)
dm_probe_devices(child);
dm_probe_devices(child, pre_reloc_only);
return 0;
}
@ -319,7 +326,7 @@ int dm_autoprobe(void)
{
int ret;
ret = dm_probe_devices(gd->dm_root);
ret = dm_probe_devices(gd->dm_root, !(gd->flags & GD_FLG_RELOC));
if (ret)
return log_msg_ret("pro", ret);

View file

@ -823,24 +823,6 @@ multiple-images:
};
};
end-at-4gb:
For x86 machines the ROM offsets start just before 4GB and extend
up so that the image finished at the 4GB boundary. This boolean
option can be enabled to support this. The image size must be
provided so that binman knows when the image should start. For an
8MB ROM, the offset of the first entry would be 0xfff80000 with
this option, instead of 0 without this option.
skip-at-start:
This property specifies the entry offset of the first entry.
For PowerPC mpc85xx based CPU, CONFIG_TEXT_BASE is the entry
offset of the first entry. It can be 0xeff40000 or 0xfff40000 for
nor flash boot, 0x201000 for sd boot etc.
'end-at-4gb' property is not applicable where CONFIG_TEXT_BASE +
Image size != 4gb.
align-default:
Specifies the default alignment for entries in this section if they do
not specify an alignment. Note that this only applies to top-level entries
@ -957,6 +939,35 @@ filename:
section in different image, since there is currently no way to share data
between images other than through files.
end-at-4gb:
For x86 machines the ROM offsets start just before 4GB and extend
up so that the image finished at the 4GB boundary. This boolean
option can be enabled to support this. The image size must be
provided so that binman knows when the image should start. For an
8MB ROM, the offset of the first entry would be 0xfff80000 with
this option, instead of 0 without this option.
skip-at-start:
This property specifies the entry offset of the first entry in the section.
It is useful when the Binman image is written to a particular offset in the
media. It allows the offset of the first entry to be the media offset, even
though it is at the start of the image. It effectively creates a hole at the
start of the image, an implied, empty area.
For example, if the image is written to offset 4K on the media, set
skip-at-start to 0x1000. At runtime, the Binman image will assume that it
has be written at offset 4K and all symbols and offsets will take account of
that. The image-pos values will also be adjusted. The effect is similar to
adding an empty 4K region at the start, except that Binman does not actually
output it.
For PowerPC mpc85xx based CPU, CONFIG_TEXT_BASE is the entry
offset of the first entry. It can be 0xeff40000 or 0xfff40000 for
nor flash boot, 0x201000 for sd boot etc.
'end-at-4gb' property is not applicable where CONFIG_TEXT_BASE +
Image size != 4gb.
Image Properties
----------------

View file

@ -392,9 +392,8 @@ class Entry(object):
"""Set the value of device-tree properties calculated by binman"""
state.SetInt(self._node, 'offset', self.offset)
state.SetInt(self._node, 'size', self.size)
base = self.section.GetRootSkipAtStart() if self.section else 0
if self.image_pos is not None:
state.SetInt(self._node, 'image-pos', self.image_pos - base)
state.SetInt(self._node, 'image-pos', self.image_pos)
if self.GetImage().allow_repack:
if self.orig_offset is not None:
state.SetInt(self._node, 'orig-offset', self.orig_offset, True)
@ -722,7 +721,7 @@ class Entry(object):
is_elf = self.GetDefaultFilename() == self.elf_fname
symbols_base = self.symbols_base
if symbols_base is None and self.GetImage()._end_4gb:
if symbols_base is None and self.GetImage()._end_at_4gb:
symbols_base = 0
elf.LookupAndWriteSymbols(self.elf_fname, self, section.GetImage(),

View file

@ -65,7 +65,7 @@ class Entry_fmap(Entry):
if entry.image_pos is None:
pos = 0
else:
pos = entry.image_pos - entry.GetRootSkipAtStart()
pos = entry.image_pos
# Drop @ symbols in name
name = entry.name.replace('@', '')
@ -75,8 +75,6 @@ class Entry_fmap(Entry):
_AddEntries(areas, subentry)
else:
pos = entry.image_pos
if pos is not None:
pos -= entry.section.GetRootSkipAtStart()
areas.append(fmap_util.FmapArea(pos or 0, entry.size or 0,
entry.name, flags))

View file

@ -165,7 +165,7 @@ class Entry_section(Entry):
self._pad_byte = 0
self._sort = False
self._skip_at_start = None
self._end_4gb = False
self._end_at_4gb = False
self._ignore_missing = False
self._filename = None
self.align_default = 0
@ -187,9 +187,9 @@ class Entry_section(Entry):
super().ReadNode()
self._pad_byte = fdt_util.GetInt(self._node, 'pad-byte', 0)
self._sort = fdt_util.GetBool(self._node, 'sort-by-offset')
self._end_4gb = fdt_util.GetBool(self._node, 'end-at-4gb')
self._end_at_4gb = fdt_util.GetBool(self._node, 'end-at-4gb')
self._skip_at_start = fdt_util.GetInt(self._node, 'skip-at-start')
if self._end_4gb:
if self._end_at_4gb:
if not self.size:
self.Raise("Section size must be provided when using end-at-4gb")
if self._skip_at_start is not None:
@ -801,7 +801,7 @@ class Entry_section(Entry):
if not entry:
self._Raise("Unable to set offset/size for unknown entry '%s'" %
name)
entry.SetOffsetSize(self._skip_at_start + offset if offset is not None
entry.SetOffsetSize(offset + self._skip_at_start if offset is not None
else None, size)
def GetEntryOffsets(self):

View file

@ -2297,16 +2297,17 @@ class TestFunctional(unittest.TestCase):
fhdr, fentries = fmap_util.DecodeFmap(data[32:])
self.assertEqual(0x100, fhdr.image_size)
base = (1 << 32) - 0x100
self.assertEqual(0, fentries[0].offset)
self.assertEqual(base, fentries[0].offset)
self.assertEqual(4, fentries[0].size)
self.assertEqual(b'U_BOOT', fentries[0].name)
self.assertEqual(4, fentries[1].offset)
self.assertEqual(base + 4, fentries[1].offset)
self.assertEqual(3, fentries[1].size)
self.assertEqual(b'INTEL_MRC', fentries[1].name)
self.assertEqual(32, fentries[2].offset)
self.assertEqual(base + 32, fentries[2].offset)
self.assertEqual(fmap_util.FMAP_HEADER_LEN +
fmap_util.FMAP_AREA_LEN * 3, fentries[2].size)
self.assertEqual(b'FMAP', fentries[2].name)
@ -2319,27 +2320,28 @@ class TestFunctional(unittest.TestCase):
fhdr, fentries = fmap_util.DecodeFmap(data[36:])
self.assertEqual(0x180, fhdr.image_size)
base = (1 << 32) - 0x180
expect_size = fmap_util.FMAP_HEADER_LEN + fmap_util.FMAP_AREA_LEN * 4
fiter = iter(fentries)
fentry = next(fiter)
self.assertEqual(b'U_BOOT', fentry.name)
self.assertEqual(0, fentry.offset)
self.assertEqual(base, fentry.offset)
self.assertEqual(4, fentry.size)
fentry = next(fiter)
self.assertEqual(b'SECTION', fentry.name)
self.assertEqual(4, fentry.offset)
self.assertEqual(base + 4, fentry.offset)
self.assertEqual(0x20 + expect_size, fentry.size)
fentry = next(fiter)
self.assertEqual(b'INTEL_MRC', fentry.name)
self.assertEqual(4, fentry.offset)
self.assertEqual(base + 4, fentry.offset)
self.assertEqual(3, fentry.size)
fentry = next(fiter)
self.assertEqual(b'FMAP', fentry.name)
self.assertEqual(36, fentry.offset)
self.assertEqual(base + 36, fentry.offset)
self.assertEqual(expect_size, fentry.size)
def testElf(self):
@ -3535,8 +3537,8 @@ class TestFunctional(unittest.TestCase):
image = control.images['image']
entries = image.GetEntries()
desc = entries['intel-descriptor']
self.assertEqual(0xff800000, desc.offset);
self.assertEqual(0xff800000, desc.image_pos);
self.assertEqual(0xff800000, desc.offset)
self.assertEqual(0xff800000, desc.image_pos)
def testReplaceCbfs(self):
"""Test replacing a single file in CBFS without changing the size"""
@ -3778,8 +3780,8 @@ class TestFunctional(unittest.TestCase):
image = control.images['image']
entries = image.GetEntries()
expected_ptr = entries['intel-fit'].image_pos - (1 << 32)
self.assertEqual(expected_ptr, ptr)
expected_ptr = entries['intel-fit'].image_pos #- (1 << 32)
self.assertEqual(expected_ptr, ptr + (1 << 32))
def testPackIntelFitMissing(self):
"""Test detection of a FIT pointer with not FIT region"""
@ -4773,7 +4775,7 @@ class TestFunctional(unittest.TestCase):
entry = image.GetEntries()['fdtmap']
self.assertEqual(orig_entry.offset, entry.offset)
self.assertEqual(orig_entry.size, entry.size)
self.assertEqual(16, entry.image_pos)
self.assertEqual((1 << 32) - 0x400 + 16, entry.image_pos)
u_boot = image.GetEntries()['section'].GetEntries()['u-boot']