git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net/cnxk: support device infos query
[dpdk.git]
/
drivers
/
net
/
nfp
/
nfpcore
/
nfp_cppcore.c
diff --git
a/drivers/net/nfp/nfpcore/nfp_cppcore.c
b/drivers/net/nfp/nfpcore/nfp_cppcore.c
index
f61143f
..
f910493
100644
(file)
--- a/
drivers/net/nfp/nfpcore/nfp_cppcore.c
+++ b/
drivers/net/nfp/nfpcore/nfp_cppcore.c
@@
-12,6
+12,7
@@
#include <sys/types.h>
#include <rte_byteorder.h>
#include <sys/types.h>
#include <rte_byteorder.h>
+#include <ethdev_pci.h>
#include "nfp_cpp.h"
#include "nfp_target.h"
#include "nfp_cpp.h"
#include "nfp_target.h"
@@
-21,8
+22,9
@@
#define NFP_PL_DEVICE_ID 0x00000004
#define NFP_PL_DEVICE_ID_MASK 0xff
#define NFP_PL_DEVICE_ID 0x00000004
#define NFP_PL_DEVICE_ID_MASK 0xff
-
-#define NFP6000_ARM_GCSR_SOFTMODEL0 0x00400144
+#define NFP_PL_DEVICE_PART_MASK 0xffff0000
+#define NFP_PL_DEVICE_MODEL_MASK (NFP_PL_DEVICE_PART_MASK | \
+ NFP_PL_DEVICE_ID_MASK)
void
nfp_cpp_priv_set(struct nfp_cpp *cpp, void *priv)
void
nfp_cpp_priv_set(struct nfp_cpp *cpp, void *priv)
@@
-45,13
+47,18
@@
nfp_cpp_model_set(struct nfp_cpp *cpp, uint32_t model)
uint32_t
nfp_cpp_model(struct nfp_cpp *cpp)
{
uint32_t
nfp_cpp_model(struct nfp_cpp *cpp)
{
+ int err;
+ uint32_t model;
+
if (!cpp)
return NFP_CPP_MODEL_INVALID;
if (!cpp)
return NFP_CPP_MODEL_INVALID;
- if (cpp->model == 0)
- cpp->model = __nfp_cpp_model_autodetect(cpp);
+ err = __nfp_cpp_model_autodetect(cpp, &model);
+
+ if (err < 0)
+ return err;
- return
cpp->
model;
+ return model;
}
void
}
void
@@
-388,9
+395,6
@@
nfp_xpb_to_cpp(struct nfp_cpp *cpp, uint32_t *xpb_addr)
uint32_t xpb;
int island;
uint32_t xpb;
int island;
- if (!NFP_CPP_MODEL_IS_6000(cpp->model))
- return 0;
-
xpb = NFP_CPP_ID(14, NFP_CPP_ACTION_RW, 0);
/*
xpb = NFP_CPP_ID(14, NFP_CPP_ACTION_RW, 0);
/*
@@
-542,7
+546,7
@@
nfp_xpb_readl(struct nfp_cpp *cpp, uint32_t xpb_addr, uint32_t *value)
}
static struct nfp_cpp *
}
static struct nfp_cpp *
-nfp_cpp_alloc(
const char *devname
, int driver_lock_needed)
+nfp_cpp_alloc(
struct rte_pci_device *dev
, int driver_lock_needed)
{
const struct nfp_cpp_operations *ops;
struct nfp_cpp *cpp;
{
const struct nfp_cpp_operations *ops;
struct nfp_cpp *cpp;
@@
-561,7
+565,7
@@
nfp_cpp_alloc(const char *devname, int driver_lock_needed)
cpp->driver_lock_needed = driver_lock_needed;
if (cpp->op->init) {
cpp->driver_lock_needed = driver_lock_needed;
if (cpp->op->init) {
- err = cpp->op->init(cpp, dev
name
);
+ err = cpp->op->init(cpp, dev);
if (err < 0) {
free(cpp);
return NULL;
if (err < 0) {
free(cpp);
return NULL;
@@
-604,9
+608,9
@@
nfp_cpp_free(struct nfp_cpp *cpp)
}
struct nfp_cpp *
}
struct nfp_cpp *
-nfp_cpp_from_device_name(
const char *devname
, int driver_lock_needed)
+nfp_cpp_from_device_name(
struct rte_pci_device *dev
, int driver_lock_needed)
{
{
- return nfp_cpp_alloc(dev
name
, driver_lock_needed);
+ return nfp_cpp_alloc(dev, driver_lock_needed);
}
/*
}
/*
@@
-795,26
+799,21
@@
nfp_cpp_area_fill(struct nfp_cpp_area *area, unsigned long offset,
* as those are model-specific
*/
uint32_t
* as those are model-specific
*/
uint32_t
-__nfp_cpp_model_autodetect(struct nfp_cpp *cpp)
+__nfp_cpp_model_autodetect(struct nfp_cpp *cpp
, uint32_t *model
)
{
{
- uint32_t arm_id = NFP_CPP_ID(NFP_CPP_TARGET_ARM, 0, 0);
- uint32_t model = 0;
-
- nfp_cpp_readl(cpp, arm_id, NFP6000_ARM_GCSR_SOFTMODEL0, &model);
-
- if (NFP_CPP_MODEL_IS_6000(model)) {
- uint32_t tmp;
+ uint32_t reg;
+ int err;
- nfp_cpp_model_set(cpp, model);
+ err = nfp_xpb_readl(cpp, NFP_XPB_DEVICE(1, 1, 16) + NFP_PL_DEVICE_ID,
+ ®);
+ if (err < 0)
+ return err;
- /* The PL's PluDeviceID revision code is authoratative */
- model &= ~0xff;
- nfp_xpb_readl(cpp, NFP_XPB_DEVICE(1, 1, 16) +
- NFP_PL_DEVICE_ID, &tmp);
- model |= (NFP_PL_DEVICE_ID_MASK & tmp) - 0x10;
- }
+ *model = reg & NFP_PL_DEVICE_MODEL_MASK;
+ if (*model & NFP_PL_DEVICE_ID_MASK)
+ *model -= 0x10;
- return
model
;
+ return
0
;
}
/*
}
/*