Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scripts/dtc: Update to upstream version v1.6.0-51-g183df9e9c2b9

This adds the following commits from upstream:

183df9e9c2b9 gitignore: Ignore the swp files
0db6d09584e1 gitignore: Add cscope files
307afa1a7be8 Update Jon Loeliger's email
ca16a723fa9d fdtdump: Fix gcc11 warning
64990a272e8f srcpos: increase MAX_SRCFILE_DEPTH
163f0469bf2e dtc: Allow overlays to have .dtbo extension
3b01518e688d Set last_comp_version correctly in new dtb and fix potential version issues in fdt_open_into
f7e5737f26aa tests: Fix overlay_overlay_nosugar test case
7cd5d5fe43d5 libfdt: Tweak description of assume-aligned load helpers
a7c404099349 libfdt: Internally perform potentially unaligned loads
bab85e48a6f4 meson: increase default timeout for tests
f8b46098824d meson: do not assume python is installed, skip tests
30a56bce4f0b meson: fix -Wall warning
5e735860c478 libfdt: Check for 8-byte address alignment in fdt_ro_probe_()
67849a327927 build-sys: add meson build
05874d08212d pylibfdt: allow build out of tree
3bc3a6b9fe0c dtc: Fix signedness comparisons warnings: Wrap (-1)
e1147b159e92 dtc: Fix signedness comparisons warnings: change types
04cf1fdc0fcf convert-dtsv0: Fix signedness comparisons warning
b30013edb878 libfdt: Fix kernel-doc comments

Signed-off-by: Rob Herring <robh@kernel.org>

