aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3/t3_hw.c
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2010-10-15 08:43:10 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-21 10:19:02 -0400
commita5190b4eea1f1c53ee26b3d1176441cafa8e7f79 (patch)
treed930bf8c0b1167d4323a764484ae7e25c6e18c82 /drivers/net/cxgb3/t3_hw.c
parentcc4ce020935eab2d261b7b8d24a9843b56ad594c (diff)
cxgb3: function namespace cleanup
Make local functions static. Remove functions that are defined and never used. Compile tested only. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: Divy Le Ray <divy@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb3/t3_hw.c')
-rw-r--r--drivers/net/cxgb3/t3_hw.c197
1 files changed, 11 insertions, 186 deletions
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 421d5589cec..3a6adf0b3e9 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -34,6 +34,8 @@
34#include "sge_defs.h" 34#include "sge_defs.h"
35#include "firmware_exports.h" 35#include "firmware_exports.h"
36 36
37static void t3_port_intr_clear(struct adapter *adapter, int idx);
38
37/** 39/**
38 * t3_wait_op_done_val - wait until an operation is completed 40 * t3_wait_op_done_val - wait until an operation is completed
39 * @adapter: the adapter performing the operation 41 * @adapter: the adapter performing the operation
@@ -840,8 +842,8 @@ static int flash_wait_op(struct adapter *adapter, int attempts, int delay)
840 * (i.e., big-endian), otherwise as 32-bit words in the platform's 842 * (i.e., big-endian), otherwise as 32-bit words in the platform's
841 * natural endianess. 843 * natural endianess.
842 */ 844 */
843int t3_read_flash(struct adapter *adapter, unsigned int addr, 845static int t3_read_flash(struct adapter *adapter, unsigned int addr,
844 unsigned int nwords, u32 *data, int byte_oriented) 846 unsigned int nwords, u32 *data, int byte_oriented)
845{ 847{
846 int ret; 848 int ret;
847 849
@@ -2111,7 +2113,7 @@ void t3_port_intr_disable(struct adapter *adapter, int idx)
2111 * Clear port-specific (i.e., MAC and PHY) interrupts for the given 2113 * Clear port-specific (i.e., MAC and PHY) interrupts for the given
2112 * adapter port. 2114 * adapter port.
2113 */ 2115 */
2114void t3_port_intr_clear(struct adapter *adapter, int idx) 2116static void t3_port_intr_clear(struct adapter *adapter, int idx)
2115{ 2117{
2116 struct cphy *phy = &adap2pinfo(adapter, idx)->phy; 2118 struct cphy *phy = &adap2pinfo(adapter, idx)->phy;
2117 2119
@@ -2484,98 +2486,6 @@ int t3_sge_cqcntxt_op(struct adapter *adapter, unsigned int id, unsigned int op,
2484} 2486}
2485 2487
2486/** 2488/**
2487 * t3_sge_read_context - read an SGE context
2488 * @type: the context type
2489 * @adapter: the adapter
2490 * @id: the context id
2491 * @data: holds the retrieved context
2492 *
2493 * Read an SGE egress context. The caller is responsible for ensuring
2494 * only one context operation occurs at a time.
2495 */
2496static int t3_sge_read_context(unsigned int type, struct adapter *adapter,
2497 unsigned int id, u32 data[4])
2498{
2499 if (t3_read_reg(adapter, A_SG_CONTEXT_CMD) & F_CONTEXT_CMD_BUSY)
2500 return -EBUSY;
2501
2502 t3_write_reg(adapter, A_SG_CONTEXT_CMD,
2503 V_CONTEXT_CMD_OPCODE(0) | type | V_CONTEXT(id));
2504 if (t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, 0,
2505 SG_CONTEXT_CMD_ATTEMPTS, 1))
2506 return -EIO;
2507 data[0] = t3_read_reg(adapter, A_SG_CONTEXT_DATA0);
2508 data[1] = t3_read_reg(adapter, A_SG_CONTEXT_DATA1);
2509 data[2] = t3_read_reg(adapter, A_SG_CONTEXT_DATA2);
2510 data[3] = t3_read_reg(adapter, A_SG_CONTEXT_DATA3);
2511 return 0;
2512}
2513
2514/**
2515 * t3_sge_read_ecntxt - read an SGE egress context
2516 * @adapter: the adapter
2517 * @id: the context id
2518 * @data: holds the retrieved context
2519 *
2520 * Read an SGE egress context. The caller is responsible for ensuring
2521 * only one context operation occurs at a time.
2522 */
2523int t3_sge_read_ecntxt(struct adapter *adapter, unsigned int id, u32 data[4])
2524{
2525 if (id >= 65536)
2526 return -EINVAL;
2527 return t3_sge_read_context(F_EGRESS, adapter, id, data);
2528}
2529
2530/**
2531 * t3_sge_read_cq - read an SGE CQ context
2532 * @adapter: the adapter
2533 * @id: the context id
2534 * @data: holds the retrieved context
2535 *
2536 * Read an SGE CQ context. The caller is responsible for ensuring
2537 * only one context operation occurs at a time.
2538 */
2539int t3_sge_read_cq(struct adapter *adapter, unsigned int id, u32 data[4])
2540{
2541 if (id >= 65536)
2542 return -EINVAL;
2543 return t3_sge_read_context(F_CQ, adapter, id, data);
2544}
2545
2546/**
2547 * t3_sge_read_fl - read an SGE free-list context
2548 * @adapter: the adapter
2549 * @id: the context id
2550 * @data: holds the retrieved context
2551 *
2552 * Read an SGE free-list context. The caller is responsible for ensuring
2553 * only one context operation occurs at a time.
2554 */
2555int t3_sge_read_fl(struct adapter *adapter, unsigned int id, u32 data[4])
2556{
2557 if (id >= SGE_QSETS * 2)
2558 return -EINVAL;
2559 return t3_sge_read_context(F_FREELIST, adapter, id, data);
2560}
2561
2562/**
2563 * t3_sge_read_rspq - read an SGE response queue context
2564 * @adapter: the adapter
2565 * @id: the context id
2566 * @data: holds the retrieved context
2567 *
2568 * Read an SGE response queue context. The caller is responsible for
2569 * ensuring only one context operation occurs at a time.
2570 */
2571int t3_sge_read_rspq(struct adapter *adapter, unsigned int id, u32 data[4])
2572{
2573 if (id >= SGE_QSETS)
2574 return -EINVAL;
2575 return t3_sge_read_context(F_RESPONSEQ, adapter, id, data);
2576}
2577
2578/**
2579 * t3_config_rss - configure Rx packet steering 2489 * t3_config_rss - configure Rx packet steering
2580 * @adapter: the adapter 2490 * @adapter: the adapter
2581 * @rss_config: RSS settings (written to TP_RSS_CONFIG) 2491 * @rss_config: RSS settings (written to TP_RSS_CONFIG)
@@ -2616,42 +2526,6 @@ void t3_config_rss(struct adapter *adapter, unsigned int rss_config,
2616} 2526}
2617 2527
2618/** 2528/**
2619 * t3_read_rss - read the contents of the RSS tables
2620 * @adapter: the adapter
2621 * @lkup: holds the contents of the RSS lookup table
2622 * @map: holds the contents of the RSS map table
2623 *
2624 * Reads the contents of the receive packet steering tables.
2625 */
2626int t3_read_rss(struct adapter *adapter, u8 * lkup, u16 *map)
2627{
2628 int i;
2629 u32 val;
2630
2631 if (lkup)
2632 for (i = 0; i < RSS_TABLE_SIZE; ++i) {
2633 t3_write_reg(adapter, A_TP_RSS_LKP_TABLE,
2634 0xffff0000 | i);
2635 val = t3_read_reg(adapter, A_TP_RSS_LKP_TABLE);
2636 if (!(val & 0x80000000))
2637 return -EAGAIN;
2638 *lkup++ = val;
2639 *lkup++ = (val >> 8);
2640 }
2641
2642 if (map)
2643 for (i = 0; i < RSS_TABLE_SIZE; ++i) {
2644 t3_write_reg(adapter, A_TP_RSS_MAP_TABLE,
2645 0xffff0000 | i);
2646 val = t3_read_reg(adapter, A_TP_RSS_MAP_TABLE);
2647 if (!(val & 0x80000000))
2648 return -EAGAIN;
2649 *map++ = val;
2650 }
2651 return 0;
2652}
2653
2654/**
2655 * t3_tp_set_offload_mode - put TP in NIC/offload mode 2529 * t3_tp_set_offload_mode - put TP in NIC/offload mode
2656 * @adap: the adapter 2530 * @adap: the adapter
2657 * @enable: 1 to select offload mode, 0 for regular NIC 2531 * @enable: 1 to select offload mode, 0 for regular NIC
@@ -2868,7 +2742,8 @@ static void tp_set_timers(struct adapter *adap, unsigned int core_clk)
2868 * 2742 *
2869 * Set the receive coalescing size and PSH bit handling. 2743 * Set the receive coalescing size and PSH bit handling.
2870 */ 2744 */
2871int t3_tp_set_coalescing_size(struct adapter *adap, unsigned int size, int psh) 2745static int t3_tp_set_coalescing_size(struct adapter *adap,
2746 unsigned int size, int psh)
2872{ 2747{
2873 u32 val; 2748 u32 val;
2874 2749
@@ -2898,7 +2773,7 @@ int t3_tp_set_coalescing_size(struct adapter *adap, unsigned int size, int psh)
2898 * Set TP's max receive size. This is the limit that applies when 2773 * Set TP's max receive size. This is the limit that applies when
2899 * receive coalescing is disabled. 2774 * receive coalescing is disabled.
2900 */ 2775 */
2901void t3_tp_set_max_rxsize(struct adapter *adap, unsigned int size) 2776static void t3_tp_set_max_rxsize(struct adapter *adap, unsigned int size)
2902{ 2777{
2903 t3_write_reg(adap, A_TP_PARA_REG7, 2778 t3_write_reg(adap, A_TP_PARA_REG7,
2904 V_PMMAXXFERLEN0(size) | V_PMMAXXFERLEN1(size)); 2779 V_PMMAXXFERLEN0(size) | V_PMMAXXFERLEN1(size));
@@ -3018,48 +2893,6 @@ void t3_load_mtus(struct adapter *adap, unsigned short mtus[NMTUS],
3018} 2893}
3019 2894
3020/** 2895/**
3021 * t3_read_hw_mtus - returns the values in the HW MTU table
3022 * @adap: the adapter
3023 * @mtus: where to store the HW MTU values
3024 *
3025 * Reads the HW MTU table.
3026 */
3027void t3_read_hw_mtus(struct adapter *adap, unsigned short mtus[NMTUS])
3028{
3029 int i;
3030
3031 for (i = 0; i < NMTUS; ++i) {
3032 unsigned int val;
3033
3034 t3_write_reg(adap, A_TP_MTU_TABLE, 0xff000000 | i);
3035 val = t3_read_reg(adap, A_TP_MTU_TABLE);
3036 mtus[i] = val & 0x3fff;
3037 }
3038}
3039
3040/**
3041 * t3_get_cong_cntl_tab - reads the congestion control table
3042 * @adap: the adapter
3043 * @incr: where to store the alpha values
3044 *
3045 * Reads the additive increments programmed into the HW congestion
3046 * control table.
3047 */
3048void t3_get_cong_cntl_tab(struct adapter *adap,
3049 unsigned short incr[NMTUS][NCCTRL_WIN])
3050{
3051 unsigned int mtu, w;
3052
3053 for (mtu = 0; mtu < NMTUS; ++mtu)
3054 for (w = 0; w < NCCTRL_WIN; ++w) {
3055 t3_write_reg(adap, A_TP_CCTRL_TABLE,
3056 0xffff0000 | (mtu << 5) | w);
3057 incr[mtu][w] = t3_read_reg(adap, A_TP_CCTRL_TABLE) &
3058 0x1fff;
3059 }
3060}
3061
3062/**
3063 * t3_tp_get_mib_stats - read TP's MIB counters 2896 * t3_tp_get_mib_stats - read TP's MIB counters
3064 * @adap: the adapter 2897 * @adap: the adapter
3065 * @tps: holds the returned counter values 2898 * @tps: holds the returned counter values
@@ -3223,15 +3056,6 @@ static int tp_init(struct adapter *adap, const struct tp_params *p)
3223 return busy; 3056 return busy;
3224} 3057}
3225 3058
3226int t3_mps_set_active_ports(struct adapter *adap, unsigned int port_mask)
3227{
3228 if (port_mask & ~((1 << adap->params.nports) - 1))
3229 return -EINVAL;
3230 t3_set_reg_field(adap, A_MPS_CFG, F_PORT1ACTIVE | F_PORT0ACTIVE,
3231 port_mask << S_PORT0ACTIVE);
3232 return 0;
3233}
3234
3235/* 3059/*
3236 * Perform the bits of HW initialization that are dependent on the Tx 3060 * Perform the bits of HW initialization that are dependent on the Tx
3237 * channels being used. 3061 * channels being used.
@@ -3687,7 +3511,7 @@ static void mc7_prep(struct adapter *adapter, struct mc7 *mc7,
3687 mc7->width = G_WIDTH(cfg); 3511 mc7->width = G_WIDTH(cfg);
3688} 3512}
3689 3513
3690void mac_prep(struct cmac *mac, struct adapter *adapter, int index) 3514static void mac_prep(struct cmac *mac, struct adapter *adapter, int index)
3691{ 3515{
3692 u16 devid; 3516 u16 devid;
3693 3517
@@ -3707,7 +3531,8 @@ void mac_prep(struct cmac *mac, struct adapter *adapter, int index)
3707 } 3531 }
3708} 3532}
3709 3533
3710void early_hw_init(struct adapter *adapter, const struct adapter_info *ai) 3534static void early_hw_init(struct adapter *adapter,
3535 const struct adapter_info *ai)
3711{ 3536{
3712 u32 val = V_PORTSPEED(is_10G(adapter) ? 3 : 2); 3537 u32 val = V_PORTSPEED(is_10G(adapter) ? 3 : 2);
3713 3538