aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/i7300_edac.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2012-01-27 16:38:08 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-28 18:10:58 -0400
commit084a4fccef39ac7abb039511f32380f28d0b67e6 (patch)
tree0596612000c7ec3a848b10f7cc4acdb573218076 /drivers/edac/i7300_edac.c
parenta7d7d2e1a07e3811dc49af2962c940fd8bbb6c8f (diff)
edac: move dimm properties to struct dimm_info
On systems based on chip select rows, all channels need to use memories with the same properties, otherwise the memories on channels A and B won't be recognized. However, such assumption is not true for all types of memory controllers. Controllers for FB-DIMM's don't have such requirements. Also, modern Intel controllers seem to be capable of handling such differences. So, we need to get rid of storing the DIMM information into a per-csrow data, storing it, instead at the right place. The first step is to move grain, mtype, dtype and edac_mode to the per-dimm struct. Reviewed-by: Aristeu Rozanski <arozansk@redhat.com> Reviewed-by: Borislav Petkov <borislav.petkov@amd.com> Acked-by: Chris Metcalf <cmetcalf@tilera.com> Cc: Doug Thompson <norsk5@yahoo.com> Cc: Borislav Petkov <borislav.petkov@amd.com> Cc: Mark Gross <mark.gross@intel.com> Cc: Jason Uhlenkott <juhlenko@akamai.com> Cc: Tim Small <tim@buttersideup.com> Cc: Ranganathan Desikan <ravi@jetztechnologies.com> Cc: "Arvind R." <arvino55@gmail.com> Cc: Olof Johansson <olof@lixom.net> Cc: Egor Martovetsky <egor@pasemi.com> Cc: Michal Marek <mmarek@suse.cz> Cc: Jiri Kosina <jkosina@suse.cz> Cc: Joe Perches <joe@perches.com> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Hitoshi Mitake <h.mitake@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: James Bottomley <James.Bottomley@parallels.com> Cc: "Niklas Söderlund" <niklas.soderlund@ericsson.com> Cc: Shaohui Xie <Shaohui.Xie@freescale.com> Cc: Josh Boyer <jwboyer@gmail.com> Cc: Mike Williams <mike@mikebwilliams.com> Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/edac/i7300_edac.c')
-rw-r--r--drivers/edac/i7300_edac.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/edac/i7300_edac.c b/drivers/edac/i7300_edac.c
index 3bafa3bca148..4bfcb3da3f01 100644
--- a/drivers/edac/i7300_edac.c
+++ b/drivers/edac/i7300_edac.c
@@ -618,6 +618,7 @@ static int decode_mtr(struct i7300_pvt *pvt,
618 int slot, int ch, int branch, 618 int slot, int ch, int branch,
619 struct i7300_dimm_info *dinfo, 619 struct i7300_dimm_info *dinfo,
620 struct csrow_info *p_csrow, 620 struct csrow_info *p_csrow,
621 struct dimm_info *dimm,
621 u32 *nr_pages) 622 u32 *nr_pages)
622{ 623{
623 int mtr, ans, addrBits, channel; 624 int mtr, ans, addrBits, channel;
@@ -663,10 +664,7 @@ static int decode_mtr(struct i7300_pvt *pvt,
663 debugf2("\t\tNUMCOL: %s\n", numcol_toString[MTR_DIMM_COLS(mtr)]); 664 debugf2("\t\tNUMCOL: %s\n", numcol_toString[MTR_DIMM_COLS(mtr)]);
664 debugf2("\t\tSIZE: %d MB\n", dinfo->megabytes); 665 debugf2("\t\tSIZE: %d MB\n", dinfo->megabytes);
665 666
666 p_csrow->grain = 8;
667 p_csrow->mtype = MEM_FB_DDR2;
668 p_csrow->csrow_idx = slot; 667 p_csrow->csrow_idx = slot;
669 p_csrow->page_mask = 0;
670 668
671 /* 669 /*
672 * The type of error detection actually depends of the 670 * The type of error detection actually depends of the
@@ -677,15 +675,17 @@ static int decode_mtr(struct i7300_pvt *pvt,
677 * See datasheet Sections 7.3.6 to 7.3.8 675 * See datasheet Sections 7.3.6 to 7.3.8
678 */ 676 */
679 677
678 dimm->grain = 8;
679 dimm->mtype = MEM_FB_DDR2;
680 if (IS_SINGLE_MODE(pvt->mc_settings_a)) { 680 if (IS_SINGLE_MODE(pvt->mc_settings_a)) {
681 p_csrow->edac_mode = EDAC_SECDED; 681 dimm->edac_mode = EDAC_SECDED;
682 debugf2("\t\tECC code is 8-byte-over-32-byte SECDED+ code\n"); 682 debugf2("\t\tECC code is 8-byte-over-32-byte SECDED+ code\n");
683 } else { 683 } else {
684 debugf2("\t\tECC code is on Lockstep mode\n"); 684 debugf2("\t\tECC code is on Lockstep mode\n");
685 if (MTR_DRAM_WIDTH(mtr) == 8) 685 if (MTR_DRAM_WIDTH(mtr) == 8)
686 p_csrow->edac_mode = EDAC_S8ECD8ED; 686 dimm->edac_mode = EDAC_S8ECD8ED;
687 else 687 else
688 p_csrow->edac_mode = EDAC_S4ECD4ED; 688 dimm->edac_mode = EDAC_S4ECD4ED;
689 } 689 }
690 690
691 /* ask what device type on this row */ 691 /* ask what device type on this row */
@@ -694,9 +694,9 @@ static int decode_mtr(struct i7300_pvt *pvt,
694 IS_SCRBALGO_ENHANCED(pvt->mc_settings) ? 694 IS_SCRBALGO_ENHANCED(pvt->mc_settings) ?
695 "enhanced" : "normal"); 695 "enhanced" : "normal");
696 696
697 p_csrow->dtype = DEV_X8; 697 dimm->dtype = DEV_X8;
698 } else 698 } else
699 p_csrow->dtype = DEV_X4; 699 dimm->dtype = DEV_X4;
700 700
701 return mtr; 701 return mtr;
702} 702}
@@ -779,6 +779,7 @@ static int i7300_init_csrows(struct mem_ctl_info *mci)
779 int mtr; 779 int mtr;
780 int ch, branch, slot, channel; 780 int ch, branch, slot, channel;
781 u32 last_page = 0, nr_pages; 781 u32 last_page = 0, nr_pages;
782 struct dimm_info *dimm;
782 783
783 pvt = mci->pvt_info; 784 pvt = mci->pvt_info;
784 785
@@ -803,20 +804,24 @@ static int i7300_init_csrows(struct mem_ctl_info *mci)
803 } 804 }
804 805
805 /* Get the set of MTR[0-7] regs by each branch */ 806 /* Get the set of MTR[0-7] regs by each branch */
807 nr_pages = 0;
806 for (slot = 0; slot < MAX_SLOTS; slot++) { 808 for (slot = 0; slot < MAX_SLOTS; slot++) {
807 int where = mtr_regs[slot]; 809 int where = mtr_regs[slot];
808 for (branch = 0; branch < MAX_BRANCHES; branch++) { 810 for (branch = 0; branch < MAX_BRANCHES; branch++) {
809 pci_read_config_word(pvt->pci_dev_2x_0_fbd_branch[branch], 811 pci_read_config_word(pvt->pci_dev_2x_0_fbd_branch[branch],
810 where, 812 where,
811 &pvt->mtr[slot][branch]); 813 &pvt->mtr[slot][branch]);
812 for (ch = 0; ch < MAX_BRANCHES; ch++) { 814 for (ch = 0; ch < MAX_CH_PER_BRANCH; ch++) {
813 int channel = to_channel(ch, branch); 815 int channel = to_channel(ch, branch);
814 816
815 dinfo = &pvt->dimm_info[slot][channel]; 817 dinfo = &pvt->dimm_info[slot][channel];
816 p_csrow = &mci->csrows[slot]; 818 p_csrow = &mci->csrows[slot];
817 819
820 dimm = p_csrow->channels[branch * MAX_CH_PER_BRANCH + ch].dimm;
821
818 mtr = decode_mtr(pvt, slot, ch, branch, 822 mtr = decode_mtr(pvt, slot, ch, branch,
819 dinfo, p_csrow, &nr_pages); 823 dinfo, p_csrow, dimm,
824 &nr_pages);
820 /* if no DIMMS on this row, continue */ 825 /* if no DIMMS on this row, continue */
821 if (!MTR_DIMMS_PRESENT(mtr)) 826 if (!MTR_DIMMS_PRESENT(mtr))
822 continue; 827 continue;