Commit 697f6093 authored by Hanjun Guo's avatar Hanjun Guo Committed by Lorenzo Pieralisi

ACPI/IORT: Rename iort_node_map_rid() to make it generic

iort_node_map_rid() was designed to take an input id (that is not
necessarily a PCI requester id) and map it to an output id (eg an SMMU
streamid or an ITS deviceid) according to the mappings provided by an
IORT node mapping entries. This means that the iort_node_map_rid() input
id is not always a PCI requester id as its name, parameters and local
variables suggest, which is misleading.

Apply the s/rid/id substitution to the iort_node_map_rid() mapping
function and its users to make sure its intended usage is clearer.
Suggested-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: default avatarHanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Tested-by: default avatarMing Lei <ming.lei@canonical.com>
Tested-by: default avatarWei Xu <xuwei5@hisilicon.com>
Tested-by: default avatarSinan Kaya <okaya@codeaurora.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Tomasz Nowicki <tn@semihalf.com>
parent c92bdfe8
...@@ -355,11 +355,11 @@ struct acpi_iort_node *iort_node_get_id(struct acpi_iort_node *node, ...@@ -355,11 +355,11 @@ struct acpi_iort_node *iort_node_get_id(struct acpi_iort_node *node,
return NULL; return NULL;
} }
static struct acpi_iort_node *iort_node_map_rid(struct acpi_iort_node *node, static struct acpi_iort_node *iort_node_map_id(struct acpi_iort_node *node,
u32 rid_in, u32 *rid_out, u32 id_in, u32 *id_out,
u8 type_mask) u8 type_mask)
{ {
u32 rid = rid_in; u32 id = id_in;
/* Parse the ID mapping tree to find specified node type */ /* Parse the ID mapping tree to find specified node type */
while (node) { while (node) {
...@@ -367,8 +367,8 @@ static struct acpi_iort_node *iort_node_map_rid(struct acpi_iort_node *node, ...@@ -367,8 +367,8 @@ static struct acpi_iort_node *iort_node_map_rid(struct acpi_iort_node *node,
int i; int i;
if (IORT_TYPE_MASK(node->type) & type_mask) { if (IORT_TYPE_MASK(node->type) & type_mask) {
if (rid_out) if (id_out)
*rid_out = rid; *id_out = id;
return node; return node;
} }
...@@ -385,9 +385,9 @@ static struct acpi_iort_node *iort_node_map_rid(struct acpi_iort_node *node, ...@@ -385,9 +385,9 @@ static struct acpi_iort_node *iort_node_map_rid(struct acpi_iort_node *node,
goto fail_map; goto fail_map;
} }
/* Do the RID translation */ /* Do the ID translation */
for (i = 0; i < node->mapping_count; i++, map++) { for (i = 0; i < node->mapping_count; i++, map++) {
if (!iort_id_map(map, node->type, rid, &rid)) if (!iort_id_map(map, node->type, id, &id))
break; break;
} }
...@@ -399,9 +399,9 @@ static struct acpi_iort_node *iort_node_map_rid(struct acpi_iort_node *node, ...@@ -399,9 +399,9 @@ static struct acpi_iort_node *iort_node_map_rid(struct acpi_iort_node *node,
} }
fail_map: fail_map:
/* Map input RID to output RID unchanged on mapping failure*/ /* Map input ID to output ID unchanged on mapping failure */
if (rid_out) if (id_out)
*rid_out = rid_in; *id_out = id_in;
return NULL; return NULL;
} }
...@@ -439,7 +439,7 @@ u32 iort_msi_map_rid(struct device *dev, u32 req_id) ...@@ -439,7 +439,7 @@ u32 iort_msi_map_rid(struct device *dev, u32 req_id)
if (!node) if (!node)
return req_id; return req_id;
iort_node_map_rid(node, req_id, &dev_id, IORT_MSI_TYPE); iort_node_map_id(node, req_id, &dev_id, IORT_MSI_TYPE);
return dev_id; return dev_id;
} }
...@@ -462,7 +462,7 @@ static int iort_dev_find_its_id(struct device *dev, u32 req_id, ...@@ -462,7 +462,7 @@ static int iort_dev_find_its_id(struct device *dev, u32 req_id,
if (!node) if (!node)
return -ENXIO; return -ENXIO;
node = iort_node_map_rid(node, req_id, NULL, IORT_MSI_TYPE); node = iort_node_map_id(node, req_id, NULL, IORT_MSI_TYPE);
if (!node) if (!node)
return -ENXIO; return -ENXIO;
...@@ -591,8 +591,8 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev) ...@@ -591,8 +591,8 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev)
if (!node) if (!node)
return NULL; return NULL;
parent = iort_node_map_rid(node, rid, &streamid, parent = iort_node_map_id(node, rid, &streamid,
IORT_IOMMU_TYPE); IORT_IOMMU_TYPE);
ops = iort_iommu_xlate(dev, parent, streamid); ops = iort_iommu_xlate(dev, parent, streamid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment