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

i7300_edac: Properly initialize per-csrow memory size

Due to the current edac-core limits, we cannot represent a per-channel
memory size, for FB-DIMM drivers. So, we need to sum-up all values
for each slot, in order to properly represent the total amount of
memory found by the i7300 driver.

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

+10 -7
+10 -7
drivers/edac/i7300_edac.c
··· 617 617 int slot, int ch, int branch, 618 618 struct i7300_dimm_info *dinfo, 619 619 struct csrow_info *p_csrow, 620 - u32 *last_page) 620 + u32 *nr_pages) 621 621 { 622 622 int mtr, ans, addrBits, channel; 623 623 ··· 649 649 addrBits -= 3; /* 8 bits per bytes */ 650 650 651 651 dinfo->megabytes = 1 << addrBits; 652 + *nr_pages = dinfo->megabytes << 8; 652 653 653 654 debugf2("\t\tWIDTH: x%d\n", MTR_DRAM_WIDTH(mtr)); 654 655 ··· 663 662 debugf2("\t\tSIZE: %d MB\n", dinfo->megabytes); 664 663 665 664 p_csrow->grain = 8; 666 - p_csrow->nr_pages = dinfo->megabytes << 8; 667 665 p_csrow->mtype = MEM_FB_DDR2; 668 666 p_csrow->csrow_idx = slot; 669 - p_csrow->first_page = *last_page; 670 - *last_page += p_csrow->nr_pages; 671 - p_csrow->last_page = *last_page; 672 667 p_csrow->page_mask = 0; 673 668 674 669 /* ··· 777 780 int rc = -ENODEV; 778 781 int mtr; 779 782 int ch, branch, slot, channel; 780 - u32 last_page = 0; 783 + u32 last_page = 0, nr_pages; 781 784 782 785 pvt = mci->pvt_info; 783 786 ··· 815 818 p_csrow = &mci->csrows[slot]; 816 819 817 820 mtr = decode_mtr(pvt, slot, ch, branch, 818 - dinfo, p_csrow, &last_page); 821 + dinfo, p_csrow, &nr_pages); 819 822 /* if no DIMMS on this row, continue */ 820 823 if (!MTR_DIMMS_PRESENT(mtr)) 821 824 continue; 825 + 826 + /* Update per_csrow memory count */ 827 + p_csrow->nr_pages += nr_pages; 828 + p_csrow->first_page = last_page; 829 + last_page += nr_pages; 830 + p_csrow->last_page = last_page; 822 831 823 832 rc = 0; 824 833 }