xref: /freebsd/sys/dev/ice/ice_vf_mbx.h (revision bc761988b724587fe9ed5b99858b05ef842243ac)
1*bc761988SKrzysztof Galazka /* SPDX-License-Identifier: BSD-3-Clause */
2*bc761988SKrzysztof Galazka /*  Copyright (c) 2025, Intel Corporation
3*bc761988SKrzysztof Galazka  *  All rights reserved.
4*bc761988SKrzysztof Galazka  *
5*bc761988SKrzysztof Galazka  *  Redistribution and use in source and binary forms, with or without
6*bc761988SKrzysztof Galazka  *  modification, are permitted provided that the following conditions are met:
7*bc761988SKrzysztof Galazka  *
8*bc761988SKrzysztof Galazka  *   1. Redistributions of source code must retain the above copyright notice,
9*bc761988SKrzysztof Galazka  *      this list of conditions and the following disclaimer.
10*bc761988SKrzysztof Galazka  *
11*bc761988SKrzysztof Galazka  *   2. Redistributions in binary form must reproduce the above copyright
12*bc761988SKrzysztof Galazka  *      notice, this list of conditions and the following disclaimer in the
13*bc761988SKrzysztof Galazka  *      documentation and/or other materials provided with the distribution.
14*bc761988SKrzysztof Galazka  *
15*bc761988SKrzysztof Galazka  *   3. Neither the name of the Intel Corporation nor the names of its
16*bc761988SKrzysztof Galazka  *      contributors may be used to endorse or promote products derived from
17*bc761988SKrzysztof Galazka  *      this software without specific prior written permission.
18*bc761988SKrzysztof Galazka  *
19*bc761988SKrzysztof Galazka  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20*bc761988SKrzysztof Galazka  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21*bc761988SKrzysztof Galazka  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22*bc761988SKrzysztof Galazka  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23*bc761988SKrzysztof Galazka  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*bc761988SKrzysztof Galazka  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*bc761988SKrzysztof Galazka  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*bc761988SKrzysztof Galazka  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*bc761988SKrzysztof Galazka  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*bc761988SKrzysztof Galazka  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*bc761988SKrzysztof Galazka  *  POSSIBILITY OF SUCH DAMAGE.
30*bc761988SKrzysztof Galazka  */
31*bc761988SKrzysztof Galazka 
32*bc761988SKrzysztof Galazka #ifndef _ICE_VF_MBX_H_
33*bc761988SKrzysztof Galazka #define _ICE_VF_MBX_H_
34*bc761988SKrzysztof Galazka 
35*bc761988SKrzysztof Galazka #include "ice_type.h"
36*bc761988SKrzysztof Galazka #include "ice_controlq.h"
37*bc761988SKrzysztof Galazka 
38*bc761988SKrzysztof Galazka /* Defining the mailbox message threshold as 63 asynchronous
39*bc761988SKrzysztof Galazka  * pending messages. Normal VF functionality does not require
40*bc761988SKrzysztof Galazka  * sending more than 63 asynchronous pending message.
41*bc761988SKrzysztof Galazka  */
42*bc761988SKrzysztof Galazka 
43*bc761988SKrzysztof Galazka  /* Threshold value should be used to initialize
44*bc761988SKrzysztof Galazka   * MBX_VF_IN_FLIGHT_MSGS_AT_PF_CNT register.
45*bc761988SKrzysztof Galazka   */
46*bc761988SKrzysztof Galazka #define ICE_ASYNC_VF_MSG_THRESHOLD	63
47*bc761988SKrzysztof Galazka 
48*bc761988SKrzysztof Galazka int
49*bc761988SKrzysztof Galazka ice_aq_send_msg_to_pf(struct ice_hw *hw, enum virtchnl_ops v_opcode,
50*bc761988SKrzysztof Galazka 		      int v_retval, u8 *msg, u16 msglen,
51*bc761988SKrzysztof Galazka 		      struct ice_sq_cd *cd);
52*bc761988SKrzysztof Galazka int
53*bc761988SKrzysztof Galazka ice_aq_send_msg_to_vf(struct ice_hw *hw, u16 vfid, u32 v_opcode, u32 v_retval,
54*bc761988SKrzysztof Galazka 		      u8 *msg, u16 msglen, struct ice_sq_cd *cd);
55*bc761988SKrzysztof Galazka 
56*bc761988SKrzysztof Galazka u32 ice_conv_link_speed_to_virtchnl(bool adv_link_support, u16 link_speed);
57*bc761988SKrzysztof Galazka 
58*bc761988SKrzysztof Galazka void ice_e830_mbx_vf_dec_trig(struct ice_hw *hw,
59*bc761988SKrzysztof Galazka 			      struct ice_rq_event_info *event);
60*bc761988SKrzysztof Galazka void ice_mbx_vf_clear_cnt_e830(struct ice_hw *hw, u16 vf_id);
61*bc761988SKrzysztof Galazka int
62*bc761988SKrzysztof Galazka ice_mbx_vf_state_handler(struct ice_hw *hw, struct ice_mbx_data *mbx_data,
63*bc761988SKrzysztof Galazka 			 struct ice_mbx_vf_info *vf_info, bool *report_malvf);
64*bc761988SKrzysztof Galazka void ice_mbx_clear_malvf(struct ice_mbx_vf_info *vf_info);
65*bc761988SKrzysztof Galazka void ice_mbx_init_vf_info(struct ice_hw *hw, struct ice_mbx_vf_info *vf_info);
66*bc761988SKrzysztof Galazka void ice_mbx_init_snapshot(struct ice_hw *hw);
67*bc761988SKrzysztof Galazka #endif /* _ICE_VF_MBX_H_ */
68