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