Merge branch '2022-06-07-assorted-improvements' into next

- A wide ranging set of minor clean-ups and improvements
This commit is contained in:
Tom Rini 2022-06-07 12:21:57 -04:00
commit ed1cbbe2af
67 changed files with 354 additions and 281 deletions

View file

@ -18,7 +18,7 @@
static void _debug_uart_putc(int c)
{
void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE;
void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
while (!(readl(base + UNIPHIER_UART_LSR) & UART_LSR_THRE))
;
@ -57,7 +57,7 @@ void sg_set_iectrl(unsigned int pin)
void _debug_uart_init(void)
{
#ifdef CONFIG_SPL_BUILD
void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE;
void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
unsigned int divisor;
switch (uniphier_get_soc_id()) {

View file

@ -72,7 +72,7 @@ static void pch_uart_init(void)
}
#ifdef CONFIG_DEBUG_UART
apl_uart_init(PCH_DEV_UART, CONFIG_DEBUG_UART_BASE);
apl_uart_init(PCH_DEV_UART, CONFIG_VAL(DEBUG_UART_BASE));
#endif
}

View file

@ -273,7 +273,7 @@ void board_debug_uart_init(void)
setup_early_clocks();
/* done by pin controller driver if not debugging */
enable_uart_pin_mux(CONFIG_DEBUG_UART_BASE);
enable_uart_pin_mux(CONFIG_VAL(DEBUG_UART_BASE));
}
#endif

View file

@ -498,7 +498,8 @@ ulong bootm_disable_interrupts(void)
}
#define CONSOLE_ARG "console="
#define CONSOLE_ARG_SIZE sizeof(CONSOLE_ARG)
#define NULL_CONSOLE (CONSOLE_ARG "ttynull")
#define CONSOLE_ARG_SIZE sizeof(NULL_CONSOLE)
/**
* fixup_silent_linux() - Handle silencing the linux boot if required
@ -550,21 +551,22 @@ static int fixup_silent_linux(char *buf, int maxlen)
char *end = strchr(start, ' ');
int start_bytes;
start_bytes = start - cmdline + CONSOLE_ARG_SIZE - 1;
start_bytes = start - cmdline;
strncpy(buf, cmdline, start_bytes);
strncpy(buf + start_bytes, NULL_CONSOLE, CONSOLE_ARG_SIZE);
if (end)
strcpy(buf + start_bytes, end);
strcpy(buf + start_bytes + CONSOLE_ARG_SIZE - 1, end);
else
buf[start_bytes] = '\0';
buf[start_bytes + CONSOLE_ARG_SIZE] = '\0';
} else {
sprintf(buf, "%s %s", cmdline, CONSOLE_ARG);
sprintf(buf, "%s %s", cmdline, NULL_CONSOLE);
}
if (buf + strlen(buf) >= cmdline)
return -ENOSPC;
} else {
if (maxlen < sizeof(CONSOLE_ARG))
if (maxlen < CONSOLE_ARG_SIZE)
return -ENOSPC;
strcpy(buf, CONSOLE_ARG);
strcpy(buf, NULL_CONSOLE);
}
debug("after silent fix-up: %s\n", buf);

View file

@ -23,11 +23,6 @@ DECLARE_GLOBAL_DATA_PTR;
#define IMAGE_PRE_LOAD_PROP_PUBLIC_KEY "public-key"
#define IMAGE_PRE_LOAD_PROP_MANDATORY "mandatory"
#ifndef CONFIG_SYS_BOOTM_LEN
/* use 8MByte as default max gunzip size */
#define CONFIG_SYS_BOOTM_LEN 0x800000
#endif
/*
* Information in the device-tree about the signature in the header
*/

View file

@ -2569,6 +2569,7 @@ config CMD_UBIFS
depends on CMD_UBI
default y if CMD_UBI
select LZO
select GZIP
help
UBIFS is a file system for flash devices which works on top of UBI.

View file

@ -8,12 +8,6 @@
#include <common.h>
#include <command.h>
#include <dm.h>
#include <malloc.h>
#include <mapmem.h>
#include <errno.h>
#include <asm/io.h>
#include <dm/root.h>
#include <dm/util.h>
static int do_dm_dump_all(struct cmd_tbl *cmdtp, int flag, int argc,
@ -64,55 +58,21 @@ static int do_dm_dump_static_driver_info(struct cmd_tbl *cmdtp, int flag, int ar
return 0;
}
static struct cmd_tbl test_commands[] = {
U_BOOT_CMD_MKENT(tree, 0, 1, do_dm_dump_all, "", ""),
U_BOOT_CMD_MKENT(uclass, 1, 1, do_dm_dump_uclass, "", ""),
U_BOOT_CMD_MKENT(devres, 1, 1, do_dm_dump_devres, "", ""),
U_BOOT_CMD_MKENT(drivers, 1, 1, do_dm_dump_drivers, "", ""),
U_BOOT_CMD_MKENT(compat, 1, 1, do_dm_dump_driver_compat, "", ""),
U_BOOT_CMD_MKENT(static, 1, 1, do_dm_dump_static_driver_info, "", ""),
};
static __maybe_unused void dm_reloc(void)
{
static int relocated;
if (!relocated) {
fixup_cmdtable(test_commands, ARRAY_SIZE(test_commands));
relocated = 1;
}
}
static int do_dm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
struct cmd_tbl *test_cmd;
int ret;
#ifdef CONFIG_NEEDS_MANUAL_RELOC
dm_reloc();
#endif
if (argc < 2)
return CMD_RET_USAGE;
test_cmd = find_cmd_tbl(argv[1], test_commands,
ARRAY_SIZE(test_commands));
argc -= 2;
argv += 2;
if (!test_cmd || argc > test_cmd->maxargs)
return CMD_RET_USAGE;
ret = test_cmd->cmd(test_cmd, flag, argc, argv);
return cmd_process_error(test_cmd, ret);
}
U_BOOT_CMD(
dm, 3, 1, do_dm,
"Driver model low level access",
#if CONFIG_IS_ENABLED(SYS_LONGHELP)
static char dm_help_text[] =
"tree Dump driver model tree ('*' = activated)\n"
"dm uclass Dump list of instances for each uclass\n"
"dm devres Dump list of device resources for each device\n"
"dm drivers Dump list of drivers with uclass and instances\n"
"dm compat Dump list of drivers with compatibility strings\n"
"dm static Dump list of drivers with static platform data"
);
;
#endif
U_BOOT_CMD_WITH_SUBCMDS(dm, "Driver model low level access", dm_help_text,
U_BOOT_SUBCMD_MKENT(tree, 1, 1, do_dm_dump_all),
U_BOOT_SUBCMD_MKENT(uclass, 1, 1, do_dm_dump_uclass),
U_BOOT_SUBCMD_MKENT(devres, 1, 1, do_dm_dump_devres),
U_BOOT_SUBCMD_MKENT(drivers, 1, 1, do_dm_dump_drivers),
U_BOOT_SUBCMD_MKENT(compat, 1, 1, do_dm_dump_driver_compat),
U_BOOT_SUBCMD_MKENT(static, 1, 1, do_dm_dump_static_driver_info));

View file

@ -25,15 +25,17 @@ static int qemu_fwcfg_cmd_setup_kernel(void *load_addr, void *initrd_addr)
qfw_read_entry(qfw_dev, FW_CFG_SETUP_SIZE, 4, &setup_size);
qfw_read_entry(qfw_dev, FW_CFG_KERNEL_SIZE, 4, &kernel_size);
if (setup_size == 0 || kernel_size == 0) {
if (kernel_size == 0) {
printf("warning: no kernel available\n");
return -1;
}
data_addr = load_addr;
qfw_read_entry(qfw_dev, FW_CFG_SETUP_DATA,
le32_to_cpu(setup_size), data_addr);
data_addr += le32_to_cpu(setup_size);
if (setup_size != 0) {
qfw_read_entry(qfw_dev, FW_CFG_SETUP_DATA,
le32_to_cpu(setup_size), data_addr);
data_addr += le32_to_cpu(setup_size);
}
qfw_read_entry(qfw_dev, FW_CFG_KERNEL_DATA,
le32_to_cpu(kernel_size), data_addr);

View file

@ -469,18 +469,6 @@ static int initr_malloc_bootparams(void)
}
#endif
#ifdef CONFIG_CMD_NET
static int initr_ethaddr(void)
{
struct bd_info *bd = gd->bd;
/* kept around for legacy kernels only ... ignore the next section */
eth_env_get_enetaddr("ethaddr", bd->bi_enetaddr);
return 0;
}
#endif /* CONFIG_CMD_NET */
#if defined(CONFIG_LED_STATUS)
static int initr_status_led(void)
{
@ -612,6 +600,9 @@ static init_fnc_t init_sequence_r[] = {
*/
#endif
initr_reloc_global_data,
#if CONFIG_IS_ENABLED(NEEDS_MANUAL_RELOC) && CONFIG_IS_ENABLED(EVENT)
event_manual_reloc,
#endif
#if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
initr_unlock_ram_in_cache,
#endif
@ -756,9 +747,6 @@ static init_fnc_t init_sequence_r[] = {
initr_status_led,
#endif
/* PPC has a udelay(20) here dating from 2002. Why? */
#ifdef CONFIG_CMD_NET
initr_ethaddr,
#endif
#if defined(CONFIG_GPIO_HOG)
gpio_hog_probe_all,
#endif

View file

@ -17,6 +17,7 @@
#include <malloc.h>
#include <asm/global_data.h>
#include <linux/list.h>
#include <relocate.h>
DECLARE_GLOBAL_DATA_PTR;
@ -148,6 +149,20 @@ void event_show_spy_list(void)
}
}
#if CONFIG_IS_ENABLED(NEEDS_MANUAL_RELOC)
int event_manual_reloc(void)
{
struct evspy_info *spy, *end;
spy = ll_entry_start(struct evspy_info, evspy_info);
end = ll_entry_end(struct evspy_info, evspy_info);
for (; spy < end; spy++)
MANUAL_RELOC(spy->func);
return 0;
}
#endif
#if CONFIG_IS_ENABLED(EVENT_DYNAMIC)
static void spy_free(struct event_spy *spy)
{
@ -159,8 +174,6 @@ int event_register(const char *id, enum event_t type, event_handler_t func, void
struct event_state *state = gd_event_state();
struct event_spy *spy;
if (!CONFIG_IS_ENABLED(EVENT_DYNAMIC))
return -ENOSYS;
spy = malloc(sizeof(*spy));
if (!spy)
return log_msg_ret("alloc", -ENOMEM);

View file

@ -180,4 +180,3 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0451
CONFIG_USB_GADGET_PRODUCT_NUM=0x6162
CONFIG_USB_GADGET_DOWNLOAD=y
CONFIG_OF_LIBFDT_OVERLAY=y
CONFIG_PHANDLE_CHECK_SEQ=y

View file

@ -86,4 +86,3 @@ CONFIG_WDT=y
CONFIG_SHA384=y
CONFIG_HEXDUMP=y
# CONFIG_EFI_LOADER is not set
CONFIG_PHANDLE_CHECK_SEQ=y

View file

@ -80,4 +80,3 @@ CONFIG_TIMER=y
CONFIG_MCHP_PIT64B_TIMER=y
CONFIG_OF_LIBFDT_OVERLAY=y
# CONFIG_EFI_LOADER_HII is not set
CONFIG_PHANDLE_CHECK_SEQ=y

View file

@ -80,4 +80,3 @@ CONFIG_TIMER=y
CONFIG_MCHP_PIT64B_TIMER=y
CONFIG_OF_LIBFDT_OVERLAY=y
# CONFIG_EFI_LOADER_HII is not set
CONFIG_PHANDLE_CHECK_SEQ=y

View file

@ -36,6 +36,7 @@ Optional properties:
- regulator-always-on: regulator should never be disabled
- regulator-boot-on: enabled by bootloader/firmware
- regulator-ramp-delay: ramp delay for regulator (in uV/us)
- regulator-force-boot-off: disabled during the boot stage
- regulator-init-microvolt: a init allowed Voltage value
- regulator-state-(standby|mem|disk)
type: object

View file

@ -99,6 +99,30 @@ Set image name to 'image name'.
.BI "\-R [" "secondary image name" "]"
Some image types support a second image for additional data. For these types,
use \-R to specify this second image.
.TS
allbox;
lb lbx
l l.
Image Type Secondary Image Description
pblimage Additional RCW-style header, typically used for PBI commands.
zynqimage, zynqmpimage T{
Initialization parameters, one per line. Each parameter has the form
.sp
.ti 4
.I address data
.sp
where
.I address
and
.I data
are hexadecimal integers. The boot ROM will write each
.I data
to
.I address
when loading the image. At most 256 parameters may be specified in this
manner.
T}
.TE
.TP
.BI "\-d [" "image data file" "]"
@ -110,8 +134,8 @@ Set XIP (execute in place) flag.
.TP
.BI "\-s"
Create an image with no data. The header will be created, but the image itself
will not contain data (such as U-Boot or any specified kernel).
Don't copy in the image data. Depending on the image type, this may create
just the header, everything but the image data, or nothing at all.
.TP
.BI "\-v"
@ -176,6 +200,11 @@ Specifies the directory containing keys to use for signing. This directory
should contain a private key file <name>.key for use with signing and a
certificate <name>.crt (containing the public key) for use with verification.
.TP
.BI "\-G [" "key_file" "]"
Specifies the private key file to use when signing. This option may be used
instead of \-k.
.TP
.BI "\-K [" "key_destination" "]"
Specifies a compiled device tree binary file (typically .dtb) to write
@ -189,6 +218,13 @@ CONFIG_OF_CONTROL in U-Boot.
Specifies the private key file to use when signing. This option may be used
instead of \-k.
.TP
.BI "\-g [" "key_name_hint" "]"
Sets the key-name-hint property when used with \-f auto. This is the <name>
part of the key. The directory part is set by \-k. This option also indicates
that the images included in the FIT should be signed. If this option is
specified, \-o must be specified as well.
.TP
.BI "\-o [" "signing algorithm" "]"
Specifies the algorithm to be used for signing a FIT image. The default is
@ -249,6 +285,15 @@ skipping those for which keys cannot be found. Also add a comment.
.B -c """Kernel 3.8 image for production devices""" kernel.itb
.fi
.P
Add public keys to u-boot.dtb without needing a FIT to sign. This will also
create a FIT containing an images node with no data named unused.itb.
.nf
.B mkimage -f auto -d /dev/null -k /public/signing-keys -g dev \\\\
.br
.B -o sha256,rsa2048 -K u-boot.dtb unused.itb
.fi
.P
Update an existing FIT image, signing it with additional keys.
Add corresponding public keys into u-boot.dtb. This will resign all images
@ -277,6 +322,14 @@ automatic mode. No .its file is required.
.B -c """Kernel 4.4 image for production devices""" -d vmlinuz \\\\
.B -b /path/to/rk3288-firefly.dtb -b /path/to/rk3288-jerry.dtb kernel.itb
.fi
.P
Create a FIT image containing a signed kernel, using automatic mode. No .its
file is required.
.nf
.B mkimage -f auto -A arm -O linux -T kernel -C none -a 43e00000 -e 0 \\\\
.br
.B -d vmlinuz -k /secret/signing-keys -g dev -o sha256,rsa2048 kernel.itb
.fi
.SH HOMEPAGE
http://www.denx.de/wiki/U-Boot/WebHome

View file

@ -89,8 +89,7 @@ config DM_DEVICE_REMOVE
config DM_EVENT
bool "Support events with driver model"
depends on DM
imply EVENT
depends on DM && EVENT
default y if SANDBOX
help
This enables support for generating events related to driver model

View file

@ -1125,9 +1125,7 @@ bool device_is_compatible(const struct udevice *dev, const char *compat)
bool of_machine_is_compatible(const char *compat)
{
const void *fdt = gd->fdt_blob;
return !fdt_node_check_compatible(fdt, 0, compat);
return ofnode_device_is_compatible(ofnode_root(), compat);
}
int dev_disable_by_path(const char *path)

View file

@ -125,7 +125,7 @@ config CROS_EC
config SPL_CROS_EC
bool "Enable Chrome OS EC in SPL"
depends on SPL
depends on SPL_MISC
help
Enable access to the Chrome OS EC in SPL. This is a separate
microcontroller typically available on a SPI bus on Chromebooks. It
@ -135,7 +135,7 @@ config SPL_CROS_EC
config TPL_CROS_EC
bool "Enable Chrome OS EC in TPL"
depends on TPL
depends on TPL_MISC
help
Enable access to the Chrome OS EC in TPL. This is a separate
microcontroller typically available on a SPI bus on Chromebooks. It
@ -145,7 +145,7 @@ config TPL_CROS_EC
config VPL_CROS_EC
bool "Enable Chrome OS EC in VPL"
depends on VPL
depends on VPL_MISC
help
Enable access to the Chrome OS EC in VPL. This is a separate
microcontroller typically available on a SPI bus on Chromebooks. It
@ -173,7 +173,7 @@ config CROS_EC_LPC
config SPL_CROS_EC_LPC
bool "Enable Chrome OS EC LPC driver in SPL"
depends on CROS_EC
depends on CROS_EC && SPL_MISC
help
Enable I2C access to the Chrome OS EC. This is used on x86
Chromebooks such as link and falco. The keyboard is provided
@ -182,7 +182,7 @@ config SPL_CROS_EC_LPC
config TPL_CROS_EC_LPC
bool "Enable Chrome OS EC LPC driver in TPL"
depends on CROS_EC
depends on CROS_EC && TPL_MISC
help
Enable I2C access to the Chrome OS EC. This is used on x86
Chromebooks such as link and falco. The keyboard is provided
@ -191,7 +191,7 @@ config TPL_CROS_EC_LPC
config VPL_CROS_EC_LPC
bool "Enable Chrome OS EC LPC driver in VPL"
depends on CROS_EC
depends on CROS_EC && VPL_MISC
help
Enable I2C access to the Chrome OS EC. This is used on x86
Chromebooks such as link and falco. The keyboard is provided
@ -284,7 +284,7 @@ config MXC_OCOTP
config SPL_MXC_OCOTP
bool "Enable MXC OCOTP driver in SPL"
depends on SPL && (ARCH_IMX8M || ARCH_MX6 || ARCH_MX7 || ARCH_MX7ULP || ARCH_VF610)
depends on SPL_MISC && (ARCH_IMX8M || ARCH_MX6 || ARCH_MX7 || ARCH_MX7ULP || ARCH_VF610)
default y
help
If you say Y here, you will get support for the One Time
@ -314,7 +314,7 @@ config P2SB
config SPL_P2SB
bool "Intel Primary to Sideband Bridge in SPL"
depends on SPL && (X86 || SANDBOX)
depends on SPL_MISC && (X86 || SANDBOX)
help
The Primary to Sideband Bridge is used to access various peripherals
through memory-mapped I/O in a large chunk of PCI space. The space is
@ -324,7 +324,7 @@ config SPL_P2SB
config TPL_P2SB
bool "Intel Primary to Sideband Bridge in TPL"
depends on TPL && (X86 || SANDBOX)
depends on TPL_MISC && (X86 || SANDBOX)
help
The Primary to Sideband Bridge is used to access various peripherals
through memory-mapped I/O in a large chunk of PCI space. The space is
@ -343,7 +343,7 @@ config PWRSEQ
config SPL_PWRSEQ
bool "Enable power-sequencing drivers for SPL"
depends on PWRSEQ
depends on SPL_MISC && PWRSEQ
help
Power-sequencing drivers provide support for controlling power for
devices. They are typically referenced by a phandle from another
@ -451,7 +451,7 @@ config I2C_EEPROM
config SPL_I2C_EEPROM
bool "Enable driver for generic I2C-attached EEPROMs for SPL"
depends on MISC && SPL && SPL_DM
depends on SPL_MISC
help
This option is an SPL-variant of the I2C_EEPROM option.
See the help of I2C_EEPROM for details.
@ -504,6 +504,7 @@ config FS_LOADER
config SPL_FS_LOADER
bool "Enable loader driver for file system"
depends on SPL
help
This is file system generic loader which can be used to load
the file image from the storage into target such as memory.

View file

@ -902,7 +902,8 @@ int add_mtd_partitions_of(struct mtd_info *master)
ofnode_for_each_subnode(child, parts) {
struct mtd_partition part = { 0 };
struct mtd_info *slave;
fdt_addr_t offset, size;
fdt_addr_t offset;
fdt_size_t size;
if (!ofnode_is_available(child))
continue;

View file

@ -954,7 +954,7 @@ int pci_bind_bus_devices(struct udevice *bus)
return 0;
}
static void decode_regions(struct pci_controller *hose, ofnode parent_node,
static int decode_regions(struct pci_controller *hose, ofnode parent_node,
ofnode node)
{
int pci_addr_cells, addr_cells, size_cells;
@ -968,7 +968,7 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
prop = ofnode_get_property(node, "ranges", &len);
if (!prop) {
debug("%s: Cannot decode regions\n", __func__);
return;
return -EINVAL;
}
pci_addr_cells = ofnode_read_simple_addr_cells(node);
@ -986,6 +986,8 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
max_regions = len / cells_per_record + CONFIG_NR_DRAM_BANKS;
hose->regions = (struct pci_region *)
calloc(1, max_regions * sizeof(struct pci_region));
if (!hose->regions)
return -ENOMEM;
for (i = 0; i < max_regions; i++, len -= cells_per_record) {
u64 pci_addr, addr, size;
@ -1053,7 +1055,7 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
/* Add a region for our local memory */
bd = gd->bd;
if (!bd)
return;
return 0;
for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
if (bd->bi_dram[i].size) {
@ -1068,7 +1070,7 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
}
}
return;
return 0;
}
static int pci_uclass_pre_probe(struct udevice *bus)
@ -1097,7 +1099,10 @@ static int pci_uclass_pre_probe(struct udevice *bus)
/* For bridges, use the top-level PCI controller */
if (!device_is_on_pci_bus(bus)) {
hose->ctlr = bus;
decode_regions(hose, dev_ofnode(bus->parent), dev_ofnode(bus));
ret = decode_regions(hose, dev_ofnode(bus->parent),
dev_ofnode(bus));
if (ret)
return ret;
} else {
struct pci_controller *parent_hose;

View file

@ -134,7 +134,7 @@ static inline void _debug_uart_init(void)
static inline void _debug_uart_putc(int ch)
{
struct altera_jtaguart_regs *regs = (void *)CONFIG_DEBUG_UART_BASE;
struct altera_jtaguart_regs *regs = (void *)CONFIG_VAL(DEBUG_UART_BASE);
while (1) {
u32 st = readl(&regs->control);

View file

@ -123,7 +123,7 @@ U_BOOT_DRIVER(altera_uart) = {
static inline void _debug_uart_init(void)
{
struct altera_uart_regs *regs = (void *)CONFIG_DEBUG_UART_BASE;
struct altera_uart_regs *regs = (void *)CONFIG_VAL(DEBUG_UART_BASE);
u32 div;
div = (CONFIG_DEBUG_UART_CLOCK / CONFIG_BAUDRATE) - 1;
@ -132,7 +132,7 @@ static inline void _debug_uart_init(void)
static inline void _debug_uart_putc(int ch)
{
struct altera_uart_regs *regs = (void *)CONFIG_DEBUG_UART_BASE;
struct altera_uart_regs *regs = (void *)CONFIG_VAL(DEBUG_UART_BASE);
while (1) {
u32 st = readl(&regs->status);

View file

@ -319,14 +319,14 @@ U_BOOT_DRIVER(serial_atmel) = {
#ifdef CONFIG_DEBUG_UART_ATMEL
static inline void _debug_uart_init(void)
{
atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_DEBUG_UART_BASE;
atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_VAL(DEBUG_UART_BASE);
_atmel_serial_init(usart, CONFIG_DEBUG_UART_CLOCK, CONFIG_BAUDRATE);
}
static inline void _debug_uart_putc(int ch)
{
atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_DEBUG_UART_BASE;
atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_VAL(DEBUG_UART_BASE);
while (!(readl(&usart->csr) & USART3_BIT(TXRDY)))
;

View file

@ -199,7 +199,7 @@ U_BOOT_DRIVER(serial_ar933x) = {
static inline void _debug_uart_init(void)
{
void __iomem *regs = (void *)CONFIG_DEBUG_UART_BASE;
void __iomem *regs = (void *)CONFIG_VAL(DEBUG_UART_BASE);
u32 val, scale, step;
/*
@ -227,7 +227,7 @@ static inline void _debug_uart_init(void)
static inline void _debug_uart_putc(int c)
{
void __iomem *regs = (void *)CONFIG_DEBUG_UART_BASE;
void __iomem *regs = (void *)CONFIG_VAL(DEBUG_UART_BASE);
u32 data;
do {

View file

@ -137,7 +137,7 @@ U_BOOT_DRIVER(serial_arc) = {
static inline void _debug_uart_init(void)
{
struct arc_serial_regs *regs = (struct arc_serial_regs *)CONFIG_DEBUG_UART_BASE;
struct arc_serial_regs *regs = (struct arc_serial_regs *)CONFIG_VAL(DEBUG_UART_BASE);
int arc_console_baud = CONFIG_DEBUG_UART_CLOCK / (CONFIG_BAUDRATE * 4) - 1;
writeb(arc_console_baud & 0xff, &regs->baudl);
@ -146,7 +146,7 @@ static inline void _debug_uart_init(void)
static inline void _debug_uart_putc(int c)
{
struct arc_serial_regs *regs = (struct arc_serial_regs *)CONFIG_DEBUG_UART_BASE;
struct arc_serial_regs *regs = (struct arc_serial_regs *)CONFIG_VAL(DEBUG_UART_BASE);
while (!(readb(&regs->status) & UART_TXEMPTY))
;

View file

@ -269,7 +269,7 @@ U_BOOT_DRIVER(bcm6345_serial) = {
#ifdef CONFIG_DEBUG_UART_BCM6345
static inline void _debug_uart_init(void)
{
void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE;
void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
bcm6345_serial_init(base, CONFIG_DEBUG_UART_CLOCK, CONFIG_BAUDRATE);
}
@ -285,7 +285,7 @@ static inline void wait_xfered(void __iomem *base)
static inline void _debug_uart_putc(int ch)
{
void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE;
void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
wait_xfered(base);
writel(ch, base + UART_FIFO_REG);

View file

@ -201,14 +201,14 @@ U_BOOT_DRIVER(serial_linflex) = {
static inline void _debug_uart_init(void)
{
struct linflex_fsl *base = (struct linflex_fsl *)CONFIG_DEBUG_UART_BASE;
struct linflex_fsl *base = (struct linflex_fsl *)CONFIG_VAL(DEBUG_UART_BASE);
linflex_serial_init_internal(base);
}
static inline void _debug_uart_putc(int ch)
{
struct linflex_fsl *base = (struct linflex_fsl *)CONFIG_DEBUG_UART_BASE;
struct linflex_fsl *base = (struct linflex_fsl *)CONFIG_VAL(DEBUG_UART_BASE);
/* XXX: Is this OK? Should this use the non-DM version? */
_linflex_serial_putc(base, ch);

View file

@ -182,7 +182,7 @@ static inline void _debug_uart_init(void)
static inline void _debug_uart_putc(int ch)
{
struct meson_uart *regs = (struct meson_uart *)CONFIG_DEBUG_UART_BASE;
struct meson_uart *regs = (struct meson_uart *)CONFIG_VAL(DEBUG_UART_BASE);
while (readl(&regs->status) & AML_UART_TX_FULL)
;

View file

@ -569,7 +569,7 @@ U_BOOT_DRIVER(serial_msm_geni) = {
#ifdef CONFIG_DEBUG_UART_MSM_GENI
static struct msm_serial_data init_serial_data = {
.base = CONFIG_DEBUG_UART_BASE
.base = CONFIG_VAL(DEBUG_UART_BASE)
};
/* Serial dumb device, to reuse driver code */
@ -587,7 +587,7 @@ static struct udevice init_dev = {
static inline void _debug_uart_init(void)
{
phys_addr_t base = CONFIG_DEBUG_UART_BASE;
phys_addr_t base = CONFIG_VAL(DEBUG_UART_BASE);
geni_serial_init(&init_dev);
geni_serial_baud(base, CLK_DIV, CONFIG_BAUDRATE);
@ -596,7 +596,7 @@ static inline void _debug_uart_init(void)
static inline void _debug_uart_putc(int ch)
{
phys_addr_t base = CONFIG_DEBUG_UART_BASE;
phys_addr_t base = CONFIG_VAL(DEBUG_UART_BASE);
writel(DEF_TX_WM, base + SE_GENI_TX_WATERMARK_REG);
qcom_geni_serial_setup_tx(base, 1);

View file

@ -220,7 +220,7 @@ static inline void _debug_uart_init(void)
{
struct mt7620_serial_plat plat;
plat.regs = (void *)CONFIG_DEBUG_UART_BASE;
plat.regs = (void *)CONFIG_VAL(DEBUG_UART_BASE);
plat.clock = CONFIG_DEBUG_UART_CLOCK;
writel(0, &plat.regs->ier);
@ -233,7 +233,7 @@ static inline void _debug_uart_init(void)
static inline void _debug_uart_putc(int ch)
{
struct mt7620_serial_regs __iomem *regs =
(void *)CONFIG_DEBUG_UART_BASE;
(void *)CONFIG_VAL(DEBUG_UART_BASE);
while (!(readl(&regs->lsr) & UART_LSR_THRE))
;

View file

@ -426,7 +426,7 @@ static inline void _debug_uart_init(void)
{
struct mtk_serial_priv priv;
priv.regs = (void *) CONFIG_DEBUG_UART_BASE;
priv.regs = (void *) CONFIG_VAL(DEBUG_UART_BASE);
priv.clock = CONFIG_DEBUG_UART_CLOCK;
writel(0, &priv.regs->ier);
@ -439,7 +439,7 @@ static inline void _debug_uart_init(void)
static inline void _debug_uart_putc(int ch)
{
struct mtk_serial_regs __iomem *regs =
(void *) CONFIG_DEBUG_UART_BASE;
(void *) CONFIG_VAL(DEBUG_UART_BASE);
while (!(readl(&regs->lsr) & UART_LSR_THRE))
;

View file

@ -321,7 +321,7 @@ U_BOOT_DRIVER(serial_mvebu) = {
static inline void _debug_uart_init(void)
{
void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE;
void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
u32 parent_rate, divider;
/* reset FIFOs */
@ -349,7 +349,7 @@ static inline void _debug_uart_init(void)
static inline void _debug_uart_putc(int ch)
{
void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE;
void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
while (readl(base + UART_STATUS_REG) & UART_STATUS_TXFIFO_FULL)
;

View file

@ -372,7 +372,7 @@ U_BOOT_DRIVER(serial_mxc) = {
static inline void _debug_uart_init(void)
{
struct mxc_uart *base = (struct mxc_uart *)CONFIG_DEBUG_UART_BASE;
struct mxc_uart *base = (struct mxc_uart *)CONFIG_VAL(DEBUG_UART_BASE);
_mxc_serial_init(base, false);
_mxc_serial_setbrg(base, CONFIG_DEBUG_UART_CLOCK,
@ -381,7 +381,7 @@ static inline void _debug_uart_init(void)
static inline void _debug_uart_putc(int ch)
{
struct mxc_uart *base = (struct mxc_uart *)CONFIG_DEBUG_UART_BASE;
struct mxc_uart *base = (struct mxc_uart *)CONFIG_VAL(DEBUG_UART_BASE);
while (!(readl(&base->ts) & UTS_TXEMPTY))
WATCHDOG_RESET();

View file

@ -66,7 +66,7 @@ static inline int serial_in_shift(void *addr, int shift)
static inline void _debug_uart_init(void)
{
struct ns16550 *com_port = (struct ns16550 *)CONFIG_DEBUG_UART_BASE;
struct ns16550 *com_port = (struct ns16550 *)CONFIG_VAL(DEBUG_UART_BASE);
int baud_divisor;
baud_divisor = ns16550_calc_divisor(com_port, CONFIG_DEBUG_UART_CLOCK,
@ -85,7 +85,7 @@ static inline void _debug_uart_init(void)
static inline void _debug_uart_putc(int ch)
{
struct ns16550 *com_port = (struct ns16550 *)CONFIG_DEBUG_UART_BASE;
struct ns16550 *com_port = (struct ns16550 *)CONFIG_VAL(DEBUG_UART_BASE);
while (!(serial_din(&com_port->lsr) & UART_LSR_THRE))
;

View file

@ -187,14 +187,14 @@ U_BOOT_DRIVER(pic32_serial) = {
static inline void _debug_uart_init(void)
{
void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE;
void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
pic32_serial_init(base, CONFIG_DEBUG_UART_CLOCK, CONFIG_BAUDRATE);
}
static inline void _debug_uart_putc(int ch)
{
writel(ch, CONFIG_DEBUG_UART_BASE + U_TXR);
writel(ch, CONFIG_VAL(DEBUG_UART_BASE) + U_TXR);
}
DEBUG_UART_FUNCS

View file

@ -403,7 +403,7 @@ U_BOOT_DRIVER(serial_pl01x) = {
static void _debug_uart_init(void)
{
#ifndef CONFIG_DEBUG_UART_SKIP_INIT
struct pl01x_regs *regs = (struct pl01x_regs *)CONFIG_DEBUG_UART_BASE;
struct pl01x_regs *regs = (struct pl01x_regs *)CONFIG_VAL(DEBUG_UART_BASE);
enum pl01x_type type;
if (IS_ENABLED(CONFIG_DEBUG_UART_PL011))
@ -419,7 +419,7 @@ static void _debug_uart_init(void)
static inline void _debug_uart_putc(int ch)
{
struct pl01x_regs *regs = (struct pl01x_regs *)CONFIG_DEBUG_UART_BASE;
struct pl01x_regs *regs = (struct pl01x_regs *)CONFIG_VAL(DEBUG_UART_BASE);
while (pl01x_putc(regs, ch) == -EAGAIN)
;

View file

@ -276,7 +276,7 @@ static inline void _debug_uart_init(void)
if (IS_ENABLED(CONFIG_DEBUG_UART_SKIP_INIT))
return;
struct s5p_uart *uart = (struct s5p_uart *)CONFIG_DEBUG_UART_BASE;
struct s5p_uart *uart = (struct s5p_uart *)CONFIG_VAL(DEBUG_UART_BASE);
s5p_serial_init(uart);
#if CONFIG_IS_ENABLED(ARCH_APPLE)
@ -288,7 +288,7 @@ static inline void _debug_uart_init(void)
static inline void _debug_uart_putc(int ch)
{
struct s5p_uart *uart = (struct s5p_uart *)CONFIG_DEBUG_UART_BASE;
struct s5p_uart *uart = (struct s5p_uart *)CONFIG_VAL(DEBUG_UART_BASE);
#if CONFIG_IS_ENABLED(ARCH_APPLE)
while (readl(&uart->ufstat) & S5L_TX_FIFO_FULL);

View file

@ -13,10 +13,12 @@
* struct smh_serial_priv - Semihosting serial private data
* @infd: stdin file descriptor (or error)
* @outfd: stdout file descriptor (or error)
* @counter: Counter used to fake pending every other call
*/
struct smh_serial_priv {
int infd;
int outfd;
unsigned counter;
};
#if CONFIG_IS_ENABLED(DM_SERIAL)
@ -68,10 +70,20 @@ static ssize_t smh_serial_puts(struct udevice *dev, const char *s, size_t len)
return ret;
}
static int smh_serial_pending(struct udevice *dev, bool input)
{
struct smh_serial_priv *priv = dev_get_priv(dev);
if (input)
return priv->counter++ & 1;
return false;
}
static const struct dm_serial_ops smh_serial_ops = {
.putc = smh_serial_putc,
.puts = smh_serial_puts,
.getc = smh_serial_getc,
.pending = smh_serial_pending,
};
static int smh_serial_bind(struct udevice *dev)
@ -106,6 +118,7 @@ U_BOOT_DRVINFO(smh_serial) = {
#else /* DM_SERIAL */
static int infd = -ENODEV;
static int outfd = -ENODEV;
static unsigned counter = 1;
static int smh_serial_start(void)
{
@ -138,7 +151,7 @@ static int smh_serial_getc(void)
static int smh_serial_tstc(void)
{
return 1;
return counter++ & 1;
}
static void smh_serial_puts(const char *s)

View file

@ -212,7 +212,7 @@ U_BOOT_DRIVER(serial_sifive) = {
static inline void _debug_uart_init(void)
{
struct uart_sifive *regs =
(struct uart_sifive *)CONFIG_DEBUG_UART_BASE;
(struct uart_sifive *)CONFIG_VAL(DEBUG_UART_BASE);
_sifive_serial_setbrg(regs, CONFIG_DEBUG_UART_CLOCK,
CONFIG_BAUDRATE);
@ -222,7 +222,7 @@ static inline void _debug_uart_init(void)
static inline void _debug_uart_putc(int ch)
{
struct uart_sifive *regs =
(struct uart_sifive *)CONFIG_DEBUG_UART_BASE;
(struct uart_sifive *)CONFIG_VAL(DEBUG_UART_BASE);
while (_sifive_serial_putc(regs, ch) == -EAGAIN)
WATCHDOG_RESET();

View file

@ -270,7 +270,7 @@ static inline struct stm32_uart_info *_debug_uart_info(void)
static inline void _debug_uart_init(void)
{
fdt_addr_t base = CONFIG_DEBUG_UART_BASE;
fdt_addr_t base = CONFIG_VAL(DEBUG_UART_BASE);
struct stm32_uart_info *uart_info = _debug_uart_info();
_stm32_serial_init(base, uart_info);
@ -281,7 +281,7 @@ static inline void _debug_uart_init(void)
static inline void _debug_uart_putc(int c)
{
fdt_addr_t base = CONFIG_DEBUG_UART_BASE;
fdt_addr_t base = CONFIG_VAL(DEBUG_UART_BASE);
struct stm32_uart_info *uart_info = _debug_uart_info();
while (_stm32_serial_putc(base, uart_info, c) == -EAGAIN)

View file

@ -143,7 +143,7 @@ U_BOOT_DRIVER(serial_uartlite) = {
static inline void _debug_uart_init(void)
{
struct uartlite *regs = (struct uartlite *)CONFIG_DEBUG_UART_BASE;
struct uartlite *regs = (struct uartlite *)CONFIG_VAL(DEBUG_UART_BASE);
int ret;
uart_out32(&regs->control, 0);
@ -159,7 +159,7 @@ static inline void _debug_uart_init(void)
static inline void _debug_uart_putc(int ch)
{
struct uartlite *regs = (struct uartlite *)CONFIG_DEBUG_UART_BASE;
struct uartlite *regs = (struct uartlite *)CONFIG_VAL(DEBUG_UART_BASE);
while (uart_in32(&regs->status) & SR_TX_FIFO_FULL)
;

View file

@ -295,7 +295,7 @@ U_BOOT_DRIVER(serial_zynq) = {
#ifdef CONFIG_DEBUG_UART_ZYNQ
static inline void _debug_uart_init(void)
{
struct uart_zynq *regs = (struct uart_zynq *)CONFIG_DEBUG_UART_BASE;
struct uart_zynq *regs = (struct uart_zynq *)CONFIG_VAL(DEBUG_UART_BASE);
_uart_zynq_serial_init(regs);
_uart_zynq_serial_setbrg(regs, CONFIG_DEBUG_UART_CLOCK,
@ -304,7 +304,7 @@ static inline void _debug_uart_init(void)
static inline void _debug_uart_putc(int ch)
{
struct uart_zynq *regs = (struct uart_zynq *)CONFIG_DEBUG_UART_BASE;
struct uart_zynq *regs = (struct uart_zynq *)CONFIG_VAL(DEBUG_UART_BASE);
while (_uart_zynq_serial_putc(regs, ch) == -EAGAIN)
WATCHDOG_RESET();

View file

@ -72,6 +72,10 @@ static struct mmc *get_mmc(struct optee_private *priv, int dev_id)
debug("Cannot find RPMB device\n");
return NULL;
}
if (mmc_init(mmc)) {
log(LOGC_BOARD, LOGL_ERR, "%s:MMC device %d init failed\n", __func__, dev_id);
return NULL;
}
if (!(mmc->version & MMC_VERSION_MMC)) {
debug("Device id %d is not an eMMC device\n", dev_id);
return NULL;
@ -104,6 +108,11 @@ static u32 rpmb_get_dev_info(u16 dev_id, struct rpmb_dev_info *info)
if (!mmc)
return TEE_ERROR_ITEM_NOT_FOUND;
if (mmc_init(mmc)) {
log(LOGC_BOARD, LOGL_ERR, "%s:MMC device %d init failed\n", __func__, dev_id);
return TEE_ERROR_NOT_SUPPORTED;
}
if (!mmc->ext_csd)
return TEE_ERROR_GENERIC;

View file

@ -546,15 +546,12 @@ static int lookup_data_extent(struct btrfs_root *root, struct btrfs_path *path,
/* Error or we're already at the file extent */
if (ret <= 0)
return ret;
if (ret > 0) {
/* Check previous file extent */
ret = btrfs_previous_item(root, path, ino,
BTRFS_EXTENT_DATA_KEY);
if (ret < 0)
return ret;
if (ret > 0)
goto check_next;
}
/* Check previous file extent */
ret = btrfs_previous_item(root, path, ino, BTRFS_EXTENT_DATA_KEY);
if (ret < 0)
return ret;
if (ret > 0)
goto check_next;
/* Now the key.offset must be smaller than @file_offset */
btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
if (key.objectid != ino ||

View file

@ -49,7 +49,7 @@ static int sqfs_read_sblk(struct squashfs_super_block **sblk)
if (sqfs_disk_read(0, 1, *sblk) != 1) {
free(*sblk);
sblk = NULL;
*sblk = NULL;
return -EINVAL;
}

View file

@ -48,7 +48,6 @@ struct bd_info {
#endif
unsigned long bi_bootflags; /* boot / reboot flag (Unused) */
unsigned long bi_ip_addr; /* IP Address */
unsigned char bi_enetaddr[6]; /* OLD: see README.enetaddr */
unsigned short bi_ethspeed; /* Ethernet speed in Mbps */
unsigned long bi_intfreq; /* Internal Freq, in MHz */
unsigned long bi_busfreq; /* Bus Freq, in MHz */

View file

@ -34,7 +34,7 @@
"root=${nandroot} " \
"rootfstype=${nandrootfstype}\0" \
"nandroot=ubi0:rootfs rw ubi.mtd=NAND.file-system,2048\0" \
"nandrootfstype=ubifs rootwait=1\0" \
"nandrootfstype=ubifs rootwait\0" \
"nandboot=echo Booting from nand ...; " \
"run nandargs; " \
"nand read ${fdtaddr} NAND.u-boot-spl-os; " \

View file

@ -159,7 +159,7 @@
"root=${nandroot} " \
"rootfstype=${nandrootfstype}\0" \
"nandroot=ubi0:rootfs rw ubi.mtd=NAND.file-system,4096\0" \
"nandrootfstype=ubifs rootwait=1\0" \
"nandrootfstype=ubifs rootwait\0" \
"nandboot=echo Booting from nand ...; " \
"run nandargs; " \
"nand read ${fdtaddr} NAND.u-boot-spl-os; " \

View file

@ -37,7 +37,7 @@
"root=${nandroot} " \
"rootfstype=${nandrootfstype}\0" \
"nandroot=ubi0:rootfs rw ubi.mtd=5\0" \
"nandrootfstype=ubifs rootwait=1\0" \
"nandrootfstype=ubifs rootwait\0" \
"nandboot=echo Booting from nand ...; " \
"run nandargs; " \
"setenv loadaddr 0x84000000; " \

View file

@ -20,7 +20,7 @@
"root=${nandroot} " \
"rootfstype=${nandrootfstype}\0" \
"nandroot=ubi0:rootfs rw ubi.mtd=NAND.file-system\0" \
"nandrootfstype=ubifs rootwait=1\0" \
"nandrootfstype=ubifs rootwait\0" \
"nandboot=echo Booting from nand ...; " \
"run nandargs; " \
"nand read ${fdt_addr} NAND.u-boot-spl-os; " \

View file

@ -107,7 +107,7 @@
"nand_active_ubi_vol=rootfs_a\0" \
"rootfs_name=rootfs\0" \
"kernel_name=uImage\0"\
"nand_root_fs_type=ubifs rootwait=1\0" \
"nand_root_fs_type=ubifs rootwait\0" \
"nand_args=run bootargs_defaults;" \
"mtdparts default;" \
"setenv ${partitionset_active} true;" \

View file

@ -21,7 +21,7 @@
"root=${nandroot} " \
"rootfstype=${nandrootfstype}\0" \
"nandroot=ubi0:root rw ubi.mtd=nandrootfs\0" \
"nandrootfstype=ubifs rootwait=1\0" \
"nandrootfstype=ubifs rootwait\0" \
"nandboot=echo Booting from nand ...; " \
"run nandargs; " \
"nand read ${fdt_addr_r} nanddtb; " \

View file

@ -218,7 +218,7 @@
"nand_active_ubi_vol=rootfs_a\0" \
"nand_active_ubi_vol_A=rootfs_a\0" \
"nand_active_ubi_vol_B=rootfs_b\0" \
"nand_root_fs_type=ubifs rootwait=1\0" \
"nand_root_fs_type=ubifs rootwait\0" \
"nand_src_addr=0x280000\0" \
"nand_src_addr_A=0x280000\0" \
"nand_src_addr_B=0x780000\0" \
@ -295,7 +295,7 @@
"nand_active_ubi_vol=rootfs_a\0" \
"rootfs_name=rootfs\0" \
"kernel_name=uImage\0"\
"nand_root_fs_type=ubifs rootwait=1\0" \
"nand_root_fs_type=ubifs rootwait\0" \
"nand_args=run bootargs_defaults;" \
"mtdparts default;" \
"setenv ${partitionset_active} true;" \

View file

@ -165,7 +165,7 @@
"sf write ${loadaddr} 0 ${filesize}\0" \
"burn_uboot_nand=nand erase 0 0x100000; " \
"nand write ${loadaddr} 0 ${filesize}\0" \
"args_all=setenv bootargs console=ttyS0,115200n8 rootwait=1 " \
"args_all=setenv bootargs console=ttyS0,115200n8 rootwait " \
KERNEL_MTD_PARTS \
"args_net=setenv bootargs ${bootargs} rootfstype=nfs " \
"root=/dev/nfs rw nfsroot=${serverip}:${nfs_root}," \

View file

@ -14,7 +14,7 @@
"root=${nandroot} " \
"rootfstype=${nandrootfstype}\0" \
"nandroot=ubi0:rootfs rw ubi.mtd=NAND.file-system,2048\0" \
"nandrootfstype=ubifs rootwait=1\0" \
"nandrootfstype=ubifs rootwait\0" \
"nandboot=echo Booting from nand ...; " \
"run nandargs; " \
"nand read ${fdtaddr} NAND.u-boot-spl-os; " \

View file

@ -144,7 +144,16 @@ int event_register(const char *id, enum event_t type, event_handler_t func,
/** event_show_spy_list( - Show a list of event spies */
void event_show_spy_list(void);
#if CONFIG_IS_ENABLED(EVENT)
/**
* event_manual_reloc() - Relocate event handler pointers
*
* Relocate event handler pointers for all static event spies. It is called
* during the generic board init sequence, after relocation.
*
* Return: 0 if OK
*/
int event_manual_reloc(void);
/**
* event_notify() - notify spies about an event
*
@ -159,6 +168,7 @@ void event_show_spy_list(void);
*/
int event_notify(enum event_t type, void *data, int size);
#if CONFIG_IS_ENABLED(EVENT)
/**
* event_notify_null() - notify spies about an event
*
@ -169,11 +179,6 @@ int event_notify(enum event_t type, void *data, int size);
*/
int event_notify_null(enum event_t type);
#else
static inline int event_notify(enum event_t type, void *data, int size)
{
return 0;
}
static inline int event_notify_null(enum event_t type)
{
return 0;

View file

@ -958,11 +958,4 @@ config LMB_RESERVED_REGIONS
Define the number of supported reserved regions in the library logical
memory blocks.
config PHANDLE_CHECK_SEQ
bool "Enable phandle check while getting sequence number"
help
When there are multiple device tree nodes with same name,
enable this config option to distinguish them using
phandles in fdtdec_get_alias_seq() function.
endmenu

View file

@ -516,11 +516,8 @@ int fdtdec_get_alias_seq(const void *blob, const char *base, int offset,
* Adding an extra check to distinguish DT nodes with
* same name
*/
if (IS_ENABLED(CONFIG_PHANDLE_CHECK_SEQ)) {
if (fdt_get_phandle(blob, offset) !=
fdt_get_phandle(blob, fdt_path_offset(blob, prop)))
continue;
}
if (offset != fdt_path_offset(blob, prop))
continue;
val = trailing_strtol(name);
if (val != -1) {

View file

@ -223,11 +223,6 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
int wrap = 1;
static const char my_version[] = ZLIB_VERSION;
ushf *overlay;
/* We overlay pending_buf and d_buf+l_buf. This works since the average
* output size for (length,distance) codes is <= 24 bits.
*/
if (version == Z_NULL || version[0] != my_version[0] ||
stream_size != sizeof(z_stream)) {
return Z_VERSION_ERROR;
@ -287,9 +282,47 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
s->pending_buf = (uchf *) overlay;
s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
/* We overlay pending_buf and sym_buf. This works since the average size
* for length/distance pairs over any compressed block is assured to be 31
* bits or less.
*
* Analysis: The longest fixed codes are a length code of 8 bits plus 5
* extra bits, for lengths 131 to 257. The longest fixed distance codes are
* 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest
* possible fixed-codes length/distance pair is then 31 bits total.
*
* sym_buf starts one-fourth of the way into pending_buf. So there are
* three bytes in sym_buf for every four bytes in pending_buf. Each symbol
* in sym_buf is three bytes -- two for the distance and one for the
* literal/length. As each symbol is consumed, the pointer to the next
* sym_buf value to read moves forward three bytes. From that symbol, up to
* 31 bits are written to pending_buf. The closest the written pending_buf
* bits gets to the next sym_buf symbol to read is just before the last
* code is written. At that time, 31*(n-2) bits have been written, just
* after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at
* 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1
* symbols are written.) The closest the writing gets to what is unread is
* then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and
* can range from 128 to 32768.
*
* Therefore, at a minimum, there are 142 bits of space between what is
* written and what is read in the overlain buffers, so the symbols cannot
* be overwritten by the compressed data. That space is actually 139 bits,
* due to the three-bit fixed-code block header.
*
* That covers the case where either Z_FIXED is specified, forcing fixed
* codes, or when the use of fixed codes is chosen, because that choice
* results in a smaller compressed block than dynamic codes. That latter
* condition then assures that the above analysis also covers all dynamic
* blocks. A dynamic-code block will only be chosen to be emitted if it has
* fewer bits than a fixed-code block would for the same set of symbols.
* Therefore its average symbol length is assured to be less than 31. So
* the compressed data for a dynamic block also cannot overwrite the
* symbols from which it is being constructed.
*/
s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4);
s->pending_buf_size = (ulg)s->lit_bufsize * 4;
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
s->pending_buf == Z_NULL) {
@ -298,8 +331,12 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
deflateEnd (strm);
return Z_MEM_ERROR;
}
s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
s->sym_buf = s->pending_buf + s->lit_bufsize;
s->sym_end = (s->lit_bufsize - 1) * 3;
/* We avoid equality with lit_bufsize*3 because of wraparound at 64K
* on 16 bit machines and because stored blocks are restricted to
* 64K-1 bytes.
*/
s->level = level;
s->strategy = strategy;
@ -935,7 +972,6 @@ int ZEXPORT deflateCopy (dest, source)
#else
deflate_state *ds;
deflate_state *ss;
ushf *overlay;
if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
@ -955,8 +991,7 @@ int ZEXPORT deflateCopy (dest, source)
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
ds->pending_buf = (uchf *) overlay;
ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4);
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
ds->pending_buf == Z_NULL) {
@ -970,8 +1005,7 @@ int ZEXPORT deflateCopy (dest, source)
zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
ds->sym_buf = ds->pending_buf + ds->lit_bufsize;
ds->l_desc.dyn_tree = ds->dyn_ltree;
ds->d_desc.dyn_tree = ds->dyn_dtree;

View file

@ -211,7 +211,7 @@ typedef struct internal_state {
/* Depth of each subtree used as tie breaker for trees of equal frequency
*/
uchf *l_buf; /* buffer for literals or lengths */
uchf *sym_buf; /* buffer for distances and literals/lengths */
uInt lit_bufsize;
/* Size of match buffer for literals/lengths. There are 4 reasons for
@ -233,13 +233,8 @@ typedef struct internal_state {
* - I can't count above 4
*/
uInt last_lit; /* running index in l_buf */
ushf *d_buf;
/* Buffer for distances. To simplify the code, d_buf and l_buf have
* the same number of elements. To use different lengths, an extra flag
* array would be necessary.
*/
uInt sym_next; /* running index in sym_buf */
uInt sym_end; /* symbol table full when sym_next reaches this */
ulg opt_len; /* bit length of current block with optimal trees */
ulg static_len; /* bit length of current block with static trees */
@ -318,20 +313,22 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
# define _tr_tally_lit(s, c, flush) \
{ uch cc = (c); \
s->d_buf[s->last_lit] = 0; \
s->l_buf[s->last_lit++] = cc; \
s->sym_buf[s->sym_next++] = 0; \
s->sym_buf[s->sym_next++] = 0; \
s->sym_buf[s->sym_next++] = cc; \
s->dyn_ltree[cc].Freq++; \
flush = (s->last_lit == s->lit_bufsize-1); \
flush = (s->sym_next == s->sym_end); \
}
# define _tr_tally_dist(s, distance, length, flush) \
{ uch len = (length); \
ush dist = (distance); \
s->d_buf[s->last_lit] = dist; \
s->l_buf[s->last_lit++] = len; \
s->sym_buf[s->sym_next++] = dist; \
s->sym_buf[s->sym_next++] = dist >> 8; \
s->sym_buf[s->sym_next++] = len; \
dist--; \
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
s->dyn_dtree[d_code(dist)].Freq++; \
flush = (s->last_lit == s->lit_bufsize-1); \
flush = (s->sym_next == s->sym_end); \
}
#else
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)

View file

@ -425,7 +425,7 @@ local void init_block(s)
s->dyn_ltree[END_BLOCK].Freq = 1;
s->opt_len = s->static_len = 0L;
s->last_lit = s->matches = 0;
s->sym_next = s->matches = 0;
}
#define SMALLEST 1
@ -962,7 +962,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
s->last_lit));
s->sym_next / 3));
if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
@ -1029,8 +1029,9 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
unsigned dist; /* distance of matched string */
unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
{
s->d_buf[s->last_lit] = (ush)dist;
s->l_buf[s->last_lit++] = (uch)lc;
s->sym_buf[s->sym_next++] = dist;
s->sym_buf[s->sym_next++] = dist >> 8;
s->sym_buf[s->sym_next++] = lc;
if (dist == 0) {
/* lc is the unmatched char */
s->dyn_ltree[lc].Freq++;
@ -1045,30 +1046,7 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
s->dyn_dtree[d_code(dist)].Freq++;
}
#ifdef TRUNCATE_BLOCK
/* Try to guess if it is profitable to stop the current block here */
if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
/* Compute an upper bound for the compressed length */
ulg out_length = (ulg)s->last_lit*8L;
ulg in_length = (ulg)((long)s->strstart - s->block_start);
int dcode;
for (dcode = 0; dcode < D_CODES; dcode++) {
out_length += (ulg)s->dyn_dtree[dcode].Freq *
(5L+extra_dbits[dcode]);
}
out_length >>= 3;
Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
s->last_lit, in_length, out_length,
100L - out_length*100L/in_length));
if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
}
#endif
return (s->last_lit == s->lit_bufsize-1);
/* We avoid equality with lit_bufsize because of wraparound at 64K
* on 16 bit machines and because stored blocks are restricted to
* 64K-1 bytes.
*/
return (s->sym_next == s->sym_end);
}
/* ===========================================================================
@ -1081,13 +1059,14 @@ local void compress_block(s, ltree, dtree)
{
unsigned dist; /* distance of matched string */
int lc; /* match length or unmatched char (if dist == 0) */
unsigned lx = 0; /* running index in l_buf */
unsigned sx = 0; /* running index in sym_buf */
unsigned code; /* the code to send */
int extra; /* number of extra bits to send */
if (s->last_lit != 0) do {
dist = s->d_buf[lx];
lc = s->l_buf[lx++];
if (s->sym_next != 0) do {
dist = s->sym_buf[sx++] & 0xff;
dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
lc = s->sym_buf[sx++];
if (dist == 0) {
send_code(s, lc, ltree); /* send a literal byte */
Tracecv(isgraph(lc), (stderr," '%c' ", lc));
@ -1112,11 +1091,10 @@ local void compress_block(s, ltree, dtree)
}
} /* literal or match pair ? */
/* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
"pendingBuf overflow");
/* Check that the overlay between pending_buf and sym_buf is ok: */
Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
} while (lx < s->last_lit);
} while (sx < s->sym_next);
send_code(s, END_BLOCK, ltree);
s->last_eob_len = ltree[END_BLOCK].Len;

View file

@ -567,6 +567,11 @@ cmd_xzmisc = (cat $(filter-out FORCE,$^) | \
# Additional commands for U-Boot
#
# bin2c
# ---------------------------------------------------------------------------
quiet_cmd_bin2c = BIN2C $@
cmd_bin2c = $(objtree)/scripts/bin2c $2 < $< > $@
# mkimage
# ---------------------------------------------------------------------------
MKIMAGEOUTPUT ?= /dev/null

View file

@ -83,12 +83,12 @@ static int bootm_test_silent(struct unit_test_state *uts)
ut_assertok(env_set("silent_linux", "yes"));
ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_SILENT));
ut_asserteq_str("console=", buf);
ut_asserteq_str("console=ttynull", buf);
/* Empty buffer should still add the string */
*buf = '\0';
ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_SILENT));
ut_asserteq_str("console=", buf);
ut_asserteq_str("console=ttynull", buf);
/* Check nothing happens when do_silent is false */
*buf = '\0';
@ -97,21 +97,21 @@ static int bootm_test_silent(struct unit_test_state *uts)
/* Not enough space */
*buf = '\0';
ut_asserteq(-ENOSPC, bootm_process_cmdline(buf, 8, BOOTM_CL_SILENT));
ut_asserteq(-ENOSPC, bootm_process_cmdline(buf, 15, BOOTM_CL_SILENT));
/* Just enough space */
*buf = '\0';
ut_assertok(bootm_process_cmdline(buf, 9, BOOTM_CL_SILENT));
ut_assertok(bootm_process_cmdline(buf, 16, BOOTM_CL_SILENT));
/* add at end */
strcpy(buf, "something");
ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_SILENT));
ut_asserteq_str("something console=", buf);
ut_asserteq_str("something console=ttynull", buf);
/* change at start */
strcpy(buf, CONSOLE_STR " something");
ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_SILENT));
ut_asserteq_str("console= something", buf);
ut_asserteq_str("console=ttynull something", buf);
return 0;
}
@ -210,12 +210,12 @@ static int bootm_test_subst_var(struct unit_test_state *uts)
{
env_set("bootargs", NULL);
ut_assertok(bootm_process_cmdline_env(BOOTM_CL_SILENT));
ut_asserteq_str("console=", env_get("bootargs"));
ut_asserteq_str("console=ttynull", env_get("bootargs"));
ut_assertok(env_set("var", "abc"));
ut_assertok(env_set("bootargs", "some${var}thing"));
ut_assertok(bootm_process_cmdline_env(BOOTM_CL_SILENT));
ut_asserteq_str("some${var}thing console=", env_get("bootargs"));
ut_asserteq_str("some${var}thing console=ttynull", env_get("bootargs"));
return 0;
}
@ -227,12 +227,12 @@ static int bootm_test_subst_both(struct unit_test_state *uts)
ut_assertok(env_set("silent_linux", "yes"));
env_set("bootargs", NULL);
ut_assertok(bootm_process_cmdline_env(BOOTM_CL_ALL));
ut_asserteq_str("console=", env_get("bootargs"));
ut_asserteq_str("console=ttynull", env_get("bootargs"));
ut_assertok(env_set("bootargs", "some${var}thing " CONSOLE_STR));
ut_assertok(env_set("var", "1234567890"));
ut_assertok(bootm_process_cmdline_env(BOOTM_CL_ALL));
ut_asserteq_str("some1234567890thing console=", env_get("bootargs"));
ut_asserteq_str("some1234567890thing console=ttynull", env_get("bootargs"));
return 0;
}

View file

@ -199,15 +199,36 @@ static void get_basename(char *str, int size, const char *fname)
}
/**
* add_crc_node() - Add a hash node to request a CRC checksum for an image
* add_hash_node() - Add a hash or signature node
*
* @params: Image parameters
* @fdt: Device tree to add to (in sequential-write mode)
*
* If there is a key name hint, try to sign the images. Otherwise, just add a
* CRC.
*
* Return: 0 on success, or -1 on failure
*/
static void add_crc_node(void *fdt)
static int add_hash_node(struct image_tool_params *params, void *fdt)
{
fdt_begin_node(fdt, "hash-1");
fdt_property_string(fdt, FIT_ALGO_PROP, "crc32");
if (params->keyname) {
if (!params->algo_name) {
fprintf(stderr,
"%s: Algorithm name must be specified\n",
params->cmdname);
return -1;
}
fdt_begin_node(fdt, "signature-1");
fdt_property_string(fdt, FIT_ALGO_PROP, params->algo_name);
fdt_property_string(fdt, FIT_KEY_HINT, params->keyname);
} else {
fdt_begin_node(fdt, "hash-1");
fdt_property_string(fdt, FIT_ALGO_PROP, "crc32");
}
fdt_end_node(fdt);
return 0;
}
/**
@ -248,7 +269,9 @@ static int fit_write_images(struct image_tool_params *params, char *fdt)
ret = fdt_property_file(params, fdt, FIT_DATA_PROP, params->datafile);
if (ret)
return ret;
add_crc_node(fdt);
ret = add_hash_node(params, fdt);
if (ret)
return ret;
fdt_end_node(fdt);
/* Now the device tree files if available */
@ -271,7 +294,9 @@ static int fit_write_images(struct image_tool_params *params, char *fdt)
genimg_get_arch_short_name(params->arch));
fdt_property_string(fdt, FIT_COMP_PROP,
genimg_get_comp_short_name(IH_COMP_NONE));
add_crc_node(fdt);
ret = add_hash_node(params, fdt);
if (ret)
return ret;
fdt_end_node(fdt);
}
@ -289,7 +314,9 @@ static int fit_write_images(struct image_tool_params *params, char *fdt)
params->fit_ramdisk);
if (ret)
return ret;
add_crc_node(fdt);
ret = add_hash_node(params, fdt);
if (ret)
return ret;
fdt_end_node(fdt);
}

View file

@ -71,6 +71,7 @@ struct image_tool_params {
const char *keydir; /* Directory holding private keys */
const char *keydest; /* Destination .dtb for public key */
const char *keyfile; /* Filename of private or public key */
const char *keyname; /* Key name "hint" */
const char *comment; /* Comment to add to signature node */
/* Algorithm name to use for hashing/signing or NULL to use the one
* specified in the its */

View file

@ -119,6 +119,7 @@ static void usage(const char *msg)
"Signing / verified boot options: [-k keydir] [-K dtb] [ -c <comment>] [-p addr] [-r] [-N engine]\n"
" -k => set directory containing private keys\n"
" -K => write public keys to this .dtb file\n"
" -g => set key name hint\n"
" -G => use this signing key (in lieu of -k)\n"
" -c => add comment in signature node\n"
" -F => re-sign existing FIT image\n"
@ -163,7 +164,7 @@ static void process_args(int argc, char **argv)
int opt;
while ((opt = getopt(argc, argv,
"a:A:b:B:c:C:d:D:e:Ef:FG:k:i:K:ln:N:p:o:O:rR:qstT:vVx")) != -1) {
"a:A:b:B:c:C:d:D:e:Ef:Fg:G:k:i:K:ln:N:p:o:O:rR:qstT:vVx")) != -1) {
switch (opt) {
case 'a':
params.addr = strtoull(optarg, &ptr, 16);
@ -239,6 +240,8 @@ static void process_args(int argc, char **argv)
params.type = IH_TYPE_FLATDT;
params.fflag = 1;
break;
case 'g':
params.keyname = optarg;
case 'G':
params.keyfile = optarg;
break;