aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/amd76x_edac.c
diff options
context:
space:
mode:
authorDoug Thompson <norsk5@xmission.com>2006-06-30 04:56:07 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-30 14:25:39 -0400
commit37f04581abac20444e5b7106c1e1f28bec5b989c (patch)
tree4112a057284749c5d53c6b9a8bf9f5e6c4ba34ef /drivers/edac/amd76x_edac.c
parentdc474c891c1993c4d608bed00c425b6db93d088d (diff)
[PATCH] EDAC: PCI device to DEVICE cleanup
Change MC drivers from using CVS revision strings for their version number, Now each driver has its own local string. Remove some PCI dependencies from the core EDAC module. Made the code 'struct device' centric instead of 'struct pci_dev' Most of the code changes here are from a patch by Dave Jiang. It may be best to eventually move the PCI-specific code into a separate source file. Signed-off-by: Doug Thompson <norsk5@xmission.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/edac/amd76x_edac.c')
-rw-r--r--drivers/edac/amd76x_edac.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/edac/amd76x_edac.c b/drivers/edac/amd76x_edac.c
index 53423ad6d4a3..7fd6283fe008 100644
--- a/drivers/edac/amd76x_edac.c
+++ b/drivers/edac/amd76x_edac.c
@@ -20,6 +20,9 @@
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include "edac_mc.h" 21#include "edac_mc.h"
22 22
23#define AMD76X_REVISION " Ver: 2.0.0 " __DATE__
24
25
23#define amd76x_printk(level, fmt, arg...) \ 26#define amd76x_printk(level, fmt, arg...) \
24 edac_printk(level, "amd76x", fmt, ##arg) 27 edac_printk(level, "amd76x", fmt, ##arg)
25 28
@@ -102,15 +105,18 @@ static const struct amd76x_dev_info amd76x_devs[] = {
102static void amd76x_get_error_info(struct mem_ctl_info *mci, 105static void amd76x_get_error_info(struct mem_ctl_info *mci,
103 struct amd76x_error_info *info) 106 struct amd76x_error_info *info)
104{ 107{
105 pci_read_config_dword(mci->pdev, AMD76X_ECC_MODE_STATUS, 108 struct pci_dev *pdev;
109
110 pdev = to_pci_dev(mci->dev);
111 pci_read_config_dword(pdev, AMD76X_ECC_MODE_STATUS,
106 &info->ecc_mode_status); 112 &info->ecc_mode_status);
107 113
108 if (info->ecc_mode_status & BIT(8)) 114 if (info->ecc_mode_status & BIT(8))
109 pci_write_bits32(mci->pdev, AMD76X_ECC_MODE_STATUS, 115 pci_write_bits32(pdev, AMD76X_ECC_MODE_STATUS,
110 (u32) BIT(8), (u32) BIT(8)); 116 (u32) BIT(8), (u32) BIT(8));
111 117
112 if (info->ecc_mode_status & BIT(9)) 118 if (info->ecc_mode_status & BIT(9))
113 pci_write_bits32(mci->pdev, AMD76X_ECC_MODE_STATUS, 119 pci_write_bits32(pdev, AMD76X_ECC_MODE_STATUS,
114 (u32) BIT(9), (u32) BIT(9)); 120 (u32) BIT(9), (u32) BIT(9));
115} 121}
116 122
@@ -211,13 +217,13 @@ static int amd76x_probe1(struct pci_dev *pdev, int dev_idx)
211 } 217 }
212 218
213 debugf0("%s(): mci = %p\n", __func__, mci); 219 debugf0("%s(): mci = %p\n", __func__, mci);
214 mci->pdev = pdev; 220 mci->dev = &pdev->dev;
215 mci->mtype_cap = MEM_FLAG_RDDR; 221 mci->mtype_cap = MEM_FLAG_RDDR;
216 mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_EC | EDAC_FLAG_SECDED; 222 mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_EC | EDAC_FLAG_SECDED;
217 mci->edac_cap = ems_mode ? 223 mci->edac_cap = ems_mode ?
218 (EDAC_FLAG_EC | EDAC_FLAG_SECDED) : EDAC_FLAG_NONE; 224 (EDAC_FLAG_EC | EDAC_FLAG_SECDED) : EDAC_FLAG_NONE;
219 mci->mod_name = EDAC_MOD_STR; 225 mci->mod_name = EDAC_MOD_STR;
220 mci->mod_ver = "$Revision: 1.4.2.5 $"; 226 mci->mod_ver = AMD76X_REVISION;
221 mci->ctl_name = amd76x_devs[dev_idx].ctl_name; 227 mci->ctl_name = amd76x_devs[dev_idx].ctl_name;
222 mci->edac_check = amd76x_check; 228 mci->edac_check = amd76x_check;
223 mci->ctl_page_to_phys = NULL; 229 mci->ctl_page_to_phys = NULL;
@@ -230,7 +236,7 @@ static int amd76x_probe1(struct pci_dev *pdev, int dev_idx)
230 u32 dms; 236 u32 dms;
231 237
232 /* find the DRAM Chip Select Base address and mask */ 238 /* find the DRAM Chip Select Base address and mask */
233 pci_read_config_dword(mci->pdev, 239 pci_read_config_dword(pdev,
234 AMD76X_MEM_BASE_ADDR + (index * 4), &mba); 240 AMD76X_MEM_BASE_ADDR + (index * 4), &mba);
235 241
236 if (!(mba & BIT(0))) 242 if (!(mba & BIT(0)))
@@ -238,8 +244,7 @@ static int amd76x_probe1(struct pci_dev *pdev, int dev_idx)
238 244
239 mba_base = mba & 0xff800000UL; 245 mba_base = mba & 0xff800000UL;
240 mba_mask = ((mba & 0xff80) << 16) | 0x7fffffUL; 246 mba_mask = ((mba & 0xff80) << 16) | 0x7fffffUL;
241 pci_read_config_dword(mci->pdev, AMD76X_DRAM_MODE_STATUS, 247 pci_read_config_dword(pdev, AMD76X_DRAM_MODE_STATUS, &dms);
242 &dms);
243 csrow->first_page = mba_base >> PAGE_SHIFT; 248 csrow->first_page = mba_base >> PAGE_SHIFT;
244 csrow->nr_pages = (mba_mask + 1) >> PAGE_SHIFT; 249 csrow->nr_pages = (mba_mask + 1) >> PAGE_SHIFT;
245 csrow->last_page = csrow->first_page + csrow->nr_pages - 1; 250 csrow->last_page = csrow->first_page + csrow->nr_pages - 1;
@@ -291,7 +296,7 @@ static void __devexit amd76x_remove_one(struct pci_dev *pdev)
291 296
292 debugf0("%s()\n", __func__); 297 debugf0("%s()\n", __func__);
293 298
294 if ((mci = edac_mc_del_mc(pdev)) == NULL) 299 if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL)
295 return; 300 return;
296 301
297 edac_mc_free(mci); 302 edac_mc_free(mci);