diff options
author | Tom Rini <trini@konsulko.com> | 2021-07-07 13:34:42 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-07-07 13:34:42 -0400 |
commit | 7e58a3a148fb94e9ce09fb48d0ddd75c20ee7df9 (patch) | |
tree | 6a4edadac675129fe33da72bb6aa863b7e57f2e1 /arch | |
parent | 5b8a83551d339736af92c43524ed0e1ba01122af (diff) | |
parent | 880e4768c20b99b1f9a50f35c180f8522dd82c9a (diff) | |
download | u-boot-7e58a3a148fb94e9ce09fb48d0ddd75c20ee7df9.zip u-boot-7e58a3a148fb94e9ce09fb48d0ddd75c20ee7df9.tar.gz u-boot-7e58a3a148fb94e9ce09fb48d0ddd75c20ee7df9.tar.bz2 |
Merge tag 'dm-pull-6jul21' of https://source.denx.de/u-boot/custodians/u-boot-dmWIP/07Jul2021
various minor sandbox improvements
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sandbox/cpu/start.c | 33 | ||||
-rw-r--r-- | arch/sandbox/dts/test.dts | 6 | ||||
-rw-r--r-- | arch/sandbox/include/asm/state.h | 1 | ||||
-rw-r--r-- | arch/sandbox/include/asm/test.h | 10 |
4 files changed, 40 insertions, 10 deletions
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index 6bb9447..777db4e 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -390,6 +390,16 @@ static int sandbox_cmdline_cb_select_unittests(struct sandbox_state *state, } SANDBOX_CMDLINE_OPT_SHORT(select_unittests, 'k', 1, "Select unit tests to run"); +static int sandbox_cmdline_cb_signals(struct sandbox_state *state, + const char *arg) +{ + state->handle_signals = true; + + return 0; +} +SANDBOX_CMDLINE_OPT_SHORT(signals, 'S', 0, + "Handle signals (such as SIGSEGV) in sandbox"); + static void setup_ram_buf(struct sandbox_state *state) { /* Zero the RAM buffer if we didn't read it, to keep valgrind happy */ @@ -426,9 +436,6 @@ void sandbox_reset(void) if (state_uninit()) os_exit(2); - if (dm_uninit()) - os_exit(2); - /* Restart U-Boot */ os_relaunch(os_argv); } @@ -444,6 +451,14 @@ int main(int argc, char *argv[]) text_base = os_find_text_base(); /* + * This must be the first invocation of os_malloc() to have + * state->ram_buf in the low 4 GiB. + */ + ret = state_init(); + if (ret) + goto err; + + /* * Copy argv[] so that we can pass the arguments in the original * sequence when resetting the sandbox. */ @@ -457,10 +472,6 @@ int main(int argc, char *argv[]) gd = &data; gd->arch.text_base = text_base; - ret = state_init(); - if (ret) - goto err; - state = state_get_current(); if (os_parse_args(state, argc, argv)) return 1; @@ -476,9 +487,11 @@ int main(int argc, char *argv[]) if (ret) goto err; - ret = os_setup_signal_handlers(); - if (ret) - goto err; + if (state->handle_signals) { + ret = os_setup_signal_handlers(); + if (ret) + goto err; + } #if CONFIG_VAL(SYS_MALLOC_F_LEN) gd->malloc_base = CONFIG_MALLOC_F_ADDR; diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 8e7eaf2..d85bb46 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -139,6 +139,12 @@ size = <0x10000>; }; }; + + cros_ec_pwm: cros-ec-pwm { + compatible = "google,cros-ec-pwm"; + #pwm-cells = <1>; + }; + }; dsi_host: dsi_host { diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index bca1306..1c4c571 100644 --- a/arch/sandbox/include/asm/state.h +++ b/arch/sandbox/include/asm/state.h @@ -93,6 +93,7 @@ struct sandbox_state { bool ram_buf_read; /* true if we read the RAM buffer */ bool run_unittests; /* Run unit tests */ const char *select_unittests; /* Unit test to run */ + bool handle_signals; /* Handle signals within sandbox */ /* Pointer to information for each SPI bus/cs */ struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS] diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h index 1cb960a..dab1a4e 100644 --- a/arch/sandbox/include/asm/test.h +++ b/arch/sandbox/include/asm/test.h @@ -275,4 +275,14 @@ void sandbox_set_enable_memio(bool enable); */ void sandbox_cros_ec_set_test_flags(struct udevice *dev, uint flags); +/** + * sandbox_cros_ec_get_pwm_duty() - Get EC PWM config for testing purposes + * + * @dev: Device to check + * @index: PWM channel index + * @duty: Current duty cycle in 0..EC_PWM_MAX_DUTY range. + * @return 0 if OK, -ENOSPC if the PWM number is invalid + */ +int sandbox_cros_ec_get_pwm_duty(struct udevice *dev, uint index, uint *duty); + #endif |