Lines Matching +full:mailbox +full:-
2 SPDX-License-Identifier: BSD-3-Clause
4 Copyright (c) 2001-2020, Intel Corporation
38 * e1000_null_mbx_check_for_flag - No-op function, return 0
40 * @mbx_id: id of mailbox to read
51 * e1000_null_mbx_transact - No-op function, return 0
55 * @mbx_id: id of mailbox to read
68 * e1000_read_mbx - Reads a message from the mailbox
72 * @mbx_id: id of mailbox to read
78 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_read_mbx()
79 s32 ret_val = -E1000_ERR_MBX; in e1000_read_mbx()
83 /* limit read to size of mailbox */ in e1000_read_mbx()
84 if (size > mbx->size) in e1000_read_mbx()
85 size = mbx->size; in e1000_read_mbx()
87 if (mbx->ops.read) in e1000_read_mbx()
88 ret_val = mbx->ops.read(hw, msg, size, mbx_id); in e1000_read_mbx()
94 * e1000_write_mbx - Write a message to the mailbox
98 * @mbx_id: id of mailbox to write
104 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_write_mbx()
109 if (size > mbx->size) in e1000_write_mbx()
110 ret_val = -E1000_ERR_MBX; in e1000_write_mbx()
112 else if (mbx->ops.write) in e1000_write_mbx()
113 ret_val = mbx->ops.write(hw, msg, size, mbx_id); in e1000_write_mbx()
119 * e1000_check_for_msg - checks to see if someone sent us mail
121 * @mbx_id: id of mailbox to check
127 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_check_for_msg()
128 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_msg()
132 if (mbx->ops.check_for_msg) in e1000_check_for_msg()
133 ret_val = mbx->ops.check_for_msg(hw, mbx_id); in e1000_check_for_msg()
139 * e1000_check_for_ack - checks to see if someone sent us ACK
141 * @mbx_id: id of mailbox to check
147 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_check_for_ack()
148 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_ack()
152 if (mbx->ops.check_for_ack) in e1000_check_for_ack()
153 ret_val = mbx->ops.check_for_ack(hw, mbx_id); in e1000_check_for_ack()
159 * e1000_check_for_rst - checks to see if other side has reset
161 * @mbx_id: id of mailbox to check
167 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_check_for_rst()
168 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_rst()
172 if (mbx->ops.check_for_rst) in e1000_check_for_rst()
173 ret_val = mbx->ops.check_for_rst(hw, mbx_id); in e1000_check_for_rst()
179 * e1000_poll_for_msg - Wait for message notification
181 * @mbx_id: id of mailbox to write
187 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_poll_for_msg()
188 int countdown = mbx->timeout; in e1000_poll_for_msg()
192 if (!countdown || !mbx->ops.check_for_msg) in e1000_poll_for_msg()
195 while (countdown && mbx->ops.check_for_msg(hw, mbx_id)) { in e1000_poll_for_msg()
196 countdown--; in e1000_poll_for_msg()
199 usec_delay(mbx->usec_delay); in e1000_poll_for_msg()
204 mbx->timeout = 0; in e1000_poll_for_msg()
206 return countdown ? E1000_SUCCESS : -E1000_ERR_MBX; in e1000_poll_for_msg()
210 * e1000_poll_for_ack - Wait for message acknowledgement
212 * @mbx_id: id of mailbox to write
218 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_poll_for_ack()
219 int countdown = mbx->timeout; in e1000_poll_for_ack()
223 if (!countdown || !mbx->ops.check_for_ack) in e1000_poll_for_ack()
226 while (countdown && mbx->ops.check_for_ack(hw, mbx_id)) { in e1000_poll_for_ack()
227 countdown--; in e1000_poll_for_ack()
230 usec_delay(mbx->usec_delay); in e1000_poll_for_ack()
235 mbx->timeout = 0; in e1000_poll_for_ack()
237 return countdown ? E1000_SUCCESS : -E1000_ERR_MBX; in e1000_poll_for_ack()
241 * e1000_read_posted_mbx - Wait for message notification and receive message
245 * @mbx_id: id of mailbox to write
252 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_read_posted_mbx()
253 s32 ret_val = -E1000_ERR_MBX; in e1000_read_posted_mbx()
257 if (!mbx->ops.read) in e1000_read_posted_mbx()
264 ret_val = mbx->ops.read(hw, msg, size, mbx_id); in e1000_read_posted_mbx()
270 * e1000_write_posted_mbx - Write a message to the mailbox, wait for ack
274 * @mbx_id: id of mailbox to write
281 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_write_posted_mbx()
282 s32 ret_val = -E1000_ERR_MBX; in e1000_write_posted_mbx()
287 if (!mbx->ops.write || !mbx->timeout) in e1000_write_posted_mbx()
291 ret_val = mbx->ops.write(hw, msg, size, mbx_id); in e1000_write_posted_mbx()
301 * e1000_init_mbx_ops_generic - Initialize mbx function pointers
304 * Sets the function pointers to no-op functions
308 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_init_mbx_ops_generic()
309 mbx->ops.init_params = e1000_null_ops_generic; in e1000_init_mbx_ops_generic()
310 mbx->ops.read = e1000_null_mbx_transact; in e1000_init_mbx_ops_generic()
311 mbx->ops.write = e1000_null_mbx_transact; in e1000_init_mbx_ops_generic()
312 mbx->ops.check_for_msg = e1000_null_mbx_check_for_flag; in e1000_init_mbx_ops_generic()
313 mbx->ops.check_for_ack = e1000_null_mbx_check_for_flag; in e1000_init_mbx_ops_generic()
314 mbx->ops.check_for_rst = e1000_null_mbx_check_for_flag; in e1000_init_mbx_ops_generic()
315 mbx->ops.read_posted = e1000_read_posted_mbx; in e1000_init_mbx_ops_generic()
316 mbx->ops.write_posted = e1000_write_posted_mbx; in e1000_init_mbx_ops_generic()
320 * e1000_read_v2p_mailbox - read v2p mailbox
323 * This function is used to read the v2p mailbox without losing the read to
330 v2p_mailbox |= hw->dev_spec.vf.v2p_mailbox; in e1000_read_v2p_mailbox()
331 hw->dev_spec.vf.v2p_mailbox |= v2p_mailbox & E1000_V2PMAILBOX_R2C_BITS; in e1000_read_v2p_mailbox()
337 * e1000_check_for_bit_vf - Determine if a status bit was set
342 * the V2P mailbox.
347 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_bit_vf()
352 hw->dev_spec.vf.v2p_mailbox &= ~mask; in e1000_check_for_bit_vf()
358 * e1000_check_for_msg_vf - checks to see if the PF has sent mail
360 * @mbx_id: id of mailbox to check
367 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_msg_vf()
373 hw->mbx.stats.reqs++; in e1000_check_for_msg_vf()
380 * e1000_check_for_ack_vf - checks to see if the PF has ACK'd
382 * @mbx_id: id of mailbox to check
389 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_ack_vf()
395 hw->mbx.stats.acks++; in e1000_check_for_ack_vf()
402 * e1000_check_for_rst_vf - checks to see if the PF has reset
404 * @mbx_id: id of mailbox to check
411 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_rst_vf()
418 hw->mbx.stats.rsts++; in e1000_check_for_rst_vf()
425 * e1000_obtain_mbx_lock_vf - obtain mailbox lock
428 * return SUCCESS if we obtained the mailbox lock
432 s32 ret_val = -E1000_ERR_MBX; in e1000_obtain_mbx_lock_vf()
441 /* reserve mailbox for vf use */ in e1000_obtain_mbx_lock_vf()
447 } while (count-- > 0); in e1000_obtain_mbx_lock_vf()
453 * e1000_write_mbx_vf - Write a message to the mailbox
457 * @mbx_id: id of mailbox to write
470 /* lock the mailbox to prevent pf/vf race condition */ in e1000_write_mbx_vf()
479 /* copy the caller specified message to the mailbox memory buffer */ in e1000_write_mbx_vf()
484 hw->mbx.stats.msgs_tx++; in e1000_write_mbx_vf()
494 * e1000_read_mbx_vf - Reads a message from the inbox intended for vf
498 * @mbx_id: id of mailbox to read
510 /* lock the mailbox to prevent pf/vf race condition */ in e1000_read_mbx_vf()
515 /* copy the message from the mailbox memory buffer */ in e1000_read_mbx_vf()
519 /* Acknowledge receipt and release mailbox, then we're done */ in e1000_read_mbx_vf()
523 hw->mbx.stats.msgs_rx++; in e1000_read_mbx_vf()
530 * e1000_init_mbx_params_vf - set initial values for vf mailbox
533 * Initializes the hw->mbx struct to correct values for vf mailbox
537 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_init_mbx_params_vf()
539 /* start mailbox as timed out and let the reset_hw call set the timeout in e1000_init_mbx_params_vf()
541 mbx->timeout = 0; in e1000_init_mbx_params_vf()
542 mbx->usec_delay = E1000_VF_MBX_INIT_DELAY; in e1000_init_mbx_params_vf()
544 mbx->size = E1000_VFMAILBOX_SIZE; in e1000_init_mbx_params_vf()
546 mbx->ops.read = e1000_read_mbx_vf; in e1000_init_mbx_params_vf()
547 mbx->ops.write = e1000_write_mbx_vf; in e1000_init_mbx_params_vf()
548 mbx->ops.read_posted = e1000_read_posted_mbx; in e1000_init_mbx_params_vf()
549 mbx->ops.write_posted = e1000_write_posted_mbx; in e1000_init_mbx_params_vf()
550 mbx->ops.check_for_msg = e1000_check_for_msg_vf; in e1000_init_mbx_params_vf()
551 mbx->ops.check_for_ack = e1000_check_for_ack_vf; in e1000_init_mbx_params_vf()
552 mbx->ops.check_for_rst = e1000_check_for_rst_vf; in e1000_init_mbx_params_vf()
554 mbx->stats.msgs_tx = 0; in e1000_init_mbx_params_vf()
555 mbx->stats.msgs_rx = 0; in e1000_init_mbx_params_vf()
556 mbx->stats.reqs = 0; in e1000_init_mbx_params_vf()
557 mbx->stats.acks = 0; in e1000_init_mbx_params_vf()
558 mbx->stats.rsts = 0; in e1000_init_mbx_params_vf()
566 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_bit_pf()
577 * e1000_check_for_msg_pf - checks to see if the VF has sent mail
585 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_msg_pf()
591 hw->mbx.stats.reqs++; in e1000_check_for_msg_pf()
598 * e1000_check_for_ack_pf - checks to see if the VF has ACKed
606 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_ack_pf()
612 hw->mbx.stats.acks++; in e1000_check_for_ack_pf()
619 * e1000_check_for_rst_pf - checks to see if the VF has reset
628 s32 ret_val = -E1000_ERR_MBX; in e1000_check_for_rst_pf()
635 hw->mbx.stats.rsts++; in e1000_check_for_rst_pf()
642 * e1000_obtain_mbx_lock_pf - obtain mailbox lock
646 * return SUCCESS if we obtained the mailbox lock
650 s32 ret_val = -E1000_ERR_MBX; in e1000_obtain_mbx_lock_pf()
661 /* reserve mailbox for pf use */ in e1000_obtain_mbx_lock_pf()
668 } while (count-- > 0); in e1000_obtain_mbx_lock_pf()
675 * e1000_write_mbx_pf - Places a message in the mailbox
691 /* lock the mailbox to prevent pf/vf race condition */ in e1000_write_mbx_pf()
700 /* copy the caller specified message to the mailbox memory buffer */ in e1000_write_mbx_pf()
708 hw->mbx.stats.msgs_tx++; in e1000_write_mbx_pf()
716 * e1000_read_mbx_pf - Read a message from the mailbox
722 * This function copies a message from the mailbox buffer to the caller's
734 /* lock the mailbox to prevent pf/vf race condition */ in e1000_read_mbx_pf()
739 /* copy the message to the mailbox memory buffer */ in e1000_read_mbx_pf()
747 hw->mbx.stats.msgs_rx++; in e1000_read_mbx_pf()
754 * e1000_init_mbx_params_pf - set initial values for pf mailbox
757 * Initializes the hw->mbx struct to correct values for pf mailbox
761 struct e1000_mbx_info *mbx = &hw->mbx; in e1000_init_mbx_params_pf()
763 switch (hw->mac.type) { in e1000_init_mbx_params_pf()
767 mbx->timeout = 0; in e1000_init_mbx_params_pf()
768 mbx->usec_delay = 0; in e1000_init_mbx_params_pf()
770 mbx->size = E1000_VFMAILBOX_SIZE; in e1000_init_mbx_params_pf()
772 mbx->ops.read = e1000_read_mbx_pf; in e1000_init_mbx_params_pf()
773 mbx->ops.write = e1000_write_mbx_pf; in e1000_init_mbx_params_pf()
774 mbx->ops.read_posted = e1000_read_posted_mbx; in e1000_init_mbx_params_pf()
775 mbx->ops.write_posted = e1000_write_posted_mbx; in e1000_init_mbx_params_pf()
776 mbx->ops.check_for_msg = e1000_check_for_msg_pf; in e1000_init_mbx_params_pf()
777 mbx->ops.check_for_ack = e1000_check_for_ack_pf; in e1000_init_mbx_params_pf()
778 mbx->ops.check_for_rst = e1000_check_for_rst_pf; in e1000_init_mbx_params_pf()
780 mbx->stats.msgs_tx = 0; in e1000_init_mbx_params_pf()
781 mbx->stats.msgs_rx = 0; in e1000_init_mbx_params_pf()
782 mbx->stats.reqs = 0; in e1000_init_mbx_params_pf()
783 mbx->stats.acks = 0; in e1000_init_mbx_params_pf()
784 mbx->stats.rsts = 0; in e1000_init_mbx_params_pf()