aboutsummaryrefslogtreecommitdiff
path: root/libfdt/libfdt.h
diff options
context:
space:
mode:
authorRob Herring (Arm) <robh@kernel.org>2024-09-17 13:23:44 -0500
committerRob Herring (Arm) <robh@kernel.org>2024-09-17 13:23:44 -0500
commitbc5c37c36343f628ccd3be6216efa0635d77a805 (patch)
tree2ce36f8bed85516b5c41ef9e976e8d4a84c62ab5 /libfdt/libfdt.h
parent55f963f3f50c82d5b692d9703d3043b9c0b58b9e (diff)
downloadlibfdt -main.zip
libfdt -main.tar.gz
libfdt -main.tar.bz2
Sync to upstream dtc v1.7.1HEADv1.7.1main
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Diffstat (limited to 'libfdt/libfdt.h')
-rw-r--r--libfdt/libfdt.h67
1 files changed, 64 insertions, 3 deletions
diff --git a/libfdt/libfdt.h b/libfdt/libfdt.h
index d0a2ed2..0677fea 100644
--- a/libfdt/libfdt.h
+++ b/libfdt/libfdt.h
@@ -524,10 +524,35 @@ int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen);
* level matching the given component, differentiated only by unit
* address).
*
+ * If the path is not absolute (i.e. does not begin with '/'), the
+ * first component is treated as an alias. That is, the property by
+ * that name is looked up in the /aliases node, and the value of that
+ * property used in place of that first component.
+ *
+ * For example, for this small fragment
+ *
+ * / {
+ * aliases {
+ * i2c2 = &foo; // RHS compiles to "/soc@0/i2c@30a40000/eeprom@52"
+ * };
+ * soc@0 {
+ * foo: i2c@30a40000 {
+ * bar: eeprom@52 {
+ * };
+ * };
+ * };
+ * };
+ *
+ * these would be equivalent:
+ *
+ * /soc@0/i2c@30a40000/eeprom@52
+ * i2c2/eeprom@52
+ *
* returns:
* structure block offset of the node with the requested path (>=0), on
* success
- * -FDT_ERR_BADPATH, given path does not begin with '/' or is invalid
+ * -FDT_ERR_BADPATH, given path does not begin with '/' and the first
+ * component is not a valid alias
* -FDT_ERR_NOTFOUND, if the requested node does not exist
* -FDT_ERR_BADMAGIC,
* -FDT_ERR_BADVERSION,
@@ -870,6 +895,42 @@ const char *fdt_get_alias_namelen(const void *fdt,
const char *fdt_get_alias(const void *fdt, const char *name);
/**
+ * fdt_get_symbol_namelen - get symbol based on substring
+ * @fdt: pointer to the device tree blob
+ * @name: name of the symbol to look up
+ * @namelen: number of characters of name to consider
+ *
+ * Identical to fdt_get_symbol(), but only examine the first @namelen
+ * characters of @name for matching the symbol name.
+ *
+ * Return: a pointer to the expansion of the symbol named @name, if it exists,
+ * NULL otherwise
+ */
+#ifndef SWIG /* Not available in Python */
+const char *fdt_get_symbol_namelen(const void *fdt,
+ const char *name, int namelen);
+#endif
+
+/**
+ * fdt_get_symbol - retrieve the path referenced by a given symbol
+ * @fdt: pointer to the device tree blob
+ * @name: name of the symbol to look up
+ *
+ * fdt_get_symbol() retrieves the value of a given symbol. That is,
+ * the value of the property named @name in the node
+ * /__symbols__. Such a node exists only for a device tree blob that
+ * has been compiled with the -@ dtc option. Each property corresponds
+ * to a label appearing in the device tree source, with the name of
+ * the property being the label and the value being the full path of
+ * the node it is attached to.
+ *
+ * returns:
+ * a pointer to the expansion of the symbol named 'name', if it exists
+ * NULL, if the given symbol or the /__symbols__ node does not exist
+ */
+const char *fdt_get_symbol(const void *fdt, const char *name);
+
+/**
* fdt_get_path - determine the full path of a node
* @fdt: pointer to the device tree blob
* @nodeoffset: offset of the node whose path to find
@@ -1450,7 +1511,7 @@ int fdt_nop_node(void *fdt, int nodeoffset);
* fdt_create_with_flags() begins the process of creating a new fdt with
* the sequential write interface.
*
- * fdt creation process must end with fdt_finished() to produce a valid fdt.
+ * fdt creation process must end with fdt_finish() to produce a valid fdt.
*
* returns:
* 0, on success
@@ -1968,7 +2029,7 @@ static inline int fdt_appendprop_cell(void *fdt, int nodeoffset,
* address and size) to the value of the named property in the given
* node, or creates a new property with that value if it does not
* already exist.
- * If "name" is not specified, a default "reg" is used.
+ *
* Cell sizes are determined by parent's #address-cells and #size-cells.
*
* This function may insert data into the blob, and will therefore