Merge patch series "testb: Various tweaks and fixes for Labgrid"

Simon Glass <sjg@chromium.org> says:

This series includes a number of mostly unrelated changes which are in
service of running U-Boot on a lab using Labgrid.
This commit is contained in:
Tom Rini 2024-07-04 09:25:51 -06:00
commit e24053d8fb
18 changed files with 77 additions and 21 deletions

View file

@ -90,6 +90,7 @@
scp { scp {
filename = "scp.bin"; filename = "scp.bin";
missing-msg = "scp-sunxi"; missing-msg = "scp-sunxi";
optional;
}; };
}; };
#endif #endif

View file

@ -490,9 +490,6 @@ void early_system_init(void)
*/ */
save_omap_boot_params(); save_omap_boot_params();
#endif #endif
#ifdef CONFIG_DEBUG_UART_OMAP
debug_uart_init();
#endif
#ifdef CONFIG_SPL_BUILD #ifdef CONFIG_SPL_BUILD
spl_early_init(); spl_early_init();
@ -533,3 +530,18 @@ static int am33xx_dm_post_init(void)
return 0; return 0;
} }
EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, am33xx_dm_post_init); EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, am33xx_dm_post_init);
#ifdef CONFIG_DEBUG_UART_BOARD_INIT
void board_debug_uart_init(void)
{
if (u_boot_first_phase()) {
hw_data_init();
set_uart_mux_conf();
setup_early_clocks();
uart_soft_reset();
/* avoid uart gibberish by allowing the clocks to settle */
mdelay(50);
}
}
#endif

View file

@ -80,6 +80,7 @@ CONFIG_SYS_NS16550=y
CONFIG_SYS_NS16550_PORT_MAPPED=y CONFIG_SYS_NS16550_PORT_MAPPED=y
CONFIG_SPI=y CONFIG_SPI=y
CONFIG_TPM_TIS_LPC=y CONFIG_TPM_TIS_LPC=y
# CONFIG_TPM_V2 is not set
CONFIG_USB_STORAGE=y CONFIG_USB_STORAGE=y
CONFIG_USB_KEYBOARD=y CONFIG_USB_KEYBOARD=y
CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y

View file

@ -72,6 +72,7 @@ CONFIG_SYS_NS16550_PORT_MAPPED=y
CONFIG_SOUND=y CONFIG_SOUND=y
CONFIG_SPI=y CONFIG_SPI=y
CONFIG_TPM_TIS_LPC=y CONFIG_TPM_TIS_LPC=y
# CONFIG_TPM_V2 is not set
CONFIG_USB_STORAGE=y CONFIG_USB_STORAGE=y
CONFIG_USB_KEYBOARD=y CONFIG_USB_KEYBOARD=y
CONFIG_VIDEO_COPY=y CONFIG_VIDEO_COPY=y

View file

@ -74,6 +74,7 @@ CONFIG_SOUND_I8254=y
CONFIG_SOUND_RT5677=y CONFIG_SOUND_RT5677=y
CONFIG_SPI=y CONFIG_SPI=y
CONFIG_TPM_TIS_LPC=y CONFIG_TPM_TIS_LPC=y
# CONFIG_TPM_V2 is not set
CONFIG_USB_STORAGE=y CONFIG_USB_STORAGE=y
CONFIG_USB_KEYBOARD=y CONFIG_USB_KEYBOARD=y
CONFIG_VIDEO_COPY=y CONFIG_VIDEO_COPY=y

View file

@ -96,6 +96,7 @@ CONFIG_SOUND_RT5677=y
CONFIG_SPI=y CONFIG_SPI=y
CONFIG_TPL_SYSRESET=y CONFIG_TPL_SYSRESET=y
CONFIG_TPM_TIS_LPC=y CONFIG_TPM_TIS_LPC=y
# CONFIG_TPM_V2 is not set
CONFIG_USB_STORAGE=y CONFIG_USB_STORAGE=y
CONFIG_USB_KEYBOARD=y CONFIG_USB_KEYBOARD=y
CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y

View file

@ -80,6 +80,7 @@ CONFIG_I2S_TEGRA=y
CONFIG_SOUND_MAX98090=y CONFIG_SOUND_MAX98090=y
CONFIG_TEGRA114_SPI=y CONFIG_TEGRA114_SPI=y
CONFIG_TPM_TIS_INFINEON=y CONFIG_TPM_TIS_INFINEON=y
# CONFIG_TPM_V2 is not set
CONFIG_USB=y CONFIG_USB=y
CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_TEGRA=y CONFIG_USB_EHCI_TEGRA=y

View file

@ -88,6 +88,7 @@ CONFIG_SOUND_MAX98095=y
CONFIG_SOUND_WM8994=y CONFIG_SOUND_WM8994=y
CONFIG_EXYNOS_SPI=y CONFIG_EXYNOS_SPI=y
CONFIG_TPM_TIS_INFINEON=y CONFIG_TPM_TIS_INFINEON=y
# CONFIG_TPM_V2 is not set
CONFIG_USB=y CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_DWC3=y

View file

@ -8,6 +8,7 @@
#define LOG_CATEGORY LOGC_DM #define LOG_CATEGORY LOGC_DM
#include <debug_uart.h>
#include <errno.h> #include <errno.h>
#include <log.h> #include <log.h>
#include <dm/device.h> #include <dm/device.h>
@ -50,6 +51,21 @@ struct uclass_driver *lists_uclass_lookup(enum uclass_id id)
return NULL; return NULL;
} }
/**
* bind_drivers_pass() - Perform a pass of driver binding
*
* Work through the driver_info records binding a driver for each one. If the
* binding fails, continue binding others, but return the error.
*
* For OF_PLATDATA we must bind parent devices before their children. So only
* children of bound parents are bound on each call to this function. When a
* child is left unbound, -EAGAIN is returned, indicating that this function
* should be called again
*
* @parent: Parent device to use when binding each child device
* Return: 0 if OK, -EAGAIN if unbound children exist, -ENOENT if there is no
* driver for one of the devices, other -ve on other error
*/
static int bind_drivers_pass(struct udevice *parent, bool pre_reloc_only) static int bind_drivers_pass(struct udevice *parent, bool pre_reloc_only)
{ {
struct driver_info *info = struct driver_info *info =

View file

@ -49,13 +49,14 @@ static int initcall_is_event(init_fnc_t func)
*/ */
int initcall_run_list(const init_fnc_t init_sequence[]) int initcall_run_list(const init_fnc_t init_sequence[])
{ {
ulong reloc_ofs = calc_reloc_ofs(); ulong reloc_ofs;
const init_fnc_t *ptr; const init_fnc_t *ptr;
enum event_t type; enum event_t type;
init_fnc_t func; init_fnc_t func;
int ret = 0; int ret = 0;
for (ptr = init_sequence; func = *ptr, func; ptr++) { for (ptr = init_sequence; func = *ptr, func; ptr++) {
reloc_ofs = calc_reloc_ofs();
type = initcall_is_event(func); type = initcall_is_event(func);
if (type) { if (type) {
@ -84,7 +85,8 @@ int initcall_run_list(const init_fnc_t init_sequence[])
sprintf(buf, "event %d/%s", type, sprintf(buf, "event %d/%s", type,
event_type_name(type)); event_type_name(type));
} else { } else {
sprintf(buf, "call %p", func); sprintf(buf, "call %p",
(char *)func - reloc_ofs);
} }
printf("initcall failed at %s (err=%dE)\n", buf, ret); printf("initcall failed at %s (err=%dE)\n", buf, ret);

View file

@ -5,6 +5,8 @@
* Adapted from coreboot src/arch/x86/smbios.c * Adapted from coreboot src/arch/x86/smbios.c
*/ */
#define LOG_CATEGORY LOGC_BOARD
#include <dm.h> #include <dm.h>
#include <env.h> #include <env.h>
#include <linux/stringify.h> #include <linux/stringify.h>
@ -596,8 +598,12 @@ ulong write_smbios_table(ulong addr)
parent_node = dev_read_subnode(ctx.dev, "smbios"); parent_node = dev_read_subnode(ctx.dev, "smbios");
ret = sysinfo_detect(ctx.dev); ret = sysinfo_detect(ctx.dev);
if (ret)
return ret; /*
* ignore the error since many boards don't implement
* this and we can still use the info in the devicetree
*/
ret = log_msg_ret("sys", ret);
} }
} else { } else {
ctx.dev = NULL; ctx.dev = NULL;

View file

@ -13,8 +13,11 @@ def test_dm_compat(u_boot_console):
for line in response[:-1].split('\n')[2:]) for line in response[:-1].split('\n')[2:])
response = u_boot_console.run_command('dm compat') response = u_boot_console.run_command('dm compat')
bad_drivers = set()
for driver in drivers: for driver in drivers:
assert driver in response if not driver in response:
bad_drivers.add(driver)
assert not bad_drivers
# check sorting - output looks something like this: # check sorting - output looks something like this:
# testacpi 0 [ ] testacpi_drv |-- acpi-test # testacpi 0 [ ] testacpi_drv |-- acpi-test

View file

@ -7,7 +7,11 @@ import pytest
def test_help(u_boot_console): def test_help(u_boot_console):
"""Test that the "help" command can be executed.""" """Test that the "help" command can be executed."""
u_boot_console.run_command('help') lines = u_boot_console.run_command('help')
if u_boot_console.config.buildconfig.get('config_cmd_2048', 'n') == 'y':
assert lines.splitlines()[0] == "2048 - The 2048 game"
else:
assert lines.splitlines()[0] == "? - alias for 'help'"
@pytest.mark.boardspec('sandbox') @pytest.mark.boardspec('sandbox')
def test_help_no_devicetree(u_boot_console): def test_help_no_devicetree(u_boot_console):

View file

@ -27,13 +27,16 @@ def test_log_format(u_boot_console):
cons = u_boot_console cons = u_boot_console
with cons.log.section('format'): with cons.log.section('format'):
run_with_format('all', 'NOTICE.arch,file.c:123-func() msg') pad = int(u_boot_console.config.buildconfig.get('config_logf_func_pad'))
padding = ' ' * (pad - len('func'))
run_with_format('all', f'NOTICE.arch,file.c:123-{padding}func() msg')
output = cons.run_command('log format') output = cons.run_command('log format')
assert output == 'Log format: clFLfm' assert output == 'Log format: clFLfm'
run_with_format('fm', 'func() msg') run_with_format('fm', f'{padding}func() msg')
run_with_format('clfm', 'NOTICE.arch,func() msg') run_with_format('clfm', f'NOTICE.arch,{padding}func() msg')
run_with_format('FLfm', 'file.c:123-func() msg') run_with_format('FLfm', f'file.c:123-{padding}func() msg')
run_with_format('lm', 'NOTICE. msg') run_with_format('lm', 'NOTICE. msg')
run_with_format('m', 'msg') run_with_format('m', 'msg')

View file

@ -12,7 +12,7 @@ import u_boot_utils as util
TMPDIR = '/tmp/test_trace' TMPDIR = '/tmp/test_trace'
# Decode a function-graph line # Decode a function-graph line
RE_LINE = re.compile(r'.*0\.\.\.\.\. \s*([0-9.]*): func.*[|](\s*)(\S.*)?([{};])$') RE_LINE = re.compile(r'.*0\.\.\.\.\.? \s*([0-9.]*): func.*[|](\s*)(\S.*)?([{};])$')
def collect_trace(cons): def collect_trace(cons):
@ -175,7 +175,7 @@ def check_funcgraph(cons, fname, proftool, map_fname, trace_dat):
# Then look for this: # Then look for this:
# u-boot-1 0..... 282.101375: funcgraph_exit: 0.006 us | } # u-boot-1 0..... 282.101375: funcgraph_exit: 0.006 us | }
# Then check for this: # Then check for this:
# u-boot-1 0..... 282.101375: funcgraph_entry: 0.000 us | initcall_is_event(); # u-boot-1 0..... 282.101375: funcgraph_entry: 0.000 us | calc_reloc_ofs();
expected_indent = None expected_indent = None
found_start = False found_start = False
@ -199,7 +199,7 @@ def check_funcgraph(cons, fname, proftool, map_fname, trace_dat):
# The next function after initf_bootstage() exits should be # The next function after initf_bootstage() exits should be
# initcall_is_event() # initcall_is_event()
assert upto == 'initcall_is_event()' assert upto == 'calc_reloc_ofs()'
# Now look for initf_dm() and dm_timer_init() so we can check the bootstage # Now look for initf_dm() and dm_timer_init() so we can check the bootstage
# time # time

View file

@ -470,6 +470,7 @@ def test_ut_dm_init(u_boot_console):
fh.write(data) fh.write(data)
@pytest.mark.buildconfigspec('cmd_bootflow') @pytest.mark.buildconfigspec('cmd_bootflow')
@pytest.mark.buildconfigspec('sandbox')
def test_ut_dm_init_bootstd(u_boot_console): def test_ut_dm_init_bootstd(u_boot_console):
"""Initialise data for bootflow tests""" """Initialise data for bootflow tests"""

View file

@ -58,7 +58,7 @@ class ConsoleSandbox(ConsoleBase):
if self.use_dtb: if self.use_dtb:
cmd += ['-d', self.config.dtb] cmd += ['-d', self.config.dtb]
cmd += self.sandbox_flags cmd += self.sandbox_flags
return Spawn(cmd, cwd=self.config.source_dir) return Spawn(cmd, cwd=self.config.source_dir, decode_signal=True)
def restart_uboot_with_flags(self, flags, expect_reset=False, use_dtb=True): def restart_uboot_with_flags(self, flags, expect_reset=False, use_dtb=True):
"""Run U-Boot with the given command-line flags """Run U-Boot with the given command-line flags

View file

@ -24,18 +24,20 @@ class Spawn:
output: accumulated output from expect() output: accumulated output from expect()
""" """
def __init__(self, args, cwd=None): def __init__(self, args, cwd=None, decode_signal=False):
"""Spawn (fork/exec) the sub-process. """Spawn (fork/exec) the sub-process.
Args: Args:
args: array of processs arguments. argv[0] is the command to args: array of processs arguments. argv[0] is the command to
execute. execute.
cwd: the directory to run the process in, or None for no change. cwd: the directory to run the process in, or None for no change.
decode_signal (bool): True to indicate the exception number when
something goes wrong
Returns: Returns:
Nothing. Nothing.
""" """
self.decode_signal = decode_signal
self.waited = False self.waited = False
self.exit_code = 0 self.exit_code = 0
self.exit_info = '' self.exit_info = ''
@ -197,12 +199,12 @@ class Spawn:
# With sandbox, try to detect when U-Boot exits when it # With sandbox, try to detect when U-Boot exits when it
# shouldn't and explain why. This is much more friendly than # shouldn't and explain why. This is much more friendly than
# just dying with an I/O error # just dying with an I/O error
if err.errno == 5: # Input/output error if self.decode_signal and err.errno == 5: # I/O error
alive, _, info = self.checkalive() alive, _, info = self.checkalive()
if alive: if alive:
raise err raise err
raise ValueError('U-Boot exited with %s' % info) raise ValueError('U-Boot exited with %s' % info)
raise err raise
if self.logfile_read: if self.logfile_read:
self.logfile_read.write(c) self.logfile_read.write(c)
self.buf += c self.buf += c