summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-07-22 18:15:52 +0300
committerTom Rini <trini@konsulko.com>2021-07-22 18:15:52 +0300
commita15fa1ba67d7b3c8061b515e7713f733fa328018 (patch)
treef7746e2e7a3410043e9ea3f3f7c0a97e2c5e6dbb /arch
parent806734f41b25931798fdf667b5a2ae830229c13f (diff)
parent1b098b3e655451572054ce933a87231ee16f7133 (diff)
downloadu-boot-a15fa1ba67d7b3c8061b515e7713f733fa328018.tar.xz
Merge tag 'dm-pull-21jul21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
dtoc improvements to show better warnings minor test build fixes sandbox fixes for SDL2 and running TPL bloblist resize feature binman multithreading
Diffstat (limited to 'arch')
-rw-r--r--arch/sandbox/cpu/os.c65
-rw-r--r--arch/sandbox/cpu/sdl.c26
-rw-r--r--arch/sandbox/cpu/spl.c16
-rw-r--r--arch/sandbox/dts/test.dts1
-rw-r--r--arch/sandbox/include/asm/spl.h13
5 files changed, 83 insertions, 38 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index 0d21827e1b..1103530941 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -226,7 +226,7 @@ int os_setup_signal_handlers(void)
act.sa_sigaction = os_signal_handler;
sigemptyset(&act.sa_mask);
- act.sa_flags = SA_SIGINFO | SA_NODEFER;
+ act.sa_flags = SA_SIGINFO;
if (sigaction(SIGILL, &act, NULL) ||
sigaction(SIGBUS, &act, NULL) ||
sigaction(SIGSEGV, &act, NULL))
@@ -783,12 +783,14 @@ int os_jump_to_image(const void *dest, int size)
return os_jump_to_file(fname, true);
}
-int os_find_u_boot(char *fname, int maxlen, bool use_img)
+int os_find_u_boot(char *fname, int maxlen, bool use_img,
+ const char *cur_prefix, const char *next_prefix)
{
struct sandbox_state *state = state_get_current();
const char *progname = state->argv[0];
int len = strlen(progname);
- const char *suffix;
+ char subdir[10];
+ char *suffix;
char *p;
int fd;
@@ -798,45 +800,36 @@ int os_find_u_boot(char *fname, int maxlen, bool use_img)
strcpy(fname, progname);
suffix = fname + len - 4;
- /* If we are TPL, boot to SPL */
- if (!strcmp(suffix, "-tpl")) {
- fname[len - 3] = 's';
- fd = os_open(fname, O_RDONLY);
- if (fd >= 0) {
- close(fd);
- return 0;
- }
-
- /* Look for 'u-boot-spl' in the spl/ directory */
- p = strstr(fname, "/spl/");
- if (p) {
- p[1] = 's';
- fd = os_open(fname, O_RDONLY);
- if (fd >= 0) {
- close(fd);
- return 0;
- }
- }
- return -ENOENT;
- }
+ /* Change the existing suffix to the new one */
+ if (*suffix != '-')
+ return -EINVAL;
- /* Look for 'u-boot' in the same directory as 'u-boot-spl' */
- if (!strcmp(suffix, "-spl")) {
- fname[len - 4] = '\0';
- fd = os_open(fname, O_RDONLY);
- if (fd >= 0) {
- close(fd);
- return 0;
- }
+ if (*next_prefix)
+ strcpy(suffix + 1, next_prefix); /* e.g. "-tpl" to "-spl" */
+ else
+ *suffix = '\0'; /* e.g. "-spl" to "" */
+ fd = os_open(fname, O_RDONLY);
+ if (fd >= 0) {
+ close(fd);
+ return 0;
}
- /* Look for 'u-boot' in the parent directory of spl/ */
- p = strstr(fname, "spl/");
+ /*
+ * We didn't find it, so try looking for 'u-boot-xxx' in the xxx/
+ * directory. Replace the old dirname with the new one.
+ */
+ snprintf(subdir, sizeof(subdir), "/%s/", cur_prefix);
+ p = strstr(fname, subdir);
if (p) {
- /* Remove the "spl" characters */
- memmove(p, p + 4, strlen(p + 4) + 1);
+ if (*next_prefix)
+ /* e.g. ".../tpl/u-boot-spl" to "../spl/u-boot-spl" */
+ memcpy(p + 1, next_prefix, strlen(next_prefix));
+ else
+ /* e.g. ".../spl/u-boot" to ".../u-boot" */
+ strcpy(p, p + 1 + strlen(cur_prefix));
if (use_img)
strcat(p, ".img");
+
fd = os_open(fname, O_RDONLY);
if (fd >= 0) {
close(fd);
diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c
index 8102649be3..bef5abd039 100644
--- a/arch/sandbox/cpu/sdl.c
+++ b/arch/sandbox/cpu/sdl.c
@@ -123,6 +123,9 @@ int sandbox_sdl_init_display(int width, int height, int log2_bpp,
sdl.vis_height = sdl.height;
}
+ if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1"))
+ printf("Unable to init hinting: %s", SDL_GetError());
+
sdl.depth = 1 << log2_bpp;
sdl.pitch = sdl.width * sdl.depth / 8;
SDL_Window *screen = SDL_CreateWindow("U-Boot", SDL_WINDOWPOS_UNDEFINED,
@@ -164,8 +167,29 @@ int sandbox_sdl_init_display(int width, int height, int log2_bpp,
int sandbox_sdl_sync(void *lcd_base)
{
+ struct SDL_Rect rect;
+ int ret;
+
+ if (!sdl.texture)
+ return 0;
+ SDL_RenderClear(sdl.renderer);
SDL_UpdateTexture(sdl.texture, NULL, lcd_base, sdl.pitch);
- SDL_RenderCopy(sdl.renderer, sdl.texture, NULL, NULL);
+ ret = SDL_RenderCopy(sdl.renderer, sdl.texture, NULL, NULL);
+ if (ret) {
+ printf("SDL copy %d: %s\n", ret, SDL_GetError());
+ return -EIO;
+ }
+
+ /*
+ * On some machines this does not appear. Draw an empty rectangle which
+ * seems to fix that.
+ */
+ rect.x = 0;
+ rect.y = 0;
+ rect.w = 0;
+ rect.h = 0;
+ SDL_RenderDrawRect(sdl.renderer, &rect);
+
SDL_RenderPresent(sdl.renderer);
sandbox_sdl_poll_events();
diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c
index f82b0d3de1..650bdb0a70 100644
--- a/arch/sandbox/cpu/spl.c
+++ b/arch/sandbox/cpu/spl.c
@@ -17,6 +17,20 @@
DECLARE_GLOBAL_DATA_PTR;
+int sandbox_find_next_phase(char *fname, int maxlen, bool use_img)
+{
+ const char *cur_prefix, *next_prefix;
+ int ret;
+
+ cur_prefix = spl_phase_prefix(spl_phase());
+ next_prefix = spl_phase_prefix(spl_next_phase());
+ ret = os_find_u_boot(fname, maxlen, use_img, cur_prefix, next_prefix);
+ if (ret)
+ return log_msg_ret("find", ret);
+
+ return 0;
+}
+
/* SPL / TPL init function */
void board_init_f(ulong flag)
{
@@ -37,7 +51,7 @@ static int spl_board_load_image(struct spl_image_info *spl_image,
char fname[256];
int ret;
- ret = os_find_u_boot(fname, sizeof(fname), false);
+ ret = sandbox_find_next_phase(fname, sizeof(fname), false);
if (ret) {
printf("(%s not found, error %d)\n", fname, ret);
return ret;
diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index d85bb46ceb..0cee15a0ea 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -819,6 +819,7 @@
mmc2 {
compatible = "sandbox,mmc";
+ non-removable;
};
mmc1 {
diff --git a/arch/sandbox/include/asm/spl.h b/arch/sandbox/include/asm/spl.h
index 51e9d95d55..d25dc7c82a 100644
--- a/arch/sandbox/include/asm/spl.h
+++ b/arch/sandbox/include/asm/spl.h
@@ -12,4 +12,17 @@ enum {
BOOT_DEVICE_BOARD,
};
+/**
+ * sandbox_find_next_phase() - Find the next phase of U-Boot
+ *
+ * This function is intended to be called from within sandbox SPL. It uses
+ * a few rules to find the filename of the next U-Boot phase. See also
+ * os_find_u_boot().
+ *
+ * @fname: place to put full path to U-Boot
+ * @maxlen: maximum size of @fname
+ * @use_img: select the 'u-boot.img' file instead of the 'u-boot' ELF file
+ */
+int sandbox_find_next_phase(char *fname, int maxlen, bool use_img);
+
#endif