summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtish Patra <atish.patra@wdc.com>2019-01-18 03:42:41 +0300
committerAnup Patel <anup@brainfault.org>2019-01-18 07:35:12 +0300
commit00f77d9ba0465fe7baf65df487195880555db597 (patch)
tree28fc5f3c620d4334d095d9e8f122bd6d85d87157
parentcf83b6e438ec0ba7fc3337f5b516da37ec5314c8 (diff)
downloadopensbi-00f77d9ba0465fe7baf65df487195880555db597.tar.xz
platform: Remove string functions from tinyfdt.c
There are couple of string function defined in platform code. We no longer need them as we can directly link minimal libc. Every platform required to inclde this as PLIC driver required libc functions. Signed-off-by: Atish Patra <atish.patra@wdc.com>
-rw-r--r--platform/common/irqchip/plic.c3
-rw-r--r--platform/common/tinyfdt.c32
-rw-r--r--platform/kendryte/k210/config.mk3
-rw-r--r--platform/qemu/sifive_u/config.mk3
-rw-r--r--platform/qemu/virt/config.mk3
5 files changed, 18 insertions, 26 deletions
diff --git a/platform/common/irqchip/plic.c b/platform/common/irqchip/plic.c
index 8a1e08e..0a2a036 100644
--- a/platform/common/irqchip/plic.c
+++ b/platform/common/irqchip/plic.c
@@ -10,6 +10,7 @@
#include <sbi/riscv_io.h>
#include <plat/tinyfdt.h>
#include <plat/irqchip/plic.h>
+#include <string.h>
#define PLIC_PRIORITY_BASE 0x0
#define PLIC_PENDING_BASE 0x1000
@@ -53,7 +54,7 @@ static void plic_fdt_fixup_prop(const struct fdt_node *node,
if (!prop)
return;
- if (fdt_strcmp(prop->name, "interrupts-extended"))
+ if (strcmp(prop->name, "interrupts-extended"))
return;
cells = prop->value;
diff --git a/platform/common/tinyfdt.c b/platform/common/tinyfdt.c
index 4f6017c..a3c1fcf 100644
--- a/platform/common/tinyfdt.c
+++ b/platform/common/tinyfdt.c
@@ -7,7 +7,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <plat/fdt.h>
+#include <plat/tinyfdt.h>
+#include <string.h>
#define FDT_MAGIC 0xd00dfeed
#define FDT_VERSION 17
@@ -39,25 +40,6 @@ u32 fdt_rev32(u32 v)
((v & 0xFF000000) >> 24);
}
-ulong fdt_strlen(const char *str)
-{
- ulong ret = 0;
-
- while (*str != '\0') {
- ret++;
- str++;
- }
-
- return ret;
-}
-
-int fdt_strcmp(const char *a, const char *b)
-{
- /* search first diff or end of string */
- for (; *a == *b && *a != '\0'; a++, b++);
- return *a - *b;
-}
-
int fdt_prop_string_index(const struct fdt_prop *prop,
const char *str)
{
@@ -69,10 +51,10 @@ int fdt_prop_string_index(const struct fdt_prop *prop,
end = p + prop->len;
for (i = 0; p < end; i++, p += l) {
- l = fdt_strlen(p) + 1;
+ l = strlen(p) + 1;
if (p + l > end)
return -1;
- if (fdt_strcmp(str, p) == 0)
+ if (strcmp(str, p) == 0)
return i; /* Found it; return index */
}
@@ -105,7 +87,7 @@ static void recursive_iter(char **data, struct recursive_iter_info *info,
node.parent = parent;
node.name = *data;
- *data += fdt_strlen(*data) + 1;
+ *data += strlen(*data) + 1;
while ((ulong)(*data) % sizeof(u32) != 0)
(*data)++;
@@ -179,7 +161,7 @@ static void match_iter(const struct fdt_node *node,
data += sizeof(u32);
/* Skip node name */
- data += fdt_strlen(data) + 1;
+ data += strlen(data) + 1;
while ((ulong)(data) % sizeof(u32) != 0)
data++;
@@ -256,7 +238,7 @@ static int match_compat(const struct fdt_node *node,
if (!prop)
return 0;
- if (fdt_strcmp(prop->name, "compatible"))
+ if (strcmp(prop->name, "compatible"))
return 0;
if (fdt_prop_string_index(prop, cinfo->compat) < 0)
diff --git a/platform/kendryte/k210/config.mk b/platform/kendryte/k210/config.mk
index 4a5b592..b8510cb 100644
--- a/platform/kendryte/k210/config.mk
+++ b/platform/kendryte/k210/config.mk
@@ -24,3 +24,6 @@ FW_PAYLOAD=y
FW_PAYLOAD_OFFSET=0x10000
#FW_PAYLOAD_FDT_ADDR=0x80040000
+# External Libraries to include
+PLATFORM_INCLUDE_LIBC=y
+
diff --git a/platform/qemu/sifive_u/config.mk b/platform/qemu/sifive_u/config.mk
index 630098e..59d3d06 100644
--- a/platform/qemu/sifive_u/config.mk
+++ b/platform/qemu/sifive_u/config.mk
@@ -26,3 +26,6 @@ FW_JUMP_FDT_ADDR=0x82200000
FW_PAYLOAD=y
FW_PAYLOAD_OFFSET=0x200000
FW_PAYLOAD_FDT_ADDR=0x82200000
+
+# External Libraries to include
+PLATFORM_INCLUDE_LIBC=y
diff --git a/platform/qemu/virt/config.mk b/platform/qemu/virt/config.mk
index 927422c..bb162e0 100644
--- a/platform/qemu/virt/config.mk
+++ b/platform/qemu/virt/config.mk
@@ -26,3 +26,6 @@ FW_JUMP_FDT_ADDR=0x82200000
FW_PAYLOAD=y
FW_PAYLOAD_OFFSET=0x200000
FW_PAYLOAD_FDT_ADDR=0x82200000
+
+# External Libraries to include
+PLATFORM_INCLUDE_LIBC=y