Deleted Added
full compact
libfdt.h (204431) libfdt.h (204433)
1#ifndef _LIBFDT_H
2#define _LIBFDT_H
3/*
4 * libfdt - Flat Device Tree manipulation
5 * Copyright (C) 2006 David Gibson, IBM Corporation.
6 *
7 * libfdt is dual licensed: you can use it either under the terms of
8 * the GPL, or the BSD license, at your option.

--- 108 unchanged lines hidden (view full) ---

117 * libfdt itself. */
118
119#define FDT_ERR_MAX 13
120
121/**********************************************************************/
122/* Low-level functions (you probably don't need these) */
123/**********************************************************************/
124
1#ifndef _LIBFDT_H
2#define _LIBFDT_H
3/*
4 * libfdt - Flat Device Tree manipulation
5 * Copyright (C) 2006 David Gibson, IBM Corporation.
6 *
7 * libfdt is dual licensed: you can use it either under the terms of
8 * the GPL, or the BSD license, at your option.

--- 108 unchanged lines hidden (view full) ---

117 * libfdt itself. */
118
119#define FDT_ERR_MAX 13
120
121/**********************************************************************/
122/* Low-level functions (you probably don't need these) */
123/**********************************************************************/
124
125const void *fdt_offset_ptr(const void *fdt, int offset, int checklen);
125const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
126static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
127{
128 return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen);
129}
130
131uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
132
133/**********************************************************************/

--- 17 unchanged lines hidden (view full) ---

151#define fdt_last_comp_version(fdt) (fdt_get_header(fdt, last_comp_version))
152#define fdt_boot_cpuid_phys(fdt) (fdt_get_header(fdt, boot_cpuid_phys))
153#define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings))
154#define fdt_size_dt_struct(fdt) (fdt_get_header(fdt, size_dt_struct))
155
156#define __fdt_set_hdr(name) \
157 static inline void fdt_set_##name(void *fdt, uint32_t val) \
158 { \
126static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
127{
128 return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen);
129}
130
131uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
132
133/**********************************************************************/

--- 17 unchanged lines hidden (view full) ---

151#define fdt_last_comp_version(fdt) (fdt_get_header(fdt, last_comp_version))
152#define fdt_boot_cpuid_phys(fdt) (fdt_get_header(fdt, boot_cpuid_phys))
153#define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings))
154#define fdt_size_dt_struct(fdt) (fdt_get_header(fdt, size_dt_struct))
155
156#define __fdt_set_hdr(name) \
157 static inline void fdt_set_##name(void *fdt, uint32_t val) \
158 { \
159 struct fdt_header *fdth = fdt; \
159 struct fdt_header *fdth = (struct fdt_header*)fdt; \
160 fdth->name = cpu_to_fdt32(val); \
161 }
162__fdt_set_hdr(magic);
163__fdt_set_hdr(totalsize);
164__fdt_set_hdr(off_dt_struct);
165__fdt_set_hdr(off_dt_strings);
166__fdt_set_hdr(off_mem_rsvmap);
167__fdt_set_hdr(version);

--- 170 unchanged lines hidden (view full) ---

