Merge branch 'master' into next

Signed-off-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Tom Rini
2022-09-19 13:19:39 -04:00
340 changed files with 13232 additions and 2087 deletions

View File

@@ -809,6 +809,20 @@ config TPL_STACKPROTECTOR
bool "Stack Protector buffer overflow detection for TPL"
depends on STACKPROTECTOR && TPL
config BOARD_RNG_SEED
bool "Provide /chosen/rng-seed property to the linux kernel"
help
Selecting this option requires the board to define a
board_rng_seed() function, which should return a buffer
which will be used to populate the /chosen/rng-seed property
in the device tree for the OS being booted.
It is up to the board code (and more generally the whole
BSP) where and how to store (or generate) such a seed, how
to ensure a given seed is only used once, how to create a
new seed for use on subsequent boots, and whether or not the
kernel should account any entropy from the given seed.
endmenu
menu "Update support"

View File

@@ -600,6 +600,9 @@ static void pre_console_putc(const char c)
{
char *buffer;
if (gd->precon_buf_idx < 0)
return;
buffer = map_sysmem(CONFIG_VAL(PRE_CON_BUF_ADDR), CONFIG_VAL(PRE_CON_BUF_SZ));
buffer[CIRC_BUF_IDX(gd->precon_buf_idx++)] = c;
@@ -609,13 +612,16 @@ static void pre_console_putc(const char c)
static void pre_console_puts(const char *s)
{
if (gd->precon_buf_idx < 0)
return;
while (*s)
pre_console_putc(*s++);
}
static void print_pre_console_buffer(int flushpoint)
{
unsigned long in = 0, out = 0;
long in = 0, out = 0;
char buf_out[CONFIG_VAL(PRE_CON_BUF_SZ) + 1];
char *buf_in;
@@ -632,6 +638,7 @@ static void print_pre_console_buffer(int flushpoint)
buf_out[out] = 0;
gd->precon_buf_idx = -1;
switch (flushpoint) {
case PRE_CONSOLE_FLUSHPOINT1_SERIAL:
puts(buf_out);
@@ -640,6 +647,7 @@ static void print_pre_console_buffer(int flushpoint)
console_puts_select(stdout, false, buf_out);
break;
}
gd->precon_buf_idx = in;
}
#else
static inline void pre_console_putc(const char c) {}

View File

@@ -7,6 +7,7 @@
*/
#include <common.h>
#include <abuf.h>
#include <env.h>
#include <log.h>
#include <mapmem.h>
@@ -279,6 +280,7 @@ __weak char *board_fdt_chosen_bootargs(void)
int fdt_chosen(void *fdt)
{
struct abuf buf = {};
int nodeoffset;
int err;
char *str; /* used to set string properties */
@@ -294,6 +296,17 @@ int fdt_chosen(void *fdt)
if (nodeoffset < 0)
return nodeoffset;
if (IS_ENABLED(CONFIG_BOARD_RNG_SEED) && !board_rng_seed(&buf)) {
err = fdt_setprop(fdt, nodeoffset, "rng-seed",
abuf_data(&buf), abuf_size(&buf));
abuf_uninit(&buf);
if (err < 0) {
printf("WARNING: could not set rng-seed %s.\n",
fdt_strerror(err));
return err;
}
}
str = board_fdt_chosen_bootargs();
if (str) {