1
1
// SPDX-License-Identifier: GPL-2.0-only
2
2
#include <linux/ras.h>
3
+ #include <linux/string_choices.h>
3
4
#include "amd64_edac.h"
4
5
#include <asm/amd_nb.h>
5
6
#include <asm/amd_node.h>
@@ -1171,22 +1172,21 @@ static void debug_dump_dramcfg_low(struct amd64_pvt *pvt, u32 dclr, int chan)
1171
1172
edac_dbg (1 , " LRDIMM %dx rank multiply\n" , (dcsm & 0x3 ));
1172
1173
}
1173
1174
1174
- edac_dbg (1 , "All DIMMs support ECC:%s\n" ,
1175
- (dclr & BIT (19 )) ? "yes" : "no" );
1175
+ edac_dbg (1 , "All DIMMs support ECC: %s\n" , str_yes_no (dclr & BIT (19 )));
1176
1176
1177
1177
1178
1178
edac_dbg (1 , " PAR/ERR parity: %s\n" ,
1179
- (dclr & BIT (8 )) ? "enabled" : "disabled" );
1179
+ str_enabled_disabled (dclr & BIT (8 )));
1180
1180
1181
1181
if (pvt -> fam == 0x10 )
1182
1182
edac_dbg (1 , " DCT 128bit mode width: %s\n" ,
1183
1183
(dclr & BIT (11 )) ? "128b" : "64b" );
1184
1184
1185
1185
edac_dbg (1 , " x4 logical DIMMs present: L0: %s L1: %s L2: %s L3: %s\n" ,
1186
- (dclr & BIT (12 )) ? "yes" : "no" ,
1187
- (dclr & BIT (13 )) ? "yes" : "no" ,
1188
- (dclr & BIT (14 )) ? "yes" : "no" ,
1189
- (dclr & BIT (15 )) ? "yes" : "no" );
1186
+ str_yes_no (dclr & BIT (12 )),
1187
+ str_yes_no (dclr & BIT (13 )),
1188
+ str_yes_no (dclr & BIT (14 )),
1189
+ str_yes_no (dclr & BIT (15 )));
1190
1190
}
1191
1191
1192
1192
#define CS_EVEN_PRIMARY BIT(0)
@@ -1353,14 +1353,14 @@ static void umc_dump_misc_regs(struct amd64_pvt *pvt)
1353
1353
edac_dbg (1 , "UMC%d UMC cap high: 0x%x\n" , i , umc -> umc_cap_hi );
1354
1354
1355
1355
edac_dbg (1 , "UMC%d ECC capable: %s, ChipKill ECC capable: %s\n" ,
1356
- i , (umc -> umc_cap_hi & BIT (30 )) ? "yes" : "no" ,
1357
- (umc -> umc_cap_hi & BIT (31 )) ? "yes" : "no" );
1356
+ i , str_yes_no (umc -> umc_cap_hi & BIT (30 )),
1357
+ str_yes_no (umc -> umc_cap_hi & BIT (31 )));
1358
1358
edac_dbg (1 , "UMC%d All DIMMs support ECC: %s\n" ,
1359
- i , (umc -> umc_cfg & BIT (12 )) ? "yes" : "no" );
1359
+ i , str_yes_no (umc -> umc_cfg & BIT (12 )));
1360
1360
edac_dbg (1 , "UMC%d x4 DIMMs present: %s\n" ,
1361
- i , (umc -> dimm_cfg & BIT (6 )) ? "yes" : "no" );
1361
+ i , str_yes_no (umc -> dimm_cfg & BIT (6 )));
1362
1362
edac_dbg (1 , "UMC%d x16 DIMMs present: %s\n" ,
1363
- i , (umc -> dimm_cfg & BIT (7 )) ? "yes" : "no" );
1363
+ i , str_yes_no (umc -> dimm_cfg & BIT (7 )));
1364
1364
1365
1365
umc_debug_display_dimm_sizes (pvt , i );
1366
1366
}
@@ -1371,11 +1371,11 @@ static void dct_dump_misc_regs(struct amd64_pvt *pvt)
1371
1371
edac_dbg (1 , "F3xE8 (NB Cap): 0x%08x\n" , pvt -> nbcap );
1372
1372
1373
1373
edac_dbg (1 , " NB two channel DRAM capable: %s\n" ,
1374
- (pvt -> nbcap & NBCAP_DCT_DUAL ) ? "yes" : "no" );
1374
+ str_yes_no (pvt -> nbcap & NBCAP_DCT_DUAL ));
1375
1375
1376
1376
edac_dbg (1 , " ECC capable: %s, ChipKill ECC capable: %s\n" ,
1377
- (pvt -> nbcap & NBCAP_SECDED ) ? "yes" : "no" ,
1378
- (pvt -> nbcap & NBCAP_CHIPKILL ) ? "yes" : "no" );
1377
+ str_yes_no (pvt -> nbcap & NBCAP_SECDED ),
1378
+ str_yes_no (pvt -> nbcap & NBCAP_CHIPKILL ));
1379
1379
1380
1380
debug_dump_dramcfg_low (pvt , pvt -> dclr0 , 0 );
1381
1381
@@ -1398,7 +1398,7 @@ static void dct_dump_misc_regs(struct amd64_pvt *pvt)
1398
1398
if (!dct_ganging_enabled (pvt ))
1399
1399
debug_dump_dramcfg_low (pvt , pvt -> dclr1 , 1 );
1400
1400
1401
- edac_dbg (1 , " DramHoleValid: %s\n" , dhar_valid (pvt ) ? "yes" : "no" );
1401
+ edac_dbg (1 , " DramHoleValid: %s\n" , str_yes_no ( dhar_valid (pvt )) );
1402
1402
1403
1403
amd64_info ("using x%u syndromes.\n" , pvt -> ecc_sym_sz );
1404
1404
}
@@ -2027,15 +2027,15 @@ static void read_dram_ctl_register(struct amd64_pvt *pvt)
2027
2027
2028
2028
if (!dct_ganging_enabled (pvt ))
2029
2029
edac_dbg (0 , " Address range split per DCT: %s\n" ,
2030
- (dct_high_range_enabled (pvt ) ? "yes" : "no" ));
2030
+ str_yes_no (dct_high_range_enabled (pvt )));
2031
2031
2032
2032
edac_dbg (0 , " data interleave for ECC: %s, DRAM cleared since last warm reset: %s\n" ,
2033
- (dct_data_intlv_enabled (pvt ) ? "enabled" : "disabled" ),
2034
- (dct_memory_cleared (pvt ) ? "yes" : "no" ));
2033
+ str_enabled_disabled (dct_data_intlv_enabled (pvt )),
2034
+ str_yes_no (dct_memory_cleared (pvt )));
2035
2035
2036
2036
edac_dbg (0 , " channel interleave: %s, "
2037
2037
"interleave bits selector: 0x%x\n" ,
2038
- (dct_interleave_enabled (pvt ) ? "enabled" : "disabled" ),
2038
+ str_enabled_disabled (dct_interleave_enabled (pvt )),
2039
2039
dct_sel_interleave_addr (pvt ));
2040
2040
}
2041
2041
@@ -3208,8 +3208,7 @@ static bool nb_mce_bank_enabled_on_node(u16 nid)
3208
3208
nbe = reg -> l & MSR_MCGCTL_NBE ;
3209
3209
3210
3210
edac_dbg (0 , "core: %u, MCG_CTL: 0x%llx, NB MSR is %s\n" ,
3211
- cpu , reg -> q ,
3212
- (nbe ? "enabled" : "disabled" ));
3211
+ cpu , reg -> q , str_enabled_disabled (nbe ));
3213
3212
3214
3213
if (!nbe )
3215
3214
goto out ;
@@ -3353,7 +3352,7 @@ static bool dct_ecc_enabled(struct amd64_pvt *pvt)
3353
3352
edac_dbg (0 , "NB MCE bank disabled, set MSR 0x%08x[4] on node %d to enable.\n" ,
3354
3353
MSR_IA32_MCG_CTL , nid );
3355
3354
3356
- edac_dbg (3 , "Node %d: DRAM ECC %s.\n" , nid , (ecc_en ? "enabled" : "disabled" ));
3355
+ edac_dbg (3 , "Node %d: DRAM ECC %s.\n" , nid , str_enabled_disabled (ecc_en ));
3357
3356
3358
3357
if (!ecc_en || !nb_mce_en )
3359
3358
return false;
@@ -3378,7 +3377,7 @@ static bool umc_ecc_enabled(struct amd64_pvt *pvt)
3378
3377
}
3379
3378
}
3380
3379
3381
- edac_dbg (3 , "Node %d: DRAM ECC %s.\n" , pvt -> mc_node_id , (ecc_en ? "enabled" : "disabled" ));
3380
+ edac_dbg (3 , "Node %d: DRAM ECC %s.\n" , pvt -> mc_node_id , str_enabled_disabled (ecc_en ));
3382
3381
3383
3382
return ecc_en ;
3384
3383
}
0 commit comments