+350 -71
+3 -3
scripts/dtc/data.c
··· 21 21 free(d.val); 22 22 } 23 23 24 - struct data data_grow_for(struct data d, int xlen) 24 + struct data data_grow_for(struct data d, unsigned int xlen) 25 25 { 26 26 struct data nd; 27 - int newsize; 27 + unsigned int newsize; 28 28 29 29 if (xlen == 0) 30 30 return d; ··· 84 84 while (!feof(f) && (d.len < maxlen)) { 85 85 size_t chunksize, ret; 86 86 87 - if (maxlen == -1) 87 + if (maxlen == (size_t)-1) 88 88 chunksize = 4096; 89 89 else 90 90 chunksize = maxlen - d.len;
+4
scripts/dtc/dtc.c
··· 122 122 return "dts"; 123 123 if (!strcasecmp(s, ".yaml")) 124 124 return "yaml"; 125 + if (!strcasecmp(s, ".dtbo")) 126 + return "dtb"; 125 127 if (!strcasecmp(s, ".dtb")) 126 128 return "dtb"; 127 129 return fallback; ··· 358 356 dt_to_yaml(outf, dti); 359 357 #endif 360 358 } else if (streq(outform, "dtb")) { 359 + dt_to_blob(outf, dti, outversion); 360 + } else if (streq(outform, "dtbo")) { 361 361 dt_to_blob(outf, dti, outversion); 362 362 } else if (streq(outform, "asm")) { 363 363 dt_to_asm(outf, dti, outversion);
+4 -4
scripts/dtc/dtc.h
··· 105 105 106 106 struct marker { 107 107 enum markertype type; 108 - int offset; 108 + unsigned int offset; 109 109 char *ref; 110 110 struct marker *next; 111 111 }; 112 112 113 113 struct data { 114 - int len; 114 + unsigned int len; 115 115 char *val; 116 116 struct marker *markers; 117 117 }; ··· 129 129 130 130 void data_free(struct data d); 131 131 132 - struct data data_grow_for(struct data d, int xlen); 132 + struct data data_grow_for(struct data d, unsigned int xlen); 133 133 134 134 struct data data_copy_mem(const char *mem, int len); 135 135 struct data data_copy_escape_string(const char *s, int len); ··· 253 253 const char *get_unitname(struct node *node); 254 254 struct property *get_property(struct node *node, const char *propname); 255 255 cell_t propval_cell(struct property *prop); 256 - cell_t propval_cell_n(struct property *prop, int n); 256 + cell_t propval_cell_n(struct property *prop, unsigned int n); 257 257 struct property *get_property_by_label(struct node *tree, const char *label, 258 258 struct node **node); 259 259 struct marker *get_marker_label(struct node *tree, const char *label,
+208
scripts/dtc/fdtoverlay.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + /* 3 + * Copyright (c) 2017 Konsulko Group Inc. All rights reserved. 4 + * 5 + * Author: 6 + * Pantelis Antoniou <pantelis.antoniou@konsulko.com> 7 + */ 8 + 9 + #include <assert.h> 10 + #include <ctype.h> 11 + #include <getopt.h> 12 + #include <stdio.h> 13 + #include <stdlib.h> 14 + #include <string.h> 15 + #include <inttypes.h> 16 + 17 + #include <libfdt.h> 18 + 19 + #include "util.h" 20 + 21 + #define BUF_INCREMENT 65536 22 + 23 + /* Usage related data. */ 24 + static const char usage_synopsis[] = 25 + "apply a number of overlays to a base blob\n" 26 + " fdtoverlay <options> [<overlay.dtbo> [<overlay.dtbo>]]\n" 27 + "\n" 28 + USAGE_TYPE_MSG; 29 + static const char usage_short_opts[] = "i:o:v" USAGE_COMMON_SHORT_OPTS; 30 + static struct option const usage_long_opts[] = { 31 + {"input", required_argument, NULL, 'i'}, 32 + {"output", required_argument, NULL, 'o'}, 33 + {"verbose", no_argument, NULL, 'v'}, 34 + USAGE_COMMON_LONG_OPTS, 35 + }; 36 + static const char * const usage_opts_help[] = { 37 + "Input base DT blob", 38 + "Output DT blob", 39 + "Verbose messages", 40 + USAGE_COMMON_OPTS_HELP 41 + }; 42 + 43 + int verbose = 0; 44 + 45 + static void *apply_one(char *base, const char *overlay, size_t *buf_len, 46 + const char *name) 47 + { 48 + char *tmp = NULL; 49 + char *tmpo; 50 + int ret; 51 + 52 + /* 53 + * We take a copies first, because a a failed apply can trash 54 + * both the base blob and the overlay 55 + */ 56 + tmpo = xmalloc(fdt_totalsize(overlay)); 57 + 58 + do { 59 + tmp = xrealloc(tmp, *buf_len); 60 + ret = fdt_open_into(base, tmp, *buf_len); 61 + if (ret) { 62 + fprintf(stderr, 63 + "\nFailed to make temporary copy: %s\n", 64 + fdt_strerror(ret)); 65 + goto fail; 66 + } 67 + 68 + memcpy(tmpo, overlay, fdt_totalsize(overlay)); 69 + 70 + ret = fdt_overlay_apply(tmp, tmpo); 71 + if (ret == -FDT_ERR_NOSPACE) { 72 + *buf_len += BUF_INCREMENT; 73 + } 74 + } while (ret == -FDT_ERR_NOSPACE); 75 + 76 + if (ret) { 77 + fprintf(stderr, "\nFailed to apply '%s': %s\n", 78 + name, fdt_strerror(ret)); 79 + goto fail; 80 + } 81 + 82 + free(base); 83 + free(tmpo); 84 + return tmp; 85 + 86 + fail: 87 + free(tmpo); 88 + if (tmp) 89 + free(tmp); 90 + 91 + return NULL; 92 + } 93 + static int do_fdtoverlay(const char *input_filename, 94 + const char *output_filename, 95 + int argc, char *argv[]) 96 + { 97 + char *blob = NULL; 98 + char **ovblob = NULL; 99 + size_t buf_len; 100 + int i, ret = -1; 101 + 102 + blob = utilfdt_read(input_filename, &buf_len); 103 + if (!blob) { 104 + fprintf(stderr, "\nFailed to read '%s'\n", input_filename); 105 + goto out_err; 106 + } 107 + if (fdt_totalsize(blob) > buf_len) { 108 + fprintf(stderr, 109 + "\nBase blob is incomplete (%lu / %" PRIu32 " bytes read)\n", 110 + (unsigned long)buf_len, fdt_totalsize(blob)); 111 + goto out_err; 112 + } 113 + 114 + /* allocate blob pointer array */ 115 + ovblob = xmalloc(sizeof(*ovblob) * argc); 116 + memset(ovblob, 0, sizeof(*ovblob) * argc); 117 + 118 + /* read and keep track of the overlay blobs */ 119 + for (i = 0; i < argc; i++) { 120 + size_t ov_len; 121 + ovblob[i] = utilfdt_read(argv[i], &ov_len); 122 + if (!ovblob[i]) { 123 + fprintf(stderr, "\nFailed to read '%s'\n", argv[i]); 124 + goto out_err; 125 + } 126 + if (fdt_totalsize(ovblob[i]) > ov_len) { 127 + fprintf(stderr, 128 + "\nOverlay '%s' is incomplete (%lu / %" PRIu32 " bytes read)\n", 129 + argv[i], (unsigned long)ov_len, 130 + fdt_totalsize(ovblob[i])); 131 + goto out_err; 132 + } 133 + } 134 + 135 + buf_len = fdt_totalsize(blob); 136 + 137 + /* apply the overlays in sequence */ 138 + for (i = 0; i < argc; i++) { 139 + blob = apply_one(blob, ovblob[i], &buf_len, argv[i]); 140 + if (!blob) 141 + goto out_err; 142 + } 143 + 144 + fdt_pack(blob); 145 + ret = utilfdt_write(output_filename, blob); 146 + if (ret) 147 + fprintf(stderr, "\nFailed to write '%s'\n", 148 + output_filename); 149 + 150 + out_err: 151 + if (ovblob) { 152 + for (i = 0; i < argc; i++) { 153 + if (ovblob[i]) 154 + free(ovblob[i]); 155 + } 156 + free(ovblob); 157 + } 158 + free(blob); 159 + 160 + return ret; 161 + } 162 + 163 + int main(int argc, char *argv[]) 164 + { 165 + int opt, i; 166 + char *input_filename = NULL; 167 + char *output_filename = NULL; 168 + 169 + while ((opt = util_getopt_long()) != EOF) { 170 + switch (opt) { 171 + case_USAGE_COMMON_FLAGS 172 + 173 + case 'i': 174 + input_filename = optarg; 175 + break; 176 + case 'o': 177 + output_filename = optarg; 178 + break; 179 + case 'v': 180 + verbose = 1; 181 + break; 182 + } 183 + } 184 + 185 + if (!input_filename) 186 + usage("missing input file"); 187 + 188 + if (!output_filename) 189 + usage("missing output file"); 190 + 191 + argv += optind; 192 + argc -= optind; 193 + 194 + if (argc <= 0) 195 + usage("missing overlay file(s)"); 196 + 197 + if (verbose) { 198 + printf("input = %s\n", input_filename); 199 + printf("output = %s\n", output_filename); 200 + for (i = 0; i < argc; i++) 201 + printf("overlay[%d] = %s\n", i, argv[i]); 202 + } 203 + 204 + if (do_fdtoverlay(input_filename, output_filename, argc, argv)) 205 + return 1; 206 + 207 + return 0; 208 + }
+4 -4
scripts/dtc/flattree.c
··· 149 149 static void asm_emit_data(void *e, struct data d) 150 150 { 151 151 FILE *f = e; 152 - int off = 0; 152 + unsigned int off = 0; 153 153 struct marker *m = d.markers; 154 154 155 155 for_each_marker_of_type(m, LABEL) ··· 219 219 220 220 static int stringtable_insert(struct data *d, const char *str) 221 221 { 222 - int i; 222 + unsigned int i; 223 223 224 224 /* FIXME: do this more efficiently? */ 225 225 ··· 345 345 void dt_to_blob(FILE *f, struct dt_info *dti, int version) 346 346 { 347 347 struct version_info *vi = NULL; 348 - int i; 348 + unsigned int i; 349 349 struct data blob = empty_data; 350 350 struct data reservebuf = empty_data; 351 351 struct data dtbuf = empty_data; ··· 446 446 void dt_to_asm(FILE *f, struct dt_info *dti, int version) 447 447 { 448 448 struct version_info *vi = NULL; 449 - int i; 449 + unsigned int i; 450 450 struct data strbuf = empty_data; 451 451 struct reserve_info *re; 452 452 const char *symprefix = "dt";
+4
scripts/dtc/libfdt/fdt.c
··· 22 22 if (can_assume(VALID_DTB)) 23 23 return totalsize; 24 24 25 + /* The device tree must be at an 8-byte aligned address */ 26 + if ((uintptr_t)fdt & 7) 27 + return -FDT_ERR_ALIGNMENT; 28 + 25 29 if (fdt_magic(fdt) == FDT_MAGIC) { 26 30 /* Complete tree */ 27 31 if (!can_assume(LATEST)) {
+10 -10
scripts/dtc/libfdt/fdt_ro.c
··· 181 181 if (!can_assume(VALID_INPUT) && !re) 182 182 return -FDT_ERR_BADOFFSET; 183 183 184 - *address = fdt64_ld(&re->address); 185 - *size = fdt64_ld(&re->size); 184 + *address = fdt64_ld_(&re->address); 185 + *size = fdt64_ld_(&re->size); 186 186 return 0; 187 187 } 188 188 ··· 192 192 const struct fdt_reserve_entry *re; 193 193 194 194 for (i = 0; (re = fdt_mem_rsv(fdt, i)) != NULL; i++) { 195 - if (fdt64_ld(&re->size) == 0) 195 + if (fdt64_ld_(&re->size) == 0) 196 196 return i; 197 197 } 198 198 return -FDT_ERR_TRUNCATED; ··· 370 370 prop = fdt_offset_ptr_(fdt, offset); 371 371 372 372 if (lenp) 373 - *lenp = fdt32_ld(&prop->len); 373 + *lenp = fdt32_ld_(&prop->len); 374 374 375 375 return prop; 376 376 } ··· 408 408 offset = -FDT_ERR_INTERNAL; 409 409 break; 410 410 } 411 - if (fdt_string_eq_(fdt, fdt32_ld(&prop->nameoff), 411 + if (fdt_string_eq_(fdt, fdt32_ld_(&prop->nameoff), 412 412 name, namelen)) { 413 413 if (poffset) 414 414 *poffset = offset; ··· 461 461 462 462 /* Handle realignment */ 463 463 if (!can_assume(LATEST) && fdt_version(fdt) < 0x10 && 464 - (poffset + sizeof(*prop)) % 8 && fdt32_ld(&prop->len) >= 8) 464 + (poffset + sizeof(*prop)) % 8 && fdt32_ld_(&prop->len) >= 8) 465 465 return prop->data + 4; 466 466 return prop->data; 467 467 } ··· 479 479 int namelen; 480 480 481 481 if (!can_assume(VALID_INPUT)) { 482 - name = fdt_get_string(fdt, fdt32_ld(&prop->nameoff), 482 + name = fdt_get_string(fdt, fdt32_ld_(&prop->nameoff), 483 483 &namelen); 484 484 if (!name) { 485 485 if (lenp) ··· 488 488 } 489 489 *namep = name; 490 490 } else { 491 - *namep = fdt_string(fdt, fdt32_ld(&prop->nameoff)); 491 + *namep = fdt_string(fdt, fdt32_ld_(&prop->nameoff)); 492 492 } 493 493 } 494 494 495 495 /* Handle realignment */ 496 496 if (!can_assume(LATEST) && fdt_version(fdt) < 0x10 && 497 - (offset + sizeof(*prop)) % 8 && fdt32_ld(&prop->len) >= 8) 497 + (offset + sizeof(*prop)) % 8 && fdt32_ld_(&prop->len) >= 8) 498 498 return prop->data + 4; 499 499 return prop->data; 500 500 } ··· 519 519 return 0; 520 520 } 521 521 522 - return fdt32_ld(php); 522 + return fdt32_ld_(php); 523 523 } 524 524 525 525 const char *fdt_get_alias_namelen(const void *fdt,
+3 -1
scripts/dtc/libfdt/fdt_rw.c
··· 428 428 429 429 if (can_assume(LATEST) || fdt_version(fdt) >= 17) { 430 430 struct_size = fdt_size_dt_struct(fdt); 431 - } else { 431 + } else if (fdt_version(fdt) == 16) { 432 432 struct_size = 0; 433 433 while (fdt_next_tag(fdt, struct_size, &struct_size) != FDT_END) 434 434 ; 435 435 if (struct_size < 0) 436 436 return struct_size; 437 + } else { 438 + return -FDT_ERR_BADVERSION; 437 439 } 438 440 439 441 if (can_assume(LIBFDT_ORDER) ||
+1 -1
scripts/dtc/libfdt/fdt_sw.c
··· 377 377 fdt_set_totalsize(fdt, newstroffset + fdt_size_dt_strings(fdt)); 378 378 379 379 /* And fix up fields that were keeping intermediate state. */ 380 - fdt_set_last_comp_version(fdt, FDT_FIRST_SUPPORTED_VERSION); 380 + fdt_set_last_comp_version(fdt, FDT_LAST_COMPATIBLE_VERSION); 381 381 fdt_set_magic(fdt, FDT_MAGIC); 382 382 383 383 return 0;
+84 -42
scripts/dtc/libfdt/libfdt.h
··· 14 14 #endif 15 15 16 16 #define FDT_FIRST_SUPPORTED_VERSION 0x02 17 + #define FDT_LAST_COMPATIBLE_VERSION 0x10 17 18 #define FDT_LAST_SUPPORTED_VERSION 0x11 18 19 19 20 /* Error codes: informative error codes */ ··· 102 101 /* FDT_ERR_BADFLAGS: The function was passed a flags field that 103 102 * contains invalid flags or an invalid combination of flags. */ 104 103 105 - #define FDT_ERR_MAX 18 104 + #define FDT_ERR_ALIGNMENT 19 105 + /* FDT_ERR_ALIGNMENT: The device tree base address is not 8-byte 106 + * aligned. */ 107 + 108 + #define FDT_ERR_MAX 19 106 109 107 110 /* constants */ 108 111 #define FDT_MAX_PHANDLE 0xfffffffe ··· 127 122 uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset); 128 123 129 124 /* 130 - * Alignment helpers: 131 - * These helpers access words from a device tree blob. They're 132 - * built to work even with unaligned pointers on platforms (ike 133 - * ARM) that don't like unaligned loads and stores 125 + * External helpers to access words from a device tree blob. They're built 126 + * to work even with unaligned pointers on platforms (such as ARMv5) that don't 127 + * like unaligned loads and stores. 134 128 */ 135 - 136 129 static inline uint32_t fdt32_ld(const fdt32_t *p) 137 130 { 138 131 const uint8_t *bp = (const uint8_t *)p; ··· 187 184 188 185 /** 189 186 * fdt_first_subnode() - get offset of first direct subnode 190 - * 191 187 * @fdt: FDT blob 192 188 * @offset: Offset of node to check 193 - * @return offset of first subnode, or -FDT_ERR_NOTFOUND if there is none 189 + * 190 + * Return: offset of first subnode, or -FDT_ERR_NOTFOUND if there is none 194 191 */ 195 192 int fdt_first_subnode(const void *fdt, int offset); 196 193 197 194 /** 198 195 * fdt_next_subnode() - get offset of next direct subnode 196 + * @fdt: FDT blob 197 + * @offset: Offset of previous subnode 199 198 * 200 199 * After first calling fdt_first_subnode(), call this function repeatedly to 201 200 * get direct subnodes of a parent node. 202 201 * 203 - * @fdt: FDT blob 204 - * @offset: Offset of previous subnode 205 - * @return offset of next subnode, or -FDT_ERR_NOTFOUND if there are no more 206 - * subnodes 202 + * Return: offset of next subnode, or -FDT_ERR_NOTFOUND if there are no more 203 + * subnodes 207 204 */ 208 205 int fdt_next_subnode(const void *fdt, int offset); 209 206 ··· 228 225 * Note that this is implemented as a macro and @node is used as 229 226 * iterator in the loop. The parent variable be constant or even a 230 227 * literal. 231 - * 232 228 */ 233 229 #define fdt_for_each_subnode(node, fdt, parent) \ 234 230 for (node = fdt_first_subnode(fdt, parent); \ ··· 271 269 /** 272 270 * fdt_header_size - return the size of the tree's header 273 271 * @fdt: pointer to a flattened device tree 272 + * 273 + * Return: size of DTB header in bytes 274 274 */ 275 275 size_t fdt_header_size(const void *fdt); 276 276 277 277 /** 278 - * fdt_header_size_ - internal function which takes a version number 278 + * fdt_header_size_ - internal function to get header size from a version number 279 + * @version: devicetree version number 280 + * 281 + * Return: size of DTB header in bytes 279 282 */ 280 283 size_t fdt_header_size_(uint32_t version); 281 284 282 285 /** 283 286 * fdt_check_header - sanity check a device tree header 284 - 285 287 * @fdt: pointer to data which might be a flattened device tree 286 288 * 287 289 * fdt_check_header() checks that the given buffer contains what ··· 410 404 * highest phandle value in the device tree blob) will be returned in the 411 405 * @phandle parameter. 412 406 * 413 - * Returns: 414 - * 0 on success or a negative error-code on failure 407 + * Return: 0 on success or a negative error-code on failure 415 408 */ 416 409 int fdt_generate_phandle(const void *fdt, uint32_t *phandle); 417 410 ··· 430 425 /** 431 426 * fdt_get_mem_rsv - retrieve one memory reserve map entry 432 427 * @fdt: pointer to the device tree blob 433 - * @address, @size: pointers to 64-bit variables 428 + * @n: index of reserve map entry 429 + * @address: pointer to 64-bit variable to hold the start address 430 + * @size: pointer to 64-bit variable to hold the size of the entry 434 431 * 435 - * On success, *address and *size will contain the address and size of 432 + * On success, @address and @size will contain the address and size of 436 433 * the n-th reserve map entry from the device tree blob, in 437 434 * native-endian format. 438 435 * ··· 457 450 * namelen characters of name for matching the subnode name. This is 458 451 * useful for finding subnodes based on a portion of a larger string, 459 452 * such as a full path. 453 + * 454 + * Return: offset of the subnode or -FDT_ERR_NOTFOUND if name not found. 460 455 */ 461 456 #ifndef SWIG /* Not available in Python */ 462 457 int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, ··· 498 489 * 499 490 * Identical to fdt_path_offset(), but only consider the first namelen 500 491 * characters of path as the path name. 492 + * 493 + * Return: offset of the node or negative libfdt error value otherwise 501 494 */ 502 495 #ifndef SWIG /* Not available in Python */ 503 496 int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen); ··· 599 588 /** 600 589 * fdt_for_each_property_offset - iterate over all properties of a node 601 590 * 602 - * @property_offset: property offset (int, lvalue) 603 - * @fdt: FDT blob (const void *) 604 - * @node: node offset (int) 591 + * @property: property offset (int, lvalue) 592 + * @fdt: FDT blob (const void *) 593 + * @node: node offset (int) 605 594 * 606 595 * This is actually a wrapper around a for loop and would be used like so: 607 596 * ··· 664 653 * 665 654 * Identical to fdt_get_property(), but only examine the first namelen 666 655 * characters of name for matching the property name. 656 + * 657 + * Return: pointer to the structure representing the property, or NULL 658 + * if not found 667 659 */ 668 660 #ifndef SWIG /* Not available in Python */ 669 661 const struct fdt_property *fdt_get_property_namelen(const void *fdt, ··· 759 745 * 760 746 * Identical to fdt_getprop(), but only examine the first namelen 761 747 * characters of name for matching the property name. 748 + * 749 + * Return: pointer to the property's value or NULL on error 762 750 */ 763 751 #ifndef SWIG /* Not available in Python */ 764 752 const void *fdt_getprop_namelen(const void *fdt, int nodeoffset, ··· 782 766 * @lenp: pointer to an integer variable (will be overwritten) or NULL 783 767 * 784 768 * fdt_getprop() retrieves a pointer to the value of the property 785 - * named 'name' of the node at offset nodeoffset (this will be a 769 + * named @name of the node at offset @nodeoffset (this will be a 786 770 * pointer to within the device blob itself, not a copy of the value). 787 - * If lenp is non-NULL, the length of the property value is also 788 - * returned, in the integer pointed to by lenp. 771 + * If @lenp is non-NULL, the length of the property value is also 772 + * returned, in the integer pointed to by @lenp. 789 773 * 790 774 * returns: 791 775 * pointer to the property's value ··· 830 814 * @name: name of the alias th look up 831 815 * @namelen: number of characters of name to consider 832 816 * 833 - * Identical to fdt_get_alias(), but only examine the first namelen 834 - * characters of name for matching the alias name. 817 + * Identical to fdt_get_alias(), but only examine the first @namelen 818 + * characters of @name for matching the alias name. 819 + * 820 + * Return: a pointer to the expansion of the alias named @name, if it exists, 821 + * NULL otherwise 835 822 */ 836 823 #ifndef SWIG /* Not available in Python */ 837 824 const char *fdt_get_alias_namelen(const void *fdt, ··· 847 828 * @name: name of the alias th look up 848 829 * 849 830 * fdt_get_alias() retrieves the value of a given alias. That is, the 850 - * value of the property named 'name' in the node /aliases. 831 + * value of the property named @name in the node /aliases. 851 832 * 852 833 * returns: 853 834 * a pointer to the expansion of the alias named 'name', if it exists ··· 1023 1004 int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle); 1024 1005 1025 1006 /** 1026 - * fdt_node_check_compatible: check a node's compatible property 1007 + * fdt_node_check_compatible - check a node's compatible property 1027 1008 * @fdt: pointer to the device tree blob 1028 1009 * @nodeoffset: offset of a tree node 1029 1010 * @compatible: string to match against 1030 1011 * 1031 - * 1032 1012 * fdt_node_check_compatible() returns 0 if the given node contains a 1033 - * 'compatible' property with the given string as one of its elements, 1013 + * @compatible property with the given string as one of its elements, 1034 1014 * it returns non-zero otherwise, or on error. 1035 1015 * 1036 1016 * returns: ··· 1093 1075 * one or more strings, each terminated by \0, as is found in a device tree 1094 1076 * "compatible" property. 1095 1077 * 1096 - * @return: 1 if the string is found in the list, 0 not found, or invalid list 1078 + * Return: 1 if the string is found in the list, 0 not found, or invalid list 1097 1079 */ 1098 1080 int fdt_stringlist_contains(const char *strlist, int listlen, const char *str); 1099 1081 ··· 1102 1084 * @fdt: pointer to the device tree blob 1103 1085 * @nodeoffset: offset of a tree node 1104 1086 * @property: name of the property containing the string list 1105 - * @return: 1087 + * 1088 + * Return: 1106 1089 * the number of strings in the given property 1107 1090 * -FDT_ERR_BADVALUE if the property value is not NUL-terminated 1108 1091 * -FDT_ERR_NOTFOUND if the property does not exist ··· 1123 1104 * small-valued cell properties, such as #address-cells, when searching for 1124 1105 * the empty string. 1125 1106 * 1126 - * @return: 1107 + * return: 1127 1108 * the index of the string in the list of strings 1128 1109 * -FDT_ERR_BADVALUE if the property value is not NUL-terminated 1129 1110 * -FDT_ERR_NOTFOUND if the property does not exist or does not contain ··· 1147 1128 * If non-NULL, the length of the string (on success) or a negative error-code 1148 1129 * (on failure) will be stored in the integer pointer to by lenp. 1149 1130 * 1150 - * @return: 1131 + * Return: 1151 1132 * A pointer to the string at the given index in the string list or NULL on 1152 1133 * failure. On success the length of the string will be stored in the memory 1153 1134 * location pointed to by the lenp parameter, if non-NULL. On failure one of ··· 1236 1217 * starting from the given index, and using only the first characters 1237 1218 * of the name. It is useful when you want to manipulate only one value of 1238 1219 * an array and you have a string that doesn't end with \0. 1220 + * 1221 + * Return: 0 on success, negative libfdt error value otherwise 1239 1222 */ 1240 1223 #ifndef SWIG /* Not available in Python */ 1241 1224 int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset, ··· 1351 1330 1352 1331 /** 1353 1332 * fdt_setprop_inplace_cell - change the value of a single-cell property 1333 + * @fdt: pointer to the device tree blob 1334 + * @nodeoffset: offset of the node containing the property 1335 + * @name: name of the property to change the value of 1336 + * @val: new value of the 32-bit cell 1354 1337 * 1355 1338 * This is an alternative name for fdt_setprop_inplace_u32() 1339 + * Return: 0 on success, negative libfdt error number otherwise. 1356 1340 */ 1357 1341 static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset, 1358 1342 const char *name, uint32_t val) ··· 1429 1403 1430 1404 /** 1431 1405 * fdt_create_with_flags - begin creation of a new fdt 1432 - * @fdt: pointer to memory allocated where fdt will be created 1406 + * @buf: pointer to memory allocated where fdt will be created 1433 1407 * @bufsize: size of the memory space at fdt 1434 1408 * @flags: a valid combination of FDT_CREATE_FLAG_ flags, or 0. 1435 1409 * ··· 1447 1421 1448 1422 /** 1449 1423 * fdt_create - begin creation of a new fdt 1450 - * @fdt: pointer to memory allocated where fdt will be created 1424 + * @buf: pointer to memory allocated where fdt will be created 1451 1425 * @bufsize: size of the memory space at fdt 1452 1426 * 1453 1427 * fdt_create() is equivalent to fdt_create_with_flags() with flags=0. ··· 1512 1486 /** 1513 1487 * fdt_add_mem_rsv - add one memory reserve map entry 1514 1488 * @fdt: pointer to the device tree blob 1515 - * @address, @size: 64-bit values (native endian) 1489 + * @address: 64-bit start address of the reserve map entry 1490 + * @size: 64-bit size of the reserved region 1516 1491 * 1517 1492 * Adds a reserve map entry to the given blob reserving a region at 1518 1493 * address address of length size. ··· 1718 1691 1719 1692 /** 1720 1693 * fdt_setprop_cell - set a property to a single cell value 1694 + * @fdt: pointer to the device tree blob 1695 + * @nodeoffset: offset of the node whose property to change 1696 + * @name: name of the property to change 1697 + * @val: 32-bit integer value for the property (native endian) 1721 1698 * 1722 1699 * This is an alternative name for fdt_setprop_u32() 1700 + * 1701 + * Return: 0 on success, negative libfdt error value otherwise. 1723 1702 */ 1724 1703 static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, 1725 1704 uint32_t val) ··· 1896 1863 1897 1864 /** 1898 1865 * fdt_appendprop_cell - append a single cell value to a property 1866 + * @fdt: pointer to the device tree blob 1867 + * @nodeoffset: offset of the node whose property to change 1868 + * @name: name of the property to change 1869 + * @val: 32-bit integer value to append to the property (native endian) 1899 1870 * 1900 1871 * This is an alternative name for fdt_appendprop_u32() 1872 + * 1873 + * Return: 0 on success, negative libfdt error value otherwise. 1901 1874 */ 1902 1875 static inline int fdt_appendprop_cell(void *fdt, int nodeoffset, 1903 1876 const char *name, uint32_t val) ··· 2006 1967 * fdt_add_subnode_namelen - creates a new node based on substring 2007 1968 * @fdt: pointer to the device tree blob 2008 1969 * @parentoffset: structure block offset of a node 2009 - * @name: name of the subnode to locate 1970 + * @name: name of the subnode to create 2010 1971 * @namelen: number of characters of name to consider 2011 1972 * 2012 - * Identical to fdt_add_subnode(), but use only the first namelen 2013 - * characters of name as the name of the new node. This is useful for 1973 + * Identical to fdt_add_subnode(), but use only the first @namelen 1974 + * characters of @name as the name of the new node. This is useful for 2014 1975 * creating subnodes based on a portion of a larger string, such as a 2015 1976 * full path. 1977 + * 1978 + * Return: structure block offset of the created subnode (>=0), 1979 + * negative libfdt error value otherwise 2016 1980 */ 2017 1981 #ifndef SWIG /* Not available in Python */ 2018 1982 int fdt_add_subnode_namelen(void *fdt, int parentoffset, ··· 2034 1992 * 2035 1993 * This function will insert data into the blob, and will therefore 2036 1994 * change the offsets of some existing nodes. 2037 - 1995 + * 2038 1996 * returns: 2039 1997 * structure block offset of the created nodeequested subnode (>=0), on 2040 1998 * success
+19
scripts/dtc/libfdt/libfdt_internal.h
··· 46 46 return (void *)(uintptr_t)fdt_mem_rsv_(fdt, n); 47 47 } 48 48 49 + /* 50 + * Internal helpers to access tructural elements of the device tree 51 + * blob (rather than for exaple reading integers from within property 52 + * values). We assume that we are either given a naturally aligned 53 + * address for the platform or if we are not, we are on a platform 54 + * where unaligned memory reads will be handled in a graceful manner. 55 + * If not the external helpers fdtXX_ld() from libfdt.h can be used 56 + * instead. 57 + */ 58 + static inline uint32_t fdt32_ld_(const fdt32_t *p) 59 + { 60 + return fdt32_to_cpu(*p); 61 + } 62 + 63 + static inline uint64_t fdt64_ld_(const fdt64_t *p) 64 + { 65 + return fdt64_to_cpu(*p); 66 + } 67 + 49 68 #define FDT_SW_MAGIC (~FDT_MAGIC) 50 69 51 70 /**********************************************************************/
+1 -1
scripts/dtc/livetree.c
··· 438 438 return fdt32_to_cpu(*((fdt32_t *)prop->val.val)); 439 439 } 440 440 441 - cell_t propval_cell_n(struct property *prop, int n) 441 + cell_t propval_cell_n(struct property *prop, unsigned int n) 442 442 { 443 443 assert(prop->val.len / sizeof(cell_t) >= n); 444 444 return fdt32_to_cpu(*((fdt32_t *)prop->val.val + n));
+1 -1
scripts/dtc/srcpos.c
··· 20 20 static struct search_path *search_path_head, **search_path_tail; 21 21 22 22 /* Detect infinite include recursion. */ 23 - #define MAX_SRCFILE_DEPTH (100) 23 + #define MAX_SRCFILE_DEPTH (200) 24 24 static int srcfile_depth; /* = 0 */ 25 25 26 26 static char *get_dirname(const char *path)
+1 -1
scripts/dtc/version_gen.h
··· 1 - #define DTC_VERSION "DTC 1.6.0-gcbca977e" 1 + #define DTC_VERSION "DTC 1.6.0-g183df9e9"
+3 -3
scripts/dtc/yamltree.c
··· 29 29 (emitter)->problem, __func__, __LINE__); \ 30 30 }) 31 31 32 - static void yaml_propval_int(yaml_emitter_t *emitter, struct marker *markers, char *data, int len, int width) 32 + static void yaml_propval_int(yaml_emitter_t *emitter, struct marker *markers, char *data, unsigned int len, int width) 33 33 { 34 34 yaml_event_t event; 35 35 void *tag; 36 - int off, start_offset = markers->offset; 36 + unsigned int off, start_offset = markers->offset; 37 37 38 38 switch(width) { 39 39 case 1: tag = "!u8"; break; ··· 112 112 static void yaml_propval(yaml_emitter_t *emitter, struct property *prop) 113 113 { 114 114 yaml_event_t event; 115 - int len = prop->val.len; 115 + unsigned int len = prop->val.len; 116 116 struct marker *m = prop->val.markers; 117 117 118 118 /* Emit the property name */