Commit 2d81d425 authored by Shanker Donthineni's avatar Shanker Donthineni Committed by Marc Zyngier

irqchip/gicv3-its: Introduce two helper functions for accessing BASERn

This patch adds the two handy helper functions for reading and writing
ITS BASERn register.
Signed-off-by: default avatarShanker Donthineni <shankerd@codeaurora.org>
[Marc: Folded its_write_baser_cache into its_write_baser]
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
parent 9c8edddf
...@@ -824,6 +824,22 @@ static const char *its_base_type_string[] = { ...@@ -824,6 +824,22 @@ static const char *its_base_type_string[] = {
[GITS_BASER_TYPE_RESERVED7] = "Reserved (7)", [GITS_BASER_TYPE_RESERVED7] = "Reserved (7)",
}; };
static u64 its_read_baser(struct its_node *its, struct its_baser *baser)
{
u32 idx = baser - its->tables;
return readq_relaxed(its->base + GITS_BASER + (idx << 3));
}
static void its_write_baser(struct its_node *its, struct its_baser *baser,
u64 val)
{
u32 idx = baser - its->tables;
writeq_relaxed(val, its->base + GITS_BASER + (idx << 3));
baser->val = its_read_baser(its, baser);
}
static void its_free_tables(struct its_node *its) static void its_free_tables(struct its_node *its)
{ {
int i; int i;
...@@ -863,7 +879,8 @@ static int its_alloc_tables(const char *node_name, struct its_node *its) ...@@ -863,7 +879,8 @@ static int its_alloc_tables(const char *node_name, struct its_node *its)
its->device_ids = ids; its->device_ids = ids;
for (i = 0; i < GITS_BASER_NR_REGS; i++) { for (i = 0; i < GITS_BASER_NR_REGS; i++) {
u64 val = readq_relaxed(its->base + GITS_BASER + i * 8); struct its_baser *baser = its->tables + i;
u64 val = its_read_baser(its, baser);
u64 type = GITS_BASER_TYPE(val); u64 type = GITS_BASER_TYPE(val);
u64 entry_size = GITS_BASER_ENTRY_SIZE(val); u64 entry_size = GITS_BASER_ENTRY_SIZE(val);
int order = get_order(psz); int order = get_order(psz);
...@@ -937,10 +954,9 @@ static int its_alloc_tables(const char *node_name, struct its_node *its) ...@@ -937,10 +954,9 @@ static int its_alloc_tables(const char *node_name, struct its_node *its)
} }
val |= alloc_pages - 1; val |= alloc_pages - 1;
its->tables[i].val = val;
writeq_relaxed(val, its->base + GITS_BASER + i * 8); its_write_baser_cache(its, baser, val);
tmp = readq_relaxed(its->base + GITS_BASER + i * 8); tmp = baser->val;
if ((val ^ tmp) & GITS_BASER_SHAREABILITY_MASK) { if ((val ^ tmp) & GITS_BASER_SHAREABILITY_MASK) {
/* /*
......
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