@@ -1703,24 +1703,6 @@ static void determine_memory_type(struct amd64_pvt *pvt)
1703
1703
pvt -> dram_type = (pvt -> dclr0 & BIT (16 )) ? MEM_DDR3 : MEM_RDDR3 ;
1704
1704
}
1705
1705
1706
- /* Get the number of DCT channels the memory controller is using. */
1707
- static int k8_early_channel_count (struct amd64_pvt * pvt )
1708
- {
1709
- int flag ;
1710
-
1711
- if (pvt -> ext_model >= K8_REV_F )
1712
- /* RevF (NPT) and later */
1713
- flag = pvt -> dclr0 & WIDTH_128 ;
1714
- else
1715
- /* RevE and earlier */
1716
- flag = pvt -> dclr0 & REVE_WIDTH_128 ;
1717
-
1718
- /* not used */
1719
- pvt -> dclr1 = 0 ;
1720
-
1721
- return (flag ) ? 2 : 1 ;
1722
- }
1723
-
1724
1706
/* On F10h and later ErrAddr is MC4_ADDR[47:1] */
1725
1707
static u64 get_error_address (struct amd64_pvt * pvt , struct mce * m )
1726
1708
{
@@ -1972,69 +1954,6 @@ static int k8_dbam_to_chip_select(struct amd64_pvt *pvt, u8 dct,
1972
1954
}
1973
1955
}
1974
1956
1975
- /*
1976
- * Get the number of DCT channels in use.
1977
- *
1978
- * Return:
1979
- * number of Memory Channels in operation
1980
- * Pass back:
1981
- * contents of the DCL0_LOW register
1982
- */
1983
- static int f1x_early_channel_count (struct amd64_pvt * pvt )
1984
- {
1985
- int i , j , channels = 0 ;
1986
-
1987
- /* On F10h, if we are in 128 bit mode, then we are using 2 channels */
1988
- if (pvt -> fam == 0x10 && (pvt -> dclr0 & WIDTH_128 ))
1989
- return 2 ;
1990
-
1991
- /*
1992
- * Need to check if in unganged mode: In such, there are 2 channels,
1993
- * but they are not in 128 bit mode and thus the above 'dclr0' status
1994
- * bit will be OFF.
1995
- *
1996
- * Need to check DCT0[0] and DCT1[0] to see if only one of them has
1997
- * their CSEnable bit on. If so, then SINGLE DIMM case.
1998
- */
1999
- edac_dbg (0 , "Data width is not 128 bits - need more decoding\n" );
2000
-
2001
- /*
2002
- * Check DRAM Bank Address Mapping values for each DIMM to see if there
2003
- * is more than just one DIMM present in unganged mode. Need to check
2004
- * both controllers since DIMMs can be placed in either one.
2005
- */
2006
- for (i = 0 ; i < 2 ; i ++ ) {
2007
- u32 dbam = (i ? pvt -> dbam1 : pvt -> dbam0 );
2008
-
2009
- for (j = 0 ; j < 4 ; j ++ ) {
2010
- if (DBAM_DIMM (j , dbam ) > 0 ) {
2011
- channels ++ ;
2012
- break ;
2013
- }
2014
- }
2015
- }
2016
-
2017
- if (channels > 2 )
2018
- channels = 2 ;
2019
-
2020
- amd64_info ("MCT channel count: %d\n" , channels );
2021
-
2022
- return channels ;
2023
- }
2024
-
2025
- static int f17_early_channel_count (struct amd64_pvt * pvt )
2026
- {
2027
- int i , channels = 0 ;
2028
-
2029
- /* SDP Control bit 31 (SdpInit) is clear for unused UMC channels */
2030
- for_each_umc (i )
2031
- channels += !!(pvt -> umc [i ].sdp_ctrl & UMC_SDP_INIT );
2032
-
2033
- amd64_info ("MCT channel count: %d\n" , channels );
2034
-
2035
- return channels ;
2036
- }
2037
-
2038
1957
static int ddr3_cs_size (unsigned i , bool dct_width )
2039
1958
{
2040
1959
unsigned shift = 0 ;
@@ -2829,7 +2748,6 @@ static struct amd64_family_type family_types[] = {
2829
2748
.f2_id = PCI_DEVICE_ID_AMD_K8_NB_MEMCTL ,
2830
2749
.max_mcs = 2 ,
2831
2750
.ops = {
2832
- .early_channel_count = k8_early_channel_count ,
2833
2751
.map_sysaddr_to_csrow = k8_map_sysaddr_to_csrow ,
2834
2752
.dbam_to_cs = k8_dbam_to_chip_select ,
2835
2753
}
@@ -2840,7 +2758,6 @@ static struct amd64_family_type family_types[] = {
2840
2758
.f2_id = PCI_DEVICE_ID_AMD_10H_NB_DRAM ,
2841
2759
.max_mcs = 2 ,
2842
2760
.ops = {
2843
- .early_channel_count = f1x_early_channel_count ,
2844
2761
.map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow ,
2845
2762
.dbam_to_cs = f10_dbam_to_chip_select ,
2846
2763
}
@@ -2851,7 +2768,6 @@ static struct amd64_family_type family_types[] = {
2851
2768
.f2_id = PCI_DEVICE_ID_AMD_15H_NB_F2 ,
2852
2769
.max_mcs = 2 ,
2853
2770
.ops = {
2854
- .early_channel_count = f1x_early_channel_count ,
2855
2771
.map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow ,
2856
2772
.dbam_to_cs = f15_dbam_to_chip_select ,
2857
2773
}
@@ -2862,7 +2778,6 @@ static struct amd64_family_type family_types[] = {
2862
2778
.f2_id = PCI_DEVICE_ID_AMD_15H_M30H_NB_F2 ,
2863
2779
.max_mcs = 2 ,
2864
2780
.ops = {
2865
- .early_channel_count = f1x_early_channel_count ,
2866
2781
.map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow ,
2867
2782
.dbam_to_cs = f16_dbam_to_chip_select ,
2868
2783
}
@@ -2873,7 +2788,6 @@ static struct amd64_family_type family_types[] = {
2873
2788
.f2_id = PCI_DEVICE_ID_AMD_15H_M60H_NB_F2 ,
2874
2789
.max_mcs = 2 ,
2875
2790
.ops = {
2876
- .early_channel_count = f1x_early_channel_count ,
2877
2791
.map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow ,
2878
2792
.dbam_to_cs = f15_m60h_dbam_to_chip_select ,
2879
2793
}
@@ -2884,7 +2798,6 @@ static struct amd64_family_type family_types[] = {
2884
2798
.f2_id = PCI_DEVICE_ID_AMD_16H_NB_F2 ,
2885
2799
.max_mcs = 2 ,
2886
2800
.ops = {
2887
- .early_channel_count = f1x_early_channel_count ,
2888
2801
.map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow ,
2889
2802
.dbam_to_cs = f16_dbam_to_chip_select ,
2890
2803
}
@@ -2895,7 +2808,6 @@ static struct amd64_family_type family_types[] = {
2895
2808
.f2_id = PCI_DEVICE_ID_AMD_16H_M30H_NB_F2 ,
2896
2809
.max_mcs = 2 ,
2897
2810
.ops = {
2898
- .early_channel_count = f1x_early_channel_count ,
2899
2811
.map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow ,
2900
2812
.dbam_to_cs = f16_dbam_to_chip_select ,
2901
2813
}
@@ -2904,47 +2816,41 @@ static struct amd64_family_type family_types[] = {
2904
2816
.ctl_name = "F17h" ,
2905
2817
.max_mcs = 2 ,
2906
2818
.ops = {
2907
- .early_channel_count = f17_early_channel_count ,
2908
2819
.dbam_to_cs = f17_addr_mask_to_cs_size ,
2909
2820
}
2910
2821
},
2911
2822
[F17_M10H_CPUS ] = {
2912
2823
.ctl_name = "F17h_M10h" ,
2913
2824
.max_mcs = 2 ,
2914
2825
.ops = {
2915
- .early_channel_count = f17_early_channel_count ,
2916
2826
.dbam_to_cs = f17_addr_mask_to_cs_size ,
2917
2827
}
2918
2828
},
2919
2829
[F17_M30H_CPUS ] = {
2920
2830
.ctl_name = "F17h_M30h" ,
2921
2831
.max_mcs = 8 ,
2922
2832
.ops = {
2923
- .early_channel_count = f17_early_channel_count ,
2924
2833
.dbam_to_cs = f17_addr_mask_to_cs_size ,
2925
2834
}
2926
2835
},
2927
2836
[F17_M60H_CPUS ] = {
2928
2837
.ctl_name = "F17h_M60h" ,
2929
2838
.max_mcs = 2 ,
2930
2839
.ops = {
2931
- .early_channel_count = f17_early_channel_count ,
2932
2840
.dbam_to_cs = f17_addr_mask_to_cs_size ,
2933
2841
}
2934
2842
},
2935
2843
[F17_M70H_CPUS ] = {
2936
2844
.ctl_name = "F17h_M70h" ,
2937
2845
.max_mcs = 2 ,
2938
2846
.ops = {
2939
- .early_channel_count = f17_early_channel_count ,
2940
2847
.dbam_to_cs = f17_addr_mask_to_cs_size ,
2941
2848
}
2942
2849
},
2943
2850
[F19_CPUS ] = {
2944
2851
.ctl_name = "F19h" ,
2945
2852
.max_mcs = 8 ,
2946
2853
.ops = {
2947
- .early_channel_count = f17_early_channel_count ,
2948
2854
.dbam_to_cs = f17_addr_mask_to_cs_size ,
2949
2855
}
2950
2856
},
@@ -2953,15 +2859,13 @@ static struct amd64_family_type family_types[] = {
2953
2859
.max_mcs = 12 ,
2954
2860
.flags .zn_regs_v2 = 1 ,
2955
2861
.ops = {
2956
- .early_channel_count = f17_early_channel_count ,
2957
2862
.dbam_to_cs = f17_addr_mask_to_cs_size ,
2958
2863
}
2959
2864
},
2960
2865
[F19_M50H_CPUS ] = {
2961
2866
.ctl_name = "F19h_M50h" ,
2962
2867
.max_mcs = 2 ,
2963
2868
.ops = {
2964
- .early_channel_count = f17_early_channel_count ,
2965
2869
.dbam_to_cs = f17_addr_mask_to_cs_size ,
2966
2870
}
2967
2871
},
@@ -3620,7 +3524,7 @@ static int init_csrows(struct mem_ctl_info *mci)
3620
3524
: EDAC_SECDED ;
3621
3525
}
3622
3526
3623
- for (j = 0 ; j < pvt -> channel_count ; j ++ ) {
3527
+ for (j = 0 ; j < fam_type -> max_mcs ; j ++ ) {
3624
3528
dimm = csrow -> channels [j ]-> dimm ;
3625
3529
dimm -> mtype = pvt -> dram_type ;
3626
3530
dimm -> edac_mode = edac_mode ;
@@ -4057,28 +3961,12 @@ static int init_one_instance(struct amd64_pvt *pvt)
4057
3961
{
4058
3962
struct mem_ctl_info * mci = NULL ;
4059
3963
struct edac_mc_layer layers [2 ];
4060
- int ret = - EINVAL ;
3964
+ int ret = - ENOMEM ;
4061
3965
4062
- /*
4063
- * We need to determine how many memory channels there are. Then use
4064
- * that information for calculating the size of the dynamic instance
4065
- * tables in the 'mci' structure.
4066
- */
4067
- pvt -> channel_count = pvt -> ops -> early_channel_count (pvt );
4068
- if (pvt -> channel_count < 0 )
4069
- return ret ;
4070
-
4071
- ret = - ENOMEM ;
4072
3966
layers [0 ].type = EDAC_MC_LAYER_CHIP_SELECT ;
4073
3967
layers [0 ].size = pvt -> csels [0 ].b_cnt ;
4074
3968
layers [0 ].is_virt_csrow = true;
4075
3969
layers [1 ].type = EDAC_MC_LAYER_CHANNEL ;
4076
-
4077
- /*
4078
- * Always allocate two channels since we can have setups with DIMMs on
4079
- * only one channel. Also, this simplifies handling later for the price
4080
- * of a couple of KBs tops.
4081
- */
4082
3970
layers [1 ].size = fam_type -> max_mcs ;
4083
3971
layers [1 ].is_virt_csrow = false;
4084
3972
0 commit comments