1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only) */ 2 /* Copyright(c) 2021 Intel Corporation */ 3 #ifndef ADF_PFVF_UTILS_H 4 #define ADF_PFVF_UTILS_H 5 6 #include <linux/types.h> 7 #include "adf_pfvf_msg.h" 8 9 /* How long to wait for far side to acknowledge receipt */ 10 #define ADF_PFVF_MSG_ACK_DELAY_US 4 11 #define ADF_PFVF_MSG_ACK_MAX_DELAY_US (1 * USEC_PER_SEC) 12 13 u8 adf_pfvf_calc_blkmsg_crc(u8 const *buf, u8 buf_len); 14 void adf_pfvf_crc_init(void); 15 16 struct pfvf_field_format { 17 u8 offset; 18 u32 mask; 19 }; 20 21 struct pfvf_csr_format { 22 struct pfvf_field_format type; 23 struct pfvf_field_format data; 24 }; 25 26 u32 adf_pfvf_csr_msg_of(struct adf_accel_dev *accel_dev, struct pfvf_message msg, 27 const struct pfvf_csr_format *fmt); 28 struct pfvf_message adf_pfvf_message_of(struct adf_accel_dev *accel_dev, u32 raw_msg, 29 const struct pfvf_csr_format *fmt); 30 31 #endif /* ADF_PFVF_UTILS_H */ 32