mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-25 16:11:45 +00:00
Merge branch 'nfp-fix-rtsym-and-XPB-register-handling-in-debug-dump'
Simon Horman says: ==================== nfp: fix rtsym and XPB register handling in debug dump this series resolves two problems in the recently added debug dump facility. * Correctly handle reading absolute rtysms * Correctly handle special-case PB register reads These fixes are for code only present in net-next. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
b4cf6a0a23
1 changed files with 39 additions and 18 deletions
|
@ -38,6 +38,7 @@
|
||||||
#include "nfp_main.h"
|
#include "nfp_main.h"
|
||||||
#include "nfpcore/nfp.h"
|
#include "nfpcore/nfp.h"
|
||||||
#include "nfpcore/nfp_nffw.h"
|
#include "nfpcore/nfp_nffw.h"
|
||||||
|
#include "nfpcore/nfp6000/nfp6000.h"
|
||||||
|
|
||||||
#define NFP_DUMP_SPEC_RTSYM "_abi_dump_spec"
|
#define NFP_DUMP_SPEC_RTSYM "_abi_dump_spec"
|
||||||
|
|
||||||
|
@ -265,6 +266,7 @@ nfp_calc_rtsym_dump_sz(struct nfp_pf *pf, struct nfp_dump_tl *spec)
|
||||||
struct nfp_dumpspec_rtsym *spec_rtsym;
|
struct nfp_dumpspec_rtsym *spec_rtsym;
|
||||||
const struct nfp_rtsym *sym;
|
const struct nfp_rtsym *sym;
|
||||||
u32 tl_len, key_len;
|
u32 tl_len, key_len;
|
||||||
|
u32 size;
|
||||||
|
|
||||||
spec_rtsym = (struct nfp_dumpspec_rtsym *)spec;
|
spec_rtsym = (struct nfp_dumpspec_rtsym *)spec;
|
||||||
tl_len = be32_to_cpu(spec->length);
|
tl_len = be32_to_cpu(spec->length);
|
||||||
|
@ -276,8 +278,13 @@ nfp_calc_rtsym_dump_sz(struct nfp_pf *pf, struct nfp_dump_tl *spec)
|
||||||
if (!sym)
|
if (!sym)
|
||||||
return nfp_dump_error_tlv_size(spec);
|
return nfp_dump_error_tlv_size(spec);
|
||||||
|
|
||||||
|
if (sym->type == NFP_RTSYM_TYPE_ABS)
|
||||||
|
size = sizeof(sym->addr);
|
||||||
|
else
|
||||||
|
size = sym->size;
|
||||||
|
|
||||||
return ALIGN8(offsetof(struct nfp_dump_rtsym, rtsym) + key_len + 1) +
|
return ALIGN8(offsetof(struct nfp_dump_rtsym, rtsym) + key_len + 1) +
|
||||||
ALIGN8(sym->size);
|
ALIGN8(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -472,6 +479,12 @@ static int nfp_dump_hwinfo_field(struct nfp_pf *pf, struct nfp_dump_tl *spec,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool is_xpb_read(struct nfp_dumpspec_cpp_isl_id *cpp_id)
|
||||||
|
{
|
||||||
|
return cpp_id->target == NFP_CPP_TARGET_ISLAND_XPB &&
|
||||||
|
cpp_id->action == 0 && cpp_id->token == 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nfp_dump_csr_range(struct nfp_pf *pf, struct nfp_dumpspec_csr *spec_csr,
|
nfp_dump_csr_range(struct nfp_pf *pf, struct nfp_dumpspec_csr *spec_csr,
|
||||||
struct nfp_dump_state *dump)
|
struct nfp_dump_state *dump)
|
||||||
|
@ -505,8 +518,12 @@ nfp_dump_csr_range(struct nfp_pf *pf, struct nfp_dumpspec_csr *spec_csr,
|
||||||
max_rd_addr = cpp_rd_addr + be32_to_cpu(spec_csr->cpp.dump_length);
|
max_rd_addr = cpp_rd_addr + be32_to_cpu(spec_csr->cpp.dump_length);
|
||||||
|
|
||||||
while (cpp_rd_addr < max_rd_addr) {
|
while (cpp_rd_addr < max_rd_addr) {
|
||||||
bytes_read = nfp_cpp_read(pf->cpp, cpp_id, cpp_rd_addr, dest,
|
if (is_xpb_read(&spec_csr->cpp.cpp_id))
|
||||||
reg_sz);
|
bytes_read = nfp_xpb_readl(pf->cpp, cpp_rd_addr,
|
||||||
|
(u32 *)dest);
|
||||||
|
else
|
||||||
|
bytes_read = nfp_cpp_read(pf->cpp, cpp_id, cpp_rd_addr,
|
||||||
|
dest, reg_sz);
|
||||||
if (bytes_read != reg_sz) {
|
if (bytes_read != reg_sz) {
|
||||||
if (bytes_read >= 0)
|
if (bytes_read >= 0)
|
||||||
bytes_read = -EIO;
|
bytes_read = -EIO;
|
||||||
|
@ -654,22 +671,26 @@ nfp_dump_single_rtsym(struct nfp_pf *pf, struct nfp_dumpspec_rtsym *spec,
|
||||||
header_size - offsetof(struct nfp_dump_rtsym, rtsym);
|
header_size - offsetof(struct nfp_dump_rtsym, rtsym);
|
||||||
memcpy(dump_header->rtsym, spec->rtsym, key_len + 1);
|
memcpy(dump_header->rtsym, spec->rtsym, key_len + 1);
|
||||||
|
|
||||||
|
if (sym->type == NFP_RTSYM_TYPE_ABS) {
|
||||||
|
dump_header->cpp.dump_length = cpu_to_be32(sizeof(sym->addr));
|
||||||
|
*(u64 *)dest = sym->addr;
|
||||||
|
} else {
|
||||||
cpp_params.target = sym->target;
|
cpp_params.target = sym->target;
|
||||||
cpp_params.action = NFP_CPP_ACTION_RW;
|
cpp_params.action = NFP_CPP_ACTION_RW;
|
||||||
cpp_params.token = 0;
|
cpp_params.token = 0;
|
||||||
cpp_params.island = sym->domain;
|
cpp_params.island = sym->domain;
|
||||||
cpp_id = nfp_get_numeric_cpp_id(&cpp_params);
|
cpp_id = nfp_get_numeric_cpp_id(&cpp_params);
|
||||||
|
|
||||||
dump_header->cpp.cpp_id = cpp_params;
|
dump_header->cpp.cpp_id = cpp_params;
|
||||||
dump_header->cpp.offset = cpu_to_be32(sym->addr);
|
dump_header->cpp.offset = cpu_to_be32(sym->addr);
|
||||||
dump_header->cpp.dump_length = cpu_to_be32(sym->size);
|
dump_header->cpp.dump_length = cpu_to_be32(sym->size);
|
||||||
|
bytes_read = nfp_cpp_read(pf->cpp, cpp_id, sym->addr, dest,
|
||||||
bytes_read = nfp_cpp_read(pf->cpp, cpp_id, sym->addr, dest, sym->size);
|
sym->size);
|
||||||
if (bytes_read != sym->size) {
|
if (bytes_read != sym->size) {
|
||||||
if (bytes_read >= 0)
|
if (bytes_read >= 0)
|
||||||
bytes_read = -EIO;
|
bytes_read = -EIO;
|
||||||
dump_header->error = cpu_to_be32(bytes_read);
|
dump_header->error = cpu_to_be32(bytes_read);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue