mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-22 07:01:39 +00:00
sandbox: Add an option to display of-platdata in SPL
At present we don't have a test that of-platdata can be accessed in SPL. Add this in as a command-line option to SPL. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
20d4440189
commit
1ca910be5d
5 changed files with 55 additions and 2 deletions
|
@ -44,5 +44,19 @@ SPL_LOAD_IMAGE_METHOD("sandbox", 0, BOOT_DEVICE_BOARD, spl_board_load_image);
|
||||||
|
|
||||||
void spl_board_init(void)
|
void spl_board_init(void)
|
||||||
{
|
{
|
||||||
|
struct sandbox_state *state = state_get_current();
|
||||||
|
struct udevice *dev;
|
||||||
|
|
||||||
preloader_console_init();
|
preloader_console_init();
|
||||||
|
if (state->show_of_platdata) {
|
||||||
|
/*
|
||||||
|
* Scan all the devices so that we can output their platform
|
||||||
|
* data. See sandbox_spl_probe().
|
||||||
|
*/
|
||||||
|
printf("Scanning misc devices\n");
|
||||||
|
for (uclass_first_device(UCLASS_MISC, &dev);
|
||||||
|
dev;
|
||||||
|
uclass_next_device(&dev))
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,6 +283,15 @@ static int sandbox_cmdline_cb_log_level(struct sandbox_state *state,
|
||||||
SANDBOX_CMDLINE_OPT_SHORT(log_level, 'L', 1,
|
SANDBOX_CMDLINE_OPT_SHORT(log_level, 'L', 1,
|
||||||
"Set log level (0=panic, 7=debug)");
|
"Set log level (0=panic, 7=debug)");
|
||||||
|
|
||||||
|
static int sandbox_cmdline_cb_show_of_platdata(struct sandbox_state *state,
|
||||||
|
const char *arg)
|
||||||
|
{
|
||||||
|
state->show_of_platdata = true;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
SANDBOX_CMDLINE_OPT(show_of_platdata, 0, "Show of-platdata in SPL");
|
||||||
|
|
||||||
int board_run_command(const char *cmdline)
|
int board_run_command(const char *cmdline)
|
||||||
{
|
{
|
||||||
printf("## Commands are disabled. Please enable CONFIG_CMDLINE.\n");
|
printf("## Commands are disabled. Please enable CONFIG_CMDLINE.\n");
|
||||||
|
|
|
@ -14,7 +14,7 @@ SECTIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
__u_boot_sandbox_option_start = .;
|
__u_boot_sandbox_option_start = .;
|
||||||
_u_boot_sandbox_getopt : { *(.u_boot_sandbox_getopt) }
|
_u_boot_sandbox_getopt : { KEEP(*(.u_boot_sandbox_getopt)) }
|
||||||
__u_boot_sandbox_option_end = .;
|
__u_boot_sandbox_option_end = .;
|
||||||
|
|
||||||
__bss_start = .;
|
__bss_start = .;
|
||||||
|
|
|
@ -89,6 +89,7 @@ struct sandbox_state {
|
||||||
bool skip_delays; /* Ignore any time delays (for test) */
|
bool skip_delays; /* Ignore any time delays (for test) */
|
||||||
bool show_test_output; /* Don't suppress stdout in tests */
|
bool show_test_output; /* Don't suppress stdout in tests */
|
||||||
int default_log_level; /* Default log level for sandbox */
|
int default_log_level; /* Default log level for sandbox */
|
||||||
|
bool show_of_platdata; /* Show of-platdata in SPL */
|
||||||
|
|
||||||
/* Pointer to information for each SPI bus/cs */
|
/* Pointer to information for each SPI bus/cs */
|
||||||
struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
|
struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
|
||||||
|
|
|
@ -3,11 +3,40 @@
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
OF_PLATDATA_OUTPUT = ''
|
OF_PLATDATA_OUTPUT = '''
|
||||||
|
of-platdata probe:
|
||||||
|
bool 1
|
||||||
|
byte 05
|
||||||
|
bytearray 06 00 00
|
||||||
|
int 1
|
||||||
|
intarray 2 3 4 0
|
||||||
|
longbytearray 09 0a 0b 0c 0d 0e 0f 10 11
|
||||||
|
string message
|
||||||
|
stringarray "multi-word" "message" ""
|
||||||
|
of-platdata probe:
|
||||||
|
bool 0
|
||||||
|
byte 08
|
||||||
|
bytearray 01 23 34
|
||||||
|
int 3
|
||||||
|
intarray 5 0 0 0
|
||||||
|
longbytearray 09 00 00 00 00 00 00 00 00
|
||||||
|
string message2
|
||||||
|
stringarray "another" "multi-word" "message"
|
||||||
|
of-platdata probe:
|
||||||
|
bool 0
|
||||||
|
byte 00
|
||||||
|
bytearray 00 00 00
|
||||||
|
int 0
|
||||||
|
intarray 0 0 0 0
|
||||||
|
longbytearray 00 00 00 00 00 00 00 00 00
|
||||||
|
string <NULL>
|
||||||
|
stringarray "one" "" ""
|
||||||
|
'''
|
||||||
|
|
||||||
@pytest.mark.buildconfigspec('spl_of_platdata')
|
@pytest.mark.buildconfigspec('spl_of_platdata')
|
||||||
def test_ofplatdata(u_boot_console):
|
def test_ofplatdata(u_boot_console):
|
||||||
"""Test that of-platdata can be generated and used in sandbox"""
|
"""Test that of-platdata can be generated and used in sandbox"""
|
||||||
cons = u_boot_console
|
cons = u_boot_console
|
||||||
|
cons.restart_uboot_with_flags(['--show_of_platdata'])
|
||||||
output = cons.get_spawn_output().replace('\r', '')
|
output = cons.get_spawn_output().replace('\r', '')
|
||||||
assert OF_PLATDATA_OUTPUT in output
|
assert OF_PLATDATA_OUTPUT in output
|
||||||
|
|
Loading…
Add table
Reference in a new issue