aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/Kconfig34
-rw-r--r--common/Makefile2
-rw-r--r--common/bloblist.c16
-rw-r--r--common/board_f.c42
-rw-r--r--common/console.c4
-rw-r--r--common/fdt_simplefb.c (renamed from common/lcd_simplefb.c)37
-rw-r--r--common/spl/spl_fit.c7
7 files changed, 114 insertions, 28 deletions
diff --git a/common/Kconfig b/common/Kconfig
index fdcf4536d0..50ac4331f5 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -32,6 +32,16 @@ config CONSOLE_RECORD_OUT_SIZE
more data will be recorded until some is removed. The buffer is
allocated immediately after the malloc() region is ready.
+config CONSOLE_RECORD_OUT_SIZE_F
+ hex "Output buffer size before relocation"
+ depends on CONSOLE_RECORD
+ default 0x400 if CONSOLE_RECORD
+ help
+ Set the size of the console output buffer before relocation. When
+ this fills up, no more data will be recorded until some is removed.
+ The buffer is allocated immediately after the early malloc() region is
+ ready.
+
config CONSOLE_RECORD_IN_SIZE
hex "Input buffer size"
depends on CONSOLE_RECORD
@@ -717,6 +727,8 @@ config TPL_BLOBLIST
This enables a bloblist in TPL. The bloblist is set up in TPL and
passed to SPL and U-Boot proper.
+if BLOBLIST
+
config BLOBLIST_SIZE
hex "Size of bloblist"
depends on BLOBLIST
@@ -727,17 +739,24 @@ config BLOBLIST_SIZE
is set up in the first part of U-Boot to run (TPL, SPL or U-Boot
proper), and this sane bloblist is used for subsequent stages.
+config BLOBLIST_ALLOC
+ bool "Allocate bloblist"
+ help
+ Allocate the bloblist using malloc(). This avoids the need to
+ specify a fixed address on systems where this is unknown or can
+ change at runtime.
+
config BLOBLIST_ADDR
hex "Address of bloblist"
- depends on BLOBLIST
default 0xc000 if SANDBOX
help
Sets the address of the bloblist, set up by the first part of U-Boot
which runs. Subsequent U-Boot stages typically use the same address.
+ This is not used if BLOBLIST_ALLOC is selected.
+
config BLOBLIST_SIZE_RELOC
hex "Size of bloblist after relocation"
- depends on BLOBLIST
default BLOBLIST_SIZE
help
Sets the size of the bloblist in bytes after relocation. Since U-Boot
@@ -745,6 +764,8 @@ config BLOBLIST_SIZE_RELOC
size than the one set up by SPL. This bloblist is set up during the
relocation process.
+endif # BLOBLIST
+
endmenu
source "common/spl/Kconfig"
@@ -766,3 +787,12 @@ config SPL_IMAGE_SIGN_INFO
Enable image_sign_info helper functions in SPL.
endif
+
+config FDT_SIMPLEFB
+ bool "FDT tools for simplefb support"
+ depends on OF_LIBFDT
+ help
+ Enable the fdt tools to manage the simple fb nodes in device tree.
+ These functions can be used by board to indicate to the OS
+ the presence of the simple frame buffer with associated reserved
+ memory
diff --git a/common/Makefile b/common/Makefile
index c500bcd7d8..24be05c368 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_DISPLAY_BOARDINFO) += board_info.o
obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o
obj-$(CONFIG_CMD_BEDBUG) += bedbug.o
+obj-$(CONFIG_FDT_SIMPLEFB) += fdt_simplefb.o
obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o
obj-$(CONFIG_MII) += miiphyutil.o
obj-$(CONFIG_CMD_MII) += miiphyutil.o
@@ -40,7 +41,6 @@ ifndef CONFIG_DM_VIDEO
obj-$(CONFIG_LCD) += lcd.o lcd_console.o
endif
obj-$(CONFIG_LCD_ROTATION) += lcd_console_rotation.o
-obj-$(CONFIG_LCD_DT_SIMPLEFB) += lcd_simplefb.o
obj-$(CONFIG_MENU) += menu.o
obj-$(CONFIG_UPDATE_COMMON) += update.o
obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
diff --git a/common/bloblist.c b/common/bloblist.c
index 1290fff850..01b04103d9 100644
--- a/common/bloblist.c
+++ b/common/bloblist.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <bloblist.h>
#include <log.h>
+#include <malloc.h>
#include <mapmem.h>
#include <spl.h>
#include <asm/global_data.h>
@@ -416,10 +417,21 @@ int bloblist_init(void)
ret = bloblist_check(CONFIG_BLOBLIST_ADDR,
CONFIG_BLOBLIST_SIZE);
if (ret) {
+ ulong addr;
+
log(LOGC_BLOBLIST, expected ? LOGL_WARNING : LOGL_DEBUG,
"Existing bloblist not found: creating new bloblist\n");
- ret = bloblist_new(CONFIG_BLOBLIST_ADDR, CONFIG_BLOBLIST_SIZE,
- 0);
+ if (IS_ENABLED(CONFIG_BLOBLIST_ALLOC)) {
+ void *ptr = memalign(BLOBLIST_ALIGN,
+ CONFIG_BLOBLIST_SIZE);
+
+ if (!ptr)
+ return log_msg_ret("alloc", -ENOMEM);
+ addr = map_to_sysmem(ptr);
+ } else {
+ addr = CONFIG_BLOBLIST_ADDR;
+ }
+ ret = bloblist_new(addr, CONFIG_BLOBLIST_SIZE, 0);
} else {
log(LOGC_BLOBLIST, LOGL_DEBUG, "Found existing bloblist\n");
}
diff --git a/common/board_f.c b/common/board_f.c
index 3dc0eaa59c..dd69c3b6b7 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -655,8 +655,14 @@ static int reloc_bootstage(void)
static int reloc_bloblist(void)
{
#ifdef CONFIG_BLOBLIST
- if (gd->flags & GD_FLG_SKIP_RELOC)
+ /*
+ * Relocate only if we are supposed to send it
+ */
+ if ((gd->flags & GD_FLG_SKIP_RELOC) &&
+ CONFIG_BLOBLIST_SIZE == CONFIG_BLOBLIST_SIZE_RELOC) {
+ debug("Not relocating bloblist\n");
return 0;
+ }
if (gd->new_bloblist) {
int size = CONFIG_BLOBLIST_SIZE;
@@ -673,30 +679,32 @@ static int reloc_bloblist(void)
static int setup_reloc(void)
{
- if (gd->flags & GD_FLG_SKIP_RELOC) {
- debug("Skipping relocation due to flag\n");
- return 0;
- }
-
+ if (!(gd->flags & GD_FLG_SKIP_RELOC)) {
#ifdef CONFIG_SYS_TEXT_BASE
#ifdef ARM
- gd->reloc_off = gd->relocaddr - (unsigned long)__image_copy_start;
+ gd->reloc_off = gd->relocaddr - (unsigned long)__image_copy_start;
#elif defined(CONFIG_M68K)
- /*
- * On all ColdFire arch cpu, monitor code starts always
- * just after the default vector table location, so at 0x400
- */
- gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400);
+ /*
+ * On all ColdFire arch cpu, monitor code starts always
+ * just after the default vector table location, so at 0x400
+ */
+ gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400);
#elif !defined(CONFIG_SANDBOX)
- gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE;
+ gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE;
#endif
#endif
+ }
+
memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
- debug("Relocation Offset is: %08lx\n", gd->reloc_off);
- debug("Relocating to %08lx, new gd at %08lx, sp at %08lx\n",
- gd->relocaddr, (ulong)map_to_sysmem(gd->new_gd),
- gd->start_addr_sp);
+ if (gd->flags & GD_FLG_SKIP_RELOC) {
+ debug("Skipping relocation due to flag\n");
+ } else {
+ debug("Relocation Offset is: %08lx\n", gd->reloc_off);
+ debug("Relocating to %08lx, new gd at %08lx, sp at %08lx\n",
+ gd->relocaddr, (ulong)map_to_sysmem(gd->new_gd),
+ gd->start_addr_sp);
+ }
return 0;
}
diff --git a/common/console.c b/common/console.c
index 0013d183ae..0c9099ca52 100644
--- a/common/console.c
+++ b/common/console.c
@@ -735,7 +735,9 @@ int console_record_init(void)
int ret;
ret = membuff_new((struct membuff *)&gd->console_out,
- CONFIG_CONSOLE_RECORD_OUT_SIZE);
+ gd->flags & GD_FLG_RELOC ?
+ CONFIG_CONSOLE_RECORD_OUT_SIZE :
+ CONFIG_CONSOLE_RECORD_OUT_SIZE_F);
if (ret)
return ret;
ret = membuff_new((struct membuff *)&gd->console_in,
diff --git a/common/lcd_simplefb.c b/common/fdt_simplefb.c
index 1650615cdb..c52846f4bc 100644
--- a/common/lcd_simplefb.c
+++ b/common/fdt_simplefb.c
@@ -16,7 +16,7 @@
DECLARE_GLOBAL_DATA_PTR;
-static int lcd_dt_simplefb_configure_node(void *blob, int off)
+static int fdt_simplefb_configure_node(void *blob, int off)
{
int xsize, ysize;
int bpix; /* log2 of bits per pixel */
@@ -58,7 +58,7 @@ static int lcd_dt_simplefb_configure_node(void *blob, int off)
xsize * (1 << bpix) / 8, name);
}
-int lcd_dt_simplefb_add_node(void *blob)
+int fdt_simplefb_add_node(void *blob)
{
static const char compat[] = "simple-framebuffer";
static const char disabled[] = "disabled";
@@ -76,10 +76,10 @@ int lcd_dt_simplefb_add_node(void *blob)
if (ret < 0)
return -1;
- return lcd_dt_simplefb_configure_node(blob, off);
+ return fdt_simplefb_configure_node(blob, off);
}
-int lcd_dt_simplefb_enable_existing_node(void *blob)
+int fdt_simplefb_enable_existing_node(void *blob)
{
int off;
@@ -87,5 +87,32 @@ int lcd_dt_simplefb_enable_existing_node(void *blob)
if (off < 0)
return -1;
- return lcd_dt_simplefb_configure_node(blob, off);
+ return fdt_simplefb_configure_node(blob, off);
}
+
+#if CONFIG_IS_ENABLED(DM_VIDEO)
+int fdt_simplefb_enable_and_mem_rsv(void *blob)
+{
+ struct fdt_memory mem;
+ int ret;
+
+ /* nothing to do when video is not active */
+ if (!video_is_active())
+ return 0;
+
+ ret = fdt_simplefb_enable_existing_node(blob);
+ if (ret)
+ return ret;
+
+ /* nothing to do when the frame buffer is not defined */
+ if (gd->video_bottom == gd->video_top)
+ return 0;
+
+ /* reserved with no-map tag the video buffer */
+ mem.start = gd->video_bottom;
+ mem.end = gd->video_top - 1;
+
+ return fdtdec_add_reserved_memory(blob, "framebuffer", &mem, NULL, 0, NULL,
+ FDTDEC_RESERVED_MEMORY_NO_MAP);
+}
+#endif
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 5fe0273d66..774072b85c 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -286,6 +286,13 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
if (fit_image_get_data_size(fit, node, &len))
return -ENOENT;
+ /* Dont bother to copy 0 byte data, but warn, though */
+ if (!len) {
+ log_warning("%s: Skip load '%s': image size is 0!\n",
+ __func__, fit_get_name(fit, node, NULL));
+ return 0;
+ }
+
src_ptr = map_sysmem(ALIGN(load_addr, ARCH_DMA_MINALIGN), len);
length = len;