aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalph Campbell <ralph.campbell@qlogic.com>2008-01-07 00:02:34 -0500
committerRoland Dreier <rolandd@cisco.com>2008-01-25 17:15:39 -0500
commita18e26ae442001de62f6b84a923e8613347dc35f (patch)
tree36109aca4360deb0ca0ea12e429d917e54819d5a
parent9e2ef36b5a83b3c8ec1153382559dff410cc4341 (diff)
IB/ipath: Allow more flexible user register alignments
User registers have different alignments on different chips (4KB on older, 64KB on 7220). Allow mapping the user registers on kernels with page sizes up to 64K. Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r--drivers/infiniband/hw/ipath/ipath_file_ops.c6
-rw-r--r--drivers/infiniband/hw/ipath/ipath_iba6110.c7
-rw-r--r--drivers/infiniband/hw/ipath/ipath_iba6120.c8
-rw-r--r--drivers/infiniband/hw/ipath/ipath_kernel.h6
4 files changed, 22 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c
index 9e5714d68ee1..0b877ed76712 100644
--- a/drivers/infiniband/hw/ipath/ipath_file_ops.c
+++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c
@@ -169,7 +169,7 @@ static int ipath_get_base_info(struct file *fp,
169 kinfo->spi_piocnt = dd->ipath_pbufsport; 169 kinfo->spi_piocnt = dd->ipath_pbufsport;
170 kinfo->spi_piobufbase = (u64) pd->port_piobufs; 170 kinfo->spi_piobufbase = (u64) pd->port_piobufs;
171 kinfo->__spi_uregbase = (u64) dd->ipath_uregbase + 171 kinfo->__spi_uregbase = (u64) dd->ipath_uregbase +
172 dd->ipath_palign * pd->port_port; 172 dd->ipath_ureg_align * pd->port_port;
173 } else if (master) { 173 } else if (master) {
174 kinfo->spi_piocnt = (dd->ipath_pbufsport / subport_cnt) + 174 kinfo->spi_piocnt = (dd->ipath_pbufsport / subport_cnt) +
175 (dd->ipath_pbufsport % subport_cnt); 175 (dd->ipath_pbufsport % subport_cnt);
@@ -186,7 +186,7 @@ static int ipath_get_base_info(struct file *fp,
186 } 186 }
187 if (shared) { 187 if (shared) {
188 kinfo->spi_port_uregbase = (u64) dd->ipath_uregbase + 188 kinfo->spi_port_uregbase = (u64) dd->ipath_uregbase +
189 dd->ipath_palign * pd->port_port; 189 dd->ipath_ureg_align * pd->port_port;
190 kinfo->spi_port_rcvegrbuf = kinfo->spi_rcv_egrbufs; 190 kinfo->spi_port_rcvegrbuf = kinfo->spi_rcv_egrbufs;
191 kinfo->spi_port_rcvhdr_base = kinfo->spi_rcvhdr_base; 191 kinfo->spi_port_rcvhdr_base = kinfo->spi_rcvhdr_base;
192 kinfo->spi_port_rcvhdr_tailaddr = kinfo->spi_rcvhdr_tailaddr; 192 kinfo->spi_port_rcvhdr_tailaddr = kinfo->spi_rcvhdr_tailaddr;
@@ -1271,7 +1271,7 @@ static int ipath_mmap(struct file *fp, struct vm_area_struct *vma)
1271 goto bail; 1271 goto bail;
1272 } 1272 }
1273 1273
1274 ureg = dd->ipath_uregbase + dd->ipath_palign * pd->port_port; 1274 ureg = dd->ipath_uregbase + dd->ipath_ureg_align * pd->port_port;
1275 if (!pd->port_subport_cnt) { 1275 if (!pd->port_subport_cnt) {
1276 /* port is not shared */ 1276 /* port is not shared */
1277 piocnt = dd->ipath_pbufsport; 1277 piocnt = dd->ipath_pbufsport;
diff --git a/drivers/infiniband/hw/ipath/ipath_iba6110.c b/drivers/infiniband/hw/ipath/ipath_iba6110.c
index dffb6826579a..5ecf65b8f85a 100644
--- a/drivers/infiniband/hw/ipath/ipath_iba6110.c
+++ b/drivers/infiniband/hw/ipath/ipath_iba6110.c
@@ -739,6 +739,13 @@ static int ipath_ht_boardname(struct ipath_devdata *dd, char *name,
739 dd->ipath_htspeed); 739 dd->ipath_htspeed);
740 ret = 0; 740 ret = 0;
741 741
742 /*
743 * set here, not in ipath_init_*_funcs because we have to do
744 * it after we can read chip registers.
745 */
746 dd->ipath_ureg_align =
747 ipath_read_kreg32(dd, dd->ipath_kregs->kr_pagealign);
748
742bail: 749bail:
743 return ret; 750 return ret;
744} 751}
diff --git a/drivers/infiniband/hw/ipath/ipath_iba6120.c b/drivers/infiniband/hw/ipath/ipath_iba6120.c
index 66925b255ccd..23de8da0f16b 100644
--- a/drivers/infiniband/hw/ipath/ipath_iba6120.c
+++ b/drivers/infiniband/hw/ipath/ipath_iba6120.c
@@ -613,6 +613,14 @@ static int ipath_pe_boardname(struct ipath_devdata *dd, char *name,
613 dd->ipath_f_put_tid = ipath_pe_put_tid_2; 613 dd->ipath_f_put_tid = ipath_pe_put_tid_2;
614 } 614 }
615 615
616
617 /*
618 * set here, not in ipath_init_*_funcs because we have to do
619 * it after we can read chip registers.
620 */
621 dd->ipath_ureg_align =
622 ipath_read_kreg32(dd, dd->ipath_kregs->kr_pagealign);
623
616 return ret; 624 return ret;
617} 625}
618 626
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
index 4f7bc08796bc..08272bef2475 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -395,6 +395,8 @@ struct ipath_devdata {
395 void *ipath_dummy_hdrq; /* used after port close */ 395 void *ipath_dummy_hdrq; /* used after port close */
396 dma_addr_t ipath_dummy_hdrq_phys; 396 dma_addr_t ipath_dummy_hdrq_phys;
397 397
398 unsigned long ipath_ureg_align; /* user register alignment */
399
398 /* 400 /*
399 * Shadow copies of registers; size indicates read access size. 401 * Shadow copies of registers; size indicates read access size.
400 * Most of them are readonly, but some are write-only register, 402 * Most of them are readonly, but some are write-only register,
@@ -865,7 +867,7 @@ static inline u32 ipath_read_ureg32(const struct ipath_devdata *dd,
865 return readl(regno + (u64 __iomem *) 867 return readl(regno + (u64 __iomem *)
866 (dd->ipath_uregbase + 868 (dd->ipath_uregbase +
867 (char __iomem *)dd->ipath_kregbase + 869 (char __iomem *)dd->ipath_kregbase +
868 dd->ipath_palign * port)); 870 dd->ipath_ureg_align * port));
869} 871}
870 872
871/** 873/**
@@ -882,7 +884,7 @@ static inline void ipath_write_ureg(const struct ipath_devdata *dd,
882{ 884{
883 u64 __iomem *ubase = (u64 __iomem *) 885 u64 __iomem *ubase = (u64 __iomem *)
884 (dd->ipath_uregbase + (char __iomem *) dd->ipath_kregbase + 886 (dd->ipath_uregbase + (char __iomem *) dd->ipath_kregbase +
885 dd->ipath_palign * port); 887 dd->ipath_ureg_align * port);
886 if (dd->ipath_kregbase) 888 if (dd->ipath_kregbase)
887 writeq(value, &ubase[regno]); 889 writeq(value, &ubase[regno]);
888} 890}