/* Read memory and check if it could be a valid MIP */ staticint
nfp_mip_try_read(struct nfp_cpp *cpp, u32 cpp_id, u64 addr, struct nfp_mip *mip)
{ int ret;
ret = nfp_cpp_read(cpp, cpp_id, addr, mip, sizeof(*mip)); if (ret != sizeof(*mip)) {
nfp_err(cpp, "Failed to read MIP data (%d, %zu)\n",
ret, sizeof(*mip)); return -EIO;
} if (mip->signature != NFP_MIP_SIGNATURE) {
nfp_warn(cpp, "Incorrect MIP signature (0x%08x)\n",
le32_to_cpu(mip->signature)); return -EINVAL;
} if (mip->mip_version != NFP_MIP_VERSION) {
nfp_warn(cpp, "Unsupported MIP version (%d)\n",
le32_to_cpu(mip->mip_version)); return -EINVAL;
}
return 0;
}
/* Try to locate MIP using the resource table */ staticint nfp_mip_read_resource(struct nfp_cpp *cpp, struct nfp_mip *mip)
{ struct nfp_nffw_info *nffw_info;
u32 cpp_id;
u64 addr; int err;
nffw_info = nfp_nffw_info_open(cpp); if (IS_ERR(nffw_info)) return PTR_ERR(nffw_info);
err = nfp_nffw_info_mip_first(nffw_info, &cpp_id, &addr); if (err) goto exit_close_nffw;
/** * nfp_mip_open() - Get device MIP structure * @cpp: NFP CPP Handle * * Copy MIP structure from NFP device and return it. The returned * structure is handled internally by the library and should be * freed by calling nfp_mip_close(). * * Return: pointer to mip, NULL on failure.
*/ conststruct nfp_mip *nfp_mip_open(struct nfp_cpp *cpp)
{ struct nfp_mip *mip; int err;
mip = kmalloc(sizeof(*mip), GFP_KERNEL); if (!mip) return NULL;
/** * nfp_mip_symtab() - Get the address and size of the MIP symbol table * @mip: MIP handle * @addr: Location for NFP DDR address of MIP symbol table * @size: Location for size of MIP symbol table
*/ void nfp_mip_symtab(conststruct nfp_mip *mip, u32 *addr, u32 *size)
{
*addr = le32_to_cpu(mip->symtab_addr);
*size = le32_to_cpu(mip->symtab_size);
}
/** * nfp_mip_strtab() - Get the address and size of the MIP symbol name table * @mip: MIP handle * @addr: Location for NFP DDR address of MIP symbol name table * @size: Location for size of MIP symbol name table
*/ void nfp_mip_strtab(conststruct nfp_mip *mip, u32 *addr, u32 *size)
{
*addr = le32_to_cpu(mip->strtab_addr);
*size = le32_to_cpu(mip->strtab_size);
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.