338 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
339 * -FDT_ERR_BADMAGIC,
340 * -FDT_ERR_BADVERSION,
341 * -FDT_ERR_BADSTATE, standard meanings
342 */
343const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp);
344
345/**
160 fdth->name = cpu_to_fdt32(val); \
161 }
162__fdt_set_hdr(magic);
163__fdt_set_hdr(totalsize);
164__fdt_set_hdr(off_dt_struct);
165__fdt_set_hdr(off_dt_strings);
166__fdt_set_hdr(off_mem_rsvmap);
167__fdt_set_hdr(version);

--- 170 unchanged lines hidden (view full) ---

338 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
339 * -FDT_ERR_BADMAGIC,
340 * -FDT_ERR_BADVERSION,
341 * -FDT_ERR_BADSTATE, standard meanings
342 */
343const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp);
344
345/**
346 * fdt_get_property_namelen - find a property based on substring
347 * @fdt: pointer to the device tree blob
348 * @nodeoffset: offset of the node whose property to find
349 * @name: name of the property to find
350 * @namelen: number of characters of name to consider
351 * @lenp: pointer to an integer variable (will be overwritten) or NULL
352 *
353 * Identical to fdt_get_property_namelen(), but only examine the first
354 * namelen characters of name for matching the property name.
355 */
356const struct fdt_property *fdt_get_property_namelen(const void *fdt,
357 int nodeoffset,
358 const char *name,
359 int namelen, int *lenp);
360
361/**
346 * fdt_get_property - find a given property in a given node
347 * @fdt: pointer to the device tree blob
348 * @nodeoffset: offset of the node whose property to find
349 * @name: name of the property to find
350 * @lenp: pointer to an integer variable (will be overwritten) or NULL
351 *
352 * fdt_get_property() retrieves a pointer to the fdt_property
353 * structure within the device tree blob corresponding to the property

--- 21 unchanged lines hidden (view full) ---

375 const char *name,
376 int *lenp)
377{
378 return (struct fdt_property *)(uintptr_t)
379 fdt_get_property(fdt, nodeoffset, name, lenp);
380}
381
382/**
362 * fdt_get_property - find a given property in a given node
363 * @fdt: pointer to the device tree blob
364 * @nodeoffset: offset of the node whose property to find
365 * @name: name of the property to find
366 * @lenp: pointer to an integer variable (will be overwritten) or NULL
367 *
368 * fdt_get_property() retrieves a pointer to the fdt_property
369 * structure within the device tree blob corresponding to the property

--- 21 unchanged lines hidden (view full) ---

391 const char *name,
392 int *lenp)
393{
394 return (struct fdt_property *)(uintptr_t)
395 fdt_get_property(fdt, nodeoffset, name, lenp);
396}
397
398/**
399 * fdt_getprop_namelen - get property value based on substring
400 * @fdt: pointer to the device tree blob
401 * @nodeoffset: offset of the node whose property to find
402 * @name: name of the property to find
403 * @namelen: number of characters of name to consider
404 * @lenp: pointer to an integer variable (will be overwritten) or NULL
405 *
406 * Identical to fdt_getprop(), but only examine the first namelen
407 * characters of name for matching the property name.
408 */
409const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
410 const char *name, int namelen, int *lenp);
411
412/**
383 * fdt_getprop - retrieve the value of a given property
384 * @fdt: pointer to the device tree blob
385 * @nodeoffset: offset of the node whose property to find
386 * @name: name of the property to find
387 * @lenp: pointer to an integer variable (will be overwritten) or NULL
388 *
389 * fdt_getprop() retrieves a pointer to the value of the property
390 * named 'name' of the node at offset nodeoffset (this will be a

--- 33 unchanged lines hidden (view full) ---

424 *
425 * returns:
426 * the phandle of the node at nodeoffset, on success (!= 0, != -1)
427 * 0, if the node has no phandle, or another error occurs
428 */
429uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
430
431/**
413 * fdt_getprop - retrieve the value of a given property
414 * @fdt: pointer to the device tree blob
415 * @nodeoffset: offset of the node whose property to find
416 * @name: name of the property to find
417 * @lenp: pointer to an integer variable (will be overwritten) or NULL
418 *
419 * fdt_getprop() retrieves a pointer to the value of the property
420 * named 'name' of the node at offset nodeoffset (this will be a

--- 33 unchanged lines hidden (view full) ---

454 *
455 * returns:
456 * the phandle of the node at nodeoffset, on success (!= 0, != -1)
457 * 0, if the node has no phandle, or another error occurs
458 */
459uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
460
461/**
462 * fdt_get_alias_namelen - get alias based on substring
463 * @fdt: pointer to the device tree blob
464 * @name: name of the alias th look up
465 * @namelen: number of characters of name to consider
466 *
467 * Identical to fdt_get_alias(), but only examine the first namelen
468 * characters of name for matching the alias name.
469 */
470const char *fdt_get_alias_namelen(const void *fdt,
471 const char *name, int namelen);
472
473/**
474 * fdt_get_alias - retreive the path referenced by a given alias
475 * @fdt: pointer to the device tree blob
476 * @name: name of the alias th look up
477 *
478 * fdt_get_alias() retrieves the value of a given alias. That is, the
479 * value of the property named 'name' in the node /aliases.
480 *
481 * returns:
482 * a pointer to the expansion of the alias named 'name', of it exists
483 * NULL, if the given alias or the /aliases node does not exist
484 */
485const char *fdt_get_alias(const void *fdt, const char *name);
486
487/**
432 * fdt_get_path - determine the full path of a node
433 * @fdt: pointer to the device tree blob
434 * @nodeoffset: offset of the node whose path to find
435 * @buf: character buffer to contain the returned path (will be overwritten)
436 * @buflen: size of the character buffer at buf
437 *
438 * fdt_get_path() computes the full path of the node at offset
439 * nodeoffset, and records that path in the buffer at buf.

--- 637 unchanged lines hidden ---
488 * fdt_get_path - determine the full path of a node
489 * @fdt: pointer to the device tree blob
490 * @nodeoffset: offset of the node whose path to find
491 * @buf: character buffer to contain the returned path (will be overwritten)
492 * @buflen: size of the character buffer at buf
493 *
494 * fdt_get_path() computes the full path of the node at offset
495 * nodeoffset, and records that path in the buffer at buf.

--- 637 unchanged lines hidden ---