Lines Matching +full:read +full:- +full:out

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2009 - 2018 Intel Corporation. */
7 * e1000_poll_for_msg - Wait for message notification
14 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_poll_for_msg()
15 int countdown = mbx->timeout; in e1000_poll_for_msg()
17 if (!mbx->ops.check_for_msg) in e1000_poll_for_msg()
18 goto out; in e1000_poll_for_msg()
20 while (countdown && mbx->ops.check_for_msg(hw)) { in e1000_poll_for_msg()
21 countdown--; in e1000_poll_for_msg()
22 udelay(mbx->usec_delay); in e1000_poll_for_msg()
27 mbx->timeout = 0; in e1000_poll_for_msg()
28 out: in e1000_poll_for_msg()
29 return countdown ? E1000_SUCCESS : -E1000_ERR_MBX; in e1000_poll_for_msg()
33 * e1000_poll_for_ack - Wait for message acknowledgment
40 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_poll_for_ack()
41 int countdown = mbx->timeout; in e1000_poll_for_ack()
43 if (!mbx->ops.check_for_ack) in e1000_poll_for_ack()
44 goto out; in e1000_poll_for_ack()
46 while (countdown && mbx->ops.check_for_ack(hw)) { in e1000_poll_for_ack()
47 countdown--; in e1000_poll_for_ack()
48 udelay(mbx->usec_delay); in e1000_poll_for_ack()
53 mbx->timeout = 0; in e1000_poll_for_ack()
54 out: in e1000_poll_for_ack()
55 return countdown ? E1000_SUCCESS : -E1000_ERR_MBX; in e1000_poll_for_ack()
59 * e1000_read_posted_mbx - Wait for message notification and receive message
69 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_read_posted_mbx()
70 s32 ret_val = -E1000_ERR_MBX; in e1000_read_posted_mbx()
72 if (!mbx->ops.read) in e1000_read_posted_mbx()
73 goto out; in e1000_read_posted_mbx()
77 /* if ack received read message, otherwise we timed out */ in e1000_read_posted_mbx()
79 ret_val = mbx->ops.read(hw, msg, size); in e1000_read_posted_mbx()
80 out: in e1000_read_posted_mbx()
85 * e1000_write_posted_mbx - Write a message to the mailbox, wait for ack
95 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_write_posted_mbx()
96 s32 ret_val = -E1000_ERR_MBX; in e1000_write_posted_mbx()
99 if (!mbx->ops.write || !mbx->timeout) in e1000_write_posted_mbx()
100 goto out; in e1000_write_posted_mbx()
103 ret_val = mbx->ops.write(hw, msg, size); in e1000_write_posted_mbx()
108 out: in e1000_write_posted_mbx()
113 * e1000_read_v2p_mailbox - read v2p mailbox
116 * This function is used to read the v2p mailbox without losing the read to
123 v2p_mailbox |= hw->dev_spec.vf.v2p_mailbox; in e1000_read_v2p_mailbox()
124 hw->dev_spec.vf.v2p_mailbox |= v2p_mailbox & E1000_V2PMAILBOX_R2C_BITS; in e1000_read_v2p_mailbox()
130 * e1000_check_for_bit_vf - Determine if a status bit was set
134 * This function is used to check for the read to clear bits within
140 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_bit_vf()
145 hw->dev_spec.vf.v2p_mailbox &= ~mask; in e1000_check_for_bit_vf()
151 * e1000_check_for_msg_vf - checks to see if the PF has sent mail
158 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_msg_vf()
162 hw->mbx.stats.reqs++; in e1000_check_for_msg_vf()
169 * e1000_check_for_ack_vf - checks to see if the PF has ACK'd
176 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_ack_vf()
180 hw->mbx.stats.acks++; in e1000_check_for_ack_vf()
187 * e1000_check_for_rst_vf - checks to see if the PF has reset
194 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_rst_vf()
199 hw->mbx.stats.rsts++; in e1000_check_for_rst_vf()
206 * e1000_obtain_mbx_lock_vf - obtain mailbox lock
213 s32 ret_val = -E1000_ERR_MBX; in e1000_obtain_mbx_lock_vf()
226 } while (count-- > 0); in e1000_obtain_mbx_lock_vf()
232 * e1000_write_mbx_vf - Write a message to the mailbox
244 lockdep_assert_held(&hw->mbx_lock); in e1000_write_mbx_vf()
260 hw->mbx.stats.msgs_tx++; in e1000_write_mbx_vf()
270 * e1000_read_mbx_vf - Reads a message from the inbox intended for VF
275 * returns SUCCESS if it successfully read message from buffer
282 lockdep_assert_held(&hw->mbx_lock); in e1000_read_mbx_vf()
297 hw->mbx.stats.msgs_rx++; in e1000_read_mbx_vf()
304 * e1000_init_mbx_params_vf - set initial values for VF mailbox
307 * Initializes the hw->mbx struct to correct values for VF mailbox
311 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_init_mbx_params_vf()
313 /* start mailbox as timed out and let the reset_hw call set the timeout in e1000_init_mbx_params_vf()
316 mbx->timeout = 0; in e1000_init_mbx_params_vf()
317 mbx->usec_delay = E1000_VF_MBX_INIT_DELAY; in e1000_init_mbx_params_vf()
319 mbx->size = E1000_VFMAILBOX_SIZE; in e1000_init_mbx_params_vf()
321 mbx->ops.read = e1000_read_mbx_vf; in e1000_init_mbx_params_vf()
322 mbx->ops.write = e1000_write_mbx_vf; in e1000_init_mbx_params_vf()
323 mbx->ops.read_posted = e1000_read_posted_mbx; in e1000_init_mbx_params_vf()
324 mbx->ops.write_posted = e1000_write_posted_mbx; in e1000_init_mbx_params_vf()
325 mbx->ops.check_for_msg = e1000_check_for_msg_vf; in e1000_init_mbx_params_vf()
326 mbx->ops.check_for_ack = e1000_check_for_ack_vf; in e1000_init_mbx_params_vf()
327 mbx->ops.check_for_rst = e1000_check_for_rst_vf; in e1000_init_mbx_params_vf()
329 mbx->stats.msgs_tx = 0; in e1000_init_mbx_params_vf()
330 mbx->stats.msgs_rx = 0; in e1000_init_mbx_params_vf()
331 mbx->stats.reqs = 0; in e1000_init_mbx_params_vf()
332 mbx->stats.acks = 0; in e1000_init_mbx_params_vf()
333 mbx->stats.rsts = 0; in e1000_init_mbx_params_vf()