Skip to content

Commit

Permalink
[PATCH] EDAC: PCI device to DEVICE cleanup
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Alan Cox <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Doug Thompson authored and Linus Torvalds committed Jun 30, 2006
1 parent dc474c8 commit 37f0458
Show file tree
Hide file tree
Showing 8 changed files with 374 additions and 323 deletions.
23 changes: 14 additions & 9 deletions drivers/edac/amd76x_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#include <linux/slab.h>
#include "edac_mc.h"

#define AMD76X_REVISION " Ver: 2.0.0 " __DATE__


#define amd76x_printk(level, fmt, arg...) \
edac_printk(level, "amd76x", fmt, ##arg)

Expand Down Expand Up @@ -102,15 +105,18 @@ static const struct amd76x_dev_info amd76x_devs[] = {
static void amd76x_get_error_info(struct mem_ctl_info *mci,
struct amd76x_error_info *info)
{
pci_read_config_dword(mci->pdev, AMD76X_ECC_MODE_STATUS,
struct pci_dev *pdev;

pdev = to_pci_dev(mci->dev);
pci_read_config_dword(pdev, AMD76X_ECC_MODE_STATUS,
&info->ecc_mode_status);

if (info->ecc_mode_status & BIT(8))
pci_write_bits32(mci->pdev, AMD76X_ECC_MODE_STATUS,
pci_write_bits32(pdev, AMD76X_ECC_MODE_STATUS,
(u32) BIT(8), (u32) BIT(8));

if (info->ecc_mode_status & BIT(9))
pci_write_bits32(mci->pdev, AMD76X_ECC_MODE_STATUS,
pci_write_bits32(pdev, AMD76X_ECC_MODE_STATUS,
(u32) BIT(9), (u32) BIT(9));
}

Expand Down Expand Up @@ -211,13 +217,13 @@ static int amd76x_probe1(struct pci_dev *pdev, int dev_idx)
}

debugf0("%s(): mci = %p\n", __func__, mci);
mci->pdev = pdev;
mci->dev = &pdev->dev;
mci->mtype_cap = MEM_FLAG_RDDR;
mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_EC | EDAC_FLAG_SECDED;
mci->edac_cap = ems_mode ?
(EDAC_FLAG_EC | EDAC_FLAG_SECDED) : EDAC_FLAG_NONE;
mci->mod_name = EDAC_MOD_STR;
mci->mod_ver = "$Revision: 1.4.2.5 $";
mci->mod_ver = AMD76X_REVISION;
mci->ctl_name = amd76x_devs[dev_idx].ctl_name;
mci->edac_check = amd76x_check;
mci->ctl_page_to_phys = NULL;
Expand All @@ -230,16 +236,15 @@ static int amd76x_probe1(struct pci_dev *pdev, int dev_idx)
u32 dms;

/* find the DRAM Chip Select Base address and mask */
pci_read_config_dword(mci->pdev,
pci_read_config_dword(pdev,
AMD76X_MEM_BASE_ADDR + (index * 4), &mba);

if (!(mba & BIT(0)))
continue;

mba_base = mba & 0xff800000UL;
mba_mask = ((mba & 0xff80) << 16) | 0x7fffffUL;
pci_read_config_dword(mci->pdev, AMD76X_DRAM_MODE_STATUS,
&dms);
pci_read_config_dword(pdev, AMD76X_DRAM_MODE_STATUS, &dms);
csrow->first_page = mba_base >> PAGE_SHIFT;
csrow->nr_pages = (mba_mask + 1) >> PAGE_SHIFT;
csrow->last_page = csrow->first_page + csrow->nr_pages - 1;
Expand Down Expand Up @@ -291,7 +296,7 @@ static void __devexit amd76x_remove_one(struct pci_dev *pdev)

debugf0("%s()\n", __func__);

if ((mci = edac_mc_del_mc(pdev)) == NULL)
if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL)
return;

edac_mc_free(mci);
Expand Down
23 changes: 12 additions & 11 deletions drivers/edac/e752x_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <linux/slab.h>
#include "edac_mc.h"

#define E752X_REVISION " Ver: 2.0.0 " __DATE__

static int force_function_unhide;

#define e752x_printk(level, fmt, arg...) \
Expand Down Expand Up @@ -819,8 +821,8 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
EDAC_FLAG_S4ECD4ED;
/* FIXME - what if different memory types are in different csrows? */
mci->mod_name = EDAC_MOD_STR;
mci->mod_ver = "$Revision: 1.5.2.11 $";
mci->pdev = pdev;
mci->mod_ver = E752X_REVISION;
mci->dev = &pdev->dev;

debugf3("%s(): init pvt\n", __func__);
pvt = (struct e752x_pvt *) mci->pvt_info;
Expand Down Expand Up @@ -864,7 +866,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
struct csrow_info *csrow = &mci->csrows[index];

mem_dev = (mem_dev == 2);
pci_read_config_byte(mci->pdev, E752X_DRB + index, &value);
pci_read_config_byte(pdev, E752X_DRB + index, &value);
/* convert a 128 or 64 MiB DRB to a page size. */
cumul_size = value << (25 + drc_drbg - PAGE_SHIFT);
debugf3("%s(): (%d) cumul_size 0x%x\n", __func__, index,
Expand Down Expand Up @@ -904,8 +906,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
u8 row = 0;

for (index = 0; index < 8; index += 2) {
pci_read_config_byte(mci->pdev, E752X_DRB + index,
&value);
pci_read_config_byte(pdev, E752X_DRB + index, &value);

/* test if there is a dimm in this slot */
if (value == last) {
Expand All @@ -918,7 +919,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
last = value;
/* test the next value to see if the dimm is
double sided */
pci_read_config_byte(mci->pdev,
pci_read_config_byte(pdev,
E752X_DRB + index + 1,
&value);
pvt->map[index + 1] = (value == last) ?
Expand All @@ -935,18 +936,18 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
}

/* set the map type. 1 = normal, 0 = reversed */
pci_read_config_byte(mci->pdev, E752X_DRM, &stat8);
pci_read_config_byte(pdev, E752X_DRM, &stat8);
pvt->map_type = ((stat8 & 0x0f) > ((stat8 >> 4) & 0x0f));

mci->edac_cap |= EDAC_FLAG_NONE;
debugf3("%s(): tolm, remapbase, remaplimit\n", __func__);

/* load the top of low memory, remap base, and remap limit vars */
pci_read_config_word(mci->pdev, E752X_TOLM, &pci_data);
pci_read_config_word(pdev, E752X_TOLM, &pci_data);
pvt->tolm = ((u32) pci_data) << 4;
pci_read_config_word(mci->pdev, E752X_REMAPBASE, &pci_data);
pci_read_config_word(pdev, E752X_REMAPBASE, &pci_data);
pvt->remapbase = ((u32) pci_data) << 14;
pci_read_config_word(mci->pdev, E752X_REMAPLIMIT, &pci_data);
pci_read_config_word(pdev, E752X_REMAPLIMIT, &pci_data);
pvt->remaplimit = ((u32) pci_data) << 14;
e752x_printk(KERN_INFO,
"tolm = %x, remapbase = %x, remaplimit = %x\n", pvt->tolm,
Expand Down Expand Up @@ -1015,7 +1016,7 @@ static void __devexit e752x_remove_one(struct pci_dev *pdev)

debugf0("%s()\n", __func__);

if ((mci = edac_mc_del_mc(pdev)) == NULL)
if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL)
return;

pvt = (struct e752x_pvt *) mci->pvt_info;
Expand Down
16 changes: 9 additions & 7 deletions drivers/edac/e7xxx_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <linux/slab.h>
#include "edac_mc.h"

#define E7XXX_REVISION " Ver: 2.0.0 " __DATE__

#define e7xxx_printk(level, fmt, arg...) \
edac_printk(level, "e7xxx", fmt, ##arg)

Expand Down Expand Up @@ -373,8 +375,8 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx)
EDAC_FLAG_S4ECD4ED;
/* FIXME - what if different memory types are in different csrows? */
mci->mod_name = EDAC_MOD_STR;
mci->mod_ver = "$Revision: 1.5.2.9 $";
mci->pdev = pdev;
mci->mod_ver = E7XXX_REVISION;
mci->dev = &pdev->dev;

debugf3("%s(): init pvt\n", __func__);
pvt = (struct e7xxx_pvt *) mci->pvt_info;
Expand Down Expand Up @@ -411,7 +413,7 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx)
int mem_dev = (dra >> (index * 4 + 3)) & 0x1;
struct csrow_info *csrow = &mci->csrows[index];

pci_read_config_byte(mci->pdev, E7XXX_DRB + index, &value);
pci_read_config_byte(pdev, E7XXX_DRB + index, &value);
/* convert a 64 or 32 MiB DRB to a page size. */
cumul_size = value << (25 + drc_drbg - PAGE_SHIFT);
debugf3("%s(): (%d) cumul_size 0x%x\n", __func__, index,
Expand Down Expand Up @@ -448,11 +450,11 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx)

debugf3("%s(): tolm, remapbase, remaplimit\n", __func__);
/* load the top of low memory, remap base, and remap limit vars */
pci_read_config_word(mci->pdev, E7XXX_TOLM, &pci_data);
pci_read_config_word(pdev, E7XXX_TOLM, &pci_data);
pvt->tolm = ((u32) pci_data) << 4;
pci_read_config_word(mci->pdev, E7XXX_REMAPBASE, &pci_data);
pci_read_config_word(pdev, E7XXX_REMAPBASE, &pci_data);
pvt->remapbase = ((u32) pci_data) << 14;
pci_read_config_word(mci->pdev, E7XXX_REMAPLIMIT, &pci_data);
pci_read_config_word(pdev, E7XXX_REMAPLIMIT, &pci_data);
pvt->remaplimit = ((u32) pci_data) << 14;
e7xxx_printk(KERN_INFO,
"tolm = %x, remapbase = %x, remaplimit = %x\n", pvt->tolm,
Expand Down Expand Up @@ -498,7 +500,7 @@ static void __devexit e7xxx_remove_one(struct pci_dev *pdev)

debugf0("%s()\n", __func__);

if ((mci = edac_mc_del_mc(pdev)) == NULL)
if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL)
return;

pvt = (struct e7xxx_pvt *) mci->pvt_info;
Expand Down
Loading

0 comments on commit 37f0458

Please sign in to comment.