diff options
author | Aristeu Rozanski <arozansk@redhat.com> | 2013-10-30 12:27:00 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-11-14 13:48:16 -0500 |
commit | 464f1d829afd51ff3b7e43da480c86148d5ff924 (patch) | |
tree | 58c73d7b503470e97e41abb968e1dae86d111569 /drivers/edac | |
parent | 8fd6a43ac9300c2451823f390c0301770973bc36 (diff) |
sb_edac: allow different dram_rule arrays
This is in preparation for Ivy Bridge support
Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/edac')
-rw-r--r-- | drivers/edac/sb_edac.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c index 4ec4957b484c..c42dec232507 100644 --- a/drivers/edac/sb_edac.c +++ b/drivers/edac/sb_edac.c | |||
@@ -83,11 +83,10 @@ static int probed; | |||
83 | #define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_ERR3 0x3c77 /* 16.7 */ | 83 | #define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_ERR3 0x3c77 /* 16.7 */ |
84 | 84 | ||
85 | /* Devices 12 Function 6, Offsets 0x80 to 0xcc */ | 85 | /* Devices 12 Function 6, Offsets 0x80 to 0xcc */ |
86 | static const u32 dram_rule[] = { | 86 | static const u32 sbridge_dram_rule[] = { |
87 | 0x80, 0x88, 0x90, 0x98, 0xa0, | 87 | 0x80, 0x88, 0x90, 0x98, 0xa0, |
88 | 0xa8, 0xb0, 0xb8, 0xc0, 0xc8, | 88 | 0xa8, 0xb0, 0xb8, 0xc0, 0xc8, |
89 | }; | 89 | }; |
90 | #define MAX_SAD ARRAY_SIZE(dram_rule) | ||
91 | 90 | ||
92 | #define SAD_LIMIT(reg) ((GET_BITFIELD(reg, 6, 25) << 26) | 0x3ffffff) | 91 | #define SAD_LIMIT(reg) ((GET_BITFIELD(reg, 6, 25) << 26) | 0x3ffffff) |
93 | #define DRAM_ATTR(reg) GET_BITFIELD(reg, 2, 3) | 92 | #define DRAM_ATTR(reg) GET_BITFIELD(reg, 2, 3) |
@@ -275,10 +274,12 @@ static const u32 correrrthrsld[] = { | |||
275 | 274 | ||
276 | struct sbridge_pvt; | 275 | struct sbridge_pvt; |
277 | struct sbridge_info { | 276 | struct sbridge_info { |
278 | u32 mcmtr; | 277 | u32 mcmtr; |
279 | u32 rankcfgr; | 278 | u32 rankcfgr; |
280 | u64 (*get_tolm)(struct sbridge_pvt *pvt); | 279 | u64 (*get_tolm)(struct sbridge_pvt *pvt); |
281 | u64 (*get_tohm)(struct sbridge_pvt *pvt); | 280 | u64 (*get_tohm)(struct sbridge_pvt *pvt); |
281 | const u32 *dram_rule; | ||
282 | u8 max_sad; | ||
282 | }; | 283 | }; |
283 | 284 | ||
284 | struct sbridge_channel { | 285 | struct sbridge_channel { |
@@ -673,9 +674,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci) | |||
673 | * algorithm bellow. | 674 | * algorithm bellow. |
674 | */ | 675 | */ |
675 | prv = 0; | 676 | prv = 0; |
676 | for (n_sads = 0; n_sads < MAX_SAD; n_sads++) { | 677 | for (n_sads = 0; n_sads < pvt->info.max_sad; n_sads++) { |
677 | /* SAD_LIMIT Address range is 45:26 */ | 678 | /* SAD_LIMIT Address range is 45:26 */ |
678 | pci_read_config_dword(pvt->pci_sad0, dram_rule[n_sads], | 679 | pci_read_config_dword(pvt->pci_sad0, pvt->info.dram_rule[n_sads], |
679 | ®); | 680 | ®); |
680 | limit = SAD_LIMIT(reg); | 681 | limit = SAD_LIMIT(reg); |
681 | 682 | ||
@@ -847,8 +848,8 @@ static int get_memory_error_data(struct mem_ctl_info *mci, | |||
847 | /* | 848 | /* |
848 | * Step 1) Get socket | 849 | * Step 1) Get socket |
849 | */ | 850 | */ |
850 | for (n_sads = 0; n_sads < MAX_SAD; n_sads++) { | 851 | for (n_sads = 0; n_sads < pvt->info.max_sad; n_sads++) { |
851 | pci_read_config_dword(pvt->pci_sad0, dram_rule[n_sads], | 852 | pci_read_config_dword(pvt->pci_sad0, pvt->info.dram_rule[n_sads], |
852 | ®); | 853 | ®); |
853 | 854 | ||
854 | if (!DRAM_RULE_ENABLE(reg)) | 855 | if (!DRAM_RULE_ENABLE(reg)) |
@@ -863,7 +864,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci, | |||
863 | break; | 864 | break; |
864 | prv = limit; | 865 | prv = limit; |
865 | } | 866 | } |
866 | if (n_sads == MAX_SAD) { | 867 | if (n_sads == pvt->info.max_sad) { |
867 | sprintf(msg, "Can't discover the memory socket"); | 868 | sprintf(msg, "Can't discover the memory socket"); |
868 | return -EINVAL; | 869 | return -EINVAL; |
869 | } | 870 | } |
@@ -1678,6 +1679,8 @@ static int sbridge_register_mci(struct sbridge_dev *sbridge_dev) | |||
1678 | mci->ctl_page_to_phys = NULL; | 1679 | mci->ctl_page_to_phys = NULL; |
1679 | pvt->info.get_tolm = sbridge_get_tolm; | 1680 | pvt->info.get_tolm = sbridge_get_tolm; |
1680 | pvt->info.get_tohm = sbridge_get_tohm; | 1681 | pvt->info.get_tohm = sbridge_get_tohm; |
1682 | pvt->info.dram_rule = sbridge_dram_rule; | ||
1683 | pvt->info.max_sad = ARRAY_SIZE(sbridge_dram_rule); | ||
1681 | 1684 | ||
1682 | /* Set the function pointer to an actual operation function */ | 1685 | /* Set the function pointer to an actual operation function */ |
1683 | mci->edac_check = sbridge_check_error; | 1686 | mci->edac_check = sbridge_check_error; |