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 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; |
429 int count = 10; |
430 431 DEBUGFUNC("e1000_obtain_mbx_lock_vf"); 432 |
433 do { 434 /* Take ownership of the buffer */ 435 E1000_WRITE_REG(hw, E1000_V2PMAILBOX(0), E1000_V2PMAILBOX_VFU); |
436 |
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); |
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; |
649 650 DEBUGFUNC("e1000_obtain_mbx_lock_pf"); 651 |
652 do { 653 /* Take ownership of the buffer */ 654 E1000_WRITE_REG(hw, E1000_P2VMAILBOX(vf_number), 655 E1000_P2VMAILBOX_PFU); |
656 |
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); |
665 666 return ret_val; |
667 |
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 --- |