1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Cavium, Inc
5 #ifndef __OCTEONTX_MBOX_H__
6 #define __OCTEONTX_MBOX_H__
8 #include <rte_common.h>
9 #include <rte_spinlock.h>
11 #define SSOW_BAR4_LEN (64 * 1024)
12 #define SSO_VHGRP_PF_MBOX(x) (0x200ULL | ((x) << 3))
15 #define RM_START_APP 0x1
16 #define RM_INTERFACE_VERSION 0x2
19 #define MBOX_LOG(level, fmt, args...) \
20 rte_log(RTE_LOG_ ## level, octeontx_logtype_mbox,\
21 "%s() line %u: " fmt "\n", __func__, __LINE__, ## args)
23 #define mbox_log_info(fmt, ...) MBOX_LOG(INFO, fmt, ##__VA_ARGS__)
24 #define mbox_log_dbg(fmt, ...) MBOX_LOG(DEBUG, fmt, ##__VA_ARGS__)
25 #define mbox_log_err(fmt, ...) MBOX_LOG(ERR, fmt, ##__VA_ARGS__)
26 #define mbox_func_trace mbox_log_dbg
28 extern int octeontx_logtype_mbox;
30 struct octeontx_mbox_hdr {
31 uint16_t vfid; /* VF index or pf resource index local to the domain */
32 uint8_t coproc; /* Coprocessor id */
33 uint8_t msg; /* Message id */
34 uint8_t oob; /* out of band data */
35 uint8_t res_code; /* Functional layer response code */
39 int octeontx_mbox_init(void);
40 void octeontx_set_global_domain(uint16_t global_domain);
42 uint16_t octeontx_get_global_domain(void);
44 int octeontx_mbox_set_ram_mbox_base(uint8_t *ram_mbox_base, uint16_t domain);
46 int octeontx_mbox_set_reg(uint8_t *reg, uint16_t domain);
48 int octeontx_mbox_send(struct octeontx_mbox_hdr *hdr,
49 void *txdata, uint16_t txlen, void *rxdata, uint16_t rxlen);
51 #endif /* __OCTEONTX_MBOX_H__ */