aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/libfdt/libfdt.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2008-08-06 22:24:17 -0400
committerPaul Mackerras <paulus@samba.org>2008-08-20 02:34:58 -0400
commited95d7450dcbfeb45ffc9d39b1747aee82b49a51 (patch)
treefaca7d89e2907e1407161f967477ed2ae21d46bb /arch/powerpc/boot/libfdt/libfdt.h
parent0ec27c049d80535f77901654a310b090106b046c (diff)
powerpc: Update in-kernel dtc and libfdt to version 1.2.0
Some time ago, a copies of the upstream dtc and libfdt sources were included in the kernel tree to avoid having these as external dependencies for building the kernel. Since then development on the upstream dtc and libfdt has continued. This updates the in-kernel versions to match the recently released upstream dtc version 1.2.0. This includes a number of bugfixes, many cleanups and a few new features. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/boot/libfdt/libfdt.h')
-rw-r--r--arch/powerpc/boot/libfdt/libfdt.h383
1 files changed, 369 insertions, 14 deletions
diff --git a/arch/powerpc/boot/libfdt/libfdt.h b/arch/powerpc/boot/libfdt/libfdt.h
index 6b2fb92ea357..ce80e4fb41b2 100644
--- a/arch/powerpc/boot/libfdt/libfdt.h
+++ b/arch/powerpc/boot/libfdt/libfdt.h
@@ -125,12 +125,18 @@
125const void *fdt_offset_ptr(const void *fdt, int offset, int checklen); 125const void *fdt_offset_ptr(const void *fdt, int offset, int checklen);
126static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen) 126static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
127{ 127{
128 return (void *)fdt_offset_ptr(fdt, offset, checklen); 128 return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen);
129} 129}
130 130
131uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset); 131uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
132 132
133/**********************************************************************/ 133/**********************************************************************/
134/* Traversal functions */
135/**********************************************************************/
136
137int fdt_next_node(const void *fdt, int offset, int *depth);
138
139/**********************************************************************/
134/* General functions */ 140/* General functions */
135/**********************************************************************/ 141/**********************************************************************/
136 142
@@ -207,7 +213,7 @@ int fdt_move(const void *fdt, void *buf, int bufsize);
207/**********************************************************************/ 213/**********************************************************************/
208 214
209/** 215/**
210 * fdt_string - retreive a string from the strings block of a device tree 216 * fdt_string - retrieve a string from the strings block of a device tree
211 * @fdt: pointer to the device tree blob 217 * @fdt: pointer to the device tree blob
212 * @stroffset: offset of the string within the strings block (native endian) 218 * @stroffset: offset of the string within the strings block (native endian)
213 * 219 *
@@ -221,7 +227,7 @@ int fdt_move(const void *fdt, void *buf, int bufsize);
221const char *fdt_string(const void *fdt, int stroffset); 227const char *fdt_string(const void *fdt, int stroffset);
222 228
223/** 229/**
224 * fdt_num_mem_rsv - retreive the number of memory reserve map entries 230 * fdt_num_mem_rsv - retrieve the number of memory reserve map entries
225 * @fdt: pointer to the device tree blob 231 * @fdt: pointer to the device tree blob
226 * 232 *
227 * Returns the number of entries in the device tree blob's memory 233 * Returns the number of entries in the device tree blob's memory
@@ -234,7 +240,7 @@ const char *fdt_string(const void *fdt, int stroffset);
234int fdt_num_mem_rsv(const void *fdt); 240int fdt_num_mem_rsv(const void *fdt);
235 241
236/** 242/**
237 * fdt_get_mem_rsv - retreive one memory reserve map entry 243 * fdt_get_mem_rsv - retrieve one memory reserve map entry
238 * @fdt: pointer to the device tree blob 244 * @fdt: pointer to the device tree blob
239 * @address, @size: pointers to 64-bit variables 245 * @address, @size: pointers to 64-bit variables
240 * 246 *
@@ -314,7 +320,7 @@ int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
314int fdt_path_offset(const void *fdt, const char *path); 320int fdt_path_offset(const void *fdt, const char *path);
315 321
316/** 322/**
317 * fdt_get_name - retreive the name of a given node 323 * fdt_get_name - retrieve the name of a given node
318 * @fdt: pointer to the device tree blob 324 * @fdt: pointer to the device tree blob
319 * @nodeoffset: structure block offset of the starting node 325 * @nodeoffset: structure block offset of the starting node
320 * @lenp: pointer to an integer variable (will be overwritten) or NULL 326 * @lenp: pointer to an integer variable (will be overwritten) or NULL
@@ -346,7 +352,7 @@ const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp);
346 * fdt_get_property() retrieves a pointer to the fdt_property 352 * fdt_get_property() retrieves a pointer to the fdt_property
347 * structure within the device tree blob corresponding to the property 353 * structure within the device tree blob corresponding to the property
348 * named 'name' of the node at offset nodeoffset. If lenp is 354 * named 'name' of the node at offset nodeoffset. If lenp is
349 * non-NULL, the length of the property value also returned, in the 355 * non-NULL, the length of the property value is also returned, in the
350 * integer pointed to by lenp. 356 * integer pointed to by lenp.
351 * 357 *
352 * returns: 358 * returns:
@@ -369,8 +375,8 @@ static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset,
369 const char *name, 375 const char *name,
370 int *lenp) 376 int *lenp)
371{ 377{
372 return (struct fdt_property *)fdt_get_property(fdt, nodeoffset, 378 return (struct fdt_property *)(uintptr_t)
373 name, lenp); 379 fdt_get_property(fdt, nodeoffset, name, lenp);
374} 380}
375 381
376/** 382/**
@@ -383,7 +389,7 @@ static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset,
383 * fdt_getprop() retrieves a pointer to the value of the property 389 * fdt_getprop() retrieves a pointer to the value of the property
384 * named 'name' of the node at offset nodeoffset (this will be a 390 * named 'name' of the node at offset nodeoffset (this will be a
385 * pointer to within the device blob itself, not a copy of the value). 391 * pointer to within the device blob itself, not a copy of the value).
386 * If lenp is non-NULL, the length of the property value also 392 * If lenp is non-NULL, the length of the property value is also
387 * returned, in the integer pointed to by lenp. 393 * returned, in the integer pointed to by lenp.
388 * 394 *
389 * returns: 395 * returns:
@@ -405,11 +411,11 @@ const void *fdt_getprop(const void *fdt, int nodeoffset,
405static inline void *fdt_getprop_w(void *fdt, int nodeoffset, 411static inline void *fdt_getprop_w(void *fdt, int nodeoffset,
406 const char *name, int *lenp) 412 const char *name, int *lenp)
407{ 413{
408 return (void *)fdt_getprop(fdt, nodeoffset, name, lenp); 414 return (void *)(uintptr_t)fdt_getprop(fdt, nodeoffset, name, lenp);
409} 415}
410 416
411/** 417/**
412 * fdt_get_phandle - retreive the phandle of a given node 418 * fdt_get_phandle - retrieve the phandle of a given node
413 * @fdt: pointer to the device tree blob 419 * @fdt: pointer to the device tree blob
414 * @nodeoffset: structure block offset of the node 420 * @nodeoffset: structure block offset of the node
415 * 421 *
@@ -417,7 +423,7 @@ static inline void *fdt_getprop_w(void *fdt, int nodeoffset,
417 * structure block offset nodeoffset. 423 * structure block offset nodeoffset.
418 * 424 *
419 * returns: 425 * returns:
420 * the phandle of the node at nodeoffset, on succes (!= 0, != -1) 426 * the phandle of the node at nodeoffset, on success (!= 0, != -1)
421 * 0, if the node has no phandle, or another error occurs 427 * 0, if the node has no phandle, or another error occurs
422 */ 428 */
423uint32_t fdt_get_phandle(const void *fdt, int nodeoffset); 429uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
@@ -516,7 +522,7 @@ int fdt_node_depth(const void *fdt, int nodeoffset);
516 * structure from the start to nodeoffset, *twice*. 522 * structure from the start to nodeoffset, *twice*.
517 * 523 *
518 * returns: 524 * returns:
519 * stucture block offset of the parent of the node at nodeoffset 525 * structure block offset of the parent of the node at nodeoffset
520 * (>=0), on success 526 * (>=0), on success
521 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag 527 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
522 * -FDT_ERR_BADMAGIC, 528 * -FDT_ERR_BADMAGIC,
@@ -573,7 +579,7 @@ int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
573 * @fdt: pointer to the device tree blob 579 * @fdt: pointer to the device tree blob
574 * @phandle: phandle value 580 * @phandle: phandle value
575 * 581 *
576 * fdt_node_offset_by_prop_value() returns the offset of the node 582 * fdt_node_offset_by_phandle() returns the offset of the node
577 * which has the given phandle value. If there is more than one node 583 * which has the given phandle value. If there is more than one node
578 * in the tree with the given phandle (an invalid tree), results are 584 * in the tree with the given phandle (an invalid tree), results are
579 * undefined. 585 * undefined.
@@ -655,8 +661,65 @@ int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
655/* Write-in-place functions */ 661/* Write-in-place functions */
656/**********************************************************************/ 662/**********************************************************************/
657 663
664/**
665 * fdt_setprop_inplace - change a property's value, but not its size
666 * @fdt: pointer to the device tree blob
667 * @nodeoffset: offset of the node whose property to change
668 * @name: name of the property to change
669 * @val: pointer to data to replace the property value with
670 * @len: length of the property value
671 *
672 * fdt_setprop_inplace() replaces the value of a given property with
673 * the data in val, of length len. This function cannot change the
674 * size of a property, and so will only work if len is equal to the
675 * current length of the property.
676 *
677 * This function will alter only the bytes in the blob which contain
678 * the given property value, and will not alter or move any other part
679 * of the tree.
680 *
681 * returns:
682 * 0, on success
683 * -FDT_ERR_NOSPACE, if len is not equal to the property's current length
684 * -FDT_ERR_NOTFOUND, node does not have the named property
685 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
686 * -FDT_ERR_BADMAGIC,
687 * -FDT_ERR_BADVERSION,
688 * -FDT_ERR_BADSTATE,
689 * -FDT_ERR_BADSTRUCTURE,
690 * -FDT_ERR_TRUNCATED, standard meanings
691 */
658int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, 692int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
659 const void *val, int len); 693 const void *val, int len);
694
695/**
696 * fdt_setprop_inplace_cell - change the value of a single-cell property
697 * @fdt: pointer to the device tree blob
698 * @nodeoffset: offset of the node whose property to change
699 * @name: name of the property to change
700 * @val: cell (32-bit integer) value to replace the property with
701 *
702 * fdt_setprop_inplace_cell() replaces the value of a given property
703 * with the 32-bit integer cell value in val, converting val to
704 * big-endian if necessary. This function cannot change the size of a
705 * property, and so will only work if the property already exists and
706 * has length 4.
707 *
708 * This function will alter only the bytes in the blob which contain
709 * the given property value, and will not alter or move any other part
710 * of the tree.
711 *
712 * returns:
713 * 0, on success
714 * -FDT_ERR_NOSPACE, if the property's length is not equal to 4
715 * -FDT_ERR_NOTFOUND, node does not have the named property
716 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
717 * -FDT_ERR_BADMAGIC,
718 * -FDT_ERR_BADVERSION,
719 * -FDT_ERR_BADSTATE,
720 * -FDT_ERR_BADSTRUCTURE,
721 * -FDT_ERR_TRUNCATED, standard meanings
722 */
660static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset, 723static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset,
661 const char *name, uint32_t val) 724 const char *name, uint32_t val)
662{ 725{
@@ -664,7 +727,54 @@ static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset,
664 return fdt_setprop_inplace(fdt, nodeoffset, name, &val, sizeof(val)); 727 return fdt_setprop_inplace(fdt, nodeoffset, name, &val, sizeof(val));
665} 728}
666 729
730/**
731 * fdt_nop_property - replace a property with nop tags
732 * @fdt: pointer to the device tree blob
733 * @nodeoffset: offset of the node whose property to nop
734 * @name: name of the property to nop
735 *
736 * fdt_nop_property() will replace a given property's representation
737 * in the blob with FDT_NOP tags, effectively removing it from the
738 * tree.
739 *
740 * This function will alter only the bytes in the blob which contain
741 * the property, and will not alter or move any other part of the
742 * tree.
743 *
744 * returns:
745 * 0, on success
746 * -FDT_ERR_NOTFOUND, node does not have the named property
747 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
748 * -FDT_ERR_BADMAGIC,
749 * -FDT_ERR_BADVERSION,
750 * -FDT_ERR_BADSTATE,
751 * -FDT_ERR_BADSTRUCTURE,
752 * -FDT_ERR_TRUNCATED, standard meanings
753 */
667int fdt_nop_property(void *fdt, int nodeoffset, const char *name); 754int fdt_nop_property(void *fdt, int nodeoffset, const char *name);
755
756/**
757 * fdt_nop_node - replace a node (subtree) with nop tags
758 * @fdt: pointer to the device tree blob
759 * @nodeoffset: offset of the node to nop
760 *
761 * fdt_nop_node() will replace a given node's representation in the
762 * blob, including all its subnodes, if any, with FDT_NOP tags,
763 * effectively removing it from the tree.
764 *
765 * This function will alter only the bytes in the blob which contain
766 * the node and its properties and subnodes, and will not alter or
767 * move any other part of the tree.
768 *
769 * returns:
770 * 0, on success
771 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
772 * -FDT_ERR_BADMAGIC,
773 * -FDT_ERR_BADVERSION,
774 * -FDT_ERR_BADSTATE,
775 * -FDT_ERR_BADSTRUCTURE,
776 * -FDT_ERR_TRUNCATED, standard meanings
777 */
668int fdt_nop_node(void *fdt, int nodeoffset); 778int fdt_nop_node(void *fdt, int nodeoffset);
669 779
670/**********************************************************************/ 780/**********************************************************************/
@@ -693,23 +803,268 @@ int fdt_finish(void *fdt);
693int fdt_open_into(const void *fdt, void *buf, int bufsize); 803int fdt_open_into(const void *fdt, void *buf, int bufsize);
694int fdt_pack(void *fdt); 804int fdt_pack(void *fdt);
695 805
806/**
807 * fdt_add_mem_rsv - add one memory reserve map entry
808 * @fdt: pointer to the device tree blob
809 * @address, @size: 64-bit values (native endian)
810 *
811 * Adds a reserve map entry to the given blob reserving a region at
812 * address address of length size.
813 *
814 * This function will insert data into the reserve map and will
815 * therefore change the indexes of some entries in the table.
816 *
817 * returns:
818 * 0, on success
819 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
820 * contain the new reservation entry
821 * -FDT_ERR_BADMAGIC,
822 * -FDT_ERR_BADVERSION,
823 * -FDT_ERR_BADSTATE,
824 * -FDT_ERR_BADSTRUCTURE,
825 * -FDT_ERR_BADLAYOUT,
826 * -FDT_ERR_TRUNCATED, standard meanings
827 */
696int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size); 828int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size);
829
830/**
831 * fdt_del_mem_rsv - remove a memory reserve map entry
832 * @fdt: pointer to the device tree blob
833 * @n: entry to remove
834 *
835 * fdt_del_mem_rsv() removes the n-th memory reserve map entry from
836 * the blob.
837 *
838 * This function will delete data from the reservation table and will
839 * therefore change the indexes of some entries in the table.
840 *
841 * returns:
842 * 0, on success
843 * -FDT_ERR_NOTFOUND, there is no entry of the given index (i.e. there
844 * are less than n+1 reserve map entries)
845 * -FDT_ERR_BADMAGIC,
846 * -FDT_ERR_BADVERSION,
847 * -FDT_ERR_BADSTATE,
848 * -FDT_ERR_BADSTRUCTURE,
849 * -FDT_ERR_BADLAYOUT,
850 * -FDT_ERR_TRUNCATED, standard meanings
851 */
697int fdt_del_mem_rsv(void *fdt, int n); 852int fdt_del_mem_rsv(void *fdt, int n);
698 853
854/**
855 * fdt_set_name - change the name of a given node
856 * @fdt: pointer to the device tree blob
857 * @nodeoffset: structure block offset of a node
858 * @name: name to give the node
859 *
860 * fdt_set_name() replaces the name (including unit address, if any)
861 * of the given node with the given string. NOTE: this function can't
862 * efficiently check if the new name is unique amongst the given
863 * node's siblings; results are undefined if this function is invoked
864 * with a name equal to one of the given node's siblings.
865 *
866 * This function may insert or delete data from the blob, and will
867 * therefore change the offsets of some existing nodes.
868 *
869 * returns:
870 * 0, on success
871 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob
872 * to contain the new name
873 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
874 * -FDT_ERR_BADMAGIC,
875 * -FDT_ERR_BADVERSION,
876 * -FDT_ERR_BADSTATE, standard meanings
877 */
878int fdt_set_name(void *fdt, int nodeoffset, const char *name);
879
880/**
881 * fdt_setprop - create or change a property
882 * @fdt: pointer to the device tree blob
883 * @nodeoffset: offset of the node whose property to change
884 * @name: name of the property to change
885 * @val: pointer to data to set the property value to
886 * @len: length of the property value
887 *
888 * fdt_setprop() sets the value of the named property in the given
889 * node to the given value and length, creating the property if it
890 * does not already exist.
891 *
892 * This function may insert or delete data from the blob, and will
893 * therefore change the offsets of some existing nodes.
894 *
895 * returns:
896 * 0, on success
897 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
898 * contain the new property value
899 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
900 * -FDT_ERR_BADLAYOUT,
901 * -FDT_ERR_BADMAGIC,
902 * -FDT_ERR_BADVERSION,
903 * -FDT_ERR_BADSTATE,
904 * -FDT_ERR_BADSTRUCTURE,
905 * -FDT_ERR_BADLAYOUT,
906 * -FDT_ERR_TRUNCATED, standard meanings
907 */
699int fdt_setprop(void *fdt, int nodeoffset, const char *name, 908int fdt_setprop(void *fdt, int nodeoffset, const char *name,
700 const void *val, int len); 909 const void *val, int len);
910
911/**
912 * fdt_setprop_cell - set a property to a single cell value
913 * @fdt: pointer to the device tree blob
914 * @nodeoffset: offset of the node whose property to change
915 * @name: name of the property to change
916 * @val: 32-bit integer value for the property (native endian)
917 *
918 * fdt_setprop_cell() sets the value of the named property in the
919 * given node to the given cell value (converting to big-endian if
920 * necessary), or creates a new property with that value if it does
921 * not already exist.
922 *
923 * This function may insert or delete data from the blob, and will
924 * therefore change the offsets of some existing nodes.
925 *
926 * returns:
927 * 0, on success
928 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
929 * contain the new property value
930 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
931 * -FDT_ERR_BADLAYOUT,
932 * -FDT_ERR_BADMAGIC,
933 * -FDT_ERR_BADVERSION,
934 * -FDT_ERR_BADSTATE,
935 * -FDT_ERR_BADSTRUCTURE,
936 * -FDT_ERR_BADLAYOUT,
937 * -FDT_ERR_TRUNCATED, standard meanings
938 */
701static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, 939static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
702 uint32_t val) 940 uint32_t val)
703{ 941{
704 val = cpu_to_fdt32(val); 942 val = cpu_to_fdt32(val);
705 return fdt_setprop(fdt, nodeoffset, name, &val, sizeof(val)); 943 return fdt_setprop(fdt, nodeoffset, name, &val, sizeof(val));
706} 944}
945
946/**
947 * fdt_setprop_string - set a property to a string value
948 * @fdt: pointer to the device tree blob
949 * @nodeoffset: offset of the node whose property to change
950 * @name: name of the property to change
951 * @str: string value for the property
952 *
953 * fdt_setprop_string() sets the value of the named property in the
954 * given node to the given string value (using the length of the
955 * string to determine the new length of the property), or creates a
956 * new property with that value if it does not already exist.
957 *
958 * This function may insert or delete data from the blob, and will
959 * therefore change the offsets of some existing nodes.
960 *
961 * returns:
962 * 0, on success
963 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
964 * contain the new property value
965 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
966 * -FDT_ERR_BADLAYOUT,
967 * -FDT_ERR_BADMAGIC,
968 * -FDT_ERR_BADVERSION,
969 * -FDT_ERR_BADSTATE,
970 * -FDT_ERR_BADSTRUCTURE,
971 * -FDT_ERR_BADLAYOUT,
972 * -FDT_ERR_TRUNCATED, standard meanings
973 */
707#define fdt_setprop_string(fdt, nodeoffset, name, str) \ 974#define fdt_setprop_string(fdt, nodeoffset, name, str) \
708 fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1) 975 fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
976
977/**
978 * fdt_delprop - delete a property
979 * @fdt: pointer to the device tree blob
980 * @nodeoffset: offset of the node whose property to nop
981 * @name: name of the property to nop
982 *
983 * fdt_del_property() will delete the given property.
984 *
985 * This function will delete data from the blob, and will therefore
986 * change the offsets of some existing nodes.
987 *
988 * returns:
989 * 0, on success
990 * -FDT_ERR_NOTFOUND, node does not have the named property
991 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
992 * -FDT_ERR_BADLAYOUT,
993 * -FDT_ERR_BADMAGIC,
994 * -FDT_ERR_BADVERSION,
995 * -FDT_ERR_BADSTATE,
996 * -FDT_ERR_BADSTRUCTURE,
997 * -FDT_ERR_TRUNCATED, standard meanings
998 */
709int fdt_delprop(void *fdt, int nodeoffset, const char *name); 999int fdt_delprop(void *fdt, int nodeoffset, const char *name);
1000
1001/**
1002 * fdt_add_subnode_namelen - creates a new node based on substring
1003 * @fdt: pointer to the device tree blob
1004 * @parentoffset: structure block offset of a node
1005 * @name: name of the subnode to locate
1006 * @namelen: number of characters of name to consider
1007 *
1008 * Identical to fdt_add_subnode(), but use only the first namelen
1009 * characters of name as the name of the new node. This is useful for
1010 * creating subnodes based on a portion of a larger string, such as a
1011 * full path.
1012 */
710int fdt_add_subnode_namelen(void *fdt, int parentoffset, 1013int fdt_add_subnode_namelen(void *fdt, int parentoffset,
711 const char *name, int namelen); 1014 const char *name, int namelen);
1015
1016/**
1017 * fdt_add_subnode - creates a new node
1018 * @fdt: pointer to the device tree blob
1019 * @parentoffset: structure block offset of a node
1020 * @name: name of the subnode to locate
1021 *
1022 * fdt_add_subnode() creates a new node as a subnode of the node at
1023 * structure block offset parentoffset, with the given name (which
1024 * should include the unit address, if any).
1025 *
1026 * This function will insert data into the blob, and will therefore
1027 * change the offsets of some existing nodes.
1028
1029 * returns:
1030 * structure block offset of the created nodeequested subnode (>=0), on success
1031 * -FDT_ERR_NOTFOUND, if the requested subnode does not exist
1032 * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag
1033 * -FDT_ERR_EXISTS, if the node at parentoffset already has a subnode of
1034 * the given name
1035 * -FDT_ERR_NOSPACE, if there is insufficient free space in the
1036 * blob to contain the new node
1037 * -FDT_ERR_NOSPACE
1038 * -FDT_ERR_BADLAYOUT
1039 * -FDT_ERR_BADMAGIC,
1040 * -FDT_ERR_BADVERSION,
1041 * -FDT_ERR_BADSTATE,
1042 * -FDT_ERR_BADSTRUCTURE,
1043 * -FDT_ERR_TRUNCATED, standard meanings.
1044 */
712int fdt_add_subnode(void *fdt, int parentoffset, const char *name); 1045int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
1046
1047/**
1048 * fdt_del_node - delete a node (subtree)
1049 * @fdt: pointer to the device tree blob
1050 * @nodeoffset: offset of the node to nop
1051 *
1052 * fdt_del_node() will remove the given node, including all its
1053 * subnodes if any, from the blob.
1054 *
1055 * This function will delete data from the blob, and will therefore
1056 * change the offsets of some existing nodes.
1057 *
1058 * returns:
1059 * 0, on success
1060 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1061 * -FDT_ERR_BADLAYOUT,
1062 * -FDT_ERR_BADMAGIC,
1063 * -FDT_ERR_BADVERSION,
1064 * -FDT_ERR_BADSTATE,
1065 * -FDT_ERR_BADSTRUCTURE,
1066 * -FDT_ERR_TRUNCATED, standard meanings
1067 */
713int fdt_del_node(void *fdt, int nodeoffset); 1068int fdt_del_node(void *fdt, int nodeoffset);
714 1069
715/**********************************************************************/ 1070/**********************************************************************/