ixgbe: prefix global function
[dpdk.git] / lib / librte_pmd_e1000 / e1000 / e1000_mbx.c
index 67dbc64..7ec4c56 100644 (file)
@@ -1,36 +1,35 @@
-/******************************************************************************
-
-  Copyright (c) 2001-2011, Intel Corporation 
-  All rights reserved.
-  
-  Redistribution and use in source and binary forms, with or without 
-  modification, are permitted provided that the following conditions are met:
-  
-   1. Redistributions of source code must retain the above copyright notice, 
-      this list of conditions and the following disclaimer.
-  
-   2. Redistributions in binary form must reproduce the above copyright 
-      notice, this list of conditions and the following disclaimer in the 
-      documentation and/or other materials provided with the distribution.
-  
-   3. Neither the name of the Intel Corporation nor the names of its 
-      contributors may be used to endorse or promote products derived from 
-      this software without specific prior written permission.
-  
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
-  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
-  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
-  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
-  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
-  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
-  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-  POSSIBILITY OF SUCH DAMAGE.
-
-******************************************************************************/
-/*$FreeBSD$*/
+/*******************************************************************************
+
+Copyright (c) 2001-2014, Intel Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+    this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+
+ 3. Neither the name of the Intel Corporation nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+***************************************************************************/
 
 #include "e1000_mbx.h"
 
  *  e1000_null_mbx_check_for_flag - No-op function, return 0
  *  @hw: pointer to the HW structure
  **/
-static s32 e1000_null_mbx_check_for_flag(struct e1000_hw *hw, u16 mbx_id)
+STATIC s32 e1000_null_mbx_check_for_flag(struct e1000_hw E1000_UNUSEDARG *hw,
+                                        u16 E1000_UNUSEDARG mbx_id)
 {
        DEBUGFUNC("e1000_null_mbx_check_flag");
+       UNREFERENCED_2PARAMETER(hw, mbx_id);
 
        return E1000_SUCCESS;
 }
@@ -49,10 +50,13 @@ static s32 e1000_null_mbx_check_for_flag(struct e1000_hw *hw, u16 mbx_id)
  *  e1000_null_mbx_transact - No-op function, return 0
  *  @hw: pointer to the HW structure
  **/
-static s32 e1000_null_mbx_transact(struct e1000_hw *hw, u32 *msg, u16 size,
-                            u16 mbx_id)
+STATIC s32 e1000_null_mbx_transact(struct e1000_hw E1000_UNUSEDARG *hw,
+                                  u32 E1000_UNUSEDARG *msg,
+                                  u16 E1000_UNUSEDARG size,
+                                  u16 E1000_UNUSEDARG mbx_id)
 {
        DEBUGFUNC("e1000_null_mbx_rw_msg");
+       UNREFERENCED_4PARAMETER(hw, msg, size, mbx_id);
 
        return E1000_SUCCESS;
 }
@@ -64,7 +68,7 @@ static s32 e1000_null_mbx_transact(struct e1000_hw *hw, u32 *msg, u16 size,
  *  @size: Length of buffer
  *  @mbx_id: id of mailbox to read
  *
- *  returns SUCCESS if it successfuly read message from buffer
+ *  returns SUCCESS if it successfully read message from buffer
  **/
 s32 e1000_read_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
 {
@@ -175,7 +179,7 @@ s32 e1000_check_for_rst(struct e1000_hw *hw, u16 mbx_id)
  *
  *  returns SUCCESS if it successfully received a message notification
  **/
-static s32 e1000_poll_for_msg(struct e1000_hw *hw, u16 mbx_id)
+STATIC s32 e1000_poll_for_msg(struct e1000_hw *hw, u16 mbx_id)
 {
        struct e1000_mbx_info *mbx = &hw->mbx;
        int countdown = mbx->timeout;
@@ -206,7 +210,7 @@ out:
  *
  *  returns SUCCESS if it successfully received a message acknowledgement
  **/
-static s32 e1000_poll_for_ack(struct e1000_hw *hw, u16 mbx_id)
+STATIC s32 e1000_poll_for_ack(struct e1000_hw *hw, u16 mbx_id)
 {
        struct e1000_mbx_info *mbx = &hw->mbx;
        int countdown = mbx->timeout;
@@ -316,7 +320,7 @@ void e1000_init_mbx_ops_generic(struct e1000_hw *hw)
  *  This function is used to read the v2p mailbox without losing the read to
  *  clear status bits.
  **/
-static u32 e1000_read_v2p_mailbox(struct e1000_hw *hw)
+STATIC u32 e1000_read_v2p_mailbox(struct e1000_hw *hw)
 {
        u32 v2p_mailbox = E1000_READ_REG(hw, E1000_V2PMAILBOX(0));
 
@@ -334,7 +338,7 @@ static u32 e1000_read_v2p_mailbox(struct e1000_hw *hw)
  *  This function is used to check for the read to clear bits within
  *  the V2P mailbox.
  **/
-static s32 e1000_check_for_bit_vf(struct e1000_hw *hw, u32 mask)
+STATIC s32 e1000_check_for_bit_vf(struct e1000_hw *hw, u32 mask)
 {
        u32 v2p_mailbox = e1000_read_v2p_mailbox(hw);
        s32 ret_val = -E1000_ERR_MBX;
@@ -354,10 +358,12 @@ static s32 e1000_check_for_bit_vf(struct e1000_hw *hw, u32 mask)
  *
  *  returns SUCCESS if the PF has set the Status bit or else ERR_MBX
  **/
-static s32 e1000_check_for_msg_vf(struct e1000_hw *hw, u16 mbx_id)
+STATIC s32 e1000_check_for_msg_vf(struct e1000_hw *hw,
+                                 u16 E1000_UNUSEDARG mbx_id)
 {
        s32 ret_val = -E1000_ERR_MBX;
 
+       UNREFERENCED_1PARAMETER(mbx_id);
        DEBUGFUNC("e1000_check_for_msg_vf");
 
        if (!e1000_check_for_bit_vf(hw, E1000_V2PMAILBOX_PFSTS)) {
@@ -375,10 +381,12 @@ static s32 e1000_check_for_msg_vf(struct e1000_hw *hw, u16 mbx_id)
  *
  *  returns SUCCESS if the PF has set the ACK bit or else ERR_MBX
  **/
-static s32 e1000_check_for_ack_vf(struct e1000_hw *hw, u16 mbx_id)
+STATIC s32 e1000_check_for_ack_vf(struct e1000_hw *hw,
+                                 u16 E1000_UNUSEDARG mbx_id)
 {
        s32 ret_val = -E1000_ERR_MBX;
 
+       UNREFERENCED_1PARAMETER(mbx_id);
        DEBUGFUNC("e1000_check_for_ack_vf");
 
        if (!e1000_check_for_bit_vf(hw, E1000_V2PMAILBOX_PFACK)) {
@@ -394,16 +402,18 @@ static s32 e1000_check_for_ack_vf(struct e1000_hw *hw, u16 mbx_id)
  *  @hw: pointer to the HW structure
  *  @mbx_id: id of mailbox to check
  *
- *  returns TRUE if the PF has set the reset done bit or else FALSE
+ *  returns true if the PF has set the reset done bit or else false
  **/
-static s32 e1000_check_for_rst_vf(struct e1000_hw *hw, u16 mbx_id)
+STATIC s32 e1000_check_for_rst_vf(struct e1000_hw *hw,
+                                 u16 E1000_UNUSEDARG mbx_id)
 {
        s32 ret_val = -E1000_ERR_MBX;
 
+       UNREFERENCED_1PARAMETER(mbx_id);
        DEBUGFUNC("e1000_check_for_rst_vf");
 
        if (!e1000_check_for_bit_vf(hw, (E1000_V2PMAILBOX_RSTD |
-                                        E1000_V2PMAILBOX_RSTI))) {
+                                        E1000_V2PMAILBOX_RSTI))) {
                ret_val = E1000_SUCCESS;
                hw->mbx.stats.rsts++;
        }
@@ -417,7 +427,7 @@ static s32 e1000_check_for_rst_vf(struct e1000_hw *hw, u16 mbx_id)
  *
  *  return SUCCESS if we obtained the mailbox lock
  **/
-static s32 e1000_obtain_mbx_lock_vf(struct e1000_hw *hw)
+STATIC s32 e1000_obtain_mbx_lock_vf(struct e1000_hw *hw)
 {
        s32 ret_val = -E1000_ERR_MBX;
 
@@ -442,12 +452,13 @@ static s32 e1000_obtain_mbx_lock_vf(struct e1000_hw *hw)
  *
  *  returns SUCCESS if it successfully copied message into the buffer
  **/
-static s32 e1000_write_mbx_vf(struct e1000_hw *hw, u32 *msg, u16 size,
-                              u16 mbx_id)
+STATIC s32 e1000_write_mbx_vf(struct e1000_hw *hw, u32 *msg, u16 size,
+                             u16 E1000_UNUSEDARG mbx_id)
 {
        s32 ret_val;
        u16 i;
 
+       UNREFERENCED_1PARAMETER(mbx_id);
 
        DEBUGFUNC("e1000_write_mbx_vf");
 
@@ -481,15 +492,16 @@ out_no_write:
  *  @size: Length of buffer
  *  @mbx_id: id of mailbox to read
  *
- *  returns SUCCESS if it successfuly read message from buffer
+ *  returns SUCCESS if it successfully read message from buffer
  **/
-static s32 e1000_read_mbx_vf(struct e1000_hw *hw, u32 *msg, u16 size,
-                             u16 mbx_id)
+STATIC s32 e1000_read_mbx_vf(struct e1000_hw *hw, u32 *msg, u16 size,
+                            u16 E1000_UNUSEDARG mbx_id)
 {
        s32 ret_val = E1000_SUCCESS;
        u16 i;
 
        DEBUGFUNC("e1000_read_mbx_vf");
+       UNREFERENCED_1PARAMETER(mbx_id);
 
        /* lock the mailbox to prevent pf/vf race condition */
        ret_val = e1000_obtain_mbx_lock_vf(hw);
@@ -544,7 +556,7 @@ s32 e1000_init_mbx_params_vf(struct e1000_hw *hw)
        return E1000_SUCCESS;
 }
 
-static s32 e1000_check_for_bit_pf(struct e1000_hw *hw, u32 mask)
+STATIC s32 e1000_check_for_bit_pf(struct e1000_hw *hw, u32 mask)
 {
        u32 mbvficr = E1000_READ_REG(hw, E1000_MBVFICR);
        s32 ret_val = -E1000_ERR_MBX;
@@ -564,7 +576,7 @@ static s32 e1000_check_for_bit_pf(struct e1000_hw *hw, u32 mask)
  *
  *  returns SUCCESS if the VF has set the Status bit or else ERR_MBX
  **/
-static s32 e1000_check_for_msg_pf(struct e1000_hw *hw, u16 vf_number)
+STATIC s32 e1000_check_for_msg_pf(struct e1000_hw *hw, u16 vf_number)
 {
        s32 ret_val = -E1000_ERR_MBX;
 
@@ -585,7 +597,7 @@ static s32 e1000_check_for_msg_pf(struct e1000_hw *hw, u16 vf_number)
  *
  *  returns SUCCESS if the VF has set the Status bit or else ERR_MBX
  **/
-static s32 e1000_check_for_ack_pf(struct e1000_hw *hw, u16 vf_number)
+STATIC s32 e1000_check_for_ack_pf(struct e1000_hw *hw, u16 vf_number)
 {
        s32 ret_val = -E1000_ERR_MBX;
 
@@ -606,7 +618,7 @@ static s32 e1000_check_for_ack_pf(struct e1000_hw *hw, u16 vf_number)
  *
  *  returns SUCCESS if the VF has set the Status bit or else ERR_MBX
  **/
-static s32 e1000_check_for_rst_pf(struct e1000_hw *hw, u16 vf_number)
+STATIC s32 e1000_check_for_rst_pf(struct e1000_hw *hw, u16 vf_number)
 {
        u32 vflre = E1000_READ_REG(hw, E1000_VFLRE);
        s32 ret_val = -E1000_ERR_MBX;
@@ -629,7 +641,7 @@ static s32 e1000_check_for_rst_pf(struct e1000_hw *hw, u16 vf_number)
  *
  *  return SUCCESS if we obtained the mailbox lock
  **/
-static s32 e1000_obtain_mbx_lock_pf(struct e1000_hw *hw, u16 vf_number)
+STATIC s32 e1000_obtain_mbx_lock_pf(struct e1000_hw *hw, u16 vf_number)
 {
        s32 ret_val = -E1000_ERR_MBX;
        u32 p2v_mailbox;
@@ -656,8 +668,8 @@ static s32 e1000_obtain_mbx_lock_pf(struct e1000_hw *hw, u16 vf_number)
  *
  *  returns SUCCESS if it successfully copied message into the buffer
  **/
-static s32 e1000_write_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size,
-                              u16 vf_number)
+STATIC s32 e1000_write_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size,
+                             u16 vf_number)
 {
        s32 ret_val;
        u16 i;
@@ -699,8 +711,8 @@ out_no_write:
  *  memory buffer.  The presumption is that the caller knows that there was
  *  a message due to a VF request so no polling for message is needed.
  **/
-static s32 e1000_read_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size,
-                             u16 vf_number)
+STATIC s32 e1000_read_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size,
+                            u16 vf_number)
 {
        s32 ret_val;
        u16 i;
@@ -739,6 +751,7 @@ s32 e1000_init_mbx_params_pf(struct e1000_hw *hw)
        switch (hw->mac.type) {
        case e1000_82576:
        case e1000_i350:
+       case e1000_i354:
                mbx->timeout = 0;
                mbx->usec_delay = 0;