common/cnxk: add roc plt init callback support
Add support for registering callbacks for roc plt init. Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com> Acked-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
This commit is contained in:
parent
014a9e222b
commit
c92d8a70ae
@ -4,10 +4,26 @@
|
||||
|
||||
#include "roc_api.h"
|
||||
|
||||
#define PLT_INIT_CB_MAX 8
|
||||
|
||||
static int plt_init_cb_num;
|
||||
static roc_plt_init_cb_t plt_init_cbs[PLT_INIT_CB_MAX];
|
||||
|
||||
int
|
||||
roc_plt_init_cb_register(roc_plt_init_cb_t cb)
|
||||
{
|
||||
if (plt_init_cb_num >= PLT_INIT_CB_MAX)
|
||||
return -ERANGE;
|
||||
|
||||
plt_init_cbs[plt_init_cb_num++] = cb;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
roc_plt_init(void)
|
||||
{
|
||||
const struct rte_memzone *mz;
|
||||
int i, rc;
|
||||
|
||||
mz = rte_memzone_lookup(PLT_MODEL_MZ_NAME);
|
||||
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
|
||||
@ -29,5 +45,11 @@ roc_plt_init(void)
|
||||
roc_model = mz->addr;
|
||||
}
|
||||
|
||||
for (i = 0; i < plt_init_cb_num; i++) {
|
||||
rc = (*plt_init_cbs[i])();
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -161,4 +161,8 @@
|
||||
__rte_internal
|
||||
int roc_plt_init(void);
|
||||
|
||||
/* Init callbacks */
|
||||
typedef int (*roc_plt_init_cb_t)(void);
|
||||
int __roc_api roc_plt_init_cb_register(roc_plt_init_cb_t cb);
|
||||
|
||||
#endif /* _ROC_PLATFORM_H_ */
|
||||
|
@ -4,6 +4,7 @@ INTERNAL {
|
||||
roc_error_msg_get;
|
||||
roc_model;
|
||||
roc_plt_init;
|
||||
roc_plt_init_cb_register;
|
||||
|
||||
local: *;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user