summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/configs/BSC9131RDB.h7
-rw-r--r--include/configs/BSC9132QDS.h8
-rw-r--r--include/configs/a3m071.h2
-rw-r--r--include/configs/am335x_evm.h1
-rw-r--r--include/configs/am335x_igep0033.h1
-rw-r--r--include/configs/baltos.h1
-rw-r--r--include/configs/bav335x.h1
-rw-r--r--include/configs/brppt1.h1
-rw-r--r--include/configs/cm_fx6.h1
-rw-r--r--include/configs/cm_t335.h1
-rw-r--r--include/configs/cm_t43.h1
-rw-r--r--include/configs/cm_t54.h2
-rw-r--r--include/configs/duovero.h1
-rw-r--r--include/configs/gw_ventana.h4
-rw-r--r--include/configs/ipam390.h1
-rw-r--r--include/configs/microblaze-generic.h3
-rw-r--r--include/configs/omap3_zoom1.h1
-rw-r--r--include/configs/pdm360ng.h8
-rw-r--r--include/configs/pepper.h1
-rw-r--r--include/configs/smartweb.h1
-rw-r--r--include/configs/taurus.h1
-rw-r--r--include/configs/ti_armv7_common.h3
-rw-r--r--include/configs/ti_armv7_keystone2.h1
-rw-r--r--include/configs/twister.h1
-rw-r--r--include/configs/xilinx_zynqmp.h1
-rw-r--r--include/configs/zynq-common.h1
-rw-r--r--include/fdt_support.h10
-rw-r--r--include/libfdt.h187
28 files changed, 119 insertions, 133 deletions
diff --git a/include/configs/BSC9131RDB.h b/include/configs/BSC9131RDB.h
index 81021ba5a3..057a3cfc93 100644
--- a/include/configs/BSC9131RDB.h
+++ b/include/configs/BSC9131RDB.h
@@ -367,13 +367,6 @@ extern unsigned long get_sdram_size(void);
#define MTDIDS_DEFAULT "nand0=ff800000.flash,"
#define MTDPARTS_DEFAULT "mtdparts=ff800000.flash:1m(uboot)," \
"8m(kernel),512k(dtb),-(fs)"
-/*
- * Override partitions in device tree using info
- * in "mtdparts" environment variable
- */
-#ifdef CONFIG_CMD_MTDPARTS
-#define CONFIG_FDT_FIXUP_PARTITIONS
-#endif
/*
* Environment Configuration
diff --git a/include/configs/BSC9132QDS.h b/include/configs/BSC9132QDS.h
index 6c5c172144..1c8a77baba 100644
--- a/include/configs/BSC9132QDS.h
+++ b/include/configs/BSC9132QDS.h
@@ -605,14 +605,6 @@ combinations. this should be removed later
"8m(kernel),512k(dtb),-(fs)"
#endif
/*
- * Override partitions in device tree using info
- * in "mtdparts" environment variable
- */
-#ifdef CONFIG_CMD_MTDPARTS
-#define CONFIG_FDT_FIXUP_PARTITIONS
-#endif
-
-/*
* Environment Configuration
*/
diff --git a/include/configs/a3m071.h b/include/configs/a3m071.h
index 1919475d19..ee75785781 100644
--- a/include/configs/a3m071.h
+++ b/include/configs/a3m071.h
@@ -330,7 +330,6 @@
#undef CONFIG_BOOTARGS
-#define CONFIG_SYS_OS_BASE 0xfc200000
#define CONFIG_SYS_FDT_BASE 0xfc1e0000
#define CONFIG_SYS_FDT_SIZE (16<<10)
@@ -401,7 +400,6 @@
#define CONFIG_SPL_BSS_START_ADDR ((128 - 1) << 20)
#define CONFIG_SPL_BSS_MAX_SIZE (64 << 10)
-#define CONFIG_SPL_OS_BOOT
/* Place patched DT blob (fdt) at this address */
#define CONFIG_SYS_SPL_ARGS_ADDR 0x01800000
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index daa7dd8b9f..ec70b72970 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -380,7 +380,6 @@
*/
#if defined(CONFIG_SPI_BOOT)
/* SPL related */
-#undef CONFIG_SPL_OS_BOOT /* Not supported by existing map */
#define CONFIG_SPL_SPI_LOAD
#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000
diff --git a/include/configs/am335x_igep0033.h b/include/configs/am335x_igep0033.h
index 18db58ad8a..32aa392e8b 100644
--- a/include/configs/am335x_igep0033.h
+++ b/include/configs/am335x_igep0033.h
@@ -123,7 +123,6 @@
#undef CONFIG_USE_IRQ
/* SPL */
-#undef CONFIG_SPL_OS_BOOT /* Not supported by existing map */
#define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/am33xx/u-boot-spl.lds"
#define CONFIG_SYS_NAND_5_ADDR_CYCLE
diff --git a/include/configs/baltos.h b/include/configs/baltos.h
index 58df571323..e69c1b63c1 100644
--- a/include/configs/baltos.h
+++ b/include/configs/baltos.h
@@ -54,7 +54,6 @@
#undef CONFIG_SYS_OMAP24_I2C_SPEED
#define CONFIG_SYS_OMAP24_I2C_SPEED 1000
-#undef CONFIG_SPL_OS_BOOT
#ifdef CONFIG_NAND
#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x00080000
#ifdef CONFIG_SPL_OS_BOOT
diff --git a/include/configs/bav335x.h b/include/configs/bav335x.h
index f1ae1a6c19..ac47decb63 100644
--- a/include/configs/bav335x.h
+++ b/include/configs/bav335x.h
@@ -513,7 +513,6 @@ DEFAULT_LINUX_BOOT_ENV \
*/
#if defined(CONFIG_SPI_BOOT)
/* SPL related */
-#undef CONFIG_SPL_OS_BOOT /* Not supported by existing map */
#define CONFIG_SPL_SPI_LOAD
#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000
diff --git a/include/configs/brppt1.h b/include/configs/brppt1.h
index e01d53565c..ccc5bb4b37 100644
--- a/include/configs/brppt1.h
+++ b/include/configs/brppt1.h
@@ -68,7 +68,6 @@
#define CONFIG_CMD_MTDPARTS
#endif /* CONFIG_SPI_BOOT, ... */
-#undef CONFIG_SPL_OS_BOOT
#ifdef CONFIG_SPL_OS_BOOT
#define CONFIG_SYS_SPL_ARGS_ADDR 0x80F80000
diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h
index 46584fdf74..b0d8c5f3ab 100644
--- a/include/configs/cm_fx6.h
+++ b/include/configs/cm_fx6.h
@@ -56,7 +56,6 @@
/* MTD support */
#ifndef CONFIG_SPL_BUILD
-#define CONFIG_FDT_FIXUP_PARTITIONS
#define CONFIG_MTD_DEVICE
#define CONFIG_MTD_PARTITIONS
#define CONFIG_SPI_FLASH_MTD
diff --git a/include/configs/cm_t335.h b/include/configs/cm_t335.h
index 6dbc9e980c..7eed776f62 100644
--- a/include/configs/cm_t335.h
+++ b/include/configs/cm_t335.h
@@ -19,7 +19,6 @@
#undef CONFIG_BOARD_LATE_INIT
#undef CONFIG_SPI
#undef CONFIG_OMAP3_SPI
-#undef CONFIG_SPL_OS_BOOT
#undef CONFIG_BOOTCOUNT_LIMIT
#undef CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC
diff --git a/include/configs/cm_t43.h b/include/configs/cm_t43.h
index 92ff251310..3a605f7504 100644
--- a/include/configs/cm_t43.h
+++ b/include/configs/cm_t43.h
@@ -90,7 +90,6 @@
#define CONFIG_HSMMC2_8BIT
#include <configs/ti_armv7_omap.h>
-#undef CONFIG_SPL_OS_BOOT
#undef CONFIG_SYS_MONITOR_LEN
#undef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
diff --git a/include/configs/cm_t54.h b/include/configs/cm_t54.h
index ddb1e97b6c..a3b1e5fe8b 100644
--- a/include/configs/cm_t54.h
+++ b/include/configs/cm_t54.h
@@ -16,8 +16,6 @@
#include <configs/ti_omap5_common.h>
-#undef CONFIG_SPL_OS_BOOT
-
/* EEPROM related defines */
#define CONFIG_SYS_I2C_OMAP34XX
#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
diff --git a/include/configs/duovero.h b/include/configs/duovero.h
index 868158b2e0..b5bd3ba651 100644
--- a/include/configs/duovero.h
+++ b/include/configs/duovero.h
@@ -21,7 +21,6 @@
#include <configs/ti_omap4_common.h>
-#undef CONFIG_SPL_OS_BOOT
#undef CONFIG_EFI_PARTITION
#undef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS
diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h
index 6caa3b1014..0b05876624 100644
--- a/include/configs/gw_ventana.h
+++ b/include/configs/gw_ventana.h
@@ -14,7 +14,6 @@
/* Falcon Mode */
#define CONFIG_CMD_SPL
-#define CONFIG_SPL_OS_BOOT
#define CONFIG_SYS_SPL_ARGS_ADDR 0x18000000
#define CONFIG_CMD_SPL_WRITE_SIZE (128 * SZ_1K)
@@ -421,7 +420,4 @@
"if run ${btype}_boot; then; fi; " \
"done"
-/* Device Tree Support */
-#define CONFIG_FDT_FIXUP_PARTITIONS
-
#endif /* __CONFIG_H */
diff --git a/include/configs/ipam390.h b/include/configs/ipam390.h
index 5f07629a59..381fe04aea 100644
--- a/include/configs/ipam390.h
+++ b/include/configs/ipam390.h
@@ -297,7 +297,6 @@
/* add FALCON boot mode */
#define CONFIG_CMD_SPL
-#define CONFIG_SPL_OS_BOOT
#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x00200000
#define CONFIG_SYS_SPL_ARGS_ADDR LINUX_BOOT_PARAM_ADDR
#define CONFIG_CMD_SPL_NAND_OFS 0x00180000
diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h
index a07bcc632c..2a7006f328 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -292,10 +292,7 @@
#endif
/* for booting directly linux */
-#define CONFIG_SPL_OS_BOOT
-#define CONFIG_SYS_OS_BASE (CONFIG_SYS_FLASH_BASE + \
- 0x60000)
#define CONFIG_SYS_FDT_BASE (CONFIG_SYS_FLASH_BASE + \
0x40000)
#define CONFIG_SYS_FDT_SIZE (16<<10)
diff --git a/include/configs/omap3_zoom1.h b/include/configs/omap3_zoom1.h
index 4dcd5de2bc..0f28278fc2 100644
--- a/include/configs/omap3_zoom1.h
+++ b/include/configs/omap3_zoom1.h
@@ -26,7 +26,6 @@
/* Remove SPL boot option - we do not support that on LDP yet */
#undef CONFIG_SPL_FRAMEWORK
-#undef CONFIG_SPL_OS_BOOT
/* Generic NAND definition conflicts with debug_base */
#undef CONFIG_SYS_NAND_BASE
diff --git a/include/configs/pdm360ng.h b/include/configs/pdm360ng.h
index 3c86b25267..2e72889b47 100644
--- a/include/configs/pdm360ng.h
+++ b/include/configs/pdm360ng.h
@@ -249,14 +249,6 @@
"f8000000.flash:-(unused);" \
"MPC5121 NAND:1024m(extended-userfs)"
-/*
- * Override partitions in device tree using info
- * in "mtdparts" environment variable
- */
-#ifdef CONFIG_CMD_MTDPARTS
-#define CONFIG_FDT_FIXUP_PARTITIONS
-#endif
-
#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE /* Start of monitor */
#define CONFIG_SYS_MONITOR_LEN (512 * 1024) /* 512 kB for monitor */
#ifdef CONFIG_FSL_DIU_FB
diff --git a/include/configs/pepper.h b/include/configs/pepper.h
index 921d33124d..e99188fc43 100644
--- a/include/configs/pepper.h
+++ b/include/configs/pepper.h
@@ -11,7 +11,6 @@
#include <configs/ti_am335x_common.h>
#undef CONFIG_BOARD_LATE_INIT
-#undef CONFIG_SPL_OS_BOOT
/* Clock defines */
#define V_OSCK 24000000 /* Clock output from T2 */
diff --git a/include/configs/smartweb.h b/include/configs/smartweb.h
index 0302740cea..df5fe2163f 100644
--- a/include/configs/smartweb.h
+++ b/include/configs/smartweb.h
@@ -275,6 +275,5 @@
#define CONFIG_SYS_THUMB_BUILD
#define CONFIG_SYS_ICACHE_OFF
#define CONFIG_SYS_DCACHE_OFF
-#undef CONFIG_SPL_OS_BOOT /* Not supported by existing map */
#endif
#endif /* __CONFIG_H */
diff --git a/include/configs/taurus.h b/include/configs/taurus.h
index 3a762e363f..ab457da2a0 100644
--- a/include/configs/taurus.h
+++ b/include/configs/taurus.h
@@ -139,7 +139,6 @@
#if defined(CONFIG_SPL_BUILD)
/* SPL related */
-#undef CONFIG_SPL_OS_BOOT /* Not supported by existing map */
#define CONFIG_SPL_SPI_LOAD
#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000
diff --git a/include/configs/ti_armv7_common.h b/include/configs/ti_armv7_common.h
index f5602b8c3e..f31d5d3687 100644
--- a/include/configs/ti_armv7_common.h
+++ b/include/configs/ti_armv7_common.h
@@ -205,9 +205,6 @@
* We also support Falcon Mode so that the Linux kernel can be booted
* directly from SPL. This is not currently available on HS devices.
*/
-#if !defined(CONFIG_TI_SECURE_DEVICE)
-#define CONFIG_SPL_OS_BOOT
-#endif
/*
* Place the image at the start of the ROM defined image space (per
diff --git a/include/configs/ti_armv7_keystone2.h b/include/configs/ti_armv7_keystone2.h
index 66d85be722..7e365aa6c6 100644
--- a/include/configs/ti_armv7_keystone2.h
+++ b/include/configs/ti_armv7_keystone2.h
@@ -301,7 +301,6 @@
#include <configs/ti_armv7_common.h>
/* We wont be loading up OS from SPL for now.. */
-#undef CONFIG_SPL_OS_BOOT
/* We do not have MMC support.. yet.. */
#undef CONFIG_MMC
diff --git a/include/configs/twister.h b/include/configs/twister.h
index 66f4680b7e..fd117b8260 100644
--- a/include/configs/twister.h
+++ b/include/configs/twister.h
@@ -42,7 +42,6 @@
#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x00200000
#define CONFIG_CMD_SPL_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\
0x600000)
-#define CONFIG_SPL_OS_BOOT
#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100)
#define CONFIG_SPL_BOARD_INIT
diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h
index adc42cff12..cbdef6eafd 100644
--- a/include/configs/xilinx_zynqmp.h
+++ b/include/configs/xilinx_zynqmp.h
@@ -268,7 +268,6 @@
#define CONFIG_SPL_BOARD_INIT
#define CONFIG_SPL_RAM_DEVICE
-#define CONFIG_SPL_OS_BOOT
/* u-boot is like dtb */
#define CONFIG_SPL_FS_LOAD_ARGS_NAME "u-boot.bin"
#define CONFIG_SYS_SPL_ARGS_ADDR 0x8000000
diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
index 0118fd2462..4f0253cd7d 100644
--- a/include/configs/zynq-common.h
+++ b/include/configs/zynq-common.h
@@ -330,7 +330,6 @@
#endif
/* for booting directly linux */
-#define CONFIG_SPL_OS_BOOT
/* SP location before relocation, must use scratch RAM */
#define CONFIG_SPL_TEXT_BASE 0x0
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 8f402310f6..506bc5a9f6 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -167,7 +167,15 @@ void ft_pci_setup(void *blob, bd_t *bd);
int ft_system_setup(void *blob, bd_t *bd);
void set_working_fdt_addr(ulong addr);
-int fdt_shrink_to_minimum(void *blob);
+
+/**
+ * shrink down the given blob to minimum size + some extrasize if required
+ *
+ * @param blob FDT blob to update
+ * @param extrasize additional bytes needed
+ * @return 0 if ok, or -FDT_ERR_... on error
+ */
+int fdt_shrink_to_minimum(void *blob, uint extrasize);
int fdt_increase_size(void *fdt, int add_len);
int fdt_fixup_nor_flash_size(void *blob);
diff --git a/include/libfdt.h b/include/libfdt.h
index b6a400a7a8..8746790a25 100644
--- a/include/libfdt.h
+++ b/include/libfdt.h
@@ -61,7 +61,7 @@
#define FDT_ERR_NOTFOUND 1
/* FDT_ERR_NOTFOUND: The requested node or property does not exist */
#define FDT_ERR_EXISTS 2
- /* FDT_ERR_EXISTS: Attemped to create a node or property which
+ /* FDT_ERR_EXISTS: Attempted to create a node or property which
* already exists */
#define FDT_ERR_NOSPACE 3
/* FDT_ERR_NOSPACE: Operation needed to expand the device
@@ -121,12 +121,17 @@
/* FDT_ERR_BADNCELLS: Device tree has a #address-cells, #size-cells
* or similar property with a bad format or value */
-#define FDT_ERR_TOODEEP 15
+#define FDT_ERR_BADVALUE 15
+ /* FDT_ERR_BADVALUE: Device tree has a property with an unexpected
+ * value. For example: a property expected to contain a string list
+ * is not NUL-terminated within the length of its value. */
+
+#define FDT_ERR_TOODEEP 16
/* FDT_ERR_TOODEEP: The depth of a node has exceeded the internal
* libfdt limit. This can happen if you have more than
* FDT_MAX_DEPTH nested nodes. */
-#define FDT_ERR_MAX 15
+#define FDT_ERR_MAX 16
/**********************************************************************/
/* Low-level functions (you probably don't need these) */
@@ -171,24 +176,27 @@ int fdt_next_subnode(const void *fdt, int offset);
/**
* fdt_for_each_subnode - iterate over all subnodes of a parent
*
+ * @node: child node (int, lvalue)
+ * @fdt: FDT blob (const void *)
+ * @parent: parent node (int)
+ *
* This is actually a wrapper around a for loop and would be used like so:
*
- * fdt_for_each_subnode(fdt, node, parent) {
- * ...
- * use node
+ * fdt_for_each_subnode(node, fdt, parent) {
+ * Use node
* ...
* }
*
- * Note that this is implemented as a macro and node is used as iterator in
- * the loop. It should therefore be a locally allocated variable. The parent
- * variable on the other hand is never modified, so it can be constant or
- * even a literal.
+ * if ((node < 0) && (node != -FDT_ERR_NOT_FOUND)) {
+ * Error handling
+ * }
+ *
+ * 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.
*
- * @fdt: FDT blob (const void *)
- * @node: child node (int)
- * @parent: parent node (int)
*/
-#define fdt_for_each_subnode(fdt, node, parent) \
+#define fdt_for_each_subnode(node, fdt, parent) \
for (node = fdt_first_subnode(fdt, parent); \
node >= 0; \
node = fdt_next_subnode(fdt, node))
@@ -213,7 +221,7 @@ int fdt_next_subnode(const void *fdt, int offset);
#define __fdt_set_hdr(name) \
static inline void fdt_set_##name(void *fdt, uint32_t val) \
{ \
- struct fdt_header *fdth = (struct fdt_header*)fdt; \
+ struct fdt_header *fdth = (struct fdt_header *)fdt; \
fdth->name = cpu_to_fdt32(val); \
}
__fdt_set_hdr(magic);
@@ -288,11 +296,13 @@ const char *fdt_string(const void *fdt, int stroffset);
* @fdt: pointer to the device tree blob
*
* fdt_get_max_phandle retrieves the highest phandle in the given
- * device tree
+ * device tree. This will ignore badly formatted phandles, or phandles
+ * with a value of 0 or -1.
*
* returns:
* the highest phandle on success
- * 0, if an error occurred
+ * 0, if no phandle was found in the device tree
+ * -1, if an error occurred
*/
uint32_t fdt_get_max_phandle(const void *fdt);
@@ -356,8 +366,9 @@ int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
* returns:
* structure block offset of the requested subnode (>=0), on success
* -FDT_ERR_NOTFOUND, if the requested subnode does not exist
- * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag
- * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE
+ * tag
+ * -FDT_ERR_BADMAGIC,
* -FDT_ERR_BADVERSION,
* -FDT_ERR_BADSTATE,
* -FDT_ERR_BADSTRUCTURE,
@@ -366,13 +377,13 @@ int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
/**
- * fdt_path_offset_namelen - find a tree node based on substring
+ * fdt_path_offset_namelen - find a tree node by its full path
* @fdt: pointer to the device tree blob
* @path: full path of the node to locate
- * @namelen: number of characters of name to consider
+ * @namelen: number of characters of path to consider
*
- * Identical to fdt_path_offset(), but only examine the first
- * namelen characters of path for matching the node path.
+ * Identical to fdt_path_offset(), but only consider the first namelen
+ * characters of path as the path name.
*/
int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen);
@@ -389,7 +400,8 @@ int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen);
* address).
*
* returns:
- * structure block offset of the node with the requested path (>=0), on success
+ * 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_NOTFOUND, if the requested node does not exist
* -FDT_ERR_BADMAGIC,
@@ -398,10 +410,7 @@ int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen);
* -FDT_ERR_BADSTRUCTURE,
* -FDT_ERR_TRUNCATED, standard meanings.
*/
-static inline int fdt_path_offset(const void *fdt, const char *path)
-{
- return fdt_path_offset_namelen(fdt, path, strlen(path));
-}
+int fdt_path_offset(const void *fdt, const char *path);
/**
* fdt_get_name - retrieve the name of a given node
@@ -416,10 +425,12 @@ static inline int fdt_path_offset(const void *fdt, const char *path)
*
* returns:
* pointer to the node's name, on success
- * If lenp is non-NULL, *lenp contains the length of that name (>=0)
+ * If lenp is non-NULL, *lenp contains the length of that name
+ * (>=0)
* NULL, on error
* if lenp is non-NULL *lenp contains an error code (<0):
- * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
+ * tag
* -FDT_ERR_BADMAGIC,
* -FDT_ERR_BADVERSION,
* -FDT_ERR_BADSTATE, standard meanings
@@ -468,23 +479,26 @@ int fdt_first_property_offset(const void *fdt, int nodeoffset);
int fdt_next_property_offset(const void *fdt, int offset);
/**
- * fdt_for_each_property - iterate over all properties of a node
- * @property_offset: property offset (int)
+ * fdt_for_each_property_offset - iterate over all properties of a node
+ *
+ * @property_offset: property offset (int, lvalue)
* @fdt: FDT blob (const void *)
* @node: node offset (int)
*
* This is actually a wrapper around a for loop and would be used like so:
*
- * fdt_for_each_property(fdt, node, property) {
- * ...
- * use property
+ * fdt_for_each_property_offset(property, fdt, node) {
+ * Use property
* ...
* }
*
+ * if ((property < 0) && (property != -FDT_ERR_NOT_FOUND)) {
+ * Error handling
+ * }
+ *
* Note that this is implemented as a macro and property is used as
- * iterator in the loop. It should therefore be a locally allocated
- * variable. The node variable on the other hand is never modified, so
- * it can be constant or even a literal.
+ * iterator in the loop. The node variable can be constant or even a
+ * literal.
*/
#define fdt_for_each_property_offset(property, fdt, node) \
for (property = fdt_first_property_offset(fdt, node); \
@@ -527,8 +541,8 @@ const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
* @namelen: number of characters of name to consider
* @lenp: pointer to an integer variable (will be overwritten) or NULL
*
- * Identical to fdt_get_property_namelen(), but only examine the first
- * namelen characters of name for matching the property name.
+ * Identical to fdt_get_property(), but only examine the first namelen
+ * characters of name for matching the property name.
*/
const struct fdt_property *fdt_get_property_namelen(const void *fdt,
int nodeoffset,
@@ -555,7 +569,8 @@ const struct fdt_property *fdt_get_property_namelen(const void *fdt,
* NULL, on error
* if lenp is non-NULL, *lenp contains an error code (<0):
* -FDT_ERR_NOTFOUND, node does not have named property
- * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
+ * tag
* -FDT_ERR_BADMAGIC,
* -FDT_ERR_BADVERSION,
* -FDT_ERR_BADSTATE,
@@ -647,7 +662,8 @@ static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset,
* NULL, on error
* if lenp is non-NULL, *lenp contains an error code (<0):
* -FDT_ERR_NOTFOUND, node does not have named property
- * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
+ * tag
* -FDT_ERR_BADMAGIC,
* -FDT_ERR_BADVERSION,
* -FDT_ERR_BADSTATE,
@@ -689,7 +705,7 @@ const char *fdt_get_alias_namelen(const void *fdt,
const char *name, int namelen);
/**
- * fdt_get_alias - retreive the path referenced by a given alias
+ * fdt_get_alias - retrieve the path referenced by a given alias
* @fdt: pointer to the device tree blob
* @name: name of the alias th look up
*
@@ -749,11 +765,11 @@ int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen);
* structure from the start to nodeoffset.
*
* returns:
-
* structure block offset of the node at node offset's ancestor
* of depth supernodedepth (>=0), on success
* -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
-* -FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of nodeoffset
+ * -FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of
+ * nodeoffset
* -FDT_ERR_BADMAGIC,
* -FDT_ERR_BADVERSION,
* -FDT_ERR_BADSTATE,
@@ -946,51 +962,66 @@ int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
int fdt_stringlist_contains(const char *strlist, int listlen, const char *str);
/**
- * fdt_count_strings - count the number of strings in a string list
+ * fdt_stringlist_count - count the number of strings in a string list
* @fdt: pointer to the device tree blob
- * @node: offset of the node
+ * @nodeoffset: offset of a tree node
* @property: name of the property containing the string list
- * @return: the number of strings in the given property
+ * @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
*/
-int fdt_count_strings(const void *fdt, int node, const char *property);
+int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property);
/**
- * fdt_find_string - find a string in a string list and return its index
+ * fdt_stringlist_search - find a string in a string list and return its index
* @fdt: pointer to the device tree blob
- * @node: offset of the node
+ * @nodeoffset: offset of a tree node
* @property: name of the property containing the string list
* @string: string to look up in the string list
- * @return: the index of the string or negative on error
+ *
+ * Note that it is possible for this function to succeed on property values
+ * that are not NUL-terminated. That's because the function will stop after
+ * finding the first occurrence of @string. This can for example happen with
+ * small-valued cell properties, such as #address-cells, when searching for
+ * the empty string.
+ *
+ * @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
+ * the given string
*/
-int fdt_find_string(const void *fdt, int node, const char *property,
- const char *string);
+int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property,
+ const char *string);
/**
- * fdt_get_string_index() - obtain the string at a given index in a string list
+ * fdt_stringlist_get() - obtain the string at a given index in a string list
* @fdt: pointer to the device tree blob
- * @node: offset of the node
+ * @nodeoffset: offset of a tree node
* @property: name of the property containing the string list
* @index: index of the string to return
- * @output: return location for the string
- * @return: 0 if the string was found or a negative error code otherwise
- */
-int fdt_get_string_index(const void *fdt, int node, const char *property,
- int index, const char **output);
-
-/**
- * fdt_get_string() - obtain the first string in a string list
- * @fdt: pointer to the device tree blob
- * @node: offset of the node
- * @property: name of the property containing the string list
- * @output: return location for the string
- * @return: 0 if the string was found or a negative error code otherwise
+ * @lenp: return location for the string length or an error code on failure
+ *
+ * Note that this will successfully extract strings from properties with
+ * non-NUL-terminated values. For example on small-valued cell properties
+ * this function will return the empty string.
*
- * This is a shortcut for:
+ * 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.
*
- * fdt_get_string_index(fdt, node, property, 0, output).
+ * @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
+ * the following negative error codes will be returned in the lenp parameter
+ * (if non-NULL):
+ * -FDT_ERR_BADVALUE if the property value is not NUL-terminated
+ * -FDT_ERR_NOTFOUND if the property does not exist
*/
-int fdt_get_string(const void *fdt, int node, const char *property,
- const char **output);
+const char *fdt_stringlist_get(const void *fdt, int nodeoffset,
+ const char *property, int index,
+ int *lenp);
/**********************************************************************/
/* Read-only functions (addressing related) */
@@ -1060,7 +1091,7 @@ int fdt_size_cells(const void *fdt, int nodeoffset);
* @nodeoffset: offset of the node whose property to change
* @name: name of the property to change
* @namelen: number of characters of name to consider
- * @index: index of the property to change in the array
+ * @idx: index of the property to change in the array
* @val: pointer to data to replace the property value with
* @len: length of the property value
*
@@ -1071,7 +1102,7 @@ int fdt_size_cells(const void *fdt, int nodeoffset);
*/
int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset,
const char *name, int namelen,
- uint32_t index, const void *val,
+ uint32_t idx, const void *val,
int len);
/**
@@ -1700,9 +1731,11 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset,
* change the offsets of some existing nodes.
* returns:
- * structure block offset of the created nodeequested subnode (>=0), on success
+ * structure block offset of the created nodeequested subnode (>=0), on
+ * success
* -FDT_ERR_NOTFOUND, if the requested subnode does not exist
- * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag
+ * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE
+ * tag
* -FDT_ERR_EXISTS, if the node at parentoffset already has a subnode of
* the given name
* -FDT_ERR_NOSPACE, if there is insufficient free space in the