Deleted Added
full compact
e1000_mbx.c (286833) e1000_mbx.c (295323)
1/******************************************************************************
2
3 Copyright (c) 2001-2015, Intel Corporation
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8

--- 16 unchanged lines hidden (view full) ---

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.
31
32******************************************************************************/
1/******************************************************************************
2
3 Copyright (c) 2001-2015, Intel Corporation
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8

--- 16 unchanged lines hidden (view full) ---

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.
31
32******************************************************************************/
33/*$FreeBSD: head/sys/dev/e1000/e1000_mbx.c 286833 2015-08-16 20:13:58Z sbruno $*/
33/*$FreeBSD: head/sys/dev/e1000/e1000_mbx.c 295323 2016-02-05 17:14:37Z erj $*/
34
35#include "e1000_mbx.h"
36
37/**
38 * e1000_null_mbx_check_for_flag - No-op function, return 0
39 * @hw: pointer to the HW structure
40 **/
41static s32 e1000_null_mbx_check_for_flag(struct e1000_hw E1000_UNUSEDARG *hw,

--- 379 unchanged lines hidden (view full) ---

421 * e1000_obtain_mbx_lock_vf - obtain mailbox lock
422 * @hw: pointer to the HW structure
423 *
424 * return SUCCESS if we obtained the mailbox lock
425 **/
426static s32 e1000_obtain_mbx_lock_vf(struct e1000_hw *hw)
427{
428 s32 ret_val = -E1000_ERR_MBX;
34
35#include "e1000_mbx.h"
36
37/**
38 * e1000_null_mbx_check_for_flag - No-op function, return 0
39 * @hw: pointer to the HW structure
40 **/
41static s32 e1000_null_mbx_check_for_flag(struct e1000_hw E1000_UNUSEDARG *hw,

--- 379 unchanged lines hidden (view full) ---

421 * e1000_obtain_mbx_lock_vf - obtain mailbox lock
422 * @hw: pointer to the HW structure
423 *
424 * return SUCCESS if we obtained the mailbox lock
425 **/
426static s32 e1000_obtain_mbx_lock_vf(struct e1000_hw *hw)
427{
428 s32 ret_val = -E1000_ERR_MBX;
429 int count = 10;
429
430 DEBUGFUNC("e1000_obtain_mbx_lock_vf");
431
430
431 DEBUGFUNC("e1000_obtain_mbx_lock_vf");
432
432 /* Take ownership of the buffer */
433 E1000_WRITE_REG(hw, E1000_V2PMAILBOX(0), E1000_V2PMAILBOX_VFU);
433 do {
434 /* Take ownership of the buffer */
435 E1000_WRITE_REG(hw, E1000_V2PMAILBOX(0), E1000_V2PMAILBOX_VFU);
434
436
435 /* reserve mailbox for vf use */
436 if (e1000_read_v2p_mailbox(hw) & E1000_V2PMAILBOX_VFU)
437 ret_val = E1000_SUCCESS;
437 /* reserve mailbox for vf use */
438 if (e1000_read_v2p_mailbox(hw) & E1000_V2PMAILBOX_VFU) {
439 ret_val = E1000_SUCCESS;
440 break;
441 }
442 usec_delay(1000);
443 } while (count-- > 0);
438
439 return ret_val;
440}
441
442/**
443 * e1000_write_mbx_vf - Write a message to the mailbox
444 * @hw: pointer to the HW structure
445 * @msg: The message buffer

--- 188 unchanged lines hidden (view full) ---

634 * @vf_number: the VF index
635 *
636 * return SUCCESS if we obtained the mailbox lock
637 **/
638static s32 e1000_obtain_mbx_lock_pf(struct e1000_hw *hw, u16 vf_number)
639{
640 s32 ret_val = -E1000_ERR_MBX;
641 u32 p2v_mailbox;
444
445 return ret_val;
446}
447
448/**
449 * e1000_write_mbx_vf - Write a message to the mailbox
450 * @hw: pointer to the HW structure
451 * @msg: The message buffer

--- 188 unchanged lines hidden (view full) ---

640 * @vf_number: the VF index
641 *
642 * return SUCCESS if we obtained the mailbox lock
643 **/
644static s32 e1000_obtain_mbx_lock_pf(struct e1000_hw *hw, u16 vf_number)
645{
646 s32 ret_val = -E1000_ERR_MBX;
647 u32 p2v_mailbox;
648 int count = 10;
642
643 DEBUGFUNC("e1000_obtain_mbx_lock_pf");
644
649
650 DEBUGFUNC("e1000_obtain_mbx_lock_pf");
651
645 /* Take ownership of the buffer */
646 E1000_WRITE_REG(hw, E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_PFU);
652 do {
653 /* Take ownership of the buffer */
654 E1000_WRITE_REG(hw, E1000_P2VMAILBOX(vf_number),
655 E1000_P2VMAILBOX_PFU);
647
656
648 /* reserve mailbox for vf use */
649 p2v_mailbox = E1000_READ_REG(hw, E1000_P2VMAILBOX(vf_number));
650 if (p2v_mailbox & E1000_P2VMAILBOX_PFU)
651 ret_val = E1000_SUCCESS;
657 /* reserve mailbox for pf use */
658 p2v_mailbox = E1000_READ_REG(hw, E1000_P2VMAILBOX(vf_number));
659 if (p2v_mailbox & E1000_P2VMAILBOX_PFU) {
660 ret_val = E1000_SUCCESS;
661 break;
662 }
663 usec_delay(1000);
664 } while (count-- > 0);
652
653 return ret_val;
665
666 return ret_val;
667
654}
655
656/**
657 * e1000_write_mbx_pf - Places a message in the mailbox
658 * @hw: pointer to the HW structure
659 * @msg: The message buffer
660 * @size: Length of buffer
661 * @vf_number: the VF index

--- 110 unchanged lines hidden ---
668}
669
670/**
671 * e1000_write_mbx_pf - Places a message in the mailbox
672 * @hw: pointer to the HW structure
673 * @msg: The message buffer
674 * @size: Length of buffer
675 * @vf_number: the VF index

--- 110 unchanged lines hidden ---