aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.azure-pipelines.yml3
-rw-r--r--.gitlab-ci.yml3
-rw-r--r--arch/sandbox/lib/Makefile2
-rw-r--r--arch/sandbox/lib/fdt_fixup.c25
-rw-r--r--cmd/nvedit.c188
-rw-r--r--env/common.c180
-rw-r--r--env/eeprom.c18
-rw-r--r--env/env.c13
-rw-r--r--env/nowhere.c5
-rw-r--r--env/nvram.c14
-rw-r--r--examples/api/glue.c5
-rw-r--r--include/dm/util.h4
-rw-r--r--include/env.h24
-rw-r--r--tools/buildman/toolchain.py2
14 files changed, 215 insertions, 271 deletions
diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 2ca146c..b3794a9 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -169,8 +169,7 @@ jobs:
options: $(container_option)
steps:
- script: |
- ./tools/buildman/buildman --fetch-arch arm
- export PATH=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/:$PATH
+ export PATH=/opt/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin:$PATH
test/nokia_rx51_test.sh
- job: test_py
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 699ce99..e7c65eb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -177,8 +177,7 @@ Run binman, buildman, dtoc, Kconfig and patman testsuites:
Run tests for Nokia RX-51 (aka N900):
stage: testsuites
script:
- - ./tools/buildman/buildman --fetch-arch arm;
- export PATH=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/:$PATH;
+ - export PATH=/opt/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin:$PATH;
test/nokia_rx51_test.sh
# Test sandbox with test.py
diff --git a/arch/sandbox/lib/Makefile b/arch/sandbox/lib/Makefile
index b4ff717..a2bc5a7 100644
--- a/arch/sandbox/lib/Makefile
+++ b/arch/sandbox/lib/Makefile
@@ -5,7 +5,7 @@
# (C) Copyright 2002-2006
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-obj-y += interrupts.o sections.o
+obj-y += fdt_fixup.o interrupts.o sections.o
obj-$(CONFIG_PCI) += pci_io.o
obj-$(CONFIG_CMD_BOOTM) += bootm.o
obj-$(CONFIG_CMD_BOOTZ) += bootm.o
diff --git a/arch/sandbox/lib/fdt_fixup.c b/arch/sandbox/lib/fdt_fixup.c
new file mode 100644
index 0000000..a646f20
--- /dev/null
+++ b/arch/sandbox/lib/fdt_fixup.c
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#define LOG_CATEGORY LOGC_ARCH
+
+#include <common.h>
+#include <fdt_support.h>
+#include <log.h>
+
+#if defined(__riscv)
+int arch_fixup_fdt(void *blob)
+{
+ int ret;
+
+ ret = fdt_find_or_add_subnode(blob, 0, "chosen");;
+ if (ret < 0)
+ goto err;
+ ret = fdt_setprop_u32(blob, ret, "boot-hartid", 1);
+ if (ret < 0)
+ goto err;
+ return 0;
+err:
+ log_err("Setting /chosen/boot-hartid failed: %s\n", fdt_strerror(ret));
+ return ret;
+}
+#endif
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index ddc715b..3bb6e76 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -30,7 +30,6 @@
#include <env.h>
#include <env_internal.h>
#include <log.h>
-#include <net.h>
#include <search.h>
#include <errno.h>
#include <malloc.h>
@@ -38,7 +37,6 @@
#include <asm/global_data.h>
#include <linux/bitops.h>
#include <u-boot/crc.h>
-#include <watchdog.h>
#include <linux/stddef.h>
#include <asm/byteorder.h>
#include <asm/io.h>
@@ -320,69 +318,6 @@ int env_set(const char *varname, const char *varvalue)
return _do_env_set(0, 3, (char * const *)argv, H_PROGRAMMATIC);
}
-/**
- * Set an environment variable to an integer value
- *
- * @param varname Environment variable to set
- * @param value Value to set it to
- * @return 0 if ok, 1 on error
- */
-int env_set_ulong(const char *varname, ulong value)
-{
- /* TODO: this should be unsigned */
- char *str = simple_itoa(value);
-
- return env_set(varname, str);
-}
-
-/**
- * Set an environment variable to an value in hex
- *
- * @param varname Environment variable to set
- * @param value Value to set it to
- * @return 0 if ok, 1 on error
- */
-int env_set_hex(const char *varname, ulong value)
-{
- char str[17];
-
- sprintf(str, "%lx", value);
- return env_set(varname, str);
-}
-
-ulong env_get_hex(const char *varname, ulong default_val)
-{
- const char *s;
- ulong value;
- char *endp;
-
- s = env_get(varname);
- if (s)
- value = hextoul(s, &endp);
- if (!s || endp == s)
- return default_val;
-
- return value;
-}
-
-int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr)
-{
- string_to_enetaddr(env_get(name), enetaddr);
- return is_valid_ethaddr(enetaddr);
-}
-
-int eth_env_set_enetaddr(const char *name, const uint8_t *enetaddr)
-{
- char buf[ARP_HLEN_ASCII + 1];
-
- if (eth_env_get_enetaddr(name, (uint8_t *)buf))
- return -EEXIST;
-
- sprintf(buf, "%pM", enetaddr);
-
- return env_set(name, buf);
-}
-
#ifndef CONFIG_SPL_BUILD
static int do_env_set(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
@@ -661,115 +596,7 @@ static int do_env_edit(struct cmd_tbl *cmdtp, int flag, int argc,
}
}
#endif /* CONFIG_CMD_EDITENV */
-#endif /* CONFIG_SPL_BUILD */
-
-/*
- * Look up variable from environment,
- * return address of storage for that variable,
- * or NULL if not found
- */
-char *env_get(const char *name)
-{
- if (gd->flags & GD_FLG_ENV_READY) { /* after import into hashtable */
- struct env_entry e, *ep;
-
- WATCHDOG_RESET();
-
- e.key = name;
- e.data = NULL;
- hsearch_r(e, ENV_FIND, &ep, &env_htab, 0);
-
- return ep ? ep->data : NULL;
- }
-
- /* restricted capabilities before import */
- if (env_get_f(name, (char *)(gd->env_buf), sizeof(gd->env_buf)) > 0)
- return (char *)(gd->env_buf);
-
- return NULL;
-}
-/*
- * Like env_get, but prints an error if envvar isn't defined in the
- * environment. It always returns what env_get does, so it can be used in
- * place of env_get without changing error handling otherwise.
- */
-char *from_env(const char *envvar)
-{
- char *ret;
-
- ret = env_get(envvar);
-
- if (!ret)
- printf("missing environment variable: %s\n", envvar);
-
- return ret;
-}
-
-/*
- * Look up variable from environment for restricted C runtime env.
- */
-int env_get_f(const char *name, char *buf, unsigned len)
-{
- int i, nxt, c;
-
- for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
- int val, n;
-
- for (nxt = i; (c = env_get_char(nxt)) != '\0'; ++nxt) {
- if (c < 0)
- return c;
- if (nxt >= CONFIG_ENV_SIZE)
- return -1;
- }
-
- val = env_match((uchar *)name, i);
- if (val < 0)
- continue;
-
- /* found; copy out */
- for (n = 0; n < len; ++n, ++buf) {
- c = env_get_char(val++);
- if (c < 0)
- return c;
- *buf = c;
- if (*buf == '\0')
- return n;
- }
-
- if (n)
- *--buf = '\0';
-
- printf("env_buf [%u bytes] too small for value of \"%s\"\n",
- len, name);
-
- return n;
- }
-
- return -1;
-}
-
-/**
- * Decode the integer value of an environment variable and return it.
- *
- * @param name Name of environment variable
- * @param base Number base to use (normally 10, or 16 for hex)
- * @param default_val Default value to return if the variable is not
- * found
- * @return the decoded value, or default_val if not found
- */
-ulong env_get_ulong(const char *name, int base, ulong default_val)
-{
- /*
- * We can use env_get() here, even before relocation, since the
- * environment variable value is an integer and thus short.
- */
- const char *str = env_get(name);
-
- return str ? simple_strtoul(str, NULL, base) : default_val;
-}
-
-#ifndef CONFIG_SPL_BUILD
#if defined(CONFIG_CMD_SAVEENV) && defined(ENV_IS_IN_DEVICE)
static int do_env_save(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
@@ -816,21 +643,6 @@ static int do_env_select(struct cmd_tbl *cmdtp, int flag, int argc,
#endif /* CONFIG_SPL_BUILD */
-int env_match(uchar *s1, int i2)
-{
- if (s1 == NULL)
- return -1;
-
- while (*s1 == env_get_char(i2++))
- if (*s1++ == '=')
- return i2;
-
- if (*s1 == '\0' && env_get_char(i2-1) == '=')
- return i2;
-
- return -1;
-}
-
#ifndef CONFIG_SPL_BUILD
static int do_env_default(struct cmd_tbl *cmdtp, int flag,
int argc, char *const argv[])
diff --git a/env/common.c b/env/common.c
index 81e9e0b..db213b7 100644
--- a/env/common.c
+++ b/env/common.c
@@ -21,6 +21,8 @@
#include <malloc.h>
#include <u-boot/crc.h>
#include <dm/ofnode.h>
+#include <net.h>
+#include <watchdog.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -34,6 +36,184 @@ struct hsearch_data env_htab = {
};
/*
+ * This env_set() function is defined in cmd/nvedit.c, since it calls
+ * _do_env_set(), whis is a static function in that file.
+ *
+ * int env_set(const char *varname, const char *varvalue);
+ */
+
+/**
+ * Set an environment variable to an integer value
+ *
+ * @param varname Environment variable to set
+ * @param value Value to set it to
+ * @return 0 if ok, 1 on error
+ */
+int env_set_ulong(const char *varname, ulong value)
+{
+ /* TODO: this should be unsigned */
+ char *str = simple_itoa(value);
+
+ return env_set(varname, str);
+}
+
+/**
+ * Set an environment variable to an value in hex
+ *
+ * @param varname Environment variable to set
+ * @param value Value to set it to
+ * @return 0 if ok, 1 on error
+ */
+int env_set_hex(const char *varname, ulong value)
+{
+ char str[17];
+
+ sprintf(str, "%lx", value);
+ return env_set(varname, str);
+}
+
+ulong env_get_hex(const char *varname, ulong default_val)
+{
+ const char *s;
+ ulong value;
+ char *endp;
+
+ s = env_get(varname);
+ if (s)
+ value = hextoul(s, &endp);
+ if (!s || endp == s)
+ return default_val;
+
+ return value;
+}
+
+int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr)
+{
+ string_to_enetaddr(env_get(name), enetaddr);
+ return is_valid_ethaddr(enetaddr);
+}
+
+int eth_env_set_enetaddr(const char *name, const uint8_t *enetaddr)
+{
+ char buf[ARP_HLEN_ASCII + 1];
+
+ if (eth_env_get_enetaddr(name, (uint8_t *)buf))
+ return -EEXIST;
+
+ sprintf(buf, "%pM", enetaddr);
+
+ return env_set(name, buf);
+}
+
+/*
+ * Look up variable from environment,
+ * return address of storage for that variable,
+ * or NULL if not found
+ */
+char *env_get(const char *name)
+{
+ if (gd->flags & GD_FLG_ENV_READY) { /* after import into hashtable */
+ struct env_entry e, *ep;
+
+ WATCHDOG_RESET();
+
+ e.key = name;
+ e.data = NULL;
+ hsearch_r(e, ENV_FIND, &ep, &env_htab, 0);
+
+ return ep ? ep->data : NULL;
+ }
+
+ /* restricted capabilities before import */
+ if (env_get_f(name, (char *)(gd->env_buf), sizeof(gd->env_buf)) > 0)
+ return (char *)(gd->env_buf);
+
+ return NULL;
+}
+
+/*
+ * Like env_get, but prints an error if envvar isn't defined in the
+ * environment. It always returns what env_get does, so it can be used in
+ * place of env_get without changing error handling otherwise.
+ */
+char *from_env(const char *envvar)
+{
+ char *ret;
+
+ ret = env_get(envvar);
+
+ if (!ret)
+ printf("missing environment variable: %s\n", envvar);
+
+ return ret;
+}
+
+/*
+ * Look up variable from environment for restricted C runtime env.
+ */
+int env_get_f(const char *name, char *buf, unsigned len)
+{
+ const char *env, *p, *end;
+ size_t name_len;
+
+ if (name == NULL || *name == '\0')
+ return -1;
+
+ name_len = strlen(name);
+
+ if (gd->env_valid == ENV_INVALID)
+ env = (const char *)default_environment;
+ else
+ env = (const char *)gd->env_addr;
+
+ for (p = env; *p != '\0'; p = end + 1) {
+ const char *value;
+ unsigned res;
+
+ for (end = p; *end != '\0'; ++end)
+ if (end - env >= CONFIG_ENV_SIZE)
+ return -1;
+
+ if (strncmp(name, p, name_len) || p[name_len] != '=')
+ continue;
+ value = &p[name_len + 1];
+
+ res = end - value;
+ memcpy(buf, value, min(len, res + 1));
+
+ if (len <= res) {
+ buf[len - 1] = '\0';
+ printf("env_buf [%u bytes] too small for value of \"%s\"\n",
+ len, name);
+ }
+
+ return res;
+ }
+
+ return -1;
+}
+
+/**
+ * Decode the integer value of an environment variable and return it.
+ *
+ * @param name Name of environment variable
+ * @param base Number base to use (normally 10, or 16 for hex)
+ * @param default_val Default value to return if the variable is not
+ * found
+ * @return the decoded value, or default_val if not found
+ */
+ulong env_get_ulong(const char *name, int base, ulong default_val)
+{
+ /*
+ * We can use env_get() here, even before relocation, since the
+ * environment variable value is an integer and thus short.
+ */
+ const char *str = env_get(name);
+
+ return str ? simple_strtoul(str, NULL, base) : default_val;
+}
+
+/*
* Read an environment variable as a boolean
* Return -1 if variable does not exist (default to true)
*/
diff --git a/env/eeprom.c b/env/eeprom.c
index 253bdf1..f8556a4 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -64,24 +64,6 @@ static int eeprom_bus_write(unsigned dev_addr, unsigned offset,
return rcode;
}
-/** Call this function from overridden env_get_char_spec() if you need
- * this functionality.
- */
-int env_eeprom_get_char(int index)
-{
- uchar c;
- unsigned int off = CONFIG_ENV_OFFSET;
-
-#ifdef CONFIG_ENV_OFFSET_REDUND
- if (gd->env_valid == ENV_REDUND)
- off = CONFIG_ENV_OFFSET_REDUND;
-#endif
- eeprom_bus_read(CONFIG_SYS_I2C_EEPROM_ADDR,
- off + index + offsetof(env_t, data), &c, 1);
-
- return c;
-}
-
static int env_eeprom_load(void)
{
char buf_env[CONFIG_ENV_SIZE];
diff --git a/env/env.c b/env/env.c
index e534008..e4dfb92 100644
--- a/env/env.c
+++ b/env/env.c
@@ -166,19 +166,6 @@ static struct env_driver *env_driver_lookup(enum env_operation op, int prio)
return drv;
}
-__weak int env_get_char_spec(int index)
-{
- return *(uchar *)(gd->env_addr + index);
-}
-
-int env_get_char(int index)
-{
- if (gd->env_valid == ENV_INVALID)
- return default_environment[index];
- else
- return env_get_char_spec(index);
-}
-
int env_load(void)
{
struct env_driver *drv;
diff --git a/env/nowhere.c b/env/nowhere.c
index 41557f5..1fcf503 100644
--- a/env/nowhere.c
+++ b/env/nowhere.c
@@ -31,9 +31,8 @@ static int env_nowhere_init(void)
static int env_nowhere_load(void)
{
/*
- * for SPL, set env_valid = ENV_INVALID is enough as env_get_char()
- * return the default env if env_get is used
- * and SPL don't used env_import to reduce its size
+ * For SPL, setting env_valid = ENV_INVALID is enough, as env_get()
+ * searches default_environment array in that case.
* For U-Boot proper, import the default environment to allow reload.
*/
if (!IS_ENABLED(CONFIG_SPL_BUILD))
diff --git a/env/nvram.c b/env/nvram.c
index f412685..261b31e 100644
--- a/env/nvram.c
+++ b/env/nvram.c
@@ -42,20 +42,6 @@ extern void nvram_write(long dest, const void *src, size_t count);
static env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
#endif
-#ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
-/** Call this function from overridden env_get_char_spec() if you need
- * this functionality.
- */
-int env_nvram_get_char(int index)
-{
- uchar c;
-
- nvram_read(&c, CONFIG_ENV_ADDR + index, 1);
-
- return c;
-}
-#endif
-
static int env_nvram_load(void)
{
char buf[CONFIG_ENV_SIZE];
diff --git a/examples/api/glue.c b/examples/api/glue.c
index 91d1315..075d307 100644
--- a/examples/api/glue.c
+++ b/examples/api/glue.c
@@ -365,11 +365,6 @@ const char * ub_env_enum(const char *last)
env = NULL;
- /*
- * It's OK to pass only the name piece as last (and not the whole
- * 'name=val' string), since the API_ENUM_ENV call uses env_match()
- * internally, which handles such case
- */
if (!syscall(API_ENV_ENUM, NULL, last, &env))
return NULL;
diff --git a/include/dm/util.h b/include/dm/util.h
index c634e47..17baf55 100644
--- a/include/dm/util.h
+++ b/include/dm/util.h
@@ -48,8 +48,6 @@ void dm_dump_driver_compat(void);
/* Dump out a list of drivers with static platform data */
void dm_dump_static_driver_info(void);
-#endif
-
#if CONFIG_IS_ENABLED(OF_PLATDATA_INST) && CONFIG_IS_ENABLED(READ_ONLY)
void *dm_priv_to_rw(void *priv);
#else
@@ -58,3 +56,5 @@ static inline void *dm_priv_to_rw(void *priv)
return priv;
}
#endif
+
+#endif
diff --git a/include/env.h b/include/env.h
index d5e2bcb..ee5e30d 100644
--- a/include/env.h
+++ b/include/env.h
@@ -91,17 +91,6 @@ int env_init(void);
void env_relocate(void);
/**
- * env_match() - Match a name / name=value pair
- *
- * This is used prior to relocation for finding envrionment variables
- *
- * @name: A simple 'name', or a 'name=value' pair.
- * @index: The environment index for a 'name2=value2' pair.
- * @return index for the value if the names match, else -1.
- */
-int env_match(unsigned char *name, int index);
-
-/**
* env_get() - Look up the value of an environment variable
*
* In U-Boot proper this can be called before relocation (which is when the
@@ -131,7 +120,8 @@ char *from_env(const char *envvar);
* support reading the value (slowly) and some will not.
*
* @varname: Variable to look up
- * @return value of variable, or NULL if not found
+ * @return actual length of the variable value excluding the terminating
+ * NULL-byte, or -1 if the variable is not found
*/
int env_get_f(const char *name, char *buf, unsigned int len);
@@ -360,16 +350,6 @@ char *env_get_default(const char *name);
void env_set_default(const char *s, int flags);
/**
- * env_get_char() - Get a character from the early environment
- *
- * This reads from the pre-relocation environment
- *
- * @index: Index of character to read (0 = first)
- * @return character read, or -ve on error
- */
-int env_get_char(int index);
-
-/**
* env_reloc() - Relocate the 'env' sub-commands
*
* This is used for those unfortunate archs with crappy toolchains
diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py
index fd137f7..4e2471f 100644
--- a/tools/buildman/toolchain.py
+++ b/tools/buildman/toolchain.py
@@ -498,7 +498,7 @@ class Toolchains:
if arch == 'aarch64':
arch = 'arm64'
base = 'https://www.kernel.org/pub/tools/crosstool/files/bin'
- versions = ['9.2.0', '7.3.0', '6.4.0', '4.9.4']
+ versions = ['11.1.0', '9.2.0', '7.3.0', '6.4.0', '4.9.4']
links = []
for version in versions:
url = '%s/%s/%s/' % (base, arch, version)