On Wed, Sep 16, 2015 at 03:53:30PM -0500, Aravind Gopalakrishnan wrote:
-static int __set_scrub_rate(struct pci_dev *ctl, u32 new_bw, u32 min_rate)What is all that churn good for?
+static u32 find_scrub_rate(u32 new_bw, u32 min_rate, u32 *scrub_bw)
{
u32 scrubval;
int i;
@@ -200,28 +200,52 @@ static int __set_scrub_rate(struct pci_dev *ctl, u32 new_bw, u32 min_rate)
}
scrubval = scrubrates[i].scrubval;
+ *scrub_bw = scrubval ? scrubrates[i].bandwidth : 0;
- pci_write_bits32(ctl, SCRCTRL, scrubval, 0x001F);
+ return scrubval;
+}
- if (scrubval)
- return scrubrates[i].bandwidth;
+static inline void __set_scrub_rate(struct pci_dev *ctl, int offset,
+ u32 scrubval)
+{
+ pci_write_bits32(ctl, offset, scrubval, SCRMASK);
- return 0;
}
What's wrong with simply adding the model 0x60 check to
__set_scrub_rate() and doing the proper write there?
- amd64_read_pci_cfg(pvt->F3, SCRCTRL, &scrubval);If it is enough, why do you select DCT 0? Just read the currently
+ if (pvt->fam == 0x15 && pvt->model == 0x60) {
+ /* Since we mirror the same scrubrate value across
+ * both DCTs, it is enough to read the value off one of
+ * the DCT registers.
+ */
+ f15h_select_dct(pvt, 0);
selected one, whichever it is...
static int f16_dbam_to_chip_select(struct amd64_pvt *pvt, u8 dct,Why is that hunk here?
- unsigned cs_mode, int cs_mask_nr)
+ unsigned cs_mode, int cs_mask_nr)
{
WARN_ON(cs_mode > 12);
@@ -1666,7 +1699,7 @@ static int f1x_match_to_this_node(struct amd64_pvt *pvt, unsigned range,That one too?
}
static int f15_m30h_match_to_this_node(struct amd64_pvt *pvt, unsigned range,
- u64 sys_addr, int *chan_sel)
+ u64 sys_addr, int *chan_sel)
{
int cs_found = -EINVAL;
int num_dcts_intlv = 0;