diff options
author | Dimitris Michailidis <dm@chelsio.com> | 2010-06-18 06:05:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-19 01:08:35 -0400 |
commit | 02b5fb8e14923ff9111de1a00004ccd593adaedb (patch) | |
tree | 10372243f7669e4f4a32b726d618b515bfd07b6e /drivers/net/cxgb4 | |
parent | 900a659687aa6349e52f7b1e3f922b77afe89b90 (diff) |
cxgb4: rearrange initialization code in preparation for EEH
Split some existing initialization code into a separate function for use
by EEH next. No functional changes.
Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb4')
-rw-r--r-- | drivers/net/cxgb4/cxgb4_main.c | 109 |
1 files changed, 60 insertions, 49 deletions
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c index 58045b00cf40..60f6ea05167a 100644 --- a/drivers/net/cxgb4/cxgb4_main.c +++ b/drivers/net/cxgb4/cxgb4_main.c | |||
@@ -2709,6 +2709,65 @@ static void setup_memwin(struct adapter *adap) | |||
2709 | WINDOW(ilog2(MEMWIN2_APERTURE) - 10)); | 2709 | WINDOW(ilog2(MEMWIN2_APERTURE) - 10)); |
2710 | } | 2710 | } |
2711 | 2711 | ||
2712 | static int adap_init1(struct adapter *adap, struct fw_caps_config_cmd *c) | ||
2713 | { | ||
2714 | u32 v; | ||
2715 | int ret; | ||
2716 | |||
2717 | /* get device capabilities */ | ||
2718 | memset(c, 0, sizeof(*c)); | ||
2719 | c->op_to_write = htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) | | ||
2720 | FW_CMD_REQUEST | FW_CMD_READ); | ||
2721 | c->retval_len16 = htonl(FW_LEN16(*c)); | ||
2722 | ret = t4_wr_mbox(adap, 0, c, sizeof(*c), c); | ||
2723 | if (ret < 0) | ||
2724 | return ret; | ||
2725 | |||
2726 | /* select capabilities we'll be using */ | ||
2727 | if (c->niccaps & htons(FW_CAPS_CONFIG_NIC_VM)) { | ||
2728 | if (!vf_acls) | ||
2729 | c->niccaps ^= htons(FW_CAPS_CONFIG_NIC_VM); | ||
2730 | else | ||
2731 | c->niccaps = htons(FW_CAPS_CONFIG_NIC_VM); | ||
2732 | } else if (vf_acls) { | ||
2733 | dev_err(adap->pdev_dev, "virtualization ACLs not supported"); | ||
2734 | return ret; | ||
2735 | } | ||
2736 | c->op_to_write = htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) | | ||
2737 | FW_CMD_REQUEST | FW_CMD_WRITE); | ||
2738 | ret = t4_wr_mbox(adap, 0, c, sizeof(*c), NULL); | ||
2739 | if (ret < 0) | ||
2740 | return ret; | ||
2741 | |||
2742 | ret = t4_config_glbl_rss(adap, 0, | ||
2743 | FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL, | ||
2744 | FW_RSS_GLB_CONFIG_CMD_TNLMAPEN | | ||
2745 | FW_RSS_GLB_CONFIG_CMD_TNLALLLKP); | ||
2746 | if (ret < 0) | ||
2747 | return ret; | ||
2748 | |||
2749 | ret = t4_cfg_pfvf(adap, 0, 0, 0, 64, 64, 64, 0, 0, 4, 0xf, 0xf, 16, | ||
2750 | FW_CMD_CAP_PF, FW_CMD_CAP_PF); | ||
2751 | if (ret < 0) | ||
2752 | return ret; | ||
2753 | |||
2754 | t4_sge_init(adap); | ||
2755 | |||
2756 | /* get basic stuff going */ | ||
2757 | ret = t4_early_init(adap, 0); | ||
2758 | if (ret < 0) | ||
2759 | return ret; | ||
2760 | |||
2761 | /* tweak some settings */ | ||
2762 | t4_write_reg(adap, TP_SHIFT_CNT, 0x64f8849); | ||
2763 | t4_write_reg(adap, ULP_RX_TDDP_PSZ, HPZ0(PAGE_SHIFT - 12)); | ||
2764 | t4_write_reg(adap, TP_PIO_ADDR, TP_INGRESS_CONFIG); | ||
2765 | v = t4_read_reg(adap, TP_PIO_DATA); | ||
2766 | t4_write_reg(adap, TP_PIO_DATA, v & ~CSUM_HAS_PSEUDO_HDR); | ||
2767 | setup_memwin(adap); | ||
2768 | return 0; | ||
2769 | } | ||
2770 | |||
2712 | /* | 2771 | /* |
2713 | * Max # of ATIDs. The absolute HW max is 16K but we keep it lower. | 2772 | * Max # of ATIDs. The absolute HW max is 16K but we keep it lower. |
2714 | */ | 2773 | */ |
@@ -2746,43 +2805,6 @@ static int adap_init0(struct adapter *adap) | |||
2746 | if (ret < 0) | 2805 | if (ret < 0) |
2747 | goto bye; | 2806 | goto bye; |
2748 | 2807 | ||
2749 | /* get device capabilities */ | ||
2750 | memset(&c, 0, sizeof(c)); | ||
2751 | c.op_to_write = htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) | | ||
2752 | FW_CMD_REQUEST | FW_CMD_READ); | ||
2753 | c.retval_len16 = htonl(FW_LEN16(c)); | ||
2754 | ret = t4_wr_mbox(adap, 0, &c, sizeof(c), &c); | ||
2755 | if (ret < 0) | ||
2756 | goto bye; | ||
2757 | |||
2758 | /* select capabilities we'll be using */ | ||
2759 | if (c.niccaps & htons(FW_CAPS_CONFIG_NIC_VM)) { | ||
2760 | if (!vf_acls) | ||
2761 | c.niccaps ^= htons(FW_CAPS_CONFIG_NIC_VM); | ||
2762 | else | ||
2763 | c.niccaps = htons(FW_CAPS_CONFIG_NIC_VM); | ||
2764 | } else if (vf_acls) { | ||
2765 | dev_err(adap->pdev_dev, "virtualization ACLs not supported"); | ||
2766 | goto bye; | ||
2767 | } | ||
2768 | c.op_to_write = htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) | | ||
2769 | FW_CMD_REQUEST | FW_CMD_WRITE); | ||
2770 | ret = t4_wr_mbox(adap, 0, &c, sizeof(c), NULL); | ||
2771 | if (ret < 0) | ||
2772 | goto bye; | ||
2773 | |||
2774 | ret = t4_config_glbl_rss(adap, 0, | ||
2775 | FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL, | ||
2776 | FW_RSS_GLB_CONFIG_CMD_TNLMAPEN | | ||
2777 | FW_RSS_GLB_CONFIG_CMD_TNLALLLKP); | ||
2778 | if (ret < 0) | ||
2779 | goto bye; | ||
2780 | |||
2781 | ret = t4_cfg_pfvf(adap, 0, 0, 0, 64, 64, 64, 0, 0, 4, 0xf, 0xf, 16, | ||
2782 | FW_CMD_CAP_PF, FW_CMD_CAP_PF); | ||
2783 | if (ret < 0) | ||
2784 | goto bye; | ||
2785 | |||
2786 | for (v = 0; v < SGE_NTIMERS - 1; v++) | 2808 | for (v = 0; v < SGE_NTIMERS - 1; v++) |
2787 | adap->sge.timer_val[v] = min(intr_holdoff[v], MAX_SGE_TIMERVAL); | 2809 | adap->sge.timer_val[v] = min(intr_holdoff[v], MAX_SGE_TIMERVAL); |
2788 | adap->sge.timer_val[SGE_NTIMERS - 1] = MAX_SGE_TIMERVAL; | 2810 | adap->sge.timer_val[SGE_NTIMERS - 1] = MAX_SGE_TIMERVAL; |
@@ -2790,10 +2812,7 @@ static int adap_init0(struct adapter *adap) | |||
2790 | for (v = 1; v < SGE_NCOUNTERS; v++) | 2812 | for (v = 1; v < SGE_NCOUNTERS; v++) |
2791 | adap->sge.counter_val[v] = min(intr_cnt[v - 1], | 2813 | adap->sge.counter_val[v] = min(intr_cnt[v - 1], |
2792 | THRESHOLD_3_MASK); | 2814 | THRESHOLD_3_MASK); |
2793 | t4_sge_init(adap); | 2815 | ret = adap_init1(adap, &c); |
2794 | |||
2795 | /* get basic stuff going */ | ||
2796 | ret = t4_early_init(adap, 0); | ||
2797 | if (ret < 0) | 2816 | if (ret < 0) |
2798 | goto bye; | 2817 | goto bye; |
2799 | 2818 | ||
@@ -2876,14 +2895,6 @@ static int adap_init0(struct adapter *adap) | |||
2876 | t4_read_mtu_tbl(adap, adap->params.mtus, NULL); | 2895 | t4_read_mtu_tbl(adap, adap->params.mtus, NULL); |
2877 | t4_load_mtus(adap, adap->params.mtus, adap->params.a_wnd, | 2896 | t4_load_mtus(adap, adap->params.mtus, adap->params.a_wnd, |
2878 | adap->params.b_wnd); | 2897 | adap->params.b_wnd); |
2879 | |||
2880 | /* tweak some settings */ | ||
2881 | t4_write_reg(adap, TP_SHIFT_CNT, 0x64f8849); | ||
2882 | t4_write_reg(adap, ULP_RX_TDDP_PSZ, HPZ0(PAGE_SHIFT - 12)); | ||
2883 | t4_write_reg(adap, TP_PIO_ADDR, TP_INGRESS_CONFIG); | ||
2884 | v = t4_read_reg(adap, TP_PIO_DATA); | ||
2885 | t4_write_reg(adap, TP_PIO_DATA, v & ~CSUM_HAS_PSEUDO_HDR); | ||
2886 | setup_memwin(adap); | ||
2887 | return 0; | 2898 | return 0; |
2888 | 2899 | ||
2889 | /* | 2900 | /* |