+// SPDX-License-Identifier: GPL-2.0-only
/*
* ACPI device specific properties support.
*
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
*/
#include <linux/acpi.h>
acpi_fwnode_get_named_child_node(const struct fwnode_handle *fwnode,
const char *childname)
{
+ char name[ACPI_PATH_SEGMENT_LENGTH];
struct fwnode_handle *child;
+ struct acpi_buffer path;
+ acpi_status status;
- /*
- * Find first matching named child node of this fwnode.
- * For ACPI this will be a data only sub-node.
- */
- fwnode_for_each_child_node(fwnode, child)
- if (acpi_data_node_match(child, childname))
+ path.length = sizeof(name);
+ path.pointer = name;
+
+ fwnode_for_each_child_node(fwnode, child) {
+ if (is_acpi_data_node(child)) {
+ if (acpi_data_node_match(child, childname))
+ return child;
+ continue;
+ }
+
+ status = acpi_get_name(ACPI_HANDLE_FWNODE(child),
+ ACPI_SINGLE_NAME, &path);
+ if (ACPI_FAILURE(status))
+ break;
+
+ if (!strncmp(name, childname, ACPI_NAMESEG_SIZE))
return child;
+ }
return NULL;
}
struct iommu_group;
struct iommu_fwspec;
struct dev_pin_info;
+struct iommu_param;
struct bus_attribute {
struct attribute attr;
gfp_t gfp_mask, unsigned int order);
extern void devm_free_pages(struct device *dev, unsigned long addr);
-void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
+void __iomem *devm_ioremap_resource(struct device *dev,
+ const struct resource *res);
void __iomem *devm_of_iomap(struct device *dev,
struct device_node *node, int index,
/* allows to add/remove a custom action to devres stack */
int devm_add_action(struct device *dev, void (*action)(void *), void *data);
void devm_remove_action(struct device *dev, void (*action)(void *), void *data);
+void devm_release_action(struct device *dev, void (*action)(void *), void *data);
static inline int devm_add_action_or_reset(struct device *dev,
void (*action)(void *), void *data)
* device (i.e. the bus driver that discovered the device).
* @iommu_group: IOMMU group the device belongs to.
* @iommu_fwspec: IOMMU-specific properties supplied by firmware.
+ * @iommu_param: Per device generic IOMMU runtime data
*
* @offline_disabled: If set, the device is permanently online.
* @offline: Set after successful invocation of bus type's .offline().
void (*release)(struct device *dev);
struct iommu_group *iommu_group;
struct iommu_fwspec *iommu_fwspec;
+ struct iommu_param *iommu_param;
bool offline_disabled:1;
bool offline:1;
int (*fn)(struct device *dev, void *data));
extern struct device *device_find_child(struct device *dev, void *data,
int (*match)(struct device *dev, void *data));
+ extern struct device *device_find_child_by_name(struct device *parent,
+ const char *name);
extern int device_rename(struct device *dev, const char *new_name);
extern int device_move(struct device *dev, struct device *new_parent,
enum dpm_order dpm_order);
+/* SPDX-License-Identifier: GPL-2.0-only */
/*
* property.h - Unified device property interface.
*
* Copyright (C) 2014, Intel Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
*/
#ifndef _LINUX_PROPERTY_H_
unsigned int nargs, unsigned int index,
struct fwnode_reference_args *args);
+ struct fwnode_handle *fwnode_find_reference(const struct fwnode_handle *fwnode,
+ const char *name,
+ unsigned int index);
+
struct fwnode_handle *fwnode_get_parent(const struct fwnode_handle *fwnode);
struct fwnode_handle *fwnode_get_next_parent(
struct fwnode_handle *fwnode);
return device_property_read_u64_array(dev, propname, val, 1);
}
+ static inline int device_property_count_u8(struct device *dev, const char *propname)
+ {
+ return device_property_read_u8_array(dev, propname, NULL, 0);
+ }
+
+ static inline int device_property_count_u16(struct device *dev, const char *propname)
+ {
+ return device_property_read_u16_array(dev, propname, NULL, 0);
+ }
+
+ static inline int device_property_count_u32(struct device *dev, const char *propname)
+ {
+ return device_property_read_u32_array(dev, propname, NULL, 0);
+ }
+
+ static inline int device_property_count_u64(struct device *dev, const char *propname)
+ {
+ return device_property_read_u64_array(dev, propname, NULL, 0);
+ }
+
static inline bool fwnode_property_read_bool(const struct fwnode_handle *fwnode,
const char *propname)
{
return fwnode_property_read_u64_array(fwnode, propname, val, 1);
}
+ static inline int fwnode_property_count_u8(const struct fwnode_handle *fwnode,
+ const char *propname)
+ {
+ return fwnode_property_read_u8_array(fwnode, propname, NULL, 0);
+ }
+
+ static inline int fwnode_property_count_u16(const struct fwnode_handle *fwnode,
+ const char *propname)
+ {
+ return fwnode_property_read_u16_array(fwnode, propname, NULL, 0);
+ }
+
+ static inline int fwnode_property_count_u32(const struct fwnode_handle *fwnode,
+ const char *propname)
+ {
+ return fwnode_property_read_u32_array(fwnode, propname, NULL, 0);
+ }
+
+ static inline int fwnode_property_count_u64(const struct fwnode_handle *fwnode,
+ const char *propname)
+ {
+ return fwnode_property_read_u64_array(fwnode, propname, NULL, 0);
+ }
+
/**
* struct property_entry - "Built-in" device property representation.
* @name: Name of the property.
/* -------------------------------------------------------------------------- */
/* Software fwnode support - when HW description is incomplete or missing */
+ struct software_node;
+
+ /**
+ * struct software_node_ref_args - Reference with additional arguments
+ * @node: Reference to a software node
+ * @nargs: Number of elements in @args array
+ * @args: Integer arguments
+ */
+ struct software_node_ref_args {
+ const struct software_node *node;
+ unsigned int nargs;
+ u64 args[NR_FWNODE_REFERENCE_ARGS];
+ };
+
+ /**
+ * struct software_node_reference - Named software node reference property
+ * @name: Name of the property
+ * @nrefs: Number of elements in @refs array
+ * @refs: Array of references with optional arguments
+ */
+ struct software_node_reference {
+ const char *name;
+ unsigned int nrefs;
+ const struct software_node_ref_args *refs;
+ };
+
+ /**
+ * struct software_node - Software node description
+ * @name: Name of the software node
+ * @parent: Parent of the software node
+ * @properties: Array of device properties
+ * @references: Array of software node reference properties
+ */
+ struct software_node {
+ const char *name;
+ const struct software_node *parent;
+ const struct property_entry *properties;
+ const struct software_node_reference *references;
+ };
+
bool is_software_node(const struct fwnode_handle *fwnode);
+ const struct software_node *to_software_node(struct fwnode_handle *fwnode);
+ struct fwnode_handle *software_node_fwnode(const struct software_node *node);
+
+ int software_node_register_nodes(const struct software_node *nodes);
+ void software_node_unregister_nodes(const struct software_node *nodes);
+
+ int software_node_register(const struct software_node *node);
int software_node_notify(struct device *dev, unsigned long action);