summaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorYazen Ghannam <yazen.ghannam@amd.com>2019-08-21 20:00:02 -0400
committerBorislav Petkov <bp@suse.de>2019-08-23 10:09:52 -0400
commit81f5090db843be897414418c24fe472fa6e082b6 (patch)
tree5f8ff7ca5c5d5f8c7ad311caa452f446a3b19a00 /drivers/edac
parent7574729e91468d568cc198de438feb35ef04f41a (diff)
EDAC/amd64: Support asymmetric dual-rank DIMMs
Future AMD systems will support asymmetric dual-rank DIMMs. These are DIMMs where the ranks are of different sizes. The even rank will use the Primary Even Chip Select registers and the odd rank will use the Secondary Odd Chip Select registers. Recognize if a Secondary Odd Chip Select is being used. Use the Secondary Odd Address Mask when calculating the chip select size. [ bp: move csrow_sec_enabled() to the header, fix CS_ODD define and tone-down the capitalized words spelling. ] Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Borislav Petkov <bp@suse.de> Cc: "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org> Cc: James Morse <james.morse@arm.com> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: Tony Luck <tony.luck@intel.com> Link: https://lkml.kernel.org/r/20190821235938.118710-8-Yazen.Ghannam@amd.com
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/amd64_edac.c16
-rw-r--r--drivers/edac/amd64_edac.h3
2 files changed, 15 insertions, 4 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 23251bba8eb6..18ba9c898389 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -790,9 +790,11 @@ static void debug_dump_dramcfg_low(struct amd64_pvt *pvt, u32 dclr, int chan)
790 790
791#define CS_EVEN_PRIMARY BIT(0) 791#define CS_EVEN_PRIMARY BIT(0)
792#define CS_ODD_PRIMARY BIT(1) 792#define CS_ODD_PRIMARY BIT(1)
793#define CS_EVEN_SECONDARY BIT(2)
794#define CS_ODD_SECONDARY BIT(3)
793 795
794#define CS_EVEN CS_EVEN_PRIMARY 796#define CS_EVEN (CS_EVEN_PRIMARY | CS_EVEN_SECONDARY)
795#define CS_ODD CS_ODD_PRIMARY 797#define CS_ODD (CS_ODD_PRIMARY | CS_ODD_SECONDARY)
796 798
797static int f17_get_cs_mode(int dimm, u8 ctrl, struct amd64_pvt *pvt) 799static int f17_get_cs_mode(int dimm, u8 ctrl, struct amd64_pvt *pvt)
798{ 800{
@@ -804,6 +806,10 @@ static int f17_get_cs_mode(int dimm, u8 ctrl, struct amd64_pvt *pvt)
804 if (csrow_enabled(2 * dimm + 1, ctrl, pvt)) 806 if (csrow_enabled(2 * dimm + 1, ctrl, pvt))
805 cs_mode |= CS_ODD_PRIMARY; 807 cs_mode |= CS_ODD_PRIMARY;
806 808
809 /* Asymmetric dual-rank DIMM support. */
810 if (csrow_sec_enabled(2 * dimm + 1, ctrl, pvt))
811 cs_mode |= CS_ODD_SECONDARY;
812
807 return cs_mode; 813 return cs_mode;
808} 814}
809 815
@@ -1600,7 +1606,11 @@ static int f17_addr_mask_to_cs_size(struct amd64_pvt *pvt, u8 umc,
1600 */ 1606 */
1601 dimm = csrow_nr >> 1; 1607 dimm = csrow_nr >> 1;
1602 1608
1603 addr_mask_orig = pvt->csels[umc].csmasks[dimm]; 1609 /* Asymmetric dual-rank DIMM support. */
1610 if ((csrow_nr & 1) && (cs_mode & CS_ODD_SECONDARY))
1611 addr_mask_orig = pvt->csels[umc].csmasks_sec[dimm];
1612 else
1613 addr_mask_orig = pvt->csels[umc].csmasks[dimm];
1604 1614
1605 /* 1615 /*
1606 * The number of zero bits in the mask is equal to the number of bits 1616 * The number of zero bits in the mask is equal to the number of bits
diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h
index 68f12de6e654..8addc4d95577 100644
--- a/drivers/edac/amd64_edac.h
+++ b/drivers/edac/amd64_edac.h
@@ -169,7 +169,8 @@
169#define DCSM0 0x60 169#define DCSM0 0x60
170#define DCSM1 0x160 170#define DCSM1 0x160
171 171
172#define csrow_enabled(i, dct, pvt) ((pvt)->csels[(dct)].csbases[(i)] & DCSB_CS_ENABLE) 172#define csrow_enabled(i, dct, pvt) ((pvt)->csels[(dct)].csbases[(i)] & DCSB_CS_ENABLE)
173#define csrow_sec_enabled(i, dct, pvt) ((pvt)->csels[(dct)].csbases_sec[(i)] & DCSB_CS_ENABLE)
173 174
174#define DRAM_CONTROL 0x78 175#define DRAM_CONTROL 0x78
175 176