@@ -18,6 +18,63 @@ struct amd64_pvt;
1818static struct mem_ctl_info * mci_lookup [MAX_NUMNODES ];
1919static struct amd64_pvt * pvt_lookup [MAX_NUMNODES ];
2020
21+ /*
22+ * See F2x80 for K8 and F2x[1,0]80 for Fam10 and later. The table below is only
23+ * for DDR2 DRAM mapping.
24+ */
25+ u32 revf_quad_ddr2_shift [] = {
26+ 0 , /* 0000b NULL DIMM (128mb) */
27+ 28 , /* 0001b 256mb */
28+ 29 , /* 0010b 512mb */
29+ 29 , /* 0011b 512mb */
30+ 29 , /* 0100b 512mb */
31+ 30 , /* 0101b 1gb */
32+ 30 , /* 0110b 1gb */
33+ 31 , /* 0111b 2gb */
34+ 31 , /* 1000b 2gb */
35+ 32 , /* 1001b 4gb */
36+ 32 , /* 1010b 4gb */
37+ 33 , /* 1011b 8gb */
38+ 0 , /* 1100b future */
39+ 0 , /* 1101b future */
40+ 0 , /* 1110b future */
41+ 0 /* 1111b future */
42+ };
43+
44+ /*
45+ * Valid scrub rates for the K8 hardware memory scrubber. We map the scrubbing
46+ * bandwidth to a valid bit pattern. The 'set' operation finds the 'matching-
47+ * or higher value'.
48+ *
49+ *FIXME: Produce a better mapping/linearisation.
50+ */
51+
52+ struct scrubrate scrubrates [] = {
53+ { 0x01 , 1600000000UL },
54+ { 0x02 , 800000000UL },
55+ { 0x03 , 400000000UL },
56+ { 0x04 , 200000000UL },
57+ { 0x05 , 100000000UL },
58+ { 0x06 , 50000000UL },
59+ { 0x07 , 25000000UL },
60+ { 0x08 , 12284069UL },
61+ { 0x09 , 6274509UL },
62+ { 0x0A , 3121951UL },
63+ { 0x0B , 1560975UL },
64+ { 0x0C , 781440UL },
65+ { 0x0D , 390720UL },
66+ { 0x0E , 195300UL },
67+ { 0x0F , 97650UL },
68+ { 0x10 , 48854UL },
69+ { 0x11 , 24427UL },
70+ { 0x12 , 12213UL },
71+ { 0x13 , 6101UL },
72+ { 0x14 , 3051UL },
73+ { 0x15 , 1523UL },
74+ { 0x16 , 761UL },
75+ { 0x00 , 0UL }, /* scrubbing off */
76+ };
77+
2178/*
2279 * Memory scrubber control interface. For K8, memory scrubbing is handled by
2380 * hardware and can involve L2 cache, dcache as well as the main memory. With
@@ -1101,8 +1158,8 @@ static void k8_map_sysaddr_to_csrow(struct mem_ctl_info *mci,
11011158 u32 page , offset ;
11021159
11031160 /* Extract the syndrome parts and form a 16-bit syndrome */
1104- syndrome = EXTRACT_HIGH_SYNDROME (info -> nbsl ) << 8 ;
1105- syndrome |= EXTRACT_LOW_SYNDROME (info -> nbsh );
1161+ syndrome = HIGH_SYNDROME (info -> nbsl ) << 8 ;
1162+ syndrome |= LOW_SYNDROME (info -> nbsh );
11061163
11071164 /* CHIPKILL enabled */
11081165 if (info -> nbcfg & K8_NBCFG_CHIPKILL ) {
@@ -1701,8 +1758,8 @@ static void f10_map_sysaddr_to_csrow(struct mem_ctl_info *mci,
17011758 if (csrow >= 0 ) {
17021759 error_address_to_page_and_offset (sys_addr , & page , & offset );
17031760
1704- syndrome = EXTRACT_HIGH_SYNDROME (info -> nbsl ) << 8 ;
1705- syndrome |= EXTRACT_LOW_SYNDROME (info -> nbsh );
1761+ syndrome = HIGH_SYNDROME (info -> nbsl ) << 8 ;
1762+ syndrome |= LOW_SYNDROME (info -> nbsh );
17061763
17071764 /*
17081765 * Is CHIPKILL on? If so, then we can attempt to use the
@@ -2155,36 +2212,22 @@ static int amd64_get_error_info(struct mem_ctl_info *mci,
21552212static inline void amd64_decode_gart_tlb_error (struct mem_ctl_info * mci ,
21562213 struct amd64_error_info_regs * info )
21572214{
2158- u32 err_code ;
2159- u32 ec_tt ; /* error code transaction type (2b) */
2160- u32 ec_ll ; /* error code cache level (2b) */
2161-
2162- err_code = EXTRACT_ERROR_CODE (info -> nbsl );
2163- ec_ll = EXTRACT_LL_CODE (err_code );
2164- ec_tt = EXTRACT_TT_CODE (err_code );
2215+ u32 ec = ERROR_CODE (info -> nbsl );
21652216
21662217 amd64_mc_printk (mci , KERN_ERR ,
21672218 "GART TLB event: transaction type(%s), "
2168- "cache level(%s)\n" , tt_msgs [ ec_tt ], ll_msgs [ ec_ll ] );
2219+ "cache level(%s)\n" , TT_MSG ( ec ), LL_MSG ( ec ) );
21692220}
21702221
21712222static inline void amd64_decode_mem_cache_error (struct mem_ctl_info * mci ,
21722223 struct amd64_error_info_regs * info )
21732224{
2174- u32 err_code ;
2175- u32 ec_rrrr ; /* error code memory transaction (4b) */
2176- u32 ec_tt ; /* error code transaction type (2b) */
2177- u32 ec_ll ; /* error code cache level (2b) */
2178-
2179- err_code = EXTRACT_ERROR_CODE (info -> nbsl );
2180- ec_ll = EXTRACT_LL_CODE (err_code );
2181- ec_tt = EXTRACT_TT_CODE (err_code );
2182- ec_rrrr = EXTRACT_RRRR_CODE (err_code );
2225+ u32 ec = ERROR_CODE (info -> nbsl );
21832226
21842227 amd64_mc_printk (mci , KERN_ERR ,
21852228 "cache hierarchy error: memory transaction type(%s), "
21862229 "transaction type(%s), cache level(%s)\n" ,
2187- rrrr_msgs [ ec_rrrr ], tt_msgs [ ec_tt ], ll_msgs [ ec_ll ] );
2230+ RRRR_MSG ( ec ), TT_MSG ( ec ), LL_MSG ( ec ) );
21882231}
21892232
21902233
@@ -2264,42 +2307,26 @@ static void amd64_handle_ue(struct mem_ctl_info *mci,
22642307static void amd64_decode_bus_error (struct mem_ctl_info * mci ,
22652308 struct amd64_error_info_regs * info )
22662309{
2267- u32 err_code , ext_ec ;
2268- u32 ec_pp ; /* error code participating processor (2p) */
2269- u32 ec_to ; /* error code timed out (1b) */
2270- u32 ec_rrrr ; /* error code memory transaction (4b) */
2271- u32 ec_ii ; /* error code memory or I/O (2b) */
2272- u32 ec_ll ; /* error code cache level (2b) */
2273-
2274- ext_ec = EXTRACT_EXT_ERROR_CODE (info -> nbsl );
2275- err_code = EXTRACT_ERROR_CODE (info -> nbsl );
2276-
2277- ec_ll = EXTRACT_LL_CODE (err_code );
2278- ec_ii = EXTRACT_II_CODE (err_code );
2279- ec_rrrr = EXTRACT_RRRR_CODE (err_code );
2280- ec_to = EXTRACT_TO_CODE (err_code );
2281- ec_pp = EXTRACT_PP_CODE (err_code );
2310+ u32 ec = ERROR_CODE (info -> nbsl );
2311+ u32 xec = EXT_ERROR_CODE (info -> nbsl );
22822312
22832313 amd64_mc_printk (mci , KERN_ERR ,
22842314 "BUS ERROR:\n"
22852315 " time-out(%s) mem or i/o(%s)\n"
22862316 " participating processor(%s)\n"
22872317 " memory transaction type(%s)\n"
22882318 " cache level(%s) Error Found by: %s\n" ,
2289- to_msgs [ec_to ],
2290- ii_msgs [ec_ii ],
2291- pp_msgs [ec_pp ],
2292- rrrr_msgs [ec_rrrr ],
2293- ll_msgs [ec_ll ],
2319+ TO_MSG (ec ), II_MSG (ec ), PP_MSG (ec ), RRRR_MSG (ec ), LL_MSG (ec ),
22942320 (info -> nbsh & K8_NBSH_ERR_SCRUBER ) ?
22952321 "Scrubber" : "Normal Operation" );
22962322
2297- /* If this was an 'observed' error, early out */
2298- if (ec_pp == K8_NBSL_PP_OBS )
2299- return ; /* We aren't the node involved */
2323+
2324+ /* Bail early out if this was an 'observed' error */
2325+ if (PP (ec ) == K8_NBSL_PP_OBS )
2326+ return ;
23002327
23012328 /* Parse out the extended error code for ECC events */
2302- switch (ext_ec ) {
2329+ switch (xec ) {
23032330 /* F10 changed to one Extended ECC error code */
23042331 case F10_NBSL_EXT_ERR_RES : /* Reserved field */
23052332 case F10_NBSL_EXT_ERR_ECC : /* F10 ECC ext err code */
@@ -2379,15 +2406,15 @@ int amd64_process_error_info(struct mem_ctl_info *mci,
23792406 (regs -> nbsh & K8_NBSH_CORE3 ) ? "True" : "False" );
23802407
23812408
2382- err_code = EXTRACT_ERROR_CODE (regs -> nbsl );
2409+ err_code = ERROR_CODE (regs -> nbsl );
23832410
23842411 /* Determine which error type:
23852412 * 1) GART errors - non-fatal, developmental events
23862413 * 2) MEMORY errors
23872414 * 3) BUS errors
23882415 * 4) Unknown error
23892416 */
2390- if (TEST_TLB_ERROR (err_code )) {
2417+ if (TLB_ERROR (err_code )) {
23912418 /*
23922419 * GART errors are intended to help graphics driver developers
23932420 * to detect bad GART PTEs. It is recommended by AMD to disable
@@ -2411,10 +2438,10 @@ int amd64_process_error_info(struct mem_ctl_info *mci,
24112438
24122439 debugf1 ("GART TLB error\n" );
24132440 amd64_decode_gart_tlb_error (mci , info );
2414- } else if (TEST_MEM_ERROR (err_code )) {
2441+ } else if (MEM_ERROR (err_code )) {
24152442 debugf1 ("Memory/Cache error\n" );
24162443 amd64_decode_mem_cache_error (mci , info );
2417- } else if (TEST_BUS_ERROR (err_code )) {
2444+ } else if (BUS_ERROR (err_code )) {
24182445 debugf1 ("Bus (Link/DRAM) error\n" );
24192446 amd64_decode_bus_error (mci , info );
24202447 } else {
@@ -2424,21 +2451,10 @@ int amd64_process_error_info(struct mem_ctl_info *mci,
24242451 err_code );
24252452 }
24262453
2427- ext_ec = EXTRACT_EXT_ERROR_CODE (regs -> nbsl );
2454+ ext_ec = EXT_ERROR_CODE (regs -> nbsl );
24282455 amd64_mc_printk (mci , KERN_ERR ,
24292456 "ExtErr=(0x%x) %s\n" , ext_ec , ext_msgs [ext_ec ]);
24302457
2431- if (((ext_ec >= F10_NBSL_EXT_ERR_CRC &&
2432- ext_ec <= F10_NBSL_EXT_ERR_TGT ) ||
2433- (ext_ec == F10_NBSL_EXT_ERR_RMW )) &&
2434- EXTRACT_LDT_LINK (info -> nbsh )) {
2435-
2436- amd64_mc_printk (mci , KERN_ERR ,
2437- "Error on hypertransport link: %s\n" ,
2438- htlink_msgs [
2439- EXTRACT_LDT_LINK (info -> nbsh )]);
2440- }
2441-
24422458 /*
24432459 * Check the UE bit of the NB status high register, if set generate some
24442460 * logs. If NOT a GART error, then process the event as a NO-INFO event.
0 commit comments