aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/i82860_edac.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/edac/i82860_edac.c')
-rw-r--r--drivers/edac/i82860_edac.c66
1 files changed, 39 insertions, 27 deletions
diff --git a/drivers/edac/i82860_edac.c b/drivers/edac/i82860_edac.c
index 688854260a0e..fd342163cf97 100644
--- a/drivers/edac/i82860_edac.c
+++ b/drivers/edac/i82860_edac.c
@@ -9,7 +9,6 @@
9 * by Thayne Harbaugh of Linux Networx. (http://lnxi.com) 9 * by Thayne Harbaugh of Linux Networx. (http://lnxi.com)
10 */ 10 */
11 11
12
13#include <linux/config.h> 12#include <linux/config.h>
14#include <linux/module.h> 13#include <linux/module.h>
15#include <linux/init.h> 14#include <linux/init.h>
@@ -18,14 +17,11 @@
18#include <linux/slab.h> 17#include <linux/slab.h>
19#include "edac_mc.h" 18#include "edac_mc.h"
20 19
21
22#define i82860_printk(level, fmt, arg...) \ 20#define i82860_printk(level, fmt, arg...) \
23 edac_printk(level, "i82860", fmt, ##arg) 21 edac_printk(level, "i82860", fmt, ##arg)
24
25 22
26#define i82860_mc_printk(mci, level, fmt, arg...) \ 23#define i82860_mc_printk(mci, level, fmt, arg...) \
27 edac_mc_chipset_printk(mci, level, "i82860", fmt, ##arg) 24 edac_mc_chipset_printk(mci, level, "i82860", fmt, ##arg)
28
29 25
30#ifndef PCI_DEVICE_ID_INTEL_82860_0 26#ifndef PCI_DEVICE_ID_INTEL_82860_0
31#define PCI_DEVICE_ID_INTEL_82860_0 0x2531 27#define PCI_DEVICE_ID_INTEL_82860_0 0x2531
@@ -56,13 +52,15 @@ struct i82860_error_info {
56 52
57static const struct i82860_dev_info i82860_devs[] = { 53static const struct i82860_dev_info i82860_devs[] = {
58 [I82860] = { 54 [I82860] = {
59 .ctl_name = "i82860"}, 55 .ctl_name = "i82860"
56 },
60}; 57};
61 58
62static struct pci_dev *mci_pdev = NULL; /* init dev: in case that AGP code 59static struct pci_dev *mci_pdev = NULL; /* init dev: in case that AGP code
63 has already registered driver */ 60 * has already registered driver
61 */
64 62
65static void i82860_get_error_info (struct mem_ctl_info *mci, 63static void i82860_get_error_info(struct mem_ctl_info *mci,
66 struct i82860_error_info *info) 64 struct i82860_error_info *info)
67{ 65{
68 /* 66 /*
@@ -84,14 +82,15 @@ static void i82860_get_error_info (struct mem_ctl_info *mci,
84 */ 82 */
85 if (!(info->errsts2 & 0x0003)) 83 if (!(info->errsts2 & 0x0003))
86 return; 84 return;
85
87 if ((info->errsts ^ info->errsts2) & 0x0003) { 86 if ((info->errsts ^ info->errsts2) & 0x0003) {
88 pci_read_config_dword(mci->pdev, I82860_EAP, &info->eap); 87 pci_read_config_dword(mci->pdev, I82860_EAP, &info->eap);
89 pci_read_config_word(mci->pdev, I82860_DERRCTL_STS, 88 pci_read_config_word(mci->pdev, I82860_DERRCTL_STS,
90 &info->derrsyn); 89 &info->derrsyn);
91 } 90 }
92} 91}
93 92
94static int i82860_process_error_info (struct mem_ctl_info *mci, 93static int i82860_process_error_info(struct mem_ctl_info *mci,
95 struct i82860_error_info *info, int handle_errors) 94 struct i82860_error_info *info, int handle_errors)
96{ 95{
97 int row; 96 int row;
@@ -113,8 +112,8 @@ static int i82860_process_error_info (struct mem_ctl_info *mci,
113 if (info->errsts & 0x0002) 112 if (info->errsts & 0x0002)
114 edac_mc_handle_ue(mci, info->eap, 0, row, "i82860 UE"); 113 edac_mc_handle_ue(mci, info->eap, 0, row, "i82860 UE");
115 else 114 else
116 edac_mc_handle_ce(mci, info->eap, 0, info->derrsyn, row, 115 edac_mc_handle_ce(mci, info->eap, 0, info->derrsyn, row, 0,
117 0, "i82860 UE"); 116 "i82860 UE");
118 117
119 return 1; 118 return 1;
120} 119}
@@ -147,15 +146,14 @@ static int i82860_probe1(struct pci_dev *pdev, int dev_idx)
147 going to make 1 channel for group. 146 going to make 1 channel for group.
148 */ 147 */
149 mci = edac_mc_alloc(0, 16, 1); 148 mci = edac_mc_alloc(0, 16, 1);
149
150 if (!mci) 150 if (!mci)
151 return -ENOMEM; 151 return -ENOMEM;
152 152
153 debugf3("%s(): init mci\n", __func__); 153 debugf3("%s(): init mci\n", __func__);
154
155 mci->pdev = pdev; 154 mci->pdev = pdev;
156 mci->mtype_cap = MEM_FLAG_DDR; 155 mci->mtype_cap = MEM_FLAG_DDR;
157 156
158
159 mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED; 157 mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED;
160 /* I"m not sure about this but I think that all RDRAM is SECDED */ 158 /* I"m not sure about this but I think that all RDRAM is SECDED */
161 mci->edac_cap = EDAC_FLAG_SECDED; 159 mci->edac_cap = EDAC_FLAG_SECDED;
@@ -182,12 +180,13 @@ static int i82860_probe1(struct pci_dev *pdev, int dev_idx)
182 struct csrow_info *csrow = &mci->csrows[index]; 180 struct csrow_info *csrow = &mci->csrows[index];
183 181
184 pci_read_config_word(mci->pdev, I82860_GBA + index * 2, 182 pci_read_config_word(mci->pdev, I82860_GBA + index * 2,
185 &value); 183 &value);
186 184
187 cumul_size = (value & I82860_GBA_MASK) << 185 cumul_size = (value & I82860_GBA_MASK) <<
188 (I82860_GBA_SHIFT - PAGE_SHIFT); 186 (I82860_GBA_SHIFT - PAGE_SHIFT);
189 debugf3("%s(): (%d) cumul_size 0x%x\n", __func__, index, 187 debugf3("%s(): (%d) cumul_size 0x%x\n", __func__, index,
190 cumul_size); 188 cumul_size);
189
191 if (cumul_size == last_cumul_size) 190 if (cumul_size == last_cumul_size)
192 continue; /* not populated */ 191 continue; /* not populated */
193 192
@@ -195,7 +194,7 @@ static int i82860_probe1(struct pci_dev *pdev, int dev_idx)
195 csrow->last_page = cumul_size - 1; 194 csrow->last_page = cumul_size - 1;
196 csrow->nr_pages = cumul_size - last_cumul_size; 195 csrow->nr_pages = cumul_size - last_cumul_size;
197 last_cumul_size = cumul_size; 196 last_cumul_size = cumul_size;
198 csrow->grain = 1 << 12; /* I82860_EAP has 4KiB reolution */ 197 csrow->grain = 1 << 12; /* I82860_EAP has 4KiB reolution */
199 csrow->mtype = MEM_RMBS; 198 csrow->mtype = MEM_RMBS;
200 csrow->dtype = DEV_UNKNOWN; 199 csrow->dtype = DEV_UNKNOWN;
201 csrow->edac_mode = mchcfg_ddim ? EDAC_SECDED : EDAC_NONE; 200 csrow->edac_mode = mchcfg_ddim ? EDAC_SECDED : EDAC_NONE;
@@ -211,23 +210,27 @@ static int i82860_probe1(struct pci_dev *pdev, int dev_idx)
211 debugf3("%s(): success\n", __func__); 210 debugf3("%s(): success\n", __func__);
212 rc = 0; 211 rc = 0;
213 } 212 }
213
214 return rc; 214 return rc;
215} 215}
216 216
217/* returns count (>= 0), or negative on error */ 217/* returns count (>= 0), or negative on error */
218static int __devinit i82860_init_one(struct pci_dev *pdev, 218static int __devinit i82860_init_one(struct pci_dev *pdev,
219 const struct pci_device_id *ent) 219 const struct pci_device_id *ent)
220{ 220{
221 int rc; 221 int rc;
222 222
223 debugf0("%s()\n", __func__); 223 debugf0("%s()\n", __func__);
224
225 i82860_printk(KERN_INFO, "i82860 init one\n"); 224 i82860_printk(KERN_INFO, "i82860 init one\n");
226 if(pci_enable_device(pdev) < 0) 225
226 if (pci_enable_device(pdev) < 0)
227 return -EIO; 227 return -EIO;
228
228 rc = i82860_probe1(pdev, ent->driver_data); 229 rc = i82860_probe1(pdev, ent->driver_data);
229 if(rc == 0) 230
231 if (rc == 0)
230 mci_pdev = pci_dev_get(pdev); 232 mci_pdev = pci_dev_get(pdev);
233
231 return rc; 234 return rc;
232} 235}
233 236
@@ -244,9 +247,13 @@ static void __devexit i82860_remove_one(struct pci_dev *pdev)
244} 247}
245 248
246static const struct pci_device_id i82860_pci_tbl[] __devinitdata = { 249static const struct pci_device_id i82860_pci_tbl[] __devinitdata = {
247 {PCI_VEND_DEV(INTEL, 82860_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0, 250 {
248 I82860}, 251 PCI_VEND_DEV(INTEL, 82860_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
249 {0,} /* 0 terminated list. */ 252 I82860
253 },
254 {
255 0,
256 } /* 0 terminated list. */
250}; 257};
251 258
252MODULE_DEVICE_TABLE(pci, i82860_pci_tbl); 259MODULE_DEVICE_TABLE(pci, i82860_pci_tbl);
@@ -263,24 +270,29 @@ static int __init i82860_init(void)
263 int pci_rc; 270 int pci_rc;
264 271
265 debugf3("%s()\n", __func__); 272 debugf3("%s()\n", __func__);
273
266 if ((pci_rc = pci_register_driver(&i82860_driver)) < 0) 274 if ((pci_rc = pci_register_driver(&i82860_driver)) < 0)
267 goto fail0; 275 goto fail0;
268 276
269 if (!mci_pdev) { 277 if (!mci_pdev) {
270 mci_pdev = pci_get_device(PCI_VENDOR_ID_INTEL, 278 mci_pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
271 PCI_DEVICE_ID_INTEL_82860_0, NULL); 279 PCI_DEVICE_ID_INTEL_82860_0, NULL);
280
272 if (mci_pdev == NULL) { 281 if (mci_pdev == NULL) {
273 debugf0("860 pci_get_device fail\n"); 282 debugf0("860 pci_get_device fail\n");
274 pci_rc = -ENODEV; 283 pci_rc = -ENODEV;
275 goto fail1; 284 goto fail1;
276 } 285 }
286
277 pci_rc = i82860_init_one(mci_pdev, i82860_pci_tbl); 287 pci_rc = i82860_init_one(mci_pdev, i82860_pci_tbl);
288
278 if (pci_rc < 0) { 289 if (pci_rc < 0) {
279 debugf0("860 init fail\n"); 290 debugf0("860 init fail\n");
280 pci_rc = -ENODEV; 291 pci_rc = -ENODEV;
281 goto fail1; 292 goto fail1;
282 } 293 }
283 } 294 }
295
284 return 0; 296 return 0;
285 297
286fail1: 298fail1:
@@ -307,6 +319,6 @@ module_init(i82860_init);
307module_exit(i82860_exit); 319module_exit(i82860_exit);
308 320
309MODULE_LICENSE("GPL"); 321MODULE_LICENSE("GPL");
310MODULE_AUTHOR 322MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com) "
311 ("Red Hat Inc. (http://www.redhat.com) Ben Woodard <woodard@redhat.com>"); 323 "Ben Woodard <woodard@redhat.com>");
312MODULE_DESCRIPTION("ECC support for Intel 82860 memory hub controllers"); 324MODULE_DESCRIPTION("ECC support for Intel 82860 memory hub controllers");