common/cnxk: add NPC init and fini
[dpdk.git] / drivers / common / cnxk / roc_platform.h
index 1d06435..cd7a5dc 100644 (file)
 #define plt_strlcpy rte_strlcpy
 
 /* Log */
+extern int cnxk_logtype_base;
+extern int cnxk_logtype_mbox;
+extern int cnxk_logtype_npa;
+extern int cnxk_logtype_nix;
+extern int cnxk_logtype_npc;
+extern int cnxk_logtype_tm;
+
 #define plt_err(fmt, args...)                                                  \
        RTE_LOG(ERR, PMD, "%s():%u " fmt "\n", __func__, __LINE__, ##args)
 #define plt_info(fmt, args...) RTE_LOG(INFO, PMD, fmt "\n", ##args)
 #define plt_warn(fmt, args...) RTE_LOG(WARNING, PMD, fmt "\n", ##args)
 #define plt_print(fmt, args...) RTE_LOG(INFO, PMD, fmt "\n", ##args)
 
+/**
+ * Log debug message if given subsystem logging is enabled.
+ */
+#define plt_dbg(subsystem, fmt, args...)                                       \
+       rte_log(RTE_LOG_DEBUG, cnxk_logtype_##subsystem,                       \
+               "[%s] %s():%u " fmt "\n", #subsystem, __func__, __LINE__,      \
+               ##args)
+
+#define plt_base_dbg(fmt, ...) plt_dbg(base, fmt, ##__VA_ARGS__)
+#define plt_mbox_dbg(fmt, ...) plt_dbg(mbox, fmt, ##__VA_ARGS__)
+#define plt_npa_dbg(fmt, ...)  plt_dbg(npa, fmt, ##__VA_ARGS__)
+#define plt_nix_dbg(fmt, ...)  plt_dbg(nix, fmt, ##__VA_ARGS__)
+#define plt_npc_dbg(fmt, ...)  plt_dbg(npc, fmt, ##__VA_ARGS__)
+#define plt_tm_dbg(fmt, ...)   plt_dbg(tm, fmt, ##__VA_ARGS__)
+
 #ifdef __cplusplus
 #define CNXK_PCI_ID(subsystem_dev, dev)                                \
        {                                                       \
 __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_ */