11// SPDX-License-Identifier: GPL-2.0-only
22#include <linux/ras.h>
3+ #include <linux/string_choices.h>
34#include "amd64_edac.h"
45#include <asm/amd_nb.h>
56#include <asm/amd_node.h>
@@ -1171,22 +1172,21 @@ static void debug_dump_dramcfg_low(struct amd64_pvt *pvt, u32 dclr, int chan)
11711172 edac_dbg (1 , " LRDIMM %dx rank multiply\n" , (dcsm & 0x3 ));
11721173 }
11731174
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 )));
11761176
11771177
11781178 edac_dbg (1 , " PAR/ERR parity: %s\n" ,
1179- (dclr & BIT (8 )) ? "enabled" : "disabled" );
1179+ str_enabled_disabled (dclr & BIT (8 )));
11801180
11811181 if (pvt -> fam == 0x10 )
11821182 edac_dbg (1 , " DCT 128bit mode width: %s\n" ,
11831183 (dclr & BIT (11 )) ? "128b" : "64b" );
11841184
11851185 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 )));
11901190}
11911191
11921192#define CS_EVEN_PRIMARY BIT(0)
@@ -1353,14 +1353,14 @@ static void umc_dump_misc_regs(struct amd64_pvt *pvt)
13531353 edac_dbg (1 , "UMC%d UMC cap high: 0x%x\n" , i , umc -> umc_cap_hi );
13541354
13551355 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 )));
13581358 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 )));
13601360 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 )));
13621362 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 )));
13641364
13651365 umc_debug_display_dimm_sizes (pvt , i );
13661366 }
@@ -1371,11 +1371,11 @@ static void dct_dump_misc_regs(struct amd64_pvt *pvt)
13711371 edac_dbg (1 , "F3xE8 (NB Cap): 0x%08x\n" , pvt -> nbcap );
13721372
13731373 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 ));
13751375
13761376 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 ));
13791379
13801380 debug_dump_dramcfg_low (pvt , pvt -> dclr0 , 0 );
13811381
@@ -1398,7 +1398,7 @@ static void dct_dump_misc_regs(struct amd64_pvt *pvt)
13981398 if (!dct_ganging_enabled (pvt ))
13991399 debug_dump_dramcfg_low (pvt , pvt -> dclr1 , 1 );
14001400
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 )) );
14021402
14031403 amd64_info ("using x%u syndromes.\n" , pvt -> ecc_sym_sz );
14041404}
@@ -2027,15 +2027,15 @@ static void read_dram_ctl_register(struct amd64_pvt *pvt)
20272027
20282028 if (!dct_ganging_enabled (pvt ))
20292029 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 )));
20312031
20322032 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 )));
20352035
20362036 edac_dbg (0 , " channel interleave: %s, "
20372037 "interleave bits selector: 0x%x\n" ,
2038- (dct_interleave_enabled (pvt ) ? "enabled" : "disabled" ),
2038+ str_enabled_disabled (dct_interleave_enabled (pvt )),
20392039 dct_sel_interleave_addr (pvt ));
20402040 }
20412041
@@ -3208,8 +3208,7 @@ static bool nb_mce_bank_enabled_on_node(u16 nid)
32083208 nbe = reg -> l & MSR_MCGCTL_NBE ;
32093209
32103210 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 ));
32133212
32143213 if (!nbe )
32153214 goto out ;
@@ -3353,7 +3352,7 @@ static bool dct_ecc_enabled(struct amd64_pvt *pvt)
33533352 edac_dbg (0 , "NB MCE bank disabled, set MSR 0x%08x[4] on node %d to enable.\n" ,
33543353 MSR_IA32_MCG_CTL , nid );
33553354
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 ));
33573356
33583357 if (!ecc_en || !nb_mce_en )
33593358 return false;
@@ -3378,7 +3377,7 @@ static bool umc_ecc_enabled(struct amd64_pvt *pvt)
33783377 }
33793378 }
33803379
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 ));
33823381
33833382 return ecc_en ;
33843383}
0 commit comments