Merge branch 'assorted-dtb-alignment-fixes' into next

This merges a number of fixes from Marek Vasut that will allow us to
move to a newer dtc release (that enforces the 8 byte alignment
requirement that has long existed).
This commit is contained in:
Tom Rini 2025-11-28 10:22:16 -06:00
commit 626cb9993f
10 changed files with 30 additions and 22 deletions

View File

@ -37,7 +37,7 @@ SECTIONS
KEEP(*(SORT(__u_boot_list*)));
}
. = ALIGN(4);
. = ALIGN(8);
__image_copy_end = .;
__init_end = .;
@ -56,7 +56,7 @@ SECTIONS
. += CONFIG_MIPS_RELOCATION_TABLE_SIZE - 4;
}
. = ALIGN(4);
. = ALIGN(8);
_end = .;
.bss __rel_start (OVERLAY) : {
@ -64,7 +64,7 @@ SECTIONS
*(.sbss.*)
*(.bss.*)
*(COMMON)
. = ALIGN(4);
. = ALIGN(8);
__bss_end = .;
}

View File

@ -135,7 +135,7 @@
sandbox,emul = <&emul0>;
bootph-pre-ram;
};
sandbox_pmic: sandbox_pmic {
sandbox_pmic: sandbox_pmic@40 {
reg = <0x40>;
};
@ -143,9 +143,9 @@
reg = <0x41>;
};
i2c_emul: emul {
i2c_emul: emul@7f {
bootph-pre-ram;
reg = <0xff>;
reg = <0x7f>;
compatible = "sandbox,i2c-emul-parent";
emul_eeprom: emul-eeprom {
compatible = "sandbox,i2c-eeprom";

View File

@ -947,8 +947,8 @@
sandbox,emul = <&emul1>;
};
i2c_emul: emul {
reg = <0xff>;
i2c_emul: emul@7f {
reg = <0x7f>;
compatible = "sandbox,i2c-emul-parent";
emul_eeprom: emul-eeprom {
compatible = "sandbox,i2c-eeprom";
@ -963,7 +963,7 @@
};
};
sandbox_pmic: sandbox_pmic {
sandbox_pmic: sandbox_pmic@40 {
reg = <0x40>;
sandbox,emul = <&emul_pmic0>;
};
@ -1842,7 +1842,7 @@
pinctrl-0 = <&pinctrl_gpios>, <&pinctrl_i2s>;
pinctrl-1 = <&pinctrl_spi>, <&pinctrl_i2c>;
pinctrl_gpios: gpios {
pinctrl_gpios: pins-gpios {
gpio0 {
pins = "P5";
function = "GPIO";
@ -1866,7 +1866,7 @@
};
};
pinctrl_i2c: i2c {
pinctrl_i2c: pins-i2c {
groups {
groups = "I2C_UART";
function = "I2C";
@ -1878,12 +1878,12 @@
};
};
pinctrl_i2s: i2s {
pinctrl_i2s: pins-i2s {
groups = "SPI_I2S";
function = "I2S";
};
pinctrl_spi: spi {
pinctrl_spi: pins-spi {
groups = "SPI_I2S";
function = "SPI";

View File

@ -9,7 +9,7 @@ PLATFORM_CPPFLAGS += -D__XTENSA__ -mlongcalls -mforce-no-pic \
LDFLAGS_FINAL += --gc-sections
ifeq ($(CONFIG_SYS_BIG_ENDIAN),y)
PLATFORM_CPPFLAGS += -B xtensa -O elf32-xtensa-be
PLATFORM_ELFFLAGS += -B xtensa -O elf32-xtensa-be
else
PLATFORM_ELFFLAGS += -B xtensa -O elf32-xtensa-le
endif

View File

@ -78,7 +78,7 @@ SECTIONS
SECTION_text(XTENSA_SYS_TEXT_ADDR, FOLLOWING(.DoubleExceptionVector.text))
SECTION_rodata(ALIGN(16), FOLLOWING(.text))
SECTION_u_boot_list(ALIGN(16), FOLLOWING(.rodata))
SECTION_data(ALIGN(16), FOLLOWING(__u_boot_list))
SECTION_data(ALIGN(16), FOLLOWINGDT(__u_boot_list))
__reloc_end = .;
__init_end = .;

View File

@ -21,6 +21,9 @@
#define FORCE_OUTPUT . = .
#define FOLLOWING(sec) \
AT(((LOADADDR(sec) + SIZEOF(sec) + ALIGN_LMA-1)) & ~(ALIGN_LMA-1))
#define ALIGN_LMA_DT 8
#define FOLLOWINGDT(sec) \
AT(((LOADADDR(sec) + SIZEOF(sec) + ALIGN_LMA_DT-1)) & ~(ALIGN_LMA_DT-1))
/*
* Specify an output section that will be added to the ROM store table
@ -110,6 +113,7 @@
___u_boot_list_start = ABSOLUTE(.); \
KEEP(*(SORT(__u_boot_list*))); \
___u_boot_list_end = ABSOLUTE(.); \
. = ALIGN(ALIGN_LMA_DT); \
}
#define SECTION_data(_vma_, _lma_) \
@ -130,6 +134,7 @@
*(.eh_frame) \
*(.dynamic) \
*(.gnu.version_d) \
. = ALIGN(ALIGN_LMA_DT); \
_data_end = ABSOLUTE(.); \
}

View File

@ -5,8 +5,6 @@
stdin=serial,usbkbd
stdout=serial,vidconsole
stderr=serial,vidconsole
fdt_high=0xffffffff
initrd_high=0xffffffff
fdt_addr=0x40000000
scriptaddr=0x40200000
pxefile_addr_r=0x40300000

View File

@ -23,7 +23,6 @@
#include <log.h>
#include <mapmem.h>
#include <asm/io.h>
#include <malloc.h>
#include <memalign.h>
#include <asm/global_data.h>
#ifdef CONFIG_DM_HASH
@ -36,6 +35,7 @@ DECLARE_GLOBAL_DATA_PTR;
#include <bootm.h>
#include <image.h>
#include <bootstage.h>
#include <malloc.h>
#include <upl.h>
#include <u-boot/crc.h>
@ -2279,7 +2279,7 @@ int fit_image_load(struct bootm_headers *images, ulong addr,
log_debug("decompressing image\n");
if (load == data) {
loadbuf = malloc(max_decomp_len);
loadbuf = memalign(8, max_decomp_len);
load = map_to_sysmem(loadbuf);
} else {
loadbuf = map_sysmem(load, max_decomp_len);
@ -2291,6 +2291,11 @@ int fit_image_load(struct bootm_headers *images, ulong addr,
return -ENOEXEC;
}
len = load_end - load;
} else if (load_op != FIT_LOAD_IGNORED && image_type == IH_TYPE_FLATDT &&
((uintptr_t)buf & 7)) {
loadbuf = memalign(8, len);
load = map_to_sysmem(loadbuf);
memcpy(loadbuf, buf, len);
} else if (load != data) {
log_debug("copying\n");
loadbuf = map_sysmem(load, len);

View File

@ -39,7 +39,7 @@ static inline int power_pmic_get(struct unit_test_state *uts, char *name)
/* Test PMIC get method */
static int dm_test_power_pmic_get(struct unit_test_state *uts)
{
power_pmic_get(uts, "sandbox_pmic");
power_pmic_get(uts, "sandbox_pmic@40");
return 0;
}
@ -57,7 +57,7 @@ DM_TEST(dm_test_power_pmic_mc34708_get, UTF_SCAN_FDT);
/* Test PMIC I/O */
static int dm_test_power_pmic_io(struct unit_test_state *uts)
{
const char *name = "sandbox_pmic";
const char *name = "sandbox_pmic@40";
uint8_t out_buffer, in_buffer;
struct udevice *dev;
int reg_count, i;

View File

@ -38,7 +38,7 @@ def test_extension(ubman):
assert('overlay1.dtbo' in output)
ubman.run_command_list([
'setenv extension_overlay_addr %s' % (overlay_addr),
'setenv extension_overlay_addr %x' % (overlay_addr),
'setenv extension_overlay_cmd \'host load hostfs - ${extension_overlay_addr} %s${extension_overlay_name}\'' % (os.path.join(ubman.config.build_dir, OVERLAY_DIR))])
output = ubman.run_command('extension apply 0')