aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Thompson <norsk5@xmission.com>2006-06-30 04:56:08 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-30 14:25:39 -0400
commit2d7bbb91c8df26c60d223205a087507430024177 (patch)
tree98d51dac1c1e53b2b6a887c31abc2260160eb50d
parent37f04581abac20444e5b7106c1e1f28bec5b989c (diff)
[PATCH] EDAC: mc numbers refactor 1-of-2
Remove add_mc_to_global_list(). In next patch, this function will be reimplemented with different semantics. 1 Reimplement add_mc_to_global_list() with semantics that allow the caller to determine the ID number for a mem_ctl_info structure. Then modify edac_mc_add_mc() so that the caller specifies the ID number for the new mem_ctl_info structure. Platform-specific code should be able to assign the ID numbers in a platform-specific manner. For instance, on Opteron it makes sense to have the ID of the mem_ctl_info structure match the ID of the node that the memory controller belongs to. 2 Modify callers of edac_mc_add_mc() so they use the new semantics. 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>
-rw-r--r--drivers/edac/amd76x_edac.c5
-rw-r--r--drivers/edac/e752x_edac.c5
-rw-r--r--drivers/edac/e7xxx_edac.c5
-rw-r--r--drivers/edac/edac_mc.c59
-rw-r--r--drivers/edac/edac_mc.h2
-rw-r--r--drivers/edac/i82860_edac.c5
-rw-r--r--drivers/edac/i82875p_edac.c5
-rw-r--r--drivers/edac/r82600_edac.c5
8 files changed, 55 insertions, 36 deletions
diff --git a/drivers/edac/amd76x_edac.c b/drivers/edac/amd76x_edac.c
index 7fd6283fe008..303cb500b377 100644
--- a/drivers/edac/amd76x_edac.c
+++ b/drivers/edac/amd76x_edac.c
@@ -257,7 +257,10 @@ static int amd76x_probe1(struct pci_dev *pdev, int dev_idx)
257 257
258 amd76x_get_error_info(mci, &discard); /* clear counters */ 258 amd76x_get_error_info(mci, &discard); /* clear counters */
259 259
260 if (edac_mc_add_mc(mci)) { 260 /* Here we assume that we will never see multiple instances of this
261 * type of memory controller. The ID is therefore hardcoded to 0.
262 */
263 if (edac_mc_add_mc(mci,0)) {
261 debugf3("%s(): failed edac_mc_add_mc()\n", __func__); 264 debugf3("%s(): failed edac_mc_add_mc()\n", __func__);
262 goto fail; 265 goto fail;
263 } 266 }
diff --git a/drivers/edac/e752x_edac.c b/drivers/edac/e752x_edac.c
index de9f332eabf0..5e773e382e8a 100644
--- a/drivers/edac/e752x_edac.c
+++ b/drivers/edac/e752x_edac.c
@@ -953,7 +953,10 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
953 "tolm = %x, remapbase = %x, remaplimit = %x\n", pvt->tolm, 953 "tolm = %x, remapbase = %x, remaplimit = %x\n", pvt->tolm,
954 pvt->remapbase, pvt->remaplimit); 954 pvt->remapbase, pvt->remaplimit);
955 955
956 if (edac_mc_add_mc(mci)) { 956 /* Here we assume that we will never see multiple instances of this
957 * type of memory controller. The ID is therefore hardcoded to 0.
958 */
959 if (edac_mc_add_mc(mci,0)) {
957 debugf3("%s(): failed edac_mc_add_mc()\n", __func__); 960 debugf3("%s(): failed edac_mc_add_mc()\n", __func__);
958 goto fail; 961 goto fail;
959 } 962 }
diff --git a/drivers/edac/e7xxx_edac.c b/drivers/edac/e7xxx_edac.c
index d601d53b9920..1e282c843e77 100644
--- a/drivers/edac/e7xxx_edac.c
+++ b/drivers/edac/e7xxx_edac.c
@@ -463,7 +463,10 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx)
463 /* clear any pending errors, or initial state bits */ 463 /* clear any pending errors, or initial state bits */
464 e7xxx_get_error_info(mci, &discard); 464 e7xxx_get_error_info(mci, &discard);
465 465
466 if (edac_mc_add_mc(mci) != 0) { 466 /* Here we assume that we will never see multiple instances of this
467 * type of memory controller. The ID is therefore hardcoded to 0.
468 */
469 if (edac_mc_add_mc(mci,0)) {
467 debugf3("%s(): failed edac_mc_add_mc()\n", __func__); 470 debugf3("%s(): failed edac_mc_add_mc()\n", __func__);
468 goto fail; 471 goto fail;
469 } 472 }
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 603de8b49f27..357c95f30fc6 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -1632,47 +1632,46 @@ static struct mem_ctl_info *find_mci_by_dev(struct device *dev)
1632 return NULL; 1632 return NULL;
1633} 1633}
1634 1634
1635static int add_mc_to_global_list(struct mem_ctl_info *mci) 1635/* Return 0 on success, 1 on failure.
1636 * Before calling this function, caller must
1637 * assign a unique value to mci->mc_idx.
1638 */
1639static int add_mc_to_global_list (struct mem_ctl_info *mci)
1636{ 1640{
1637 struct list_head *item, *insert_before; 1641 struct list_head *item, *insert_before;
1638 struct mem_ctl_info *p; 1642 struct mem_ctl_info *p;
1639 int i;
1640 1643
1641 if (list_empty(&mc_devices)) { 1644 insert_before = &mc_devices;
1642 mci->mc_idx = 0;
1643 insert_before = &mc_devices;
1644 } else {
1645 if (find_mci_by_dev(mci->dev)) {
1646 edac_printk(KERN_WARNING, EDAC_MC,
1647 "%s (%s) %s %s already assigned %d\n",
1648 mci->dev->bus_id, dev_name(mci->dev),
1649 mci->mod_name, mci->ctl_name,
1650 mci->mc_idx);
1651 return 1;
1652 }
1653 1645
1654 insert_before = NULL; 1646 if (unlikely((p = find_mci_by_dev(mci->dev)) != NULL))
1655 i = 0; 1647 goto fail0;
1656 1648
1657 list_for_each(item, &mc_devices) { 1649 list_for_each(item, &mc_devices) {
1658 p = list_entry(item, struct mem_ctl_info, link); 1650 p = list_entry(item, struct mem_ctl_info, link);
1659 1651
1660 if (p->mc_idx != i) { 1652 if (p->mc_idx >= mci->mc_idx) {
1661 insert_before = item; 1653 if (unlikely(p->mc_idx == mci->mc_idx))
1662 break; 1654 goto fail1;
1663 }
1664 1655
1665 i++; 1656 insert_before = item;
1657 break;
1666 } 1658 }
1667
1668 mci->mc_idx = i;
1669
1670 if (insert_before == NULL)
1671 insert_before = &mc_devices;
1672 } 1659 }
1673 1660
1674 list_add_tail_rcu(&mci->link, insert_before); 1661 list_add_tail_rcu(&mci->link, insert_before);
1675 return 0; 1662 return 0;
1663
1664fail0:
1665 edac_printk(KERN_WARNING, EDAC_MC,
1666 "%s (%s) %s %s already assigned %d\n", p->dev->bus_id,
1667 dev_name(p->dev), p->mod_name, p->ctl_name, p->mc_idx);
1668 return 1;
1669
1670fail1:
1671 edac_printk(KERN_WARNING, EDAC_MC,
1672 "bug in low-level driver: attempt to assign\n"
1673 " duplicate mc_idx %d in %s()\n", p->mc_idx, __func__);
1674 return 1;
1676} 1675}
1677 1676
1678static void complete_mc_list_del(struct rcu_head *head) 1677static void complete_mc_list_del(struct rcu_head *head)
@@ -1696,6 +1695,7 @@ static void del_mc_from_global_list(struct mem_ctl_info *mci)
1696 * edac_mc_add_mc: Insert the 'mci' structure into the mci global list and 1695 * edac_mc_add_mc: Insert the 'mci' structure into the mci global list and
1697 * create sysfs entries associated with mci structure 1696 * create sysfs entries associated with mci structure
1698 * @mci: pointer to the mci structure to be added to the list 1697 * @mci: pointer to the mci structure to be added to the list
1698 * @mc_idx: A unique numeric identifier to be assigned to the 'mci' structure.
1699 * 1699 *
1700 * Return: 1700 * Return:
1701 * 0 Success 1701 * 0 Success
@@ -1703,9 +1703,10 @@ static void del_mc_from_global_list(struct mem_ctl_info *mci)
1703 */ 1703 */
1704 1704
1705/* FIXME - should a warning be printed if no error detection? correction? */ 1705/* FIXME - should a warning be printed if no error detection? correction? */
1706int edac_mc_add_mc(struct mem_ctl_info *mci) 1706int edac_mc_add_mc(struct mem_ctl_info *mci, int mc_idx)
1707{ 1707{
1708 debugf0("%s()\n", __func__); 1708 debugf0("%s()\n", __func__);
1709 mci->mc_idx = mc_idx;
1709#ifdef CONFIG_EDAC_DEBUG 1710#ifdef CONFIG_EDAC_DEBUG
1710 if (edac_debug_level >= 3) 1711 if (edac_debug_level >= 3)
1711 edac_mc_dump_mci(mci); 1712 edac_mc_dump_mci(mci);
diff --git a/drivers/edac/edac_mc.h b/drivers/edac/edac_mc.h
index a2c3a4607a89..342979677d2f 100644
--- a/drivers/edac/edac_mc.h
+++ b/drivers/edac/edac_mc.h
@@ -417,7 +417,7 @@ void edac_mc_dump_mci(struct mem_ctl_info *mci);
417void edac_mc_dump_csrow(struct csrow_info *csrow); 417void edac_mc_dump_csrow(struct csrow_info *csrow);
418#endif /* CONFIG_EDAC_DEBUG */ 418#endif /* CONFIG_EDAC_DEBUG */
419 419
420extern int edac_mc_add_mc(struct mem_ctl_info *mci); 420extern int edac_mc_add_mc(struct mem_ctl_info *mci,int mc_idx);
421extern struct mem_ctl_info * edac_mc_del_mc(struct device *dev); 421extern struct mem_ctl_info * edac_mc_del_mc(struct device *dev);
422extern int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci, 422extern int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci,
423 unsigned long page); 423 unsigned long page);
diff --git a/drivers/edac/i82860_edac.c b/drivers/edac/i82860_edac.c
index baa021b96d18..e2c3b8bc097b 100644
--- a/drivers/edac/i82860_edac.c
+++ b/drivers/edac/i82860_edac.c
@@ -208,7 +208,10 @@ static int i82860_probe1(struct pci_dev *pdev, int dev_idx)
208 208
209 i82860_get_error_info(mci, &discard); /* clear counters */ 209 i82860_get_error_info(mci, &discard); /* clear counters */
210 210
211 if (edac_mc_add_mc(mci)) { 211 /* Here we assume that we will never see multiple instances of this
212 * type of memory controller. The ID is therefore hardcoded to 0.
213 */
214 if (edac_mc_add_mc(mci,0)) {
212 debugf3("%s(): failed edac_mc_add_mc()\n", __func__); 215 debugf3("%s(): failed edac_mc_add_mc()\n", __func__);
213 edac_mc_free(mci); 216 edac_mc_free(mci);
214 } else { 217 } else {
diff --git a/drivers/edac/i82875p_edac.c b/drivers/edac/i82875p_edac.c
index 3f509a7ea02a..2be18ca96408 100644
--- a/drivers/edac/i82875p_edac.c
+++ b/drivers/edac/i82875p_edac.c
@@ -390,7 +390,10 @@ static int i82875p_probe1(struct pci_dev *pdev, int dev_idx)
390 390
391 i82875p_get_error_info(mci, &discard); /* clear counters */ 391 i82875p_get_error_info(mci, &discard); /* clear counters */
392 392
393 if (edac_mc_add_mc(mci)) { 393 /* Here we assume that we will never see multiple instances of this
394 * type of memory controller. The ID is therefore hardcoded to 0.
395 */
396 if (edac_mc_add_mc(mci,0)) {
394 debugf3("%s(): failed edac_mc_add_mc()\n", __func__); 397 debugf3("%s(): failed edac_mc_add_mc()\n", __func__);
395 goto fail3; 398 goto fail3;
396 } 399 }
diff --git a/drivers/edac/r82600_edac.c b/drivers/edac/r82600_edac.c
index d04769aade5d..eb3aa615dc57 100644
--- a/drivers/edac/r82600_edac.c
+++ b/drivers/edac/r82600_edac.c
@@ -304,7 +304,10 @@ static int r82600_probe1(struct pci_dev *pdev, int dev_idx)
304 304
305 r82600_get_error_info(mci, &discard); /* clear counters */ 305 r82600_get_error_info(mci, &discard); /* clear counters */
306 306
307 if (edac_mc_add_mc(mci)) { 307 /* Here we assume that we will never see multiple instances of this
308 * type of memory controller. The ID is therefore hardcoded to 0.
309 */
310 if (edac_mc_add_mc(mci,0)) {
308 debugf3("%s(): failed edac_mc_add_mc()\n", __func__); 311 debugf3("%s(): failed edac_mc_add_mc()\n", __func__);
309 goto fail; 312 goto fail;
310 } 313 }