Merge tag 'tpm-030822' of https://source.denx.de/u-boot/custodians/u-boot-tpm
[platform/kernel/u-boot.git] / include / fdtdec.h
index 15f2d2b..12355af 100644 (file)
 typedef phys_addr_t fdt_addr_t;
 typedef phys_size_t fdt_size_t;
 
-#define FDT_ADDR_T_NONE (-1U)
 #define FDT_SIZE_T_NONE (-1U)
 
 #ifdef CONFIG_PHYS_64BIT
+#define FDT_ADDR_T_NONE ((ulong)(-1))
+
 #define fdt_addr_to_cpu(reg) be64_to_cpu(reg)
 #define fdt_size_to_cpu(reg) be64_to_cpu(reg)
 #define cpu_to_fdt_addr(reg) cpu_to_be64(reg)
 #define cpu_to_fdt_size(reg) cpu_to_be64(reg)
 typedef fdt64_t fdt_val_t;
 #else
+#define FDT_ADDR_T_NONE (-1U)
+
 #define fdt_addr_to_cpu(reg) be32_to_cpu(reg)
 #define fdt_size_to_cpu(reg) be32_to_cpu(reg)
 #define cpu_to_fdt_addr(reg) cpu_to_be32(reg)
@@ -148,7 +151,7 @@ static inline u8 *dtb_dt_embedded(void)
  * Compute the size of a resource.
  *
  * @param res  the resource to operate on
- * @return the size of the resource
+ * Return: the size of the resource
  */
 static inline fdt_size_t fdt_resource_size(const struct fdt_resource *res)
 {
@@ -241,7 +244,7 @@ struct fdtdec_phandle_args {
  * @cells_count: Cell count to use if @cells_name is NULL
  * @index:     index of a phandle to parse out
  * @out_args:  optional pointer to output arguments structure (will be filled)
- * @return 0 on success (with @out_args filled out if not NULL), -ENOENT if
+ * Return: 0 on success (with @out_args filled out if not NULL), -ENOENT if
  *     @list_name does not exist, a phandle was not found, @cells_name
  *     could not be found, the arguments were truncated or there were too
  *     many arguments.
@@ -268,7 +271,7 @@ int fdtdec_parse_phandle_with_args(const void *blob, int src_node,
  * @param blob         FDT blob to use
  * @param name         Root name of alias to search for
  * @param id           Compatible ID to look for
- * @return offset of next compatible node, or -FDT_ERR_NOTFOUND if no more
+ * Return: offset of next compatible node, or -FDT_ERR_NOTFOUND if no more
  */
 int fdtdec_next_alias(const void *blob, const char *name,
                enum fdt_compat_id id, int *upto);
@@ -282,7 +285,7 @@ int fdtdec_next_alias(const void *blob, const char *name,
  *
  * @param blob         FDT blob to use
  * @param node         Node containing compatible string to find
- * @return compatible ID, or COMPAT_UNKNOWN if we cannot find a match
+ * Return: compatible ID, or COMPAT_UNKNOWN if we cannot find a match
  */
 enum fdt_compat_id fdtdec_lookup(const void *blob, int node);
 
@@ -296,7 +299,7 @@ enum fdt_compat_id fdtdec_lookup(const void *blob, int node);
  * @param blob         FDT blob to use
  * @param node         Start node for search
  * @param id           Compatible ID to look for (enum fdt_compat_id)
- * @return offset of next compatible node, or -FDT_ERR_NOTFOUND if no more
+ * Return: offset of next compatible node, or -FDT_ERR_NOTFOUND if no more
  */
 int fdtdec_next_compatible(const void *blob, int node,
                enum fdt_compat_id id);
@@ -313,7 +316,7 @@ int fdtdec_next_compatible(const void *blob, int node,
  * @param node         Start node for search
  * @param id           Compatible ID to look for (enum fdt_compat_id)
  * @param depthp       Current depth (set to 0 before first call)
- * @return offset of next compatible node, or -FDT_ERR_NOTFOUND if no more
+ * Return: offset of next compatible node, or -FDT_ERR_NOTFOUND if no more
  */
 int fdtdec_next_compatible_subnode(const void *blob, int node,
                enum fdt_compat_id id, int *depthp);
@@ -339,7 +342,7 @@ int fdtdec_next_compatible_subnode(const void *blob, int node,
  * @param sizep        a pointer to store the size into. Use NULL if not required
  * @param translate    Indicates whether to translate the returned value
  *                     using the parent node's ranges property.
- * @return address, if found, or FDT_ADDR_T_NONE if not
+ * Return: address, if found, or FDT_ADDR_T_NONE if not
  */
 fdt_addr_t fdtdec_get_addr_size_fixed(const void *blob, int node,
                const char *prop_name, int index, int na, int ns,
@@ -361,7 +364,7 @@ fdt_addr_t fdtdec_get_addr_size_fixed(const void *blob, int node,
  * @param sizep        a pointer to store the size into. Use NULL if not required
  * @param translate    Indicates whether to translate the returned value
  *                     using the parent node's ranges property.
- * @return address, if found, or FDT_ADDR_T_NONE if not
+ * Return: address, if found, or FDT_ADDR_T_NONE if not
  */
 fdt_addr_t fdtdec_get_addr_size_auto_parent(const void *blob, int parent,
                int node, const char *prop_name, int index, fdt_size_t *sizep,
@@ -387,7 +390,7 @@ fdt_addr_t fdtdec_get_addr_size_auto_parent(const void *blob, int parent,
  * @param sizep        a pointer to store the size into. Use NULL if not required
  * @param translate    Indicates whether to translate the returned value
  *                     using the parent node's ranges property.
- * @return address, if found, or FDT_ADDR_T_NONE if not
+ * Return: address, if found, or FDT_ADDR_T_NONE if not
  */
 fdt_addr_t fdtdec_get_addr_size_auto_noparent(const void *blob, int node,
                const char *prop_name, int index, fdt_size_t *sizep,
@@ -414,7 +417,7 @@ fdt_addr_t fdtdec_get_addr_size_auto_noparent(const void *blob, int node,
  * @param blob FDT blob
  * @param node node to examine
  * @param prop_name    name of property to find
- * @return address, if found, or FDT_ADDR_T_NONE if not
+ * Return: address, if found, or FDT_ADDR_T_NONE if not
  */
 fdt_addr_t fdtdec_get_addr(const void *blob, int node,
                const char *prop_name);
@@ -442,7 +445,7 @@ fdt_addr_t fdtdec_get_addr(const void *blob, int node,
  * @param node node to examine
  * @param prop_name    name of property to find
  * @param sizep        a pointer to store the size into. Use NULL if not required
- * @return address, if found, or FDT_ADDR_T_NONE if not
+ * Return: address, if found, or FDT_ADDR_T_NONE if not
  */
 fdt_addr_t fdtdec_get_addr_size(const void *blob, int node,
                const char *prop_name, fdt_size_t *sizep);
@@ -455,7 +458,7 @@ fdt_addr_t fdtdec_get_addr_size(const void *blob, int node,
  * @param node         node to examine
  * @param vendor       vendor id of the pci device
  * @param device       device id of the pci device
- * @return 0 if ok, negative on error
+ * Return: 0 if ok, negative on error
  */
 int fdtdec_get_pci_vendev(const void *blob, int node,
                u16 *vendor, u16 *device);
@@ -467,7 +470,7 @@ int fdtdec_get_pci_vendev(const void *blob, int node,
  * @param dev          device to examine
  * @param addr         pci address in the form of fdt_pci_addr
  * @param bar          returns base address of the pci device's registers
- * @return 0 if ok, negative on error
+ * Return: 0 if ok, negative on error
  */
 int fdtdec_get_pci_bar32(const struct udevice *dev, struct fdt_pci_addr *addr,
                         u32 *bar);
@@ -479,7 +482,7 @@ int fdtdec_get_pci_bar32(const struct udevice *dev, struct fdt_pci_addr *addr,
  * @param blob         FDT blob
  * @param node         node to examine
  * @param res          the resource structure to return the bus range
- * @return 0 if ok, negative on error
+ * Return: 0 if ok, negative on error
  */
 
 int fdtdec_get_pci_bus_range(const void *blob, int node,
@@ -494,7 +497,7 @@ int fdtdec_get_pci_bus_range(const void *blob, int node,
  * @param node node to examine
  * @param prop_name    name of property to find
  * @param default_val  default value to return if the property is not found
- * @return integer value, if found, or default_val if not
+ * Return: integer value, if found, or default_val if not
  */
 s32 fdtdec_get_int(const void *blob, int node, const char *prop_name,
                s32 default_val);
@@ -507,7 +510,7 @@ s32 fdtdec_get_int(const void *blob, int node, const char *prop_name,
  * @param node node to examine
  * @param prop_name    name of property to find
  * @param default_val  default value to return if the property is not found
- * @return unsigned integer value, if found, or default_val if not
+ * Return: unsigned integer value, if found, or default_val if not
  */
 unsigned int fdtdec_get_uint(const void *blob, int node, const char *prop_name,
                        unsigned int default_val);
@@ -519,7 +522,7 @@ unsigned int fdtdec_get_uint(const void *blob, int node, const char *prop_name,
  *
  * @param ptr  Pointer to property
  * @param cells        Number of cells containing the number
- * @return the value in the cells
+ * Return: the value in the cells
  */
 u64 fdtdec_get_number(const fdt32_t *ptr, unsigned int cells);
 
@@ -533,7 +536,7 @@ u64 fdtdec_get_number(const fdt32_t *ptr, unsigned int cells);
  * @param node node to examine
  * @param prop_name    name of property to find
  * @param default_val  default value to return if the property is not found
- * @return integer value, if found, or default_val if not
+ * Return: integer value, if found, or default_val if not
  */
 uint64_t fdtdec_get_uint64(const void *blob, int node, const char *prop_name,
                uint64_t default_val);
@@ -547,7 +550,7 @@ uint64_t fdtdec_get_uint64(const void *blob, int node, const char *prop_name,
  *
  * @param blob FDT blob
  * @param node node to examine
- * @return integer value 0 (not enabled) or 1 (enabled)
+ * Return: integer value 0 (not enabled) or 1 (enabled)
  */
 int fdtdec_get_is_enabled(const void *blob, int node);
 
@@ -556,7 +559,7 @@ int fdtdec_get_is_enabled(const void *blob, int node);
  *
  * If not, a message is printed to the console if the console is ready.
  *
- * @return 0 if all ok, -1 if not
+ * Return: 0 if all ok, -1 if not
  */
 int fdtdec_prepare_fdt(void);
 
@@ -604,7 +607,7 @@ int fdtdec_check_fdt(void);
  * @param id           Compatible ID to look for
  * @param node_list    Place to put list of found nodes
  * @param maxcount     Maximum number of nodes to find
- * @return number of nodes found on success, FDT_ERR_... on error
+ * Return: number of nodes found on success, FDT_ERR_... on error
  */
 int fdtdec_find_aliases_for_id(const void *blob, const char *name,
                        enum fdt_compat_id id, int *node_list, int maxcount);
@@ -645,7 +648,7 @@ int fdtdec_add_aliases_for_id(const void *blob, const char *name,
  * @param node         Node to look up
  * @param seqp         This is set to the sequence number if one is found,
  *                     but otherwise the value is left alone
- * @return 0 if a sequence was found, -ve if not
+ * Return: 0 if a sequence was found, -ve if not
  */
 int fdtdec_get_alias_seq(const void *blob, const char *base, int node,
                         int *seqp);
@@ -659,7 +662,7 @@ int fdtdec_get_alias_seq(const void *blob, const char *base, int node,
  * @param blob         Device tree blob (if NULL, then error is returned)
  * @param base         Base name for alias susbystem (before the number)
  *
- * @return 0 highest alias ID, -1 if not found
+ * Return: 0 highest alias ID, -1 if not found
  */
 int fdtdec_get_alias_highest_id(const void *blob, const char *base);
 
@@ -668,7 +671,7 @@ int fdtdec_get_alias_highest_id(const void *blob, const char *base);
  *
  * @param blob         Device tree blob (if NULL, then NULL is returned)
  * @param name         Property name to look up
- * @return Value of property, or NULL if it does not exist
+ * Return: Value of property, or NULL if it does not exist
  */
 const char *fdtdec_get_chosen_prop(const void *blob, const char *name);
 
@@ -680,7 +683,7 @@ const char *fdtdec_get_chosen_prop(const void *blob, const char *name);
  *
  * @param blob         Device tree blob (if NULL, then error is returned)
  * @param name         Property name, e.g. "stdout-path"
- * @return Node offset referred to by that chosen node, or -ve FDT_ERR_...
+ * Return: Node offset referred to by that chosen node, or -ve FDT_ERR_...
  */
 int fdtdec_get_chosen_node(const void *blob, const char *name);
 
@@ -688,7 +691,7 @@ int fdtdec_get_chosen_node(const void *blob, const char *name);
  * Get the name for a compatible ID
  *
  * @param id           Compatible ID to look for
- * @return compatible string for that id
+ * Return: compatible string for that id
  */
 const char *fdtdec_get_compatible(enum fdt_compat_id id);
 
@@ -698,7 +701,7 @@ const char *fdtdec_get_compatible(enum fdt_compat_id id);
  * @param blob         FDT blob
  * @param node         node to examine
  * @param prop_name    name of property to find
- * @return node offset if found, -ve error code on error
+ * Return: node offset if found, -ve error code on error
  */
 int fdtdec_lookup_phandle(const void *blob, int node, const char *prop_name);
 
@@ -712,7 +715,7 @@ int fdtdec_lookup_phandle(const void *blob, int node, const char *prop_name);
  * @param prop_name    name of property to find
  * @param array                array to fill with data
  * @param count                number of array elements
- * @return 0 if ok, or -FDT_ERR_NOTFOUND if the property is not found,
+ * Return: 0 if ok, or -FDT_ERR_NOTFOUND if the property is not found,
  *             or -FDT_ERR_BADLAYOUT if not enough data
  */
 int fdtdec_get_int_array(const void *blob, int node, const char *prop_name,
@@ -728,7 +731,7 @@ int fdtdec_get_int_array(const void *blob, int node, const char *prop_name,
  * @param prop_name    name of property to find
  * @param array                array to fill with data
  * @param count                number of array elements
- * @return number of array elements if ok, or -FDT_ERR_NOTFOUND if the
+ * Return: number of array elements if ok, or -FDT_ERR_NOTFOUND if the
  *             property is not found
  */
 int fdtdec_get_int_array_count(const void *blob, int node,
@@ -747,7 +750,7 @@ int fdtdec_get_int_array_count(const void *blob, int node,
  * @param node         node to examine
  * @param prop_name    name of property to find
  * @param count                number of array elements
- * @return pointer to array if found, or NULL if the property is not
+ * Return: pointer to array if found, or NULL if the property is not
  *             found or there is not enough data
  */
 const u32 *fdtdec_locate_array(const void *blob, int node,
@@ -762,7 +765,7 @@ const u32 *fdtdec_locate_array(const void *blob, int node,
  * @param blob FDT blob
  * @param node node to examine
  * @param prop_name    name of property to find
- * @return 1 if the properly is present; 0 if it isn't present
+ * Return: 1 if the properly is present; 0 if it isn't present
  */
 int fdtdec_get_bool(const void *blob, int node, const char *prop_name);
 
@@ -771,7 +774,7 @@ int fdtdec_get_bool(const void *blob, int node, const char *prop_name);
  *
  * @param blob FDT blob
  * @param node parent node
- * @return number of child node; 0 if there is not child node
+ * Return: number of child node; 0 if there is not child node
  */
 int fdtdec_get_child_count(const void *blob, int node);
 
@@ -785,7 +788,7 @@ int fdtdec_get_child_count(const void *blob, int node);
  * @param prop_name    name of property to find
  * @param array                array to fill with data
  * @param count                number of array elements
- * @return 0 if ok, or -FDT_ERR_MISSING if the property is not found,
+ * Return: 0 if ok, or -FDT_ERR_MISSING if the property is not found,
  *             or -FDT_ERR_BADLAYOUT if not enough data
  */
 int fdtdec_get_byte_array(const void *blob, int node, const char *prop_name,
@@ -801,7 +804,7 @@ int fdtdec_get_byte_array(const void *blob, int node, const char *prop_name,
  * @param node         node to examine
  * @param prop_name    name of property to find
  * @param count                number of array elements
- * @return pointer to byte array if found, or NULL if the property is not
+ * Return: pointer to byte array if found, or NULL if the property is not
  *             found or there is not enough data
  */
 const u8 *fdtdec_locate_byte_array(const void *blob, int node,
@@ -815,7 +818,7 @@ const u8 *fdtdec_locate_byte_array(const void *blob, int node,
  * @param property     name of the property to parse
  * @param index                index of the resource to retrieve
  * @param res          returns the resource
- * @return 0 if ok, negative on error
+ * Return: 0 if ok, negative on error
  */
 int fdt_get_resource(const void *fdt, int node, const char *property,
                     unsigned int index, struct fdt_resource *res);
@@ -911,7 +914,7 @@ struct display_timing {
  * @param node         'display-timing' node containing the timing subnodes
  * @param index                Index number to read (0=first timing subnode)
  * @param config       Place to put timings
- * @return 0 if OK, -FDT_ERR_NOTFOUND if not found
+ * Return: 0 if OK, -FDT_ERR_NOTFOUND if not found
  */
 int fdtdec_decode_display_timing(const void *blob, int node, int index,
                                 struct display_timing *config);
@@ -929,7 +932,7 @@ int fdtdec_decode_display_timing(const void *blob, int node, int index,
  * address instead of hard coding the value in the case where the memory size
  * and start address cannot be detected automatically.
  *
- * @return 0 if OK, -EINVAL if the /memory node or reg property is missing or
+ * Return: 0 if OK, -EINVAL if the /memory node or reg property is missing or
  * invalid
  */
 int fdtdec_setup_mem_size_base(void);
@@ -946,7 +949,7 @@ int fdtdec_setup_mem_size_base(void);
  * address instead of hard coding the value in the case where the memory size
  * and start address cannot be detected automatically.
  *
- * @return 0 if OK, -EINVAL if the /memory node or reg property is missing or
+ * Return: 0 if OK, -EINVAL if the /memory node or reg property is missing or
  * invalid
  */
 int fdtdec_setup_mem_size_base_lowest(void);
@@ -963,7 +966,7 @@ int fdtdec_setup_mem_size_base_lowest(void);
  * information instead of hard coding the information in cases where it cannot
  * be detected automatically.
  *
- * @return 0 if OK, -EINVAL if the /memory node or reg property is missing or
+ * Return: 0 if OK, -EINVAL if the /memory node or reg property is missing or
  * invalid
  */
 int fdtdec_setup_memory_banksize(void);
@@ -988,7 +991,7 @@ int fdtdec_setup_memory_banksize(void);
  * @param fdt FDT blob
  * @param mac buffer containing the MAC address to set
  * @param size size of MAC address
- * @return 0 on success or a negative error code on failure
+ * Return: 0 on success or a negative error code on failure
  */
 int fdtdec_set_ethernet_mac_address(void *fdt, const u8 *mac, size_t size);
 
@@ -999,7 +1002,7 @@ int fdtdec_set_ethernet_mac_address(void *fdt, const u8 *mac, size_t size);
  * @param node         offset in the FDT blob of the node whose phandle is to
  *                     be set
  * @param phandle      phandle to set for the given node
- * @return 0 on success or a negative error code on failure
+ * Return: 0 on success or a negative error code on failure
  */
 static inline int fdtdec_set_phandle(void *blob, int node, uint32_t phandle)
 {
@@ -1058,7 +1061,7 @@ static inline int fdtdec_set_phandle(void *blob, int node, uint32_t phandle)
  * @param phandlep     return location for the phandle of the carveout region
  *                     can be NULL if no phandle should be added
  * @param flags                bitmask of flags to set for the carveout region
- * @return 0 on success or a negative error code on failure
+ * Return: 0 on success or a negative error code on failure
  */
 int fdtdec_add_reserved_memory(void *blob, const char *basename,
                               const struct fdt_memory *carveout,
@@ -1082,7 +1085,7 @@ int fdtdec_add_reserved_memory(void *blob, const char *basename,
  * @param compatiblesp return location for compatible strings
  * @param countp       return location for the number of compatible strings
  * @param flags                return location for the flags of the carveout
- * @return 0 on success or a negative error code on failure
+ * Return: 0 on success or a negative error code on failure
  */
 int fdtdec_get_carveout(const void *blob, const char *node,
                        const char *prop_name, unsigned int index,
@@ -1149,7 +1152,7 @@ int fdtdec_get_carveout(const void *blob, const char *node,
  * @param compatibles  compatible strings to set for the carveout
  * @param count                number of compatible strings
  * @param flags                bitmask of flags to set for the carveout
- * @return 0 on success or a negative error code on failure
+ * Return: 0 on success or a negative error code on failure
  */
 int fdtdec_set_carveout(void *blob, const char *node, const char *prop_name,
                        unsigned int index, const struct fdt_memory *carveout,
@@ -1166,7 +1169,6 @@ int fdtdec_setup(void);
  */
 int fdtdec_board_setup(const void *fdt_blob);
 
-#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
 /**
  * fdtdec_resetup()  - Set up the device tree again
  *
@@ -1182,10 +1184,9 @@ int fdtdec_board_setup(const void *fdt_blob);
  * @param rescan Returns a flag indicating that fdt has changed and rescanning
  *               the fdt is required
  *
- * @return 0 if OK, -ve on error
+ * Return: 0 if OK, -ve on error
  */
 int fdtdec_resetup(int *rescan);
-#endif
 
 /**
  * Board-specific FDT initialization. Returns the address to a device tree blob.
@@ -1228,7 +1229,7 @@ void *board_fdt_blob_setup(int *err);
  *                     ignore)
  * @param sizep                Returns total memory size (NULL to ignore)
  * @param bd           Updated with the memory bank information (NULL to skip)
- * @return 0 if OK, -ve on error
+ * Return: 0 if OK, -ve on error
  */
 int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
                           phys_addr_t *basep, phys_size_t *sizep,
@@ -1237,7 +1238,7 @@ int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
 /**
  * fdtdec_get_srcname() - Get the name of where the devicetree comes from
  *
- * @return source name
+ * Return: source name
  */
 const char *fdtdec_get_srcname(void);