aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/Kconfig.boot7
-rw-r--r--common/avb_verify.c2
-rw-r--r--common/board_r.c6
-rw-r--r--common/bootstage.c2
-rw-r--r--common/fdt_support.c20
-rw-r--r--common/image-fdt.c17
-rw-r--r--common/image-fit.c2
-rw-r--r--common/image.c24
-rw-r--r--common/usb_kbd.c23
9 files changed, 73 insertions, 30 deletions
diff --git a/common/Kconfig.boot b/common/Kconfig.boot
index 7532e55edb..9c335f4f8c 100644
--- a/common/Kconfig.boot
+++ b/common/Kconfig.boot
@@ -138,7 +138,7 @@ config FIT_BEST_MATCH
config FIT_IMAGE_POST_PROCESS
bool "Enable post-processing of FIT artifacts after loading by U-Boot"
- depends on TI_SECURE_DEVICE
+ depends on TI_SECURE_DEVICE || SOCFPGA_SECURE_VAB_AUTH
help
Allows doing any sort of manipulation to blobs after they got extracted
from FIT images like stripping off headers or modifying the size of the
@@ -181,6 +181,8 @@ config SPL_FIT_FULL_CHECK
config SPL_FIT_SIGNATURE
bool "Enable signature verification of FIT firmware within SPL"
depends on SPL_DM
+ depends on SPL_LOAD_FIT || SPL_LOAD_FIT_FULL
+ select FIT_SIGNATURE
select SPL_FIT
select SPL_CRYPTO_SUPPORT
select SPL_HASH_SUPPORT
@@ -447,6 +449,7 @@ config BOOTSTAGE_REPORT
config BOOTSTAGE_RECORD_COUNT
int "Number of boot stage records to store"
+ depends on BOOTSTAGE
default 30
help
This is the size of the bootstage record list and is the maximum
@@ -454,6 +457,7 @@ config BOOTSTAGE_RECORD_COUNT
config SPL_BOOTSTAGE_RECORD_COUNT
int "Number of boot stage records to store for SPL"
+ depends on SPL_BOOTSTAGE
default 5
help
This is the size of the bootstage record list and is the maximum
@@ -461,6 +465,7 @@ config SPL_BOOTSTAGE_RECORD_COUNT
config TPL_BOOTSTAGE_RECORD_COUNT
int "Number of boot stage records to store for TPL"
+ depends on TPL_BOOTSTAGE
default 5
help
This is the size of the bootstage record list and is the maximum
diff --git a/common/avb_verify.c b/common/avb_verify.c
index db10d0f21f..0520a71455 100644
--- a/common/avb_verify.c
+++ b/common/avb_verify.c
@@ -369,7 +369,7 @@ static struct mmc_part *get_partition(AvbOps *ops, const char *partition)
}
ret = part_get_info_by_name(mmc_blk, partition, &part->info);
- if (!ret) {
+ if (ret < 0) {
printf("Can't find partition '%s'\n", partition);
goto err;
}
diff --git a/common/board_r.c b/common/board_r.c
index 9793439adf..c835ff8e26 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -626,6 +626,9 @@ static init_fnc_t init_sequence_r[] = {
#ifdef CONFIG_DM
initr_dm,
#endif
+#ifdef CONFIG_ADDR_MAP
+ initr_addr_map,
+#endif
#if defined(CONFIG_ARM) || defined(CONFIG_NDS32) || defined(CONFIG_RISCV) || \
defined(CONFIG_SANDBOX)
board_init, /* Setup chipselects */
@@ -661,9 +664,6 @@ static init_fnc_t init_sequence_r[] = {
initr_manual_reloc_cmdtable,
#endif
arch_initr_trap,
-#ifdef CONFIG_ADDR_MAP
- initr_addr_map,
-#endif
#if defined(CONFIG_BOARD_EARLY_INIT_R)
board_early_init_r,
#endif
diff --git a/common/bootstage.c b/common/bootstage.c
index d5b78b9f48..2c0110c263 100644
--- a/common/bootstage.c
+++ b/common/bootstage.c
@@ -349,7 +349,7 @@ void bootstage_report(void)
}
if (data->rec_count > RECORD_COUNT)
printf("Overflowed internal boot id table by %d entries\n"
- "Please increase CONFIG_(SPL_)BOOTSTAGE_RECORD_COUNT\n",
+ "Please increase CONFIG_(SPL_TPL_)BOOTSTAGE_RECORD_COUNT\n",
data->rec_count - RECORD_COUNT);
puts("\nAccumulated time:\n");
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 08d540bfc8..e624bbdf40 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -1668,22 +1668,36 @@ u64 fdt_get_base_address(const void *fdt, int node)
}
/*
- * Read a property of size <prop_len>. Currently only supports 1 or 2 cells.
+ * Read a property of size <prop_len>. Currently only supports 1 or 2 cells,
+ * or 3 cells specially for a PCI address.
*/
static int fdt_read_prop(const fdt32_t *prop, int prop_len, int cell_off,
uint64_t *val, int cells)
{
- const fdt32_t *prop32 = &prop[cell_off];
- const unaligned_fdt64_t *prop64 = (const fdt64_t *)&prop[cell_off];
+ const fdt32_t *prop32;
+ const unaligned_fdt64_t *prop64;
if ((cell_off + cells) > prop_len)
return -FDT_ERR_NOSPACE;
+ prop32 = &prop[cell_off];
+
+ /*
+ * Special handling for PCI address in PCI bus <ranges>
+ *
+ * PCI child address is made up of 3 cells. Advance the cell offset
+ * by 1 so that the PCI child address can be correctly read.
+ */
+ if (cells == 3)
+ cell_off += 1;
+ prop64 = (const fdt64_t *)&prop[cell_off];
+
switch (cells) {
case 1:
*val = fdt32_to_cpu(*prop32);
break;
case 2:
+ case 3:
*val = fdt64_to_cpu(*prop64);
break;
default:
diff --git a/common/image-fdt.c b/common/image-fdt.c
index 61ce6e5779..a287b66392 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -576,11 +576,18 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
fdt_fixup_pstore(blob);
#endif
if (IMAGE_OF_BOARD_SETUP) {
- fdt_ret = ft_board_setup(blob, gd->bd);
- if (fdt_ret) {
- printf("ERROR: board-specific fdt fixup failed: %s\n",
- fdt_strerror(fdt_ret));
- goto err;
+ const char *skip_board_fixup;
+
+ skip_board_fixup = env_get("skip_board_fixup");
+ if (skip_board_fixup && ((int)simple_strtol(skip_board_fixup, NULL, 10) == 1)) {
+ printf("skip board fdt fixup\n");
+ } else {
+ fdt_ret = ft_board_setup(blob, gd->bd);
+ if (fdt_ret) {
+ printf("ERROR: board-specific fdt fixup failed: %s\n",
+ fdt_strerror(fdt_ret));
+ goto err;
+ }
}
}
if (IMAGE_OF_SYSTEM_SETUP) {
diff --git a/common/image-fit.c b/common/image-fit.c
index 28b3d2b191..94501b1071 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1651,7 +1651,7 @@ int fit_check_format(const void *fit, ulong size)
/* mandatory / node 'timestamp' property */
if (!fdt_getprop(fit, 0, FIT_TIMESTAMP_PROP, NULL)) {
log_debug("Wrong FIT format: no timestamp\n");
- return -ENODATA;
+ return -EBADMSG;
}
}
diff --git a/common/image.c b/common/image.c
index a6500f5f5c..51854aae5d 100644
--- a/common/image.c
+++ b/common/image.c
@@ -462,13 +462,16 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
else
ret = -ENOSPC;
break;
-#ifdef CONFIG_GZIP
+#ifndef USE_HOSTCC
+#if CONFIG_IS_ENABLED(GZIP)
case IH_COMP_GZIP: {
ret = gunzip(load_buf, unc_len, image_buf, &image_len);
break;
}
#endif /* CONFIG_GZIP */
-#ifdef CONFIG_BZIP2
+#endif
+#ifndef USE_HOSTCC
+#if CONFIG_IS_ENABLED(BZIP2)
case IH_COMP_BZIP2: {
uint size = unc_len;
@@ -484,7 +487,9 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
break;
}
#endif /* CONFIG_BZIP2 */
-#ifdef CONFIG_LZMA
+#endif
+#ifndef USE_HOSTCC
+#if CONFIG_IS_ENABLED(LZMA)
case IH_COMP_LZMA: {
SizeT lzma_len = unc_len;
@@ -494,7 +499,9 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
break;
}
#endif /* CONFIG_LZMA */
-#ifdef CONFIG_LZO
+#endif
+#ifndef USE_HOSTCC
+#if CONFIG_IS_ENABLED(LZO)
case IH_COMP_LZO: {
size_t size = unc_len;
@@ -503,7 +510,9 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
break;
}
#endif /* CONFIG_LZO */
-#ifdef CONFIG_LZ4
+#endif
+#ifndef USE_HOSTCC
+#if CONFIG_IS_ENABLED(LZ4)
case IH_COMP_LZ4: {
size_t size = unc_len;
@@ -512,7 +521,9 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
break;
}
#endif /* CONFIG_LZ4 */
-#ifdef CONFIG_ZSTD
+#endif
+#ifndef USE_HOSTCC
+#if CONFIG_IS_ENABLED(ZSTD)
case IH_COMP_ZSTD: {
size_t size = unc_len;
ZSTD_DStream *dstream;
@@ -562,6 +573,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
break;
}
#endif /* CONFIG_ZSTD */
+#endif
default:
printf("Unimplemented compression type %d\n", comp);
return -ENOSYS;
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 60c6027e04..afad260d3d 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -443,6 +443,7 @@ static int usb_kbd_probe_dev(struct usb_device *dev, unsigned int ifnum)
struct usb_interface *iface;
struct usb_endpoint_descriptor *ep;
struct usb_kbd_pdata *data;
+ int epNum;
if (dev->descriptor.bNumConfigurations != 1)
return 0;
@@ -458,19 +459,21 @@ static int usb_kbd_probe_dev(struct usb_device *dev, unsigned int ifnum)
if (iface->desc.bInterfaceProtocol != USB_PROT_HID_KEYBOARD)
return 0;
- if (iface->desc.bNumEndpoints != 1)
- return 0;
+ for (epNum = 0; epNum < iface->desc.bNumEndpoints; epNum++) {
+ ep = &iface->ep_desc[epNum];
- ep = &iface->ep_desc[0];
+ /* Check if endpoint is interrupt IN endpoint */
+ if ((ep->bmAttributes & 3) != 3)
+ continue;
- /* Check if endpoint 1 is interrupt endpoint */
- if (!(ep->bEndpointAddress & 0x80))
- return 0;
+ if (ep->bEndpointAddress & 0x80)
+ break;
+ }
- if ((ep->bmAttributes & 3) != 3)
+ if (epNum == iface->desc.bNumEndpoints)
return 0;
- debug("USB KBD: found set protocol...\n");
+ debug("USB KBD: found interrupt EP: 0x%x\n", ep->bEndpointAddress);
data = malloc(sizeof(struct usb_kbd_pdata));
if (!data) {
@@ -498,13 +501,15 @@ static int usb_kbd_probe_dev(struct usb_device *dev, unsigned int ifnum)
data->last_report = -1;
/* We found a USB Keyboard, install it. */
+ debug("USB KBD: set boot protocol\n");
usb_set_protocol(dev, iface->desc.bInterfaceNumber, 0);
- debug("USB KBD: found set idle...\n");
#if !defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP) && \
!defined(CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE)
+ debug("USB KBD: set idle interval...\n");
usb_set_idle(dev, iface->desc.bInterfaceNumber, REPEAT_RATE / 4, 0);
#else
+ debug("USB KBD: set idle interval=0...\n");
usb_set_idle(dev, iface->desc.bInterfaceNumber, 0, 0);
#endif