Commit 76196999 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

nfp: convert existing RTsym helpers to full target decoding

Make nfp_rtsym_{read,write}_le() and nfp_rtsym_map() use the new
target resolution helpers to allow accessing in-cache symbols.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarFrancois H. Theron <francois.theron@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8f6d6052
...@@ -395,7 +395,7 @@ u64 nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, ...@@ -395,7 +395,7 @@ u64 nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name,
int *error) int *error)
{ {
const struct nfp_rtsym *sym; const struct nfp_rtsym *sym;
u32 val32, id; u32 val32;
u64 val; u64 val;
int err; int err;
...@@ -405,15 +405,13 @@ u64 nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, ...@@ -405,15 +405,13 @@ u64 nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name,
goto exit; goto exit;
} }
id = NFP_CPP_ISLAND_ID(sym->target, NFP_CPP_ACTION_RW, 0, sym->domain);
switch (sym->size) { switch (sym->size) {
case 4: case 4:
err = nfp_cpp_readl(rtbl->cpp, id, sym->addr, &val32); err = nfp_rtsym_readl(rtbl->cpp, sym, 0, &val32);
val = val32; val = val32;
break; break;
case 8: case 8:
err = nfp_cpp_readq(rtbl->cpp, id, sym->addr, &val); err = nfp_rtsym_readq(rtbl->cpp, sym, 0, &val);
break; break;
default: default:
nfp_err(rtbl->cpp, nfp_err(rtbl->cpp,
...@@ -449,20 +447,17 @@ int nfp_rtsym_write_le(struct nfp_rtsym_table *rtbl, const char *name, ...@@ -449,20 +447,17 @@ int nfp_rtsym_write_le(struct nfp_rtsym_table *rtbl, const char *name,
{ {
const struct nfp_rtsym *sym; const struct nfp_rtsym *sym;
int err; int err;
u32 id;
sym = nfp_rtsym_lookup(rtbl, name); sym = nfp_rtsym_lookup(rtbl, name);
if (!sym) if (!sym)
return -ENOENT; return -ENOENT;
id = NFP_CPP_ISLAND_ID(sym->target, NFP_CPP_ACTION_RW, 0, sym->domain);
switch (sym->size) { switch (sym->size) {
case 4: case 4:
err = nfp_cpp_writel(rtbl->cpp, id, sym->addr, value); err = nfp_rtsym_writel(rtbl->cpp, sym, 0, value);
break; break;
case 8: case 8:
err = nfp_cpp_writeq(rtbl->cpp, id, sym->addr, value); err = nfp_rtsym_writeq(rtbl->cpp, sym, 0, value);
break; break;
default: default:
nfp_err(rtbl->cpp, nfp_err(rtbl->cpp,
...@@ -482,21 +477,26 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, const char *id, ...@@ -482,21 +477,26 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, const char *id,
const struct nfp_rtsym *sym; const struct nfp_rtsym *sym;
u8 __iomem *mem; u8 __iomem *mem;
u32 cpp_id; u32 cpp_id;
u64 addr;
int err;
sym = nfp_rtsym_lookup(rtbl, name); sym = nfp_rtsym_lookup(rtbl, name);
if (!sym) if (!sym)
return (u8 __iomem *)ERR_PTR(-ENOENT); return (u8 __iomem *)ERR_PTR(-ENOENT);
cpp_id = NFP_CPP_ISLAND_ID(sym->target, NFP_CPP_ACTION_RW, 0, err = nfp_rtsym_to_dest(rtbl->cpp, sym, NFP_CPP_ACTION_RW, 0, 0,
sym->domain); &cpp_id, &addr);
if (err) {
nfp_err(rtbl->cpp, "Symbol %s mapping failed\n", name);
return (u8 __iomem *)ERR_PTR(err);
}
if (sym->size < min_size) { if (sym->size < min_size) {
nfp_err(rtbl->cpp, "Symbol %s too small\n", name); nfp_err(rtbl->cpp, "Symbol %s too small\n", name);
return (u8 __iomem *)ERR_PTR(-EINVAL); return (u8 __iomem *)ERR_PTR(-EINVAL);
} }
mem = nfp_cpp_map_area(rtbl->cpp, id, cpp_id, sym->addr, mem = nfp_cpp_map_area(rtbl->cpp, id, cpp_id, addr, sym->size, area);
sym->size, area);
if (IS_ERR(mem)) { if (IS_ERR(mem)) {
nfp_err(rtbl->cpp, "Failed to map symbol %s: %ld\n", nfp_err(rtbl->cpp, "Failed to map symbol %s: %ld\n",
name, PTR_ERR(mem)); name, PTR_ERR(mem));
......
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