diff options
Diffstat (limited to 'drivers/infiniband/hw/qib/qib_diag.c')
-rw-r--r-- | drivers/infiniband/hw/qib/qib_diag.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/qib/qib_diag.c b/drivers/infiniband/hw/qib/qib_diag.c index ca98dd523752..05dcf0d9a7d3 100644 --- a/drivers/infiniband/hw/qib/qib_diag.c +++ b/drivers/infiniband/hw/qib/qib_diag.c | |||
@@ -233,6 +233,7 @@ static u32 __iomem *qib_remap_ioaddr32(struct qib_devdata *dd, u32 offset, | |||
233 | u32 __iomem *krb32 = (u32 __iomem *)dd->kregbase; | 233 | u32 __iomem *krb32 = (u32 __iomem *)dd->kregbase; |
234 | u32 __iomem *map = NULL; | 234 | u32 __iomem *map = NULL; |
235 | u32 cnt = 0; | 235 | u32 cnt = 0; |
236 | u32 tot4k, offs4k; | ||
236 | 237 | ||
237 | /* First, simplest case, offset is within the first map. */ | 238 | /* First, simplest case, offset is within the first map. */ |
238 | kreglen = (dd->kregend - dd->kregbase) * sizeof(u64); | 239 | kreglen = (dd->kregend - dd->kregbase) * sizeof(u64); |
@@ -250,7 +251,8 @@ static u32 __iomem *qib_remap_ioaddr32(struct qib_devdata *dd, u32 offset, | |||
250 | if (dd->userbase) { | 251 | if (dd->userbase) { |
251 | /* If user regs mapped, they are after send, so set limit. */ | 252 | /* If user regs mapped, they are after send, so set limit. */ |
252 | u32 ulim = (dd->cfgctxts * dd->ureg_align) + dd->uregbase; | 253 | u32 ulim = (dd->cfgctxts * dd->ureg_align) + dd->uregbase; |
253 | snd_lim = dd->uregbase; | 254 | if (!dd->piovl15base) |
255 | snd_lim = dd->uregbase; | ||
254 | krb32 = (u32 __iomem *)dd->userbase; | 256 | krb32 = (u32 __iomem *)dd->userbase; |
255 | if (offset >= dd->uregbase && offset < ulim) { | 257 | if (offset >= dd->uregbase && offset < ulim) { |
256 | map = krb32 + (offset - dd->uregbase) / sizeof(u32); | 258 | map = krb32 + (offset - dd->uregbase) / sizeof(u32); |
@@ -277,14 +279,14 @@ static u32 __iomem *qib_remap_ioaddr32(struct qib_devdata *dd, u32 offset, | |||
277 | /* If 4k buffers exist, account for them by bumping | 279 | /* If 4k buffers exist, account for them by bumping |
278 | * appropriate limit. | 280 | * appropriate limit. |
279 | */ | 281 | */ |
282 | tot4k = dd->piobcnt4k * dd->align4k; | ||
283 | offs4k = dd->piobufbase >> 32; | ||
280 | if (dd->piobcnt4k) { | 284 | if (dd->piobcnt4k) { |
281 | u32 tot4k = dd->piobcnt4k * dd->align4k; | ||
282 | u32 offs4k = dd->piobufbase >> 32; | ||
283 | if (snd_bottom > offs4k) | 285 | if (snd_bottom > offs4k) |
284 | snd_bottom = offs4k; | 286 | snd_bottom = offs4k; |
285 | else { | 287 | else { |
286 | /* 4k above 2k. Bump snd_lim, if needed*/ | 288 | /* 4k above 2k. Bump snd_lim, if needed*/ |
287 | if (!dd->userbase) | 289 | if (!dd->userbase || dd->piovl15base) |
288 | snd_lim = offs4k + tot4k; | 290 | snd_lim = offs4k + tot4k; |
289 | } | 291 | } |
290 | } | 292 | } |
@@ -298,6 +300,15 @@ static u32 __iomem *qib_remap_ioaddr32(struct qib_devdata *dd, u32 offset, | |||
298 | cnt = snd_lim - offset; | 300 | cnt = snd_lim - offset; |
299 | } | 301 | } |
300 | 302 | ||
303 | if (!map && offs4k && dd->piovl15base) { | ||
304 | snd_lim = offs4k + tot4k + 2 * dd->align4k; | ||
305 | if (offset >= (offs4k + tot4k) && offset < snd_lim) { | ||
306 | map = (u32 __iomem *)dd->piovl15base + | ||
307 | ((offset - (offs4k + tot4k)) / sizeof(u32)); | ||
308 | cnt = snd_lim - offset; | ||
309 | } | ||
310 | } | ||
311 | |||
301 | mapped: | 312 | mapped: |
302 | if (cntp) | 313 | if (cntp) |
303 | *cntp = cnt; | 314 | *cntp = cnt; |