diff options
author | Dave Olson <dave.olson@qlogic.com> | 2007-06-18 17:24:40 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-07-09 23:12:26 -0400 |
commit | 561095f20eeb5c6c05c303bad8cdb3f8a80821bc (patch) | |
tree | 57a8c7e69151ae5c94d73cb1ecfcef1441270792 /drivers/infiniband/hw/ipath | |
parent | f716cdfe57f217966f41a7add190d6f5b9fd0769 (diff) |
IB/ipath: Fix the mtrr_add args for chips with 2 buffer sizes
The values passed have never been right for iba 6120 chips, but just
happened to work. We needed to select the right buffer offset in the
chip (both are in same register), and the total length was wrong also,
but was covered by the rounding up.
Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ipath')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_wc_x86_64.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_wc_x86_64.c b/drivers/infiniband/hw/ipath/ipath_wc_x86_64.c index 04696e62da87..9f409fd928fb 100644 --- a/drivers/infiniband/hw/ipath/ipath_wc_x86_64.c +++ b/drivers/infiniband/hw/ipath/ipath_wc_x86_64.c | |||
@@ -63,12 +63,29 @@ int ipath_enable_wc(struct ipath_devdata *dd) | |||
63 | * of 2 address matching the length (which has to be a power of 2). | 63 | * of 2 address matching the length (which has to be a power of 2). |
64 | * For rev1, that means the base address, for rev2, it will be just | 64 | * For rev1, that means the base address, for rev2, it will be just |
65 | * the PIO buffers themselves. | 65 | * the PIO buffers themselves. |
66 | * For chips with two sets of buffers, the calculations are | ||
67 | * somewhat more complicated; we need to sum, and the piobufbase | ||
68 | * register has both offsets, 2K in low 32 bits, 4K in high 32 bits. | ||
69 | * The buffers are still packed, so a single range covers both. | ||
66 | */ | 70 | */ |
67 | pioaddr = addr + dd->ipath_piobufbase; | 71 | if (dd->ipath_piobcnt2k && dd->ipath_piobcnt4k) { /* 2 sizes */ |
68 | piolen = (dd->ipath_piobcnt2k + | 72 | unsigned long pio2kbase, pio4kbase; |
69 | dd->ipath_piobcnt4k) * | 73 | pio2kbase = dd->ipath_piobufbase & 0xffffffffUL; |
70 | ALIGN(dd->ipath_piobcnt2k + | 74 | pio4kbase = (dd->ipath_piobufbase >> 32) & 0xffffffffUL; |
71 | dd->ipath_piobcnt4k, dd->ipath_palign); | 75 | if (pio2kbase < pio4kbase) { /* all, for now */ |
76 | pioaddr = addr + pio2kbase; | ||
77 | piolen = pio4kbase - pio2kbase + | ||
78 | dd->ipath_piobcnt4k * dd->ipath_4kalign; | ||
79 | } else { | ||
80 | pioaddr = addr + pio4kbase; | ||
81 | piolen = pio2kbase - pio4kbase + | ||
82 | dd->ipath_piobcnt2k * dd->ipath_palign; | ||
83 | } | ||
84 | } else { /* single buffer size (2K, currently) */ | ||
85 | pioaddr = addr + dd->ipath_piobufbase; | ||
86 | piolen = dd->ipath_piobcnt2k * dd->ipath_palign + | ||
87 | dd->ipath_piobcnt4k * dd->ipath_4kalign; | ||
88 | } | ||
72 | 89 | ||
73 | for (bits = 0; !(piolen & (1ULL << bits)); bits++) | 90 | for (bits = 0; !(piolen & (1ULL << bits)); bits++) |
74 | /* do nothing */ ; | 91 | /* do nothing */ ; |