Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i7core_edac: Memory info fixes and preparation for properly filling cswrow data

Now, memory size is properly displayed:

EDAC i7core: DOD Max limits: DIMMS: 2, 1-ranked, 8-banked
EDAC i7core: DOD Max rows x colums = 0x4000 x 0x400
EDAC i7core: Memory channel configuration:
EDAC i7core: Ch0 phy rd0, wr0 (0x063f7c31): 2 ranks, UDIMMs
EDAC i7core: dimm 0 (0x00000288) 1024 Mb offset: 0, numbank: 8,
numrank: 1, numrow: 0x4000, numcol: 0x400
EDAC i7core: dimm 1 (0x00001288) 1024 Mb offset: 4, numbank: 8,
numrank: 1, numrow: 0x4000, numcol: 0x400
EDAC i7core: Ch1 phy rd1, wr1 (0x063f7c31): 2 ranks, UDIMMs
EDAC i7core: dimm 0 (0x00000288) 1024 Mb offset: 0, numbank: 8,
numrank: 1, numrow: 0x4000, numcol: 0x400
EDAC i7core: Ch2 phy rd3, wr3 (0x063f7c31): 2 ranks, UDIMMs
EDAC i7core: dimm 0 (0x00000288) 1024 Mb offset: 0, numbank: 8,
numrank: 1, numrow: 0x4000, numcol: 0x400

Still, as the way to retrieve csrows info is not known, it does a
mapping of what's available to csrows basic unit at edac core.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

+19 -9
+19 -9
drivers/edac/i7core_edac.c
··· 113 113 #define MC_DOD_NUMBANK(x) (((x) & MC_DOD_NUMBANK_MASK) >> 7) 114 114 #define MC_DOD_NUMRANK_MASK ((1 << 6) | (1 << 5)) 115 115 #define MC_DOD_NUMRANK(x) (((x) & MC_DOD_NUMRANK_MASK) >> 5) 116 - #define MC_DOD_NUMROW_MASK ((1 << 4) | (1 << 3)) 117 - #define MC_DOD_NUMROW(x) (((x) & MC_DOD_NUMROW_MASK) >> 3) 116 + #define MC_DOD_NUMROW_MASK ((1 << 4) | (1 << 3)| (1 << 2)) 117 + #define MC_DOD_NUMROW(x) (((x) & MC_DOD_NUMROW_MASK) >> 2) 118 118 #define MC_DOD_NUMCOL_MASK 3 119 119 #define MC_DOD_NUMCOL(x) ((x) & MC_DOD_NUMCOL_MASK) 120 120 ··· 361 361 struct csrow_info *csr; 362 362 struct pci_dev *pdev; 363 363 int i, j, csrow = 0; 364 + unsigned long last_page = 0; 364 365 enum edac_type mode; 365 366 enum mem_type mtype; 366 367 ··· 381 380 pvt->info.max_dod, pvt->info.ch_map); 382 381 383 382 if (ECC_ENABLED(pvt)) { 384 - debugf0("ECC enabled with x%d SDCC\n", ECCx8(pvt)?8:4); 383 + debugf0("ECC enabled with x%d SDCC\n", ECCx8(pvt) ?8:4); 385 384 if (ECCx8(pvt)) 386 385 mode = EDAC_S8ECD8ED; 387 386 else ··· 451 450 452 451 for (j = 0; j < 3; j++) { 453 452 u32 banks, ranks, rows, cols; 453 + u32 size, npages; 454 454 455 455 if (!DIMM_PRESENT(dimm_dod[j])) 456 456 continue; ··· 461 459 rows = numrow(MC_DOD_NUMROW(dimm_dod[j])); 462 460 cols = numcol(MC_DOD_NUMCOL(dimm_dod[j])); 463 461 462 + /* DDR3 has 8 I/O banks */ 463 + size = (rows * cols * banks * ranks) >> (20 - 3); 464 + 464 465 pvt->channel[i].dimms++; 465 466 466 - debugf0("\tdimm %d offset: %x, numbank: %#x, " 467 - "numrank: %#x, numrow: %#x, numcol: %#x\n", 468 - j, 467 + debugf0("\tdimm %d (0x%08x) %d Mb offset: %x, " 468 + "numbank: %d,\n\t\t" 469 + "numrank: %d, numrow: %#x, numcol: %#x\n", 470 + j, dimm_dod[j], size, 469 471 RANKOFFSET(dimm_dod[j]), 470 472 banks, ranks, rows, cols); 471 473 474 + npages = cols * rows; /* FIXME */ 475 + 472 476 csr = &mci->csrows[csrow]; 473 - csr->first_page = 0; 474 - csr->last_page = 0; 477 + csr->first_page = last_page + 1; 478 + last_page += npages; 479 + csr->last_page = last_page; 480 + csr->nr_pages = npages; 481 + 475 482 csr->page_mask = 0; 476 - csr->nr_pages = 0; 477 483 csr->grain = 0; 478 484 csr->csrow_idx = csrow; 479 485