1 /*******************************************************************************
3 Copyright (c) 2001-2015, Intel Corporation
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
9 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
16 3. Neither the name of the Intel Corporation nor the names of its
17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission.
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
32 ***************************************************************************/
34 #include "ixgbe_type.h"
35 #include "ixgbe_mbx.h"
38 * ixgbe_read_mbx - Reads a message from the mailbox
39 * @hw: pointer to the HW structure
40 * @msg: The message buffer
41 * @size: Length of buffer
42 * @mbx_id: id of mailbox to read
44 * returns SUCCESS if it successfully read message from buffer
46 s32 ixgbe_read_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
48 struct ixgbe_mbx_info *mbx = &hw->mbx;
49 s32 ret_val = IXGBE_ERR_MBX;
51 DEBUGFUNC("ixgbe_read_mbx");
53 /* limit read to size of mailbox */
58 ret_val = mbx->ops.read(hw, msg, size, mbx_id);
64 * ixgbe_write_mbx - Write a message to the mailbox
65 * @hw: pointer to the HW structure
66 * @msg: The message buffer
67 * @size: Length of buffer
68 * @mbx_id: id of mailbox to write
70 * returns SUCCESS if it successfully copied message into the buffer
72 s32 ixgbe_write_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
74 struct ixgbe_mbx_info *mbx = &hw->mbx;
75 s32 ret_val = IXGBE_SUCCESS;
77 DEBUGFUNC("ixgbe_write_mbx");
79 if (size > mbx->size) {
80 ret_val = IXGBE_ERR_MBX;
81 ERROR_REPORT2(IXGBE_ERROR_ARGUMENT,
82 "Invalid mailbox message size %d", size);
83 } else if (mbx->ops.write)
84 ret_val = mbx->ops.write(hw, msg, size, mbx_id);
90 * ixgbe_check_for_msg - checks to see if someone sent us mail
91 * @hw: pointer to the HW structure
92 * @mbx_id: id of mailbox to check
94 * returns SUCCESS if the Status bit was found or else ERR_MBX
96 s32 ixgbe_check_for_msg(struct ixgbe_hw *hw, u16 mbx_id)
98 struct ixgbe_mbx_info *mbx = &hw->mbx;
99 s32 ret_val = IXGBE_ERR_MBX;
101 DEBUGFUNC("ixgbe_check_for_msg");
103 if (mbx->ops.check_for_msg)
104 ret_val = mbx->ops.check_for_msg(hw, mbx_id);
110 * ixgbe_check_for_ack - checks to see if someone sent us ACK
111 * @hw: pointer to the HW structure
112 * @mbx_id: id of mailbox to check
114 * returns SUCCESS if the Status bit was found or else ERR_MBX
116 s32 ixgbe_check_for_ack(struct ixgbe_hw *hw, u16 mbx_id)
118 struct ixgbe_mbx_info *mbx = &hw->mbx;
119 s32 ret_val = IXGBE_ERR_MBX;
121 DEBUGFUNC("ixgbe_check_for_ack");
123 if (mbx->ops.check_for_ack)
124 ret_val = mbx->ops.check_for_ack(hw, mbx_id);
130 * ixgbe_check_for_rst - checks to see if other side has reset
131 * @hw: pointer to the HW structure
132 * @mbx_id: id of mailbox to check
134 * returns SUCCESS if the Status bit was found or else ERR_MBX
136 s32 ixgbe_check_for_rst(struct ixgbe_hw *hw, u16 mbx_id)
138 struct ixgbe_mbx_info *mbx = &hw->mbx;
139 s32 ret_val = IXGBE_ERR_MBX;
141 DEBUGFUNC("ixgbe_check_for_rst");
143 if (mbx->ops.check_for_rst)
144 ret_val = mbx->ops.check_for_rst(hw, mbx_id);
150 * ixgbe_poll_for_msg - Wait for message notification
151 * @hw: pointer to the HW structure
152 * @mbx_id: id of mailbox to write
154 * returns SUCCESS if it successfully received a message notification
156 STATIC s32 ixgbe_poll_for_msg(struct ixgbe_hw *hw, u16 mbx_id)
158 struct ixgbe_mbx_info *mbx = &hw->mbx;
159 int countdown = mbx->timeout;
161 DEBUGFUNC("ixgbe_poll_for_msg");
163 if (!countdown || !mbx->ops.check_for_msg)
166 while (countdown && mbx->ops.check_for_msg(hw, mbx_id)) {
170 usec_delay(mbx->usec_delay);
174 ERROR_REPORT2(IXGBE_ERROR_POLLING,
175 "Polling for VF%d mailbox message timedout", mbx_id);
178 return countdown ? IXGBE_SUCCESS : IXGBE_ERR_MBX;
182 * ixgbe_poll_for_ack - Wait for message acknowledgement
183 * @hw: pointer to the HW structure
184 * @mbx_id: id of mailbox to write
186 * returns SUCCESS if it successfully received a message acknowledgement
188 STATIC s32 ixgbe_poll_for_ack(struct ixgbe_hw *hw, u16 mbx_id)
190 struct ixgbe_mbx_info *mbx = &hw->mbx;
191 int countdown = mbx->timeout;
193 DEBUGFUNC("ixgbe_poll_for_ack");
195 if (!countdown || !mbx->ops.check_for_ack)
198 while (countdown && mbx->ops.check_for_ack(hw, mbx_id)) {
202 usec_delay(mbx->usec_delay);
206 ERROR_REPORT2(IXGBE_ERROR_POLLING,
207 "Polling for VF%d mailbox ack timedout", mbx_id);
210 return countdown ? IXGBE_SUCCESS : IXGBE_ERR_MBX;
214 * ixgbe_read_posted_mbx - Wait for message notification and receive message
215 * @hw: pointer to the HW structure
216 * @msg: The message buffer
217 * @size: Length of buffer
218 * @mbx_id: id of mailbox to write
220 * returns SUCCESS if it successfully received a message notification and
221 * copied it into the receive buffer.
223 s32 ixgbe_read_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
225 struct ixgbe_mbx_info *mbx = &hw->mbx;
226 s32 ret_val = IXGBE_ERR_MBX;
228 DEBUGFUNC("ixgbe_read_posted_mbx");
233 ret_val = ixgbe_poll_for_msg(hw, mbx_id);
235 /* if ack received read message, otherwise we timed out */
237 ret_val = mbx->ops.read(hw, msg, size, mbx_id);
243 * ixgbe_write_posted_mbx - Write a message to the mailbox, wait for ack
244 * @hw: pointer to the HW structure
245 * @msg: The message buffer
246 * @size: Length of buffer
247 * @mbx_id: id of mailbox to write
249 * returns SUCCESS if it successfully copied message into the buffer and
250 * received an ack to that message within delay * timeout period
252 s32 ixgbe_write_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size,
255 struct ixgbe_mbx_info *mbx = &hw->mbx;
256 s32 ret_val = IXGBE_ERR_MBX;
258 DEBUGFUNC("ixgbe_write_posted_mbx");
260 /* exit if either we can't write or there isn't a defined timeout */
261 if (!mbx->ops.write || !mbx->timeout)
265 ret_val = mbx->ops.write(hw, msg, size, mbx_id);
267 /* if msg sent wait until we receive an ack */
269 ret_val = ixgbe_poll_for_ack(hw, mbx_id);
275 * ixgbe_init_mbx_ops_generic - Initialize MB function pointers
276 * @hw: pointer to the HW structure
278 * Setups up the mailbox read and write message function pointers
280 void ixgbe_init_mbx_ops_generic(struct ixgbe_hw *hw)
282 struct ixgbe_mbx_info *mbx = &hw->mbx;
284 mbx->ops.read_posted = ixgbe_read_posted_mbx;
285 mbx->ops.write_posted = ixgbe_write_posted_mbx;
289 * ixgbe_read_v2p_mailbox - read v2p mailbox
290 * @hw: pointer to the HW structure
292 * This function is used to read the v2p mailbox without losing the read to
295 STATIC u32 ixgbe_read_v2p_mailbox(struct ixgbe_hw *hw)
297 u32 v2p_mailbox = IXGBE_READ_REG(hw, IXGBE_VFMAILBOX);
299 v2p_mailbox |= hw->mbx.v2p_mailbox;
300 hw->mbx.v2p_mailbox |= v2p_mailbox & IXGBE_VFMAILBOX_R2C_BITS;
306 * ixgbe_check_for_bit_vf - Determine if a status bit was set
307 * @hw: pointer to the HW structure
308 * @mask: bitmask for bits to be tested and cleared
310 * This function is used to check for the read to clear bits within
313 STATIC s32 ixgbe_check_for_bit_vf(struct ixgbe_hw *hw, u32 mask)
315 u32 v2p_mailbox = ixgbe_read_v2p_mailbox(hw);
316 s32 ret_val = IXGBE_ERR_MBX;
318 if (v2p_mailbox & mask)
319 ret_val = IXGBE_SUCCESS;
321 hw->mbx.v2p_mailbox &= ~mask;
327 * ixgbe_check_for_msg_vf - checks to see if the PF has sent mail
328 * @hw: pointer to the HW structure
329 * @mbx_id: id of mailbox to check
331 * returns SUCCESS if the PF has set the Status bit or else ERR_MBX
333 STATIC s32 ixgbe_check_for_msg_vf(struct ixgbe_hw *hw, u16 mbx_id)
335 s32 ret_val = IXGBE_ERR_MBX;
337 UNREFERENCED_1PARAMETER(mbx_id);
338 DEBUGFUNC("ixgbe_check_for_msg_vf");
340 if (!ixgbe_check_for_bit_vf(hw, IXGBE_VFMAILBOX_PFSTS)) {
341 ret_val = IXGBE_SUCCESS;
342 hw->mbx.stats.reqs++;
349 * ixgbe_check_for_ack_vf - checks to see if the PF has ACK'd
350 * @hw: pointer to the HW structure
351 * @mbx_id: id of mailbox to check
353 * returns SUCCESS if the PF has set the ACK bit or else ERR_MBX
355 STATIC s32 ixgbe_check_for_ack_vf(struct ixgbe_hw *hw, u16 mbx_id)
357 s32 ret_val = IXGBE_ERR_MBX;
359 UNREFERENCED_1PARAMETER(mbx_id);
360 DEBUGFUNC("ixgbe_check_for_ack_vf");
362 if (!ixgbe_check_for_bit_vf(hw, IXGBE_VFMAILBOX_PFACK)) {
363 ret_val = IXGBE_SUCCESS;
364 hw->mbx.stats.acks++;
371 * ixgbe_check_for_rst_vf - checks to see if the PF has reset
372 * @hw: pointer to the HW structure
373 * @mbx_id: id of mailbox to check
375 * returns true if the PF has set the reset done bit or else false
377 STATIC s32 ixgbe_check_for_rst_vf(struct ixgbe_hw *hw, u16 mbx_id)
379 s32 ret_val = IXGBE_ERR_MBX;
381 UNREFERENCED_1PARAMETER(mbx_id);
382 DEBUGFUNC("ixgbe_check_for_rst_vf");
384 if (!ixgbe_check_for_bit_vf(hw, (IXGBE_VFMAILBOX_RSTD |
385 IXGBE_VFMAILBOX_RSTI))) {
386 ret_val = IXGBE_SUCCESS;
387 hw->mbx.stats.rsts++;
394 * ixgbe_obtain_mbx_lock_vf - obtain mailbox lock
395 * @hw: pointer to the HW structure
397 * return SUCCESS if we obtained the mailbox lock
399 STATIC s32 ixgbe_obtain_mbx_lock_vf(struct ixgbe_hw *hw)
401 s32 ret_val = IXGBE_ERR_MBX;
403 DEBUGFUNC("ixgbe_obtain_mbx_lock_vf");
405 /* Take ownership of the buffer */
406 IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_VFU);
408 /* reserve mailbox for vf use */
409 if (ixgbe_read_v2p_mailbox(hw) & IXGBE_VFMAILBOX_VFU)
410 ret_val = IXGBE_SUCCESS;
416 * ixgbe_write_mbx_vf - Write a message to the mailbox
417 * @hw: pointer to the HW structure
418 * @msg: The message buffer
419 * @size: Length of buffer
420 * @mbx_id: id of mailbox to write
422 * returns SUCCESS if it successfully copied message into the buffer
424 STATIC s32 ixgbe_write_mbx_vf(struct ixgbe_hw *hw, u32 *msg, u16 size,
430 UNREFERENCED_1PARAMETER(mbx_id);
432 DEBUGFUNC("ixgbe_write_mbx_vf");
434 /* lock the mailbox to prevent pf/vf race condition */
435 ret_val = ixgbe_obtain_mbx_lock_vf(hw);
439 /* flush msg and acks as we are overwriting the message buffer */
440 ixgbe_check_for_msg_vf(hw, 0);
441 ixgbe_check_for_ack_vf(hw, 0);
443 /* copy the caller specified message to the mailbox memory buffer */
444 for (i = 0; i < size; i++)
445 IXGBE_WRITE_REG_ARRAY(hw, IXGBE_VFMBMEM, i, msg[i]);
448 * Complete the remaining mailbox data registers with zero to reset
449 * the data sent in a previous exchange (in either side) with the PF,
450 * including exchanges performed by another Guest OS to which that VF
451 * was previously assigned.
453 while (i < hw->mbx.size) {
454 IXGBE_WRITE_REG_ARRAY(hw, IXGBE_VFMBMEM, i, 0);
459 hw->mbx.stats.msgs_tx++;
461 /* Drop VFU and interrupt the PF to tell it a message has been sent */
462 IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_REQ);
469 * ixgbe_read_mbx_vf - Reads a message from the inbox intended for vf
470 * @hw: pointer to the HW structure
471 * @msg: The message buffer
472 * @size: Length of buffer
473 * @mbx_id: id of mailbox to read
475 * returns SUCCESS if it successfully read message from buffer
477 STATIC s32 ixgbe_read_mbx_vf(struct ixgbe_hw *hw, u32 *msg, u16 size,
480 s32 ret_val = IXGBE_SUCCESS;
483 DEBUGFUNC("ixgbe_read_mbx_vf");
484 UNREFERENCED_1PARAMETER(mbx_id);
486 /* lock the mailbox to prevent pf/vf race condition */
487 ret_val = ixgbe_obtain_mbx_lock_vf(hw);
491 /* copy the message from the mailbox memory buffer */
492 for (i = 0; i < size; i++)
493 msg[i] = IXGBE_READ_REG_ARRAY(hw, IXGBE_VFMBMEM, i);
495 /* Acknowledge receipt and release mailbox, then we're done */
496 IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_ACK);
499 hw->mbx.stats.msgs_rx++;
506 * ixgbe_init_mbx_params_vf - set initial values for vf mailbox
507 * @hw: pointer to the HW structure
509 * Initializes the hw->mbx struct to correct values for vf mailbox
511 void ixgbe_init_mbx_params_vf(struct ixgbe_hw *hw)
513 struct ixgbe_mbx_info *mbx = &hw->mbx;
515 /* start mailbox as timed out and let the reset_hw call set the timeout
516 * value to begin communications */
518 mbx->usec_delay = IXGBE_VF_MBX_INIT_DELAY;
520 mbx->size = IXGBE_VFMAILBOX_SIZE;
522 mbx->ops.read = ixgbe_read_mbx_vf;
523 mbx->ops.write = ixgbe_write_mbx_vf;
524 mbx->ops.read_posted = ixgbe_read_posted_mbx;
525 mbx->ops.write_posted = ixgbe_write_posted_mbx;
526 mbx->ops.check_for_msg = ixgbe_check_for_msg_vf;
527 mbx->ops.check_for_ack = ixgbe_check_for_ack_vf;
528 mbx->ops.check_for_rst = ixgbe_check_for_rst_vf;
530 mbx->stats.msgs_tx = 0;
531 mbx->stats.msgs_rx = 0;
537 STATIC s32 ixgbe_check_for_bit_pf(struct ixgbe_hw *hw, u32 mask, s32 index)
539 u32 mbvficr = IXGBE_READ_REG(hw, IXGBE_MBVFICR(index));
540 s32 ret_val = IXGBE_ERR_MBX;
542 if (mbvficr & mask) {
543 ret_val = IXGBE_SUCCESS;
544 IXGBE_WRITE_REG(hw, IXGBE_MBVFICR(index), mask);
551 * ixgbe_check_for_msg_pf - checks to see if the VF has sent mail
552 * @hw: pointer to the HW structure
553 * @vf_number: the VF index
555 * returns SUCCESS if the VF has set the Status bit or else ERR_MBX
557 STATIC s32 ixgbe_check_for_msg_pf(struct ixgbe_hw *hw, u16 vf_number)
559 s32 ret_val = IXGBE_ERR_MBX;
560 s32 index = IXGBE_MBVFICR_INDEX(vf_number);
561 u32 vf_bit = vf_number % 16;
563 DEBUGFUNC("ixgbe_check_for_msg_pf");
565 if (!ixgbe_check_for_bit_pf(hw, IXGBE_MBVFICR_VFREQ_VF1 << vf_bit,
567 ret_val = IXGBE_SUCCESS;
568 hw->mbx.stats.reqs++;
575 * ixgbe_check_for_ack_pf - checks to see if the VF has ACKed
576 * @hw: pointer to the HW structure
577 * @vf_number: the VF index
579 * returns SUCCESS if the VF has set the Status bit or else ERR_MBX
581 STATIC s32 ixgbe_check_for_ack_pf(struct ixgbe_hw *hw, u16 vf_number)
583 s32 ret_val = IXGBE_ERR_MBX;
584 s32 index = IXGBE_MBVFICR_INDEX(vf_number);
585 u32 vf_bit = vf_number % 16;
587 DEBUGFUNC("ixgbe_check_for_ack_pf");
589 if (!ixgbe_check_for_bit_pf(hw, IXGBE_MBVFICR_VFACK_VF1 << vf_bit,
591 ret_val = IXGBE_SUCCESS;
592 hw->mbx.stats.acks++;
599 * ixgbe_check_for_rst_pf - checks to see if the VF has reset
600 * @hw: pointer to the HW structure
601 * @vf_number: the VF index
603 * returns SUCCESS if the VF has set the Status bit or else ERR_MBX
605 STATIC s32 ixgbe_check_for_rst_pf(struct ixgbe_hw *hw, u16 vf_number)
607 u32 reg_offset = (vf_number < 32) ? 0 : 1;
608 u32 vf_shift = vf_number % 32;
610 s32 ret_val = IXGBE_ERR_MBX;
612 DEBUGFUNC("ixgbe_check_for_rst_pf");
614 switch (hw->mac.type) {
615 case ixgbe_mac_82599EB:
616 vflre = IXGBE_READ_REG(hw, IXGBE_VFLRE(reg_offset));
619 case ixgbe_mac_X550EM_x:
620 case ixgbe_mac_X550EM_a:
622 vflre = IXGBE_READ_REG(hw, IXGBE_VFLREC(reg_offset));
628 if (vflre & (1 << vf_shift)) {
629 ret_val = IXGBE_SUCCESS;
630 IXGBE_WRITE_REG(hw, IXGBE_VFLREC(reg_offset), (1 << vf_shift));
631 hw->mbx.stats.rsts++;
638 * ixgbe_obtain_mbx_lock_pf - obtain mailbox lock
639 * @hw: pointer to the HW structure
640 * @vf_number: the VF index
642 * return SUCCESS if we obtained the mailbox lock
644 STATIC s32 ixgbe_obtain_mbx_lock_pf(struct ixgbe_hw *hw, u16 vf_number)
646 s32 ret_val = IXGBE_ERR_MBX;
649 DEBUGFUNC("ixgbe_obtain_mbx_lock_pf");
651 /* Take ownership of the buffer */
652 IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_number), IXGBE_PFMAILBOX_PFU);
654 /* reserve mailbox for vf use */
655 p2v_mailbox = IXGBE_READ_REG(hw, IXGBE_PFMAILBOX(vf_number));
656 if (p2v_mailbox & IXGBE_PFMAILBOX_PFU)
657 ret_val = IXGBE_SUCCESS;
659 ERROR_REPORT2(IXGBE_ERROR_POLLING,
660 "Failed to obtain mailbox lock for VF%d", vf_number);
667 * ixgbe_write_mbx_pf - Places a message in the mailbox
668 * @hw: pointer to the HW structure
669 * @msg: The message buffer
670 * @size: Length of buffer
671 * @vf_number: the VF index
673 * returns SUCCESS if it successfully copied message into the buffer
675 STATIC s32 ixgbe_write_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size,
681 DEBUGFUNC("ixgbe_write_mbx_pf");
683 /* lock the mailbox to prevent pf/vf race condition */
684 ret_val = ixgbe_obtain_mbx_lock_pf(hw, vf_number);
688 /* flush msg and acks as we are overwriting the message buffer */
689 ixgbe_check_for_msg_pf(hw, vf_number);
690 ixgbe_check_for_ack_pf(hw, vf_number);
692 /* copy the caller specified message to the mailbox memory buffer */
693 for (i = 0; i < size; i++)
694 IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_number), i, msg[i]);
697 * Complete the remaining mailbox data registers with zero to reset
698 * the data sent in a previous exchange (in either side) with the VF,
699 * including exchanges performed by another Guest OS to which that VF
700 * was previously assigned.
702 while (i < hw->mbx.size) {
703 IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_number), i, 0);
707 /* Interrupt VF to tell it a message has been sent and release buffer*/
708 IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_number), IXGBE_PFMAILBOX_STS);
711 hw->mbx.stats.msgs_tx++;
719 * ixgbe_read_mbx_pf - Read a message from the mailbox
720 * @hw: pointer to the HW structure
721 * @msg: The message buffer
722 * @size: Length of buffer
723 * @vf_number: the VF index
725 * This function copies a message from the mailbox buffer to the caller's
726 * memory buffer. The presumption is that the caller knows that there was
727 * a message due to a VF request so no polling for message is needed.
729 STATIC s32 ixgbe_read_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size,
735 DEBUGFUNC("ixgbe_read_mbx_pf");
737 /* lock the mailbox to prevent pf/vf race condition */
738 ret_val = ixgbe_obtain_mbx_lock_pf(hw, vf_number);
742 /* copy the message to the mailbox memory buffer */
743 for (i = 0; i < size; i++)
744 msg[i] = IXGBE_READ_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_number), i);
746 /* Acknowledge the message and release buffer */
747 IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_number), IXGBE_PFMAILBOX_ACK);
750 hw->mbx.stats.msgs_rx++;
757 * ixgbe_init_mbx_params_pf - set initial values for pf mailbox
758 * @hw: pointer to the HW structure
760 * Initializes the hw->mbx struct to correct values for pf mailbox
762 void ixgbe_init_mbx_params_pf(struct ixgbe_hw *hw)
764 struct ixgbe_mbx_info *mbx = &hw->mbx;
766 if (hw->mac.type != ixgbe_mac_82599EB &&
767 hw->mac.type != ixgbe_mac_X550 &&
768 hw->mac.type != ixgbe_mac_X550EM_x &&
769 hw->mac.type != ixgbe_mac_X550EM_a &&
770 hw->mac.type != ixgbe_mac_X540)
776 mbx->size = IXGBE_VFMAILBOX_SIZE;
778 mbx->ops.read = ixgbe_read_mbx_pf;
779 mbx->ops.write = ixgbe_write_mbx_pf;
780 mbx->ops.read_posted = ixgbe_read_posted_mbx;
781 mbx->ops.write_posted = ixgbe_write_posted_mbx;
782 mbx->ops.check_for_msg = ixgbe_check_for_msg_pf;
783 mbx->ops.check_for_ack = ixgbe_check_for_ack_pf;
784 mbx->ops.check_for_rst = ixgbe_check_for_rst_pf;
786 mbx->stats.msgs_tx = 0;
787 mbx->stats.msgs_rx = 0;