]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ACPI/IORT: Replace rid map type with type mask
authorLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Mon, 21 Nov 2016 10:01:46 +0000 (10:01 +0000)
committerWill Deacon <will.deacon@arm.com>
Tue, 29 Nov 2016 15:57:47 +0000 (15:57 +0000)
IORT tables provide data that allow the kernel to carry out
device ID mappings between endpoints and system components
(eg interrupt controllers, IOMMUs). When the mapping for a
given device ID is carried out, the translation mechanism
is done on a per-subsystem basis rather than a component
subtype (ie the IOMMU kernel layer will look for mappings
from a device to all IORT node types corresponding to IOMMU
components), therefore the corresponding mapping API should
work on a range (ie mask) of IORT node types corresponding
to a common set of components (eg IOMMUs) rather than a
specific node type.

Upgrade the IORT iort_node_map_rid() API to work with a
type mask instead of a single node type so that it can
be used for mappings that span multiple components types
(ie IOMMUs).

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Tomasz Nowicki <tn@semihalf.com>
Tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Tested-by: Tomasz Nowicki <tn@semihalf.com>
Acked-by: Hanjun Guo <hanjun.guo@linaro.org>
Cc: Hanjun Guo <hanjun.guo@linaro.org>
Cc: Tomasz Nowicki <tn@semihalf.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Signed-off-by: Will Deacon <will.deacon@arm.com>
drivers/acpi/arm64/iort.c

index 8a8ae5ed05d5c56acf8bec59a0001da245a05d2c..f3bbef8bb15a0c300853d70a1e8599188e807a59 100644 (file)
@@ -26,6 +26,9 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
+#define IORT_TYPE_MASK(type)   (1 << (type))
+#define IORT_MSI_TYPE          (1 << ACPI_IORT_NODE_ITS_GROUP)
+
 struct iort_its_msi_chip {
        struct list_head        list;
        struct fwnode_handle    *fw_node;
@@ -317,7 +320,7 @@ static int iort_id_map(struct acpi_iort_id_mapping *map, u8 type, u32 rid_in,
 
 static struct acpi_iort_node *iort_node_map_rid(struct acpi_iort_node *node,
                                                u32 rid_in, u32 *rid_out,
-                                               u8 type)
+                                               u8 type_mask)
 {
        u32 rid = rid_in;
 
@@ -326,7 +329,7 @@ static struct acpi_iort_node *iort_node_map_rid(struct acpi_iort_node *node,
                struct acpi_iort_id_mapping *map;
                int i;
 
-               if (node->type == type) {
+               if (IORT_TYPE_MASK(node->type) & type_mask) {
                        if (rid_out)
                                *rid_out = rid;
                        return node;
@@ -399,7 +402,7 @@ u32 iort_msi_map_rid(struct device *dev, u32 req_id)
        if (!node)
                return req_id;
 
-       iort_node_map_rid(node, req_id, &dev_id, ACPI_IORT_NODE_ITS_GROUP);
+       iort_node_map_rid(node, req_id, &dev_id, IORT_MSI_TYPE);
        return dev_id;
 }
 
@@ -421,7 +424,7 @@ static int iort_dev_find_its_id(struct device *dev, u32 req_id,
        if (!node)
                return -ENXIO;
 
-       node = iort_node_map_rid(node, req_id, NULL, ACPI_IORT_NODE_ITS_GROUP);
+       node = iort_node_map_rid(node, req_id, NULL, IORT_MSI_TYPE);
        if (!node)
                return -ENXIO;