summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/asm-offsets.c3
-rw-r--r--lib/fdtdec.c28
-rw-r--r--lib/strmhz.c4
-rw-r--r--lib/vsprintf.c19
4 files changed, 44 insertions, 10 deletions
diff --git a/lib/asm-offsets.c b/lib/asm-offsets.c
index 129bc3e2af..580f763da6 100644
--- a/lib/asm-offsets.c
+++ b/lib/asm-offsets.c
@@ -31,6 +31,9 @@ int main(void)
#ifdef CONFIG_SYS_MALLOC_F_LEN
DEFINE(GD_MALLOC_BASE, offsetof(struct global_data, malloc_base));
#endif
+#ifdef CONFIG_X86
+ DEFINE(GD_BIST, offsetof(struct global_data, arch.bist));
+#endif
#if defined(CONFIG_ARM)
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 9c332ad903..7c7e673aeb 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -73,6 +73,8 @@ static const char * const compat_names[COMPAT_COUNT] = {
COMPAT(SAMSUNG_EXYNOS_SYSMMU, "samsung,sysmmu-v3.3"),
COMPAT(PARADE_PS8625, "parade,ps8625"),
COMPAT(COMPAT_INTEL_LPC, "intel,lpc"),
+ COMPAT(INTEL_MICROCODE, "intel,microcode"),
+ COMPAT(MEMORY_SPD, "memory-spd"),
};
const char *fdtdec_get_compatible(enum fdt_compat_id id)
@@ -355,9 +357,9 @@ int fdtdec_get_alias_seq(const void *blob, const char *base, int offset,
slash = strrchr(prop, '/');
if (strcmp(slash + 1, find_name))
continue;
- for (p = name; *p; p++) {
- if (isdigit(*p)) {
- *seqp = simple_strtoul(p, NULL, 10);
+ for (p = name + strlen(name) - 1; p > name; p--) {
+ if (!isdigit(*p)) {
+ *seqp = simple_strtoul(p + 1, NULL, 10);
debug("Found seq %d\n", *seqp);
return 0;
}
@@ -485,6 +487,26 @@ int fdtdec_get_int_array(const void *blob, int node, const char *prop_name,
return err;
}
+int fdtdec_get_int_array_count(const void *blob, int node,
+ const char *prop_name, u32 *array, int count)
+{
+ const u32 *cell;
+ int len, elems;
+ int i;
+
+ debug("%s: %s\n", __func__, prop_name);
+ cell = fdt_getprop(blob, node, prop_name, &len);
+ if (!cell)
+ return -FDT_ERR_NOTFOUND;
+ elems = len / sizeof(u32);
+ if (count > elems)
+ count = elems;
+ for (i = 0; i < count; i++)
+ array[i] = fdt32_to_cpu(cell[i]);
+
+ return count;
+}
+
const u32 *fdtdec_locate_array(const void *blob, int node,
const char *prop_name, int count)
{
diff --git a/lib/strmhz.c b/lib/strmhz.c
index f9a17727f5..5c16cc4fc7 100644
--- a/lib/strmhz.c
+++ b/lib/strmhz.c
@@ -11,11 +11,11 @@ char *strmhz (char *buf, unsigned long hz)
long l, n;
long m;
- n = DIV_ROUND(hz, 1000) / 1000L;
+ n = DIV_ROUND_CLOSEST(hz, 1000) / 1000L;
l = sprintf (buf, "%ld", n);
hz -= n * 1000000L;
- m = DIV_ROUND(hz, 1000L);
+ m = DIV_ROUND_CLOSEST(hz, 1000L);
if (m != 0)
sprintf (buf + l, ".%03ld", m);
return (buf);
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index b585713b7c..e0f264850f 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -25,9 +25,6 @@
#include <div64.h>
#define noinline __attribute__((noinline))
-/* some reluctance to put this into a new limits.h, so it is here */
-#define INT_MAX ((int)(~0U>>1))
-
unsigned long simple_strtoul(const char *cp, char **endp,
unsigned int base)
{
@@ -518,6 +515,8 @@ static char *ip4_addr_string(char *buf, char *end, u8 *addr, int field_width,
static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
int field_width, int precision, int flags)
{
+ u64 num = (uintptr_t)ptr;
+
/*
* Being a boot loader, we explicitly allow pointers to
* (physical) address null.
@@ -530,6 +529,17 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
#ifdef CONFIG_CMD_NET
switch (*fmt) {
+ case 'a':
+ flags |= SPECIAL | ZEROPAD;
+
+ switch (fmt[1]) {
+ case 'p':
+ default:
+ field_width = sizeof(phys_addr_t) * 2 + 2;
+ num = *(phys_addr_t *)ptr;
+ break;
+ }
+ break;
case 'm':
flags |= SPECIAL;
/* Fallthrough */
@@ -555,8 +565,7 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
field_width = 2*sizeof(void *);
flags |= ZEROPAD;
}
- return number(buf, end, (unsigned long)ptr, 16, field_width,
- precision, flags);
+ return number(buf, end, num, 16, field_width, precision, flags);
}
static int vsnprintf_internal(char *buf, size_t size, const char *fmt,
OpenPOWER on IntegriCloud