hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/edac/i5100_edac.c
....@@ -259,11 +259,6 @@
259259 return a & ((1 << 16) - 1);
260260 }
261261
262
-static inline u32 i5100_redmemb_ecc_locator(u32 a)
263
-{
264
- return a & ((1 << 18) - 1);
265
-}
266
-
267262 static inline u32 i5100_recmema_merr(u32 a)
268263 {
269264 return i5100_nrecmema_merr(a);
....@@ -417,7 +412,8 @@
417412 }
418413
419414 /* convert csrow index into a rank (per channel -- 0..5) */
420
-static int i5100_csrow_to_rank(const struct mem_ctl_info *mci, int csrow)
415
+static unsigned int i5100_csrow_to_rank(const struct mem_ctl_info *mci,
416
+ unsigned int csrow)
421417 {
422418 const struct i5100_priv *priv = mci->pvt_info;
423419
....@@ -425,7 +421,8 @@
425421 }
426422
427423 /* convert csrow index into a channel (0..1) */
428
-static int i5100_csrow_to_chan(const struct mem_ctl_info *mci, int csrow)
424
+static unsigned int i5100_csrow_to_chan(const struct mem_ctl_info *mci,
425
+ unsigned int csrow)
429426 {
430427 const struct i5100_priv *priv = mci->pvt_info;
431428
....@@ -484,7 +481,6 @@
484481 u32 dw;
485482 u32 dw2;
486483 unsigned syndrome = 0;
487
- unsigned ecc_loc = 0;
488484 unsigned merr;
489485 unsigned bank;
490486 unsigned rank;
....@@ -497,7 +493,6 @@
497493 pci_read_config_dword(pdev, I5100_REDMEMA, &dw2);
498494 syndrome = dw2;
499495 pci_read_config_dword(pdev, I5100_REDMEMB, &dw2);
500
- ecc_loc = i5100_redmemb_ecc_locator(dw2);
501496 }
502497
503498 if (i5100_validlog_recmemvalid(dw)) {
....@@ -653,11 +648,11 @@
653648 return ret;
654649 }
655650
656
-static unsigned long i5100_npages(struct mem_ctl_info *mci, int csrow)
651
+static unsigned long i5100_npages(struct mem_ctl_info *mci, unsigned int csrow)
657652 {
658653 struct i5100_priv *priv = mci->pvt_info;
659
- const unsigned chan_rank = i5100_csrow_to_rank(mci, csrow);
660
- const unsigned chan = i5100_csrow_to_chan(mci, csrow);
654
+ const unsigned int chan_rank = i5100_csrow_to_rank(mci, csrow);
655
+ const unsigned int chan = i5100_csrow_to_chan(mci, csrow);
661656 unsigned addr_lines;
662657
663658 /* dimm present? */
....@@ -711,7 +706,6 @@
711706 {
712707 struct i5100_priv *priv = mci->pvt_info;
713708 u16 w;
714
- unsigned long et;
715709
716710 pci_read_config_word(priv->mc, I5100_SPDDATA, &w);
717711 if (i5100_spddata_busy(w))
....@@ -722,7 +716,6 @@
722716 0, 0));
723717
724718 /* wait up to 100ms */
725
- et = jiffies + HZ / 10;
726719 udelay(100);
727720 while (1) {
728721 pci_read_config_word(priv->mc, I5100_SPDDATA, &w);
....@@ -846,20 +839,16 @@
846839
847840 static void i5100_init_csrows(struct mem_ctl_info *mci)
848841 {
849
- int i;
850842 struct i5100_priv *priv = mci->pvt_info;
843
+ struct dimm_info *dimm;
851844
852
- for (i = 0; i < mci->tot_dimms; i++) {
853
- struct dimm_info *dimm;
854
- const unsigned long npages = i5100_npages(mci, i);
855
- const unsigned chan = i5100_csrow_to_chan(mci, i);
856
- const unsigned rank = i5100_csrow_to_rank(mci, i);
845
+ mci_for_each_dimm(mci, dimm) {
846
+ const unsigned long npages = i5100_npages(mci, dimm->idx);
847
+ const unsigned int chan = i5100_csrow_to_chan(mci, dimm->idx);
848
+ const unsigned int rank = i5100_csrow_to_rank(mci, dimm->idx);
857849
858850 if (!npages)
859851 continue;
860
-
861
- dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, mci->n_layers,
862
- chan, rank, 0);
863852
864853 dimm->nr_pages = npages;
865854 dimm->grain = 32;