aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mthca/mthca_eq.c
diff options
context:
space:
mode:
authorRoland Dreier <roland@topspin.com>2005-04-16 18:26:32 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:26:32 -0400
commitd10ddbf6d7f6699c386d1f41bf542189de32b6be (patch)
treeb2e3ab95925407472fa9c62bb6016d85f822cb68 /drivers/infiniband/hw/mthca/mthca_eq.c
parent6bd6228eed52ef188ebe46865ccff72da936c968 (diff)
[PATCH] IB/mthca: encapsulate mem-free check into mthca_is_memfree()
Clean up mem-free mode support by introducing mthca_is_memfree() function, which encapsulates the logic of deciding if a device is mem-free. Signed-off-by: Roland Dreier <roland@topspin.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_eq.c')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_eq.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_eq.c b/drivers/infiniband/hw/mthca/mthca_eq.c
index b6f2a46fc84b..f46d615d396f 100644
--- a/drivers/infiniband/hw/mthca/mthca_eq.c
+++ b/drivers/infiniband/hw/mthca/mthca_eq.c
@@ -198,7 +198,7 @@ static inline void arbel_set_eq_ci(struct mthca_dev *dev, struct mthca_eq *eq, u
198 198
199static inline void set_eq_ci(struct mthca_dev *dev, struct mthca_eq *eq, u32 ci) 199static inline void set_eq_ci(struct mthca_dev *dev, struct mthca_eq *eq, u32 ci)
200{ 200{
201 if (dev->hca_type == ARBEL_NATIVE) 201 if (mthca_is_memfree(dev))
202 arbel_set_eq_ci(dev, eq, ci); 202 arbel_set_eq_ci(dev, eq, ci);
203 else 203 else
204 tavor_set_eq_ci(dev, eq, ci); 204 tavor_set_eq_ci(dev, eq, ci);
@@ -223,7 +223,7 @@ static inline void arbel_eq_req_not(struct mthca_dev *dev, u32 eqn_mask)
223 223
224static inline void disarm_cq(struct mthca_dev *dev, int eqn, int cqn) 224static inline void disarm_cq(struct mthca_dev *dev, int eqn, int cqn)
225{ 225{
226 if (dev->hca_type != ARBEL_NATIVE) { 226 if (!mthca_is_memfree(dev)) {
227 u32 doorbell[2]; 227 u32 doorbell[2];
228 228
229 doorbell[0] = cpu_to_be32(MTHCA_EQ_DB_DISARM_CQ | eqn); 229 doorbell[0] = cpu_to_be32(MTHCA_EQ_DB_DISARM_CQ | eqn);
@@ -535,11 +535,11 @@ static int __devinit mthca_create_eq(struct mthca_dev *dev,
535 MTHCA_EQ_OWNER_HW | 535 MTHCA_EQ_OWNER_HW |
536 MTHCA_EQ_STATE_ARMED | 536 MTHCA_EQ_STATE_ARMED |
537 MTHCA_EQ_FLAG_TR); 537 MTHCA_EQ_FLAG_TR);
538 if (dev->hca_type == ARBEL_NATIVE) 538 if (mthca_is_memfree(dev))
539 eq_context->flags |= cpu_to_be32(MTHCA_EQ_STATE_ARBEL); 539 eq_context->flags |= cpu_to_be32(MTHCA_EQ_STATE_ARBEL);
540 540
541 eq_context->logsize_usrpage = cpu_to_be32((ffs(nent) - 1) << 24); 541 eq_context->logsize_usrpage = cpu_to_be32((ffs(nent) - 1) << 24);
542 if (dev->hca_type == ARBEL_NATIVE) { 542 if (mthca_is_memfree(dev)) {
543 eq_context->arbel_pd = cpu_to_be32(dev->driver_pd.pd_num); 543 eq_context->arbel_pd = cpu_to_be32(dev->driver_pd.pd_num);
544 } else { 544 } else {
545 eq_context->logsize_usrpage |= cpu_to_be32(dev->driver_uar.index); 545 eq_context->logsize_usrpage |= cpu_to_be32(dev->driver_uar.index);
@@ -686,7 +686,7 @@ static int __devinit mthca_map_eq_regs(struct mthca_dev *dev)
686 686
687 mthca_base = pci_resource_start(dev->pdev, 0); 687 mthca_base = pci_resource_start(dev->pdev, 0);
688 688
689 if (dev->hca_type == ARBEL_NATIVE) { 689 if (mthca_is_memfree(dev)) {
690 /* 690 /*
691 * We assume that the EQ arm and EQ set CI registers 691 * We assume that the EQ arm and EQ set CI registers
692 * fall within the first BAR. We can't trust the 692 * fall within the first BAR. We can't trust the
@@ -756,7 +756,7 @@ static int __devinit mthca_map_eq_regs(struct mthca_dev *dev)
756 756
757static void __devexit mthca_unmap_eq_regs(struct mthca_dev *dev) 757static void __devexit mthca_unmap_eq_regs(struct mthca_dev *dev)
758{ 758{
759 if (dev->hca_type == ARBEL_NATIVE) { 759 if (mthca_is_memfree(dev)) {
760 mthca_unmap_reg(dev, (pci_resource_len(dev->pdev, 0) - 1) & 760 mthca_unmap_reg(dev, (pci_resource_len(dev->pdev, 0) - 1) &
761 dev->fw.arbel.eq_set_ci_base, 761 dev->fw.arbel.eq_set_ci_base,
762 MTHCA_EQ_SET_CI_SIZE, 762 MTHCA_EQ_SET_CI_SIZE,
@@ -880,7 +880,7 @@ int __devinit mthca_init_eq_table(struct mthca_dev *dev)
880 880
881 for (i = 0; i < MTHCA_NUM_EQ; ++i) { 881 for (i = 0; i < MTHCA_NUM_EQ; ++i) {
882 err = request_irq(dev->eq_table.eq[i].msi_x_vector, 882 err = request_irq(dev->eq_table.eq[i].msi_x_vector,
883 dev->hca_type == ARBEL_NATIVE ? 883 mthca_is_memfree(dev) ?
884 mthca_arbel_msi_x_interrupt : 884 mthca_arbel_msi_x_interrupt :
885 mthca_tavor_msi_x_interrupt, 885 mthca_tavor_msi_x_interrupt,
886 0, eq_name[i], dev->eq_table.eq + i); 886 0, eq_name[i], dev->eq_table.eq + i);
@@ -890,7 +890,7 @@ int __devinit mthca_init_eq_table(struct mthca_dev *dev)
890 } 890 }
891 } else { 891 } else {
892 err = request_irq(dev->pdev->irq, 892 err = request_irq(dev->pdev->irq,
893 dev->hca_type == ARBEL_NATIVE ? 893 mthca_is_memfree(dev) ?
894 mthca_arbel_interrupt : 894 mthca_arbel_interrupt :
895 mthca_tavor_interrupt, 895 mthca_tavor_interrupt,
896 SA_SHIRQ, DRV_NAME, dev); 896 SA_SHIRQ, DRV_NAME, dev);
@@ -918,7 +918,7 @@ int __devinit mthca_init_eq_table(struct mthca_dev *dev)
918 dev->eq_table.eq[MTHCA_EQ_CMD].eqn, status); 918 dev->eq_table.eq[MTHCA_EQ_CMD].eqn, status);
919 919
920 for (i = 0; i < MTHCA_EQ_CMD; ++i) 920 for (i = 0; i < MTHCA_EQ_CMD; ++i)
921 if (dev->hca_type == ARBEL_NATIVE) 921 if (mthca_is_memfree(dev))
922 arbel_eq_req_not(dev, dev->eq_table.eq[i].eqn_mask); 922 arbel_eq_req_not(dev, dev->eq_table.eq[i].eqn_mask);
923 else 923 else
924 tavor_eq_req_not(dev, dev->eq_table.eq[i].eqn); 924 tavor_eq_req_not(dev, dev->eq_table.eq[i].eqn);