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>
This commit is contained in:
Atish Patra 2019-01-17 16:42:41 -08:00 committed by Anup Patel
parent cf83b6e438
commit 00f77d9ba0
5 changed files with 18 additions and 26 deletions

View file

@ -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;

View file

@ -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)

View file

@ -24,3 +24,6 @@ FW_PAYLOAD=y
FW_PAYLOAD_OFFSET=0x10000
#FW_PAYLOAD_FDT_ADDR=0x80040000
# External Libraries to include
PLATFORM_INCLUDE_LIBC=y

View file

@ -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

View file

@ -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