Merge branch 'dt/dtc-sync' into dt/next
This commit is contained in:
Коммит
eb90b4f8fb
|
@ -18,6 +18,7 @@
|
|||
*.c.[012]*.*
|
||||
*.dt.yaml
|
||||
*.dtb
|
||||
*.dtbo
|
||||
*.dtb.S
|
||||
*.dwo
|
||||
*.elf
|
||||
|
|
5
Makefile
5
Makefile
|
@ -1337,6 +1337,9 @@ ifneq ($(dtstree),)
|
|||
%.dtb: include/config/kernel.release scripts_dtc
|
||||
$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
|
||||
|
||||
%.dtbo: include/config/kernel.release scripts_dtc
|
||||
$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
|
||||
|
||||
PHONY += dtbs dtbs_install dtbs_check
|
||||
dtbs: include/config/kernel.release scripts_dtc
|
||||
$(Q)$(MAKE) $(build)=$(dtstree)
|
||||
|
@ -1816,7 +1819,7 @@ clean: $(clean-dirs)
|
|||
@find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
|
||||
\( -name '*.[aios]' -o -name '*.ko' -o -name '.*.cmd' \
|
||||
-o -name '*.ko.*' \
|
||||
-o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
|
||||
-o -name '*.dtb' -o -name '*.dtbo' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
|
||||
-o -name '*.dwo' -o -name '*.lst' \
|
||||
-o -name '*.su' -o -name '*.mod' \
|
||||
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
|
||||
|
|
|
@ -29,6 +29,9 @@ quiet_cmd_dtb_install = INSTALL $@
|
|||
$(dst)/%.dtb: $(obj)/%.dtb
|
||||
$(call cmd,dtb_install)
|
||||
|
||||
$(dst)/%.dtbo: $(obj)/%.dtbo
|
||||
$(call cmd,dtb_install)
|
||||
|
||||
PHONY += $(subdirs)
|
||||
$(subdirs):
|
||||
$(Q)$(MAKE) $(dtbinst)=$@ dst=$(patsubst $(obj)/%,$(dst)/%,$@)
|
||||
|
|
|
@ -86,7 +86,9 @@ extra-$(CONFIG_OF_ALL_DTBS) += $(dtb-)
|
|||
|
||||
ifneq ($(CHECK_DTBS),)
|
||||
extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y))
|
||||
extra-y += $(patsubst %.dtbo,%.dt.yaml, $(dtb-y))
|
||||
extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-))
|
||||
extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtbo,%.dt.yaml, $(dtb-))
|
||||
endif
|
||||
|
||||
# Add subdir path
|
||||
|
@ -327,6 +329,9 @@ cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ;
|
|||
$(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE
|
||||
$(call if_changed_dep,dtc)
|
||||
|
||||
$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE
|
||||
$(call if_changed_dep,dtc)
|
||||
|
||||
DT_CHECKER ?= dt-validate
|
||||
DT_BINDING_DIR := Documentation/devicetree/bindings
|
||||
# DT_TMP_SCHEMA may be overridden from Documentation/devicetree/bindings/Makefile
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
# scripts/dtc makefile
|
||||
|
||||
hostprogs-always-$(CONFIG_DTC) += dtc
|
||||
hostprogs-always-$(CONFIG_DTC) += dtc fdtoverlay
|
||||
hostprogs-always-$(CHECK_DT_BINDING) += dtc
|
||||
|
||||
dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
|
||||
srcpos.o checks.o util.o
|
||||
dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
|
||||
|
||||
# The upstream project builds libfdt as a separate library. We are choosing to
|
||||
# instead directly link the libfdt object files into fdtoverlay.
|
||||
libfdt-objs := fdt.o fdt_ro.o fdt_wip.o fdt_sw.o fdt_rw.o fdt_strerror.o fdt_empty_tree.o fdt_addresses.o fdt_overlay.o
|
||||
libfdt = $(addprefix libfdt/,$(libfdt-objs))
|
||||
fdtoverlay-objs := $(libfdt) fdtoverlay.o util.o
|
||||
|
||||
# Source files need to get at the userspace version of libfdt_env.h to compile
|
||||
HOST_EXTRACFLAGS += -I $(srctree)/$(src)/libfdt
|
||||
|
||||
|
|
|
@ -21,10 +21,10 @@ void data_free(struct data d)
|
|||
free(d.val);
|
||||
}
|
||||
|
||||
struct data data_grow_for(struct data d, int xlen)
|
||||
struct data data_grow_for(struct data d, unsigned int xlen)
|
||||
{
|
||||
struct data nd;
|
||||
int newsize;
|
||||
unsigned int newsize;
|
||||
|
||||
if (xlen == 0)
|
||||
return d;
|
||||
|
@ -84,7 +84,7 @@ struct data data_copy_file(FILE *f, size_t maxlen)
|
|||
while (!feof(f) && (d.len < maxlen)) {
|
||||
size_t chunksize, ret;
|
||||
|
||||
if (maxlen == -1)
|
||||
if (maxlen == (size_t)-1)
|
||||
chunksize = 4096;
|
||||
else
|
||||
chunksize = maxlen - d.len;
|
||||
|
|
|
@ -122,6 +122,8 @@ static const char *guess_type_by_name(const char *fname, const char *fallback)
|
|||
return "dts";
|
||||
if (!strcasecmp(s, ".yaml"))
|
||||
return "yaml";
|
||||
if (!strcasecmp(s, ".dtbo"))
|
||||
return "dtb";
|
||||
if (!strcasecmp(s, ".dtb"))
|
||||
return "dtb";
|
||||
return fallback;
|
||||
|
@ -357,6 +359,8 @@ int main(int argc, char *argv[])
|
|||
#endif
|
||||
} else if (streq(outform, "dtb")) {
|
||||
dt_to_blob(outf, dti, outversion);
|
||||
} else if (streq(outform, "dtbo")) {
|
||||
dt_to_blob(outf, dti, outversion);
|
||||
} else if (streq(outform, "asm")) {
|
||||
dt_to_asm(outf, dti, outversion);
|
||||
} else if (streq(outform, "null")) {
|
||||
|
|
|
@ -105,13 +105,13 @@ extern const char *markername(enum markertype markertype);
|
|||
|
||||
struct marker {
|
||||
enum markertype type;
|
||||
int offset;
|
||||
unsigned int offset;
|
||||
char *ref;
|
||||
struct marker *next;
|
||||
};
|
||||
|
||||
struct data {
|
||||
int len;
|
||||
unsigned int len;
|
||||
char *val;
|
||||
struct marker *markers;
|
||||
};
|
||||
|
@ -129,7 +129,7 @@ size_t type_marker_length(struct marker *m);
|
|||
|
||||
void data_free(struct data d);
|
||||
|
||||
struct data data_grow_for(struct data d, int xlen);
|
||||
struct data data_grow_for(struct data d, unsigned int xlen);
|
||||
|
||||
struct data data_copy_mem(const char *mem, int len);
|
||||
struct data data_copy_escape_string(const char *s, int len);
|
||||
|
@ -253,7 +253,7 @@ void append_to_property(struct node *node,
|
|||
const char *get_unitname(struct node *node);
|
||||
struct property *get_property(struct node *node, const char *propname);
|
||||
cell_t propval_cell(struct property *prop);
|
||||
cell_t propval_cell_n(struct property *prop, int n);
|
||||
cell_t propval_cell_n(struct property *prop, unsigned int n);
|
||||
struct property *get_property_by_label(struct node *tree, const char *label,
|
||||
struct node **node);
|
||||
struct marker *get_marker_label(struct node *tree, const char *label,
|
||||
|
|
|
@ -1,163 +0,0 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* fdtdump.c - Contributed by Pantelis Antoniou <pantelis.antoniou AT gmail.com>
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <fdt.h>
|
||||
#include <libfdt_env.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1))
|
||||
#define PALIGN(p, a) ((void *)(ALIGN((unsigned long)(p), (a))))
|
||||
#define GET_CELL(p) (p += 4, *((const uint32_t *)(p-4)))
|
||||
|
||||
static void print_data(const char *data, int len)
|
||||
{
|
||||
int i;
|
||||
const char *p = data;
|
||||
|
||||
/* no data, don't print */
|
||||
if (len == 0)
|
||||
return;
|
||||
|
||||
if (util_is_printable_string(data, len)) {
|
||||
printf(" = \"%s\"", (const char *)data);
|
||||
} else if ((len % 4) == 0) {
|
||||
printf(" = <");
|
||||
for (i = 0; i < len; i += 4)
|
||||
printf("0x%08x%s", fdt32_to_cpu(GET_CELL(p)),
|
||||
i < (len - 4) ? " " : "");
|
||||
printf(">");
|
||||
} else {
|
||||
printf(" = [");
|
||||
for (i = 0; i < len; i++)
|
||||
printf("%02x%s", *p++, i < len - 1 ? " " : "");
|
||||
printf("]");
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_blob(void *blob)
|
||||
{
|
||||
struct fdt_header *bph = blob;
|
||||
uint32_t off_mem_rsvmap = fdt32_to_cpu(bph->off_mem_rsvmap);
|
||||
uint32_t off_dt = fdt32_to_cpu(bph->off_dt_struct);
|
||||
uint32_t off_str = fdt32_to_cpu(bph->off_dt_strings);
|
||||
struct fdt_reserve_entry *p_rsvmap =
|
||||
(struct fdt_reserve_entry *)((char *)blob + off_mem_rsvmap);
|
||||
const char *p_struct = (const char *)blob + off_dt;
|
||||
const char *p_strings = (const char *)blob + off_str;
|
||||
uint32_t version = fdt32_to_cpu(bph->version);
|
||||
uint32_t totalsize = fdt32_to_cpu(bph->totalsize);
|
||||
uint32_t tag;
|
||||
const char *p, *s, *t;
|
||||
int depth, sz, shift;
|
||||
int i;
|
||||
uint64_t addr, size;
|
||||
|
||||
depth = 0;
|
||||
shift = 4;
|
||||
|
||||
printf("/dts-v1/;\n");
|
||||
printf("// magic:\t\t0x%x\n", fdt32_to_cpu(bph->magic));
|
||||
printf("// totalsize:\t\t0x%x (%d)\n", totalsize, totalsize);
|
||||
printf("// off_dt_struct:\t0x%x\n", off_dt);
|
||||
printf("// off_dt_strings:\t0x%x\n", off_str);
|
||||
printf("// off_mem_rsvmap:\t0x%x\n", off_mem_rsvmap);
|
||||
printf("// version:\t\t%d\n", version);
|
||||
printf("// last_comp_version:\t%d\n",
|
||||
fdt32_to_cpu(bph->last_comp_version));
|
||||
if (version >= 2)
|
||||
printf("// boot_cpuid_phys:\t0x%x\n",
|
||||
fdt32_to_cpu(bph->boot_cpuid_phys));
|
||||
|
||||
if (version >= 3)
|
||||
printf("// size_dt_strings:\t0x%x\n",
|
||||
fdt32_to_cpu(bph->size_dt_strings));
|
||||
if (version >= 17)
|
||||
printf("// size_dt_struct:\t0x%x\n",
|
||||
fdt32_to_cpu(bph->size_dt_struct));
|
||||
printf("\n");
|
||||
|
||||
for (i = 0; ; i++) {
|
||||
addr = fdt64_to_cpu(p_rsvmap[i].address);
|
||||
size = fdt64_to_cpu(p_rsvmap[i].size);
|
||||
if (addr == 0 && size == 0)
|
||||
break;
|
||||
|
||||
printf("/memreserve/ %llx %llx;\n",
|
||||
(unsigned long long)addr, (unsigned long long)size);
|
||||
}
|
||||
|
||||
p = p_struct;
|
||||
while ((tag = fdt32_to_cpu(GET_CELL(p))) != FDT_END) {
|
||||
|
||||
/* printf("tag: 0x%08x (%d)\n", tag, p - p_struct); */
|
||||
|
||||
if (tag == FDT_BEGIN_NODE) {
|
||||
s = p;
|
||||
p = PALIGN(p + strlen(s) + 1, 4);
|
||||
|
||||
if (*s == '\0')
|
||||
s = "/";
|
||||
|
||||
printf("%*s%s {\n", depth * shift, "", s);
|
||||
|
||||
depth++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tag == FDT_END_NODE) {
|
||||
depth--;
|
||||
|
||||
printf("%*s};\n", depth * shift, "");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tag == FDT_NOP) {
|
||||
printf("%*s// [NOP]\n", depth * shift, "");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tag != FDT_PROP) {
|
||||
fprintf(stderr, "%*s ** Unknown tag 0x%08x\n", depth * shift, "", tag);
|
||||
break;
|
||||
}
|
||||
sz = fdt32_to_cpu(GET_CELL(p));
|
||||
s = p_strings + fdt32_to_cpu(GET_CELL(p));
|
||||
if (version < 16 && sz >= 8)
|
||||
p = PALIGN(p, 8);
|
||||
t = p;
|
||||
|
||||
p = PALIGN(p + sz, 4);
|
||||
|
||||
printf("%*s%s", depth * shift, "", s);
|
||||
print_data(t, sz);
|
||||
printf(";\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char *buf;
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "supply input filename\n");
|
||||
return 5;
|
||||
}
|
||||
|
||||
buf = utilfdt_read(argv[1]);
|
||||
if (buf)
|
||||
dump_blob(buf);
|
||||
else
|
||||
return 10;
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,208 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (c) 2017 Konsulko Group Inc. All rights reserved.
|
||||
*
|
||||
* Author:
|
||||
* Pantelis Antoniou <pantelis.antoniou@konsulko.com>
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <getopt.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <libfdt.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#define BUF_INCREMENT 65536
|
||||
|
||||
/* Usage related data. */
|
||||
static const char usage_synopsis[] =
|
||||
"apply a number of overlays to a base blob\n"
|
||||
" fdtoverlay <options> [<overlay.dtbo> [<overlay.dtbo>]]\n"
|
||||
"\n"
|
||||
USAGE_TYPE_MSG;
|
||||
static const char usage_short_opts[] = "i:o:v" USAGE_COMMON_SHORT_OPTS;
|
||||
static struct option const usage_long_opts[] = {
|
||||
{"input", required_argument, NULL, 'i'},
|
||||
{"output", required_argument, NULL, 'o'},
|
||||
{"verbose", no_argument, NULL, 'v'},
|
||||
USAGE_COMMON_LONG_OPTS,
|
||||
};
|
||||
static const char * const usage_opts_help[] = {
|
||||
"Input base DT blob",
|
||||
"Output DT blob",
|
||||
"Verbose messages",
|
||||
USAGE_COMMON_OPTS_HELP
|
||||
};
|
||||
|
||||
int verbose = 0;
|
||||
|
||||
static void *apply_one(char *base, const char *overlay, size_t *buf_len,
|
||||
const char *name)
|
||||
{
|
||||
char *tmp = NULL;
|
||||
char *tmpo;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* We take a copies first, because a a failed apply can trash
|
||||
* both the base blob and the overlay
|
||||
*/
|
||||
tmpo = xmalloc(fdt_totalsize(overlay));
|
||||
|
||||
do {
|
||||
tmp = xrealloc(tmp, *buf_len);
|
||||
ret = fdt_open_into(base, tmp, *buf_len);
|
||||
if (ret) {
|
||||
fprintf(stderr,
|
||||
"\nFailed to make temporary copy: %s\n",
|
||||
fdt_strerror(ret));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
memcpy(tmpo, overlay, fdt_totalsize(overlay));
|
||||
|
||||
ret = fdt_overlay_apply(tmp, tmpo);
|
||||
if (ret == -FDT_ERR_NOSPACE) {
|
||||
*buf_len += BUF_INCREMENT;
|
||||
}
|
||||
} while (ret == -FDT_ERR_NOSPACE);
|
||||
|
||||
if (ret) {
|
||||
fprintf(stderr, "\nFailed to apply '%s': %s\n",
|
||||
name, fdt_strerror(ret));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
free(base);
|
||||
free(tmpo);
|
||||
return tmp;
|
||||
|
||||
fail:
|
||||
free(tmpo);
|
||||
if (tmp)
|
||||
free(tmp);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
static int do_fdtoverlay(const char *input_filename,
|
||||
const char *output_filename,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
char *blob = NULL;
|
||||
char **ovblob = NULL;
|
||||
size_t buf_len;
|
||||
int i, ret = -1;
|
||||
|
||||
blob = utilfdt_read(input_filename, &buf_len);
|
||||
if (!blob) {
|
||||
fprintf(stderr, "\nFailed to read '%s'\n", input_filename);
|
||||
goto out_err;
|
||||
}
|
||||
if (fdt_totalsize(blob) > buf_len) {
|
||||
fprintf(stderr,
|
||||
"\nBase blob is incomplete (%lu / %" PRIu32 " bytes read)\n",
|
||||
(unsigned long)buf_len, fdt_totalsize(blob));
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
/* allocate blob pointer array */
|
||||
ovblob = xmalloc(sizeof(*ovblob) * argc);
|
||||
memset(ovblob, 0, sizeof(*ovblob) * argc);
|
||||
|
||||
/* read and keep track of the overlay blobs */
|
||||
for (i = 0; i < argc; i++) {
|
||||
size_t ov_len;
|
||||
ovblob[i] = utilfdt_read(argv[i], &ov_len);
|
||||
if (!ovblob[i]) {
|
||||
fprintf(stderr, "\nFailed to read '%s'\n", argv[i]);
|
||||
goto out_err;
|
||||
}
|
||||
if (fdt_totalsize(ovblob[i]) > ov_len) {
|
||||
fprintf(stderr,
|
||||
"\nOverlay '%s' is incomplete (%lu / %" PRIu32 " bytes read)\n",
|
||||
argv[i], (unsigned long)ov_len,
|
||||
fdt_totalsize(ovblob[i]));
|
||||
goto out_err;
|
||||
}
|
||||
}
|
||||
|
||||
buf_len = fdt_totalsize(blob);
|
||||
|
||||
/* apply the overlays in sequence */
|
||||
for (i = 0; i < argc; i++) {
|
||||
blob = apply_one(blob, ovblob[i], &buf_len, argv[i]);
|
||||
if (!blob)
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
fdt_pack(blob);
|
||||
ret = utilfdt_write(output_filename, blob);
|
||||
if (ret)
|
||||
fprintf(stderr, "\nFailed to write '%s'\n",
|
||||
output_filename);
|
||||
|
||||
out_err:
|
||||
if (ovblob) {
|
||||
for (i = 0; i < argc; i++) {
|
||||
if (ovblob[i])
|
||||
free(ovblob[i]);
|
||||
}
|
||||
free(ovblob);
|
||||
}
|
||||
free(blob);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int opt, i;
|
||||
char *input_filename = NULL;
|
||||
char *output_filename = NULL;
|
||||
|
||||
while ((opt = util_getopt_long()) != EOF) {
|
||||
switch (opt) {
|
||||
case_USAGE_COMMON_FLAGS
|
||||
|
||||
case 'i':
|
||||
input_filename = optarg;
|
||||
break;
|
||||
case 'o':
|
||||
output_filename = optarg;
|
||||
break;
|
||||
case 'v':
|
||||
verbose = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!input_filename)
|
||||
usage("missing input file");
|
||||
|
||||
if (!output_filename)
|
||||
usage("missing output file");
|
||||
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
|
||||
if (argc <= 0)
|
||||
usage("missing overlay file(s)");
|
||||
|
||||
if (verbose) {
|
||||
printf("input = %s\n", input_filename);
|
||||
printf("output = %s\n", output_filename);
|
||||
for (i = 0; i < argc; i++)
|
||||
printf("overlay[%d] = %s\n", i, argv[i]);
|
||||
}
|
||||
|
||||
if (do_fdtoverlay(input_filename, output_filename, argc, argv))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -149,7 +149,7 @@ static void asm_emit_align(void *e, int a)
|
|||
static void asm_emit_data(void *e, struct data d)
|
||||
{
|
||||
FILE *f = e;
|
||||
int off = 0;
|
||||
unsigned int off = 0;
|
||||
struct marker *m = d.markers;
|
||||
|
||||
for_each_marker_of_type(m, LABEL)
|
||||
|
@ -219,7 +219,7 @@ static struct emitter asm_emitter = {
|
|||
|
||||
static int stringtable_insert(struct data *d, const char *str)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
/* FIXME: do this more efficiently? */
|
||||
|
||||
|
@ -345,7 +345,7 @@ static void make_fdt_header(struct fdt_header *fdt,
|
|||
void dt_to_blob(FILE *f, struct dt_info *dti, int version)
|
||||
{
|
||||
struct version_info *vi = NULL;
|
||||
int i;
|
||||
unsigned int i;
|
||||
struct data blob = empty_data;
|
||||
struct data reservebuf = empty_data;
|
||||
struct data dtbuf = empty_data;
|
||||
|
@ -446,7 +446,7 @@ static void dump_stringtable_asm(FILE *f, struct data strbuf)
|
|||
void dt_to_asm(FILE *f, struct dt_info *dti, int version)
|
||||
{
|
||||
struct version_info *vi = NULL;
|
||||
int i;
|
||||
unsigned int i;
|
||||
struct data strbuf = empty_data;
|
||||
struct reserve_info *re;
|
||||
const char *symprefix = "dt";
|
||||
|
|
|
@ -22,6 +22,10 @@ int32_t fdt_ro_probe_(const void *fdt)
|
|||
if (can_assume(VALID_DTB))
|
||||
return totalsize;
|
||||
|
||||
/* The device tree must be at an 8-byte aligned address */
|
||||
if ((uintptr_t)fdt & 7)
|
||||
return -FDT_ERR_ALIGNMENT;
|
||||
|
||||
if (fdt_magic(fdt) == FDT_MAGIC) {
|
||||
/* Complete tree */
|
||||
if (!can_assume(LATEST)) {
|
||||
|
|
|
@ -181,8 +181,8 @@ int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size)
|
|||
if (!can_assume(VALID_INPUT) && !re)
|
||||
return -FDT_ERR_BADOFFSET;
|
||||
|
||||
*address = fdt64_ld(&re->address);
|
||||
*size = fdt64_ld(&re->size);
|
||||
*address = fdt64_ld_(&re->address);
|
||||
*size = fdt64_ld_(&re->size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ int fdt_num_mem_rsv(const void *fdt)
|
|||
const struct fdt_reserve_entry *re;
|
||||
|
||||
for (i = 0; (re = fdt_mem_rsv(fdt, i)) != NULL; i++) {
|
||||
if (fdt64_ld(&re->size) == 0)
|
||||
if (fdt64_ld_(&re->size) == 0)
|
||||
return i;
|
||||
}
|
||||
return -FDT_ERR_TRUNCATED;
|
||||
|
@ -370,7 +370,7 @@ static const struct fdt_property *fdt_get_property_by_offset_(const void *fdt,
|
|||
prop = fdt_offset_ptr_(fdt, offset);
|
||||
|
||||
if (lenp)
|
||||
*lenp = fdt32_ld(&prop->len);
|
||||
*lenp = fdt32_ld_(&prop->len);
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ static const struct fdt_property *fdt_get_property_namelen_(const void *fdt,
|
|||
offset = -FDT_ERR_INTERNAL;
|
||||
break;
|
||||
}
|
||||
if (fdt_string_eq_(fdt, fdt32_ld(&prop->nameoff),
|
||||
if (fdt_string_eq_(fdt, fdt32_ld_(&prop->nameoff),
|
||||
name, namelen)) {
|
||||
if (poffset)
|
||||
*poffset = offset;
|
||||
|
@ -461,7 +461,7 @@ const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
|
|||
|
||||
/* Handle realignment */
|
||||
if (!can_assume(LATEST) && fdt_version(fdt) < 0x10 &&
|
||||
(poffset + sizeof(*prop)) % 8 && fdt32_ld(&prop->len) >= 8)
|
||||
(poffset + sizeof(*prop)) % 8 && fdt32_ld_(&prop->len) >= 8)
|
||||
return prop->data + 4;
|
||||
return prop->data;
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ const void *fdt_getprop_by_offset(const void *fdt, int offset,
|
|||
int namelen;
|
||||
|
||||
if (!can_assume(VALID_INPUT)) {
|
||||
name = fdt_get_string(fdt, fdt32_ld(&prop->nameoff),
|
||||
name = fdt_get_string(fdt, fdt32_ld_(&prop->nameoff),
|
||||
&namelen);
|
||||
if (!name) {
|
||||
if (lenp)
|
||||
|
@ -488,13 +488,13 @@ const void *fdt_getprop_by_offset(const void *fdt, int offset,
|
|||
}
|
||||
*namep = name;
|
||||
} else {
|
||||
*namep = fdt_string(fdt, fdt32_ld(&prop->nameoff));
|
||||
*namep = fdt_string(fdt, fdt32_ld_(&prop->nameoff));
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle realignment */
|
||||
if (!can_assume(LATEST) && fdt_version(fdt) < 0x10 &&
|
||||
(offset + sizeof(*prop)) % 8 && fdt32_ld(&prop->len) >= 8)
|
||||
(offset + sizeof(*prop)) % 8 && fdt32_ld_(&prop->len) >= 8)
|
||||
return prop->data + 4;
|
||||
return prop->data;
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ uint32_t fdt_get_phandle(const void *fdt, int nodeoffset)
|
|||
return 0;
|
||||
}
|
||||
|
||||
return fdt32_ld(php);
|
||||
return fdt32_ld_(php);
|
||||
}
|
||||
|
||||
const char *fdt_get_alias_namelen(const void *fdt,
|
||||
|
|
|
@ -428,12 +428,14 @@ int fdt_open_into(const void *fdt, void *buf, int bufsize)
|
|||
|
||||
if (can_assume(LATEST) || fdt_version(fdt) >= 17) {
|
||||
struct_size = fdt_size_dt_struct(fdt);
|
||||
} else {
|
||||
} else if (fdt_version(fdt) == 16) {
|
||||
struct_size = 0;
|
||||
while (fdt_next_tag(fdt, struct_size, &struct_size) != FDT_END)
|
||||
;
|
||||
if (struct_size < 0)
|
||||
return struct_size;
|
||||
} else {
|
||||
return -FDT_ERR_BADVERSION;
|
||||
}
|
||||
|
||||
if (can_assume(LIBFDT_ORDER) ||
|
||||
|
|
|
@ -377,7 +377,7 @@ int fdt_finish(void *fdt)
|
|||
fdt_set_totalsize(fdt, newstroffset + fdt_size_dt_strings(fdt));
|
||||
|
||||
/* And fix up fields that were keeping intermediate state. */
|
||||
fdt_set_last_comp_version(fdt, FDT_FIRST_SUPPORTED_VERSION);
|
||||
fdt_set_last_comp_version(fdt, FDT_LAST_COMPATIBLE_VERSION);
|
||||
fdt_set_magic(fdt, FDT_MAGIC);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -14,6 +14,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#define FDT_FIRST_SUPPORTED_VERSION 0x02
|
||||
#define FDT_LAST_COMPATIBLE_VERSION 0x10
|
||||
#define FDT_LAST_SUPPORTED_VERSION 0x11
|
||||
|
||||
/* Error codes: informative error codes */
|
||||
|
@ -101,7 +102,11 @@ extern "C" {
|
|||
/* FDT_ERR_BADFLAGS: The function was passed a flags field that
|
||||
* contains invalid flags or an invalid combination of flags. */
|
||||
|
||||
#define FDT_ERR_MAX 18
|
||||
#define FDT_ERR_ALIGNMENT 19
|
||||
/* FDT_ERR_ALIGNMENT: The device tree base address is not 8-byte
|
||||
* aligned. */
|
||||
|
||||
#define FDT_ERR_MAX 19
|
||||
|
||||
/* constants */
|
||||
#define FDT_MAX_PHANDLE 0xfffffffe
|
||||
|
@ -122,12 +127,10 @@ static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
|
|||
uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
|
||||
|
||||
/*
|
||||
* Alignment helpers:
|
||||
* These helpers access words from a device tree blob. They're
|
||||
* built to work even with unaligned pointers on platforms (ike
|
||||
* ARM) that don't like unaligned loads and stores
|
||||
* External helpers to access words from a device tree blob. They're built
|
||||
* to work even with unaligned pointers on platforms (such as ARMv5) that don't
|
||||
* like unaligned loads and stores.
|
||||
*/
|
||||
|
||||
static inline uint32_t fdt32_ld(const fdt32_t *p)
|
||||
{
|
||||
const uint8_t *bp = (const uint8_t *)p;
|
||||
|
@ -184,22 +187,22 @@ int fdt_next_node(const void *fdt, int offset, int *depth);
|
|||
|
||||
/**
|
||||
* fdt_first_subnode() - get offset of first direct subnode
|
||||
*
|
||||
* @fdt: FDT blob
|
||||
* @offset: Offset of node to check
|
||||
* @return offset of first subnode, or -FDT_ERR_NOTFOUND if there is none
|
||||
*
|
||||
* Return: offset of first subnode, or -FDT_ERR_NOTFOUND if there is none
|
||||
*/
|
||||
int fdt_first_subnode(const void *fdt, int offset);
|
||||
|
||||
/**
|
||||
* fdt_next_subnode() - get offset of next direct subnode
|
||||
* @fdt: FDT blob
|
||||
* @offset: Offset of previous subnode
|
||||
*
|
||||
* After first calling fdt_first_subnode(), call this function repeatedly to
|
||||
* get direct subnodes of a parent node.
|
||||
*
|
||||
* @fdt: FDT blob
|
||||
* @offset: Offset of previous subnode
|
||||
* @return offset of next subnode, or -FDT_ERR_NOTFOUND if there are no more
|
||||
* Return: offset of next subnode, or -FDT_ERR_NOTFOUND if there are no more
|
||||
* subnodes
|
||||
*/
|
||||
int fdt_next_subnode(const void *fdt, int offset);
|
||||
|
@ -225,7 +228,6 @@ int fdt_next_subnode(const void *fdt, int offset);
|
|||
* Note that this is implemented as a macro and @node is used as
|
||||
* iterator in the loop. The parent variable be constant or even a
|
||||
* literal.
|
||||
*
|
||||
*/
|
||||
#define fdt_for_each_subnode(node, fdt, parent) \
|
||||
for (node = fdt_first_subnode(fdt, parent); \
|
||||
|
@ -269,17 +271,21 @@ fdt_set_hdr_(size_dt_struct);
|
|||
/**
|
||||
* fdt_header_size - return the size of the tree's header
|
||||
* @fdt: pointer to a flattened device tree
|
||||
*
|
||||
* Return: size of DTB header in bytes
|
||||
*/
|
||||
size_t fdt_header_size(const void *fdt);
|
||||
|
||||
/**
|
||||
* fdt_header_size_ - internal function which takes a version number
|
||||
* fdt_header_size_ - internal function to get header size from a version number
|
||||
* @version: devicetree version number
|
||||
*
|
||||
* Return: size of DTB header in bytes
|
||||
*/
|
||||
size_t fdt_header_size_(uint32_t version);
|
||||
|
||||
/**
|
||||
* fdt_check_header - sanity check a device tree header
|
||||
|
||||
* @fdt: pointer to data which might be a flattened device tree
|
||||
*
|
||||
* fdt_check_header() checks that the given buffer contains what
|
||||
|
@ -404,8 +410,7 @@ static inline uint32_t fdt_get_max_phandle(const void *fdt)
|
|||
* highest phandle value in the device tree blob) will be returned in the
|
||||
* @phandle parameter.
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success or a negative error-code on failure
|
||||
* Return: 0 on success or a negative error-code on failure
|
||||
*/
|
||||
int fdt_generate_phandle(const void *fdt, uint32_t *phandle);
|
||||
|
||||
|
@ -425,9 +430,11 @@ int fdt_num_mem_rsv(const void *fdt);
|
|||
/**
|
||||
* fdt_get_mem_rsv - retrieve one memory reserve map entry
|
||||
* @fdt: pointer to the device tree blob
|
||||
* @address, @size: pointers to 64-bit variables
|
||||
* @n: index of reserve map entry
|
||||
* @address: pointer to 64-bit variable to hold the start address
|
||||
* @size: pointer to 64-bit variable to hold the size of the entry
|
||||
*
|
||||
* On success, *address and *size will contain the address and size of
|
||||
* On success, @address and @size will contain the address and size of
|
||||
* the n-th reserve map entry from the device tree blob, in
|
||||
* native-endian format.
|
||||
*
|
||||
|
@ -450,6 +457,8 @@ int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
|
|||
* namelen characters of name for matching the subnode name. This is
|
||||
* useful for finding subnodes based on a portion of a larger string,
|
||||
* such as a full path.
|
||||
*
|
||||
* Return: offset of the subnode or -FDT_ERR_NOTFOUND if name not found.
|
||||
*/
|
||||
#ifndef SWIG /* Not available in Python */
|
||||
int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
|
||||
|
@ -489,6 +498,8 @@ int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
|
|||
*
|
||||
* Identical to fdt_path_offset(), but only consider the first namelen
|
||||
* characters of path as the path name.
|
||||
*
|
||||
* Return: offset of the node or negative libfdt error value otherwise
|
||||
*/
|
||||
#ifndef SWIG /* Not available in Python */
|
||||
int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen);
|
||||
|
@ -588,7 +599,7 @@ int fdt_next_property_offset(const void *fdt, int offset);
|
|||
/**
|
||||
* fdt_for_each_property_offset - iterate over all properties of a node
|
||||
*
|
||||
* @property_offset: property offset (int, lvalue)
|
||||
* @property: property offset (int, lvalue)
|
||||
* @fdt: FDT blob (const void *)
|
||||
* @node: node offset (int)
|
||||
*
|
||||
|
@ -653,6 +664,9 @@ const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
|
|||
*
|
||||
* Identical to fdt_get_property(), but only examine the first namelen
|
||||
* characters of name for matching the property name.
|
||||
*
|
||||
* Return: pointer to the structure representing the property, or NULL
|
||||
* if not found
|
||||
*/
|
||||
#ifndef SWIG /* Not available in Python */
|
||||
const struct fdt_property *fdt_get_property_namelen(const void *fdt,
|
||||
|
@ -745,6 +759,8 @@ const void *fdt_getprop_by_offset(const void *fdt, int offset,
|
|||
*
|
||||
* Identical to fdt_getprop(), but only examine the first namelen
|
||||
* characters of name for matching the property name.
|
||||
*
|
||||
* Return: pointer to the property's value or NULL on error
|
||||
*/
|
||||
#ifndef SWIG /* Not available in Python */
|
||||
const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
|
||||
|
@ -766,10 +782,10 @@ static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset,
|
|||
* @lenp: pointer to an integer variable (will be overwritten) or NULL
|
||||
*
|
||||
* fdt_getprop() retrieves a pointer to the value of the property
|
||||
* named 'name' of the node at offset nodeoffset (this will be a
|
||||
* named @name of the node at offset @nodeoffset (this will be a
|
||||
* pointer to within the device blob itself, not a copy of the value).
|
||||
* If lenp is non-NULL, the length of the property value is also
|
||||
* returned, in the integer pointed to by lenp.
|
||||
* If @lenp is non-NULL, the length of the property value is also
|
||||
* returned, in the integer pointed to by @lenp.
|
||||
*
|
||||
* returns:
|
||||
* pointer to the property's value
|
||||
|
@ -814,8 +830,11 @@ uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
|
|||
* @name: name of the alias th look up
|
||||
* @namelen: number of characters of name to consider
|
||||
*
|
||||
* Identical to fdt_get_alias(), but only examine the first namelen
|
||||
* characters of name for matching the alias name.
|
||||
* Identical to fdt_get_alias(), but only examine the first @namelen
|
||||
* characters of @name for matching the alias name.
|
||||
*
|
||||
* Return: a pointer to the expansion of the alias named @name, if it exists,
|
||||
* NULL otherwise
|
||||
*/
|
||||
#ifndef SWIG /* Not available in Python */
|
||||
const char *fdt_get_alias_namelen(const void *fdt,
|
||||
|
@ -828,7 +847,7 @@ const char *fdt_get_alias_namelen(const void *fdt,
|
|||
* @name: name of the alias th look up
|
||||
*
|
||||
* fdt_get_alias() retrieves the value of a given alias. That is, the
|
||||
* value of the property named 'name' in the node /aliases.
|
||||
* value of the property named @name in the node /aliases.
|
||||
*
|
||||
* returns:
|
||||
* a pointer to the expansion of the alias named 'name', if it exists
|
||||
|
@ -1004,14 +1023,13 @@ int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
|
|||
int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle);
|
||||
|
||||
/**
|
||||
* fdt_node_check_compatible: check a node's compatible property
|
||||
* fdt_node_check_compatible - check a node's compatible property
|
||||
* @fdt: pointer to the device tree blob
|
||||
* @nodeoffset: offset of a tree node
|
||||
* @compatible: string to match against
|
||||
*
|
||||
*
|
||||
* fdt_node_check_compatible() returns 0 if the given node contains a
|
||||
* 'compatible' property with the given string as one of its elements,
|
||||
* @compatible property with the given string as one of its elements,
|
||||
* it returns non-zero otherwise, or on error.
|
||||
*
|
||||
* returns:
|
||||
|
@ -1075,7 +1093,7 @@ int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
|
|||
* one or more strings, each terminated by \0, as is found in a device tree
|
||||
* "compatible" property.
|
||||
*
|
||||
* @return: 1 if the string is found in the list, 0 not found, or invalid list
|
||||
* Return: 1 if the string is found in the list, 0 not found, or invalid list
|
||||
*/
|
||||
int fdt_stringlist_contains(const char *strlist, int listlen, const char *str);
|
||||
|
||||
|
@ -1084,7 +1102,8 @@ int fdt_stringlist_contains(const char *strlist, int listlen, const char *str);
|
|||
* @fdt: pointer to the device tree blob
|
||||
* @nodeoffset: offset of a tree node
|
||||
* @property: name of the property containing the string list
|
||||
* @return:
|
||||
*
|
||||
* Return:
|
||||
* the number of strings in the given property
|
||||
* -FDT_ERR_BADVALUE if the property value is not NUL-terminated
|
||||
* -FDT_ERR_NOTFOUND if the property does not exist
|
||||
|
@ -1104,7 +1123,7 @@ int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property);
|
|||
* small-valued cell properties, such as #address-cells, when searching for
|
||||
* the empty string.
|
||||
*
|
||||
* @return:
|
||||
* return:
|
||||
* the index of the string in the list of strings
|
||||
* -FDT_ERR_BADVALUE if the property value is not NUL-terminated
|
||||
* -FDT_ERR_NOTFOUND if the property does not exist or does not contain
|
||||
|
@ -1128,7 +1147,7 @@ int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property,
|
|||
* If non-NULL, the length of the string (on success) or a negative error-code
|
||||
* (on failure) will be stored in the integer pointer to by lenp.
|
||||
*
|
||||
* @return:
|
||||
* Return:
|
||||
* A pointer to the string at the given index in the string list or NULL on
|
||||
* failure. On success the length of the string will be stored in the memory
|
||||
* location pointed to by the lenp parameter, if non-NULL. On failure one of
|
||||
|
@ -1217,6 +1236,8 @@ int fdt_size_cells(const void *fdt, int nodeoffset);
|
|||
* starting from the given index, and using only the first characters
|
||||
* of the name. It is useful when you want to manipulate only one value of
|
||||
* an array and you have a string that doesn't end with \0.
|
||||
*
|
||||
* Return: 0 on success, negative libfdt error value otherwise
|
||||
*/
|
||||
#ifndef SWIG /* Not available in Python */
|
||||
int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset,
|
||||
|
@ -1330,8 +1351,13 @@ static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset,
|
|||
|
||||
/**
|
||||
* fdt_setprop_inplace_cell - change the value of a single-cell property
|
||||
* @fdt: pointer to the device tree blob
|
||||
* @nodeoffset: offset of the node containing the property
|
||||
* @name: name of the property to change the value of
|
||||
* @val: new value of the 32-bit cell
|
||||
*
|
||||
* This is an alternative name for fdt_setprop_inplace_u32()
|
||||
* Return: 0 on success, negative libfdt error number otherwise.
|
||||
*/
|
||||
static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset,
|
||||
const char *name, uint32_t val)
|
||||
|
@ -1403,7 +1429,7 @@ int fdt_nop_node(void *fdt, int nodeoffset);
|
|||
|
||||
/**
|
||||
* fdt_create_with_flags - begin creation of a new fdt
|
||||
* @fdt: pointer to memory allocated where fdt will be created
|
||||
* @buf: pointer to memory allocated where fdt will be created
|
||||
* @bufsize: size of the memory space at fdt
|
||||
* @flags: a valid combination of FDT_CREATE_FLAG_ flags, or 0.
|
||||
*
|
||||
|
@ -1421,7 +1447,7 @@ int fdt_create_with_flags(void *buf, int bufsize, uint32_t flags);
|
|||
|
||||
/**
|
||||
* fdt_create - begin creation of a new fdt
|
||||
* @fdt: pointer to memory allocated where fdt will be created
|
||||
* @buf: pointer to memory allocated where fdt will be created
|
||||
* @bufsize: size of the memory space at fdt
|
||||
*
|
||||
* fdt_create() is equivalent to fdt_create_with_flags() with flags=0.
|
||||
|
@ -1486,7 +1512,8 @@ int fdt_pack(void *fdt);
|
|||
/**
|
||||
* fdt_add_mem_rsv - add one memory reserve map entry
|
||||
* @fdt: pointer to the device tree blob
|
||||
* @address, @size: 64-bit values (native endian)
|
||||
* @address: 64-bit start address of the reserve map entry
|
||||
* @size: 64-bit size of the reserved region
|
||||
*
|
||||
* Adds a reserve map entry to the given blob reserving a region at
|
||||
* address address of length size.
|
||||
|
@ -1691,8 +1718,14 @@ static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name,
|
|||
|
||||
/**
|
||||
* fdt_setprop_cell - set a property to a single cell value
|
||||
* @fdt: pointer to the device tree blob
|
||||
* @nodeoffset: offset of the node whose property to change
|
||||
* @name: name of the property to change
|
||||
* @val: 32-bit integer value for the property (native endian)
|
||||
*
|
||||
* This is an alternative name for fdt_setprop_u32()
|
||||
*
|
||||
* Return: 0 on success, negative libfdt error value otherwise.
|
||||
*/
|
||||
static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
|
||||
uint32_t val)
|
||||
|
@ -1863,8 +1896,14 @@ static inline int fdt_appendprop_u64(void *fdt, int nodeoffset,
|
|||
|
||||
/**
|
||||
* fdt_appendprop_cell - append a single cell value to a property
|
||||
* @fdt: pointer to the device tree blob
|
||||
* @nodeoffset: offset of the node whose property to change
|
||||
* @name: name of the property to change
|
||||
* @val: 32-bit integer value to append to the property (native endian)
|
||||
*
|
||||
* This is an alternative name for fdt_appendprop_u32()
|
||||
*
|
||||
* Return: 0 on success, negative libfdt error value otherwise.
|
||||
*/
|
||||
static inline int fdt_appendprop_cell(void *fdt, int nodeoffset,
|
||||
const char *name, uint32_t val)
|
||||
|
@ -1967,13 +2006,16 @@ int fdt_delprop(void *fdt, int nodeoffset, const char *name);
|
|||
* fdt_add_subnode_namelen - creates a new node based on substring
|
||||
* @fdt: pointer to the device tree blob
|
||||
* @parentoffset: structure block offset of a node
|
||||
* @name: name of the subnode to locate
|
||||
* @name: name of the subnode to create
|
||||
* @namelen: number of characters of name to consider
|
||||
*
|
||||
* Identical to fdt_add_subnode(), but use only the first namelen
|
||||
* characters of name as the name of the new node. This is useful for
|
||||
* Identical to fdt_add_subnode(), but use only the first @namelen
|
||||
* characters of @name as the name of the new node. This is useful for
|
||||
* creating subnodes based on a portion of a larger string, such as a
|
||||
* full path.
|
||||
*
|
||||
* Return: structure block offset of the created subnode (>=0),
|
||||
* negative libfdt error value otherwise
|
||||
*/
|
||||
#ifndef SWIG /* Not available in Python */
|
||||
int fdt_add_subnode_namelen(void *fdt, int parentoffset,
|
||||
|
@ -1992,7 +2034,7 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset,
|
|||
*
|
||||
* This function will insert data into the blob, and will therefore
|
||||
* change the offsets of some existing nodes.
|
||||
|
||||
*
|
||||
* returns:
|
||||
* structure block offset of the created nodeequested subnode (>=0), on
|
||||
* success
|
||||
|
|
|
@ -46,6 +46,25 @@ static inline struct fdt_reserve_entry *fdt_mem_rsv_w_(void *fdt, int n)
|
|||
return (void *)(uintptr_t)fdt_mem_rsv_(fdt, n);
|
||||
}
|
||||
|
||||
/*
|
||||
* Internal helpers to access tructural elements of the device tree
|
||||
* blob (rather than for exaple reading integers from within property
|
||||
* values). We assume that we are either given a naturally aligned
|
||||
* address for the platform or if we are not, we are on a platform
|
||||
* where unaligned memory reads will be handled in a graceful manner.
|
||||
* If not the external helpers fdtXX_ld() from libfdt.h can be used
|
||||
* instead.
|
||||
*/
|
||||
static inline uint32_t fdt32_ld_(const fdt32_t *p)
|
||||
{
|
||||
return fdt32_to_cpu(*p);
|
||||
}
|
||||
|
||||
static inline uint64_t fdt64_ld_(const fdt64_t *p)
|
||||
{
|
||||
return fdt64_to_cpu(*p);
|
||||
}
|
||||
|
||||
#define FDT_SW_MAGIC (~FDT_MAGIC)
|
||||
|
||||
/**********************************************************************/
|
||||
|
|
|
@ -438,7 +438,7 @@ cell_t propval_cell(struct property *prop)
|
|||
return fdt32_to_cpu(*((fdt32_t *)prop->val.val));
|
||||
}
|
||||
|
||||
cell_t propval_cell_n(struct property *prop, int n)
|
||||
cell_t propval_cell_n(struct property *prop, unsigned int n)
|
||||
{
|
||||
assert(prop->val.len / sizeof(cell_t) >= n);
|
||||
return fdt32_to_cpu(*((fdt32_t *)prop->val.val + n));
|
||||
|
|
|
@ -20,7 +20,7 @@ struct search_path {
|
|||
static struct search_path *search_path_head, **search_path_tail;
|
||||
|
||||
/* Detect infinite include recursion. */
|
||||
#define MAX_SRCFILE_DEPTH (100)
|
||||
#define MAX_SRCFILE_DEPTH (200)
|
||||
static int srcfile_depth; /* = 0 */
|
||||
|
||||
static char *get_dirname(const char *path)
|
||||
|
|
|
@ -37,6 +37,7 @@ DTC_SOURCE="checks.c data.c dtc.c dtc.h flattree.c fstree.c livetree.c srcpos.c
|
|||
LIBFDT_SOURCE="fdt.c fdt.h fdt_addresses.c fdt_empty_tree.c \
|
||||
fdt_overlay.c fdt_ro.c fdt_rw.c fdt_strerror.c fdt_sw.c \
|
||||
fdt_wip.c libfdt.h libfdt_env.h libfdt_internal.h"
|
||||
FDTOVERLAY_SOURCE=fdtoverlay.c
|
||||
|
||||
get_last_dtc_version() {
|
||||
git log --oneline scripts/dtc/ | grep 'upstream' | head -1 | sed -e 's/^.* \(.*\)/\1/'
|
||||
|
@ -54,7 +55,7 @@ dtc_log=$(git log --oneline ${last_dtc_ver}..)
|
|||
|
||||
# Copy the files into the Linux tree
|
||||
cd $DTC_LINUX_PATH
|
||||
for f in $DTC_SOURCE; do
|
||||
for f in $DTC_SOURCE $FDTOVERLAY_SOURCE; do
|
||||
cp ${DTC_UPSTREAM_PATH}/${f} ${f}
|
||||
git add ${f}
|
||||
done
|
||||
|
|
|
@ -1 +1 @@
|
|||
#define DTC_VERSION "DTC 1.6.0-gcbca977e"
|
||||
#define DTC_VERSION "DTC 1.6.0-g183df9e9"
|
||||
|
|
|
@ -29,11 +29,11 @@ char *yaml_error_name[] = {
|
|||
(emitter)->problem, __func__, __LINE__); \
|
||||
})
|
||||
|
||||
static void yaml_propval_int(yaml_emitter_t *emitter, struct marker *markers, char *data, int len, int width)
|
||||
static void yaml_propval_int(yaml_emitter_t *emitter, struct marker *markers, char *data, unsigned int len, int width)
|
||||
{
|
||||
yaml_event_t event;
|
||||
void *tag;
|
||||
int off, start_offset = markers->offset;
|
||||
unsigned int off, start_offset = markers->offset;
|
||||
|
||||
switch(width) {
|
||||
case 1: tag = "!u8"; break;
|
||||
|
@ -112,7 +112,7 @@ static void yaml_propval_string(yaml_emitter_t *emitter, char *str, int len)
|
|||
static void yaml_propval(yaml_emitter_t *emitter, struct property *prop)
|
||||
{
|
||||
yaml_event_t event;
|
||||
int len = prop->val.len;
|
||||
unsigned int len = prop->val.len;
|
||||
struct marker *m = prop->val.markers;
|
||||
|
||||
/* Emit the property name */
|
||||
|
|
Загрузка…
Ссылка в новой задаче