Lines Matching +full:read +full:- +full:out
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2009 - 2018 Intel Corporation. */
8 * e1000_poll_for_msg - Wait for message notification
15 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_poll_for_msg()
16 int countdown = mbx->timeout; in e1000_poll_for_msg()
18 if (!mbx->ops.check_for_msg) in e1000_poll_for_msg()
19 goto out; in e1000_poll_for_msg()
21 while (countdown && mbx->ops.check_for_msg(hw)) { in e1000_poll_for_msg()
22 countdown--; in e1000_poll_for_msg()
23 udelay(mbx->usec_delay); in e1000_poll_for_msg()
28 mbx->timeout = 0; in e1000_poll_for_msg()
29 out: in e1000_poll_for_msg()
30 return countdown ? E1000_SUCCESS : -E1000_ERR_MBX; in e1000_poll_for_msg()
34 * e1000_poll_for_ack - Wait for message acknowledgment
41 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_poll_for_ack()
42 int countdown = mbx->timeout; in e1000_poll_for_ack()
44 if (!mbx->ops.check_for_ack) in e1000_poll_for_ack()
45 goto out; in e1000_poll_for_ack()
47 while (countdown && mbx->ops.check_for_ack(hw)) { in e1000_poll_for_ack()
48 countdown--; in e1000_poll_for_ack()
49 udelay(mbx->usec_delay); in e1000_poll_for_ack()
54 mbx->timeout = 0; in e1000_poll_for_ack()
55 out: in e1000_poll_for_ack()
56 return countdown ? E1000_SUCCESS : -E1000_ERR_MBX; in e1000_poll_for_ack()
60 * e1000_read_posted_mbx - Wait for message notification and receive message
70 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_read_posted_mbx()
71 s32 ret_val = -E1000_ERR_MBX; in e1000_read_posted_mbx()
73 if (!mbx->ops.read) in e1000_read_posted_mbx()
74 goto out; in e1000_read_posted_mbx()
78 /* if ack received read message, otherwise we timed out */ in e1000_read_posted_mbx()
80 ret_val = mbx->ops.read(hw, msg, size); in e1000_read_posted_mbx()
81 out: in e1000_read_posted_mbx()
86 * e1000_write_posted_mbx - Write a message to the mailbox, wait for ack
96 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_write_posted_mbx()
97 s32 ret_val = -E1000_ERR_MBX; in e1000_write_posted_mbx()
100 if (!mbx->ops.write || !mbx->timeout) in e1000_write_posted_mbx()
101 goto out; in e1000_write_posted_mbx()
104 ret_val = mbx->ops.write(hw, msg, size); in e1000_write_posted_mbx()
109 out: in e1000_write_posted_mbx()
114 * e1000_read_v2p_mailbox - read v2p mailbox
117 * This function is used to read the v2p mailbox without losing the read to
124 v2p_mailbox |= hw->dev_spec.vf.v2p_mailbox; in e1000_read_v2p_mailbox()
125 hw->dev_spec.vf.v2p_mailbox |= v2p_mailbox & E1000_V2PMAILBOX_R2C_BITS; in e1000_read_v2p_mailbox()
131 * e1000_check_for_bit_vf - Determine if a status bit was set
135 * This function is used to check for the read to clear bits within
141 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_bit_vf()
146 hw->dev_spec.vf.v2p_mailbox &= ~mask; in e1000_check_for_bit_vf()
152 * e1000_check_for_msg_vf - checks to see if the PF has sent mail
159 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_msg_vf()
163 hw->mbx.stats.reqs++; in e1000_check_for_msg_vf()
170 * e1000_check_for_ack_vf - checks to see if the PF has ACK'd
177 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_ack_vf()
181 hw->mbx.stats.acks++; in e1000_check_for_ack_vf()
188 * e1000_check_for_rst_vf - checks to see if the PF has reset
195 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_rst_vf()
200 hw->mbx.stats.rsts++; in e1000_check_for_rst_vf()
207 * e1000_obtain_mbx_lock_vf - obtain mailbox lock
214 s32 ret_val = -E1000_ERR_MBX; in e1000_obtain_mbx_lock_vf()
227 } while (count-- > 0); in e1000_obtain_mbx_lock_vf()
233 * e1000_write_mbx_vf - Write a message to the mailbox
245 lockdep_assert_held(&hw->mbx_lock); in e1000_write_mbx_vf()
261 hw->mbx.stats.msgs_tx++; in e1000_write_mbx_vf()
271 * e1000_read_mbx_vf - Reads a message from the inbox intended for VF
276 * returns SUCCESS if it successfully read message from buffer
283 lockdep_assert_held(&hw->mbx_lock); in e1000_read_mbx_vf()
298 hw->mbx.stats.msgs_rx++; in e1000_read_mbx_vf()
305 * e1000_init_mbx_params_vf - set initial values for VF mailbox
308 * Initializes the hw->mbx struct to correct values for VF mailbox
312 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_init_mbx_params_vf()
314 /* start mailbox as timed out and let the reset_hw call set the timeout in e1000_init_mbx_params_vf()
317 mbx->timeout = 0; in e1000_init_mbx_params_vf()
318 mbx->usec_delay = E1000_VF_MBX_INIT_DELAY; in e1000_init_mbx_params_vf()
320 mbx->size = E1000_VFMAILBOX_SIZE; in e1000_init_mbx_params_vf()
322 mbx->ops.read = e1000_read_mbx_vf; in e1000_init_mbx_params_vf()
323 mbx->ops.write = e1000_write_mbx_vf; in e1000_init_mbx_params_vf()
324 mbx->ops.read_posted = e1000_read_posted_mbx; in e1000_init_mbx_params_vf()
325 mbx->ops.write_posted = e1000_write_posted_mbx; in e1000_init_mbx_params_vf()
326 mbx->ops.check_for_msg = e1000_check_for_msg_vf; in e1000_init_mbx_params_vf()
327 mbx->ops.check_for_ack = e1000_check_for_ack_vf; in e1000_init_mbx_params_vf()
328 mbx->ops.check_for_rst = e1000_check_for_rst_vf; in e1000_init_mbx_params_vf()
330 mbx->stats.msgs_tx = 0; in e1000_init_mbx_params_vf()
331 mbx->stats.msgs_rx = 0; in e1000_init_mbx_params_vf()
332 mbx->stats.reqs = 0; in e1000_init_mbx_params_vf()
333 mbx->stats.acks = 0; in e1000_init_mbx_params_vf()
334 mbx->stats.rsts = 0; in e1000_init_mbx_params_vf()