diff options
author | Jon Mason <jon.mason@intel.com> | 2013-07-15 18:53:54 -0400 |
---|---|---|
committer | Jon Mason <jon.mason@intel.com> | 2013-09-05 14:07:58 -0400 |
commit | 497938890a0121d040683aa1db42cad8daf7ae97 (patch) | |
tree | 50abe4b7cd4de14bab11f3a0801490df404367e4 /drivers/ntb | |
parent | 282a2feeb9bfb1d1dfbad93df206b74eaf80d564 (diff) |
NTB: Rename Variables for NTB-RP
Many variable names in the NTB driver refer to the primary or secondary
side. However, these variables will be used to access the reverse case
when in NTB-RP mode. Make these names more generic in anticipation of
NTB-RP support.
Signed-off-by: Jon Mason <jon.mason@intel.com>
Diffstat (limited to 'drivers/ntb')
-rw-r--r-- | drivers/ntb/ntb_hw.c | 83 | ||||
-rw-r--r-- | drivers/ntb/ntb_hw.h | 12 | ||||
-rw-r--r-- | drivers/ntb/ntb_transport.c | 2 |
3 files changed, 48 insertions, 49 deletions
diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw.c index 0345817a8355..97b18eec3d39 100644 --- a/drivers/ntb/ntb_hw.c +++ b/drivers/ntb/ntb_hw.c | |||
@@ -167,9 +167,9 @@ int ntb_register_db_callback(struct ntb_device *ndev, unsigned int idx, | |||
167 | ndev->db_cb[idx].data = data; | 167 | ndev->db_cb[idx].data = data; |
168 | 168 | ||
169 | /* unmask interrupt */ | 169 | /* unmask interrupt */ |
170 | mask = readw(ndev->reg_ofs.pdb_mask); | 170 | mask = readw(ndev->reg_ofs.ldb_mask); |
171 | clear_bit(idx * ndev->bits_per_vector, &mask); | 171 | clear_bit(idx * ndev->bits_per_vector, &mask); |
172 | writew(mask, ndev->reg_ofs.pdb_mask); | 172 | writew(mask, ndev->reg_ofs.ldb_mask); |
173 | 173 | ||
174 | return 0; | 174 | return 0; |
175 | } | 175 | } |
@@ -189,9 +189,9 @@ void ntb_unregister_db_callback(struct ntb_device *ndev, unsigned int idx) | |||
189 | if (idx >= ndev->max_cbs || !ndev->db_cb[idx].callback) | 189 | if (idx >= ndev->max_cbs || !ndev->db_cb[idx].callback) |
190 | return; | 190 | return; |
191 | 191 | ||
192 | mask = readw(ndev->reg_ofs.pdb_mask); | 192 | mask = readw(ndev->reg_ofs.ldb_mask); |
193 | set_bit(idx * ndev->bits_per_vector, &mask); | 193 | set_bit(idx * ndev->bits_per_vector, &mask); |
194 | writew(mask, ndev->reg_ofs.pdb_mask); | 194 | writew(mask, ndev->reg_ofs.ldb_mask); |
195 | 195 | ||
196 | ndev->db_cb[idx].callback = NULL; | 196 | ndev->db_cb[idx].callback = NULL; |
197 | } | 197 | } |
@@ -423,16 +423,16 @@ void ntb_set_mw_addr(struct ntb_device *ndev, unsigned int mw, u64 addr) | |||
423 | 423 | ||
424 | switch (MW_TO_BAR(mw)) { | 424 | switch (MW_TO_BAR(mw)) { |
425 | case NTB_BAR_23: | 425 | case NTB_BAR_23: |
426 | writeq(addr, ndev->reg_ofs.sbar2_xlat); | 426 | writeq(addr, ndev->reg_ofs.bar2_xlat); |
427 | break; | 427 | break; |
428 | case NTB_BAR_45: | 428 | case NTB_BAR_45: |
429 | writeq(addr, ndev->reg_ofs.sbar4_xlat); | 429 | writeq(addr, ndev->reg_ofs.bar4_xlat); |
430 | break; | 430 | break; |
431 | } | 431 | } |
432 | } | 432 | } |
433 | 433 | ||
434 | /** | 434 | /** |
435 | * ntb_ring_sdb() - Set the doorbell on the secondary/external side | 435 | * ntb_ring_doorbell() - Set the doorbell on the secondary/external side |
436 | * @ndev: pointer to ntb_device instance | 436 | * @ndev: pointer to ntb_device instance |
437 | * @db: doorbell to ring | 437 | * @db: doorbell to ring |
438 | * | 438 | * |
@@ -441,15 +441,15 @@ void ntb_set_mw_addr(struct ntb_device *ndev, unsigned int mw, u64 addr) | |||
441 | * | 441 | * |
442 | * RETURNS: An appropriate -ERRNO error value on error, or zero for success. | 442 | * RETURNS: An appropriate -ERRNO error value on error, or zero for success. |
443 | */ | 443 | */ |
444 | void ntb_ring_sdb(struct ntb_device *ndev, unsigned int db) | 444 | void ntb_ring_doorbell(struct ntb_device *ndev, unsigned int db) |
445 | { | 445 | { |
446 | dev_dbg(&ndev->pdev->dev, "%s: ringing doorbell %d\n", __func__, db); | 446 | dev_dbg(&ndev->pdev->dev, "%s: ringing doorbell %d\n", __func__, db); |
447 | 447 | ||
448 | if (ndev->hw_type == BWD_HW) | 448 | if (ndev->hw_type == BWD_HW) |
449 | writeq((u64) 1 << db, ndev->reg_ofs.sdb); | 449 | writeq((u64) 1 << db, ndev->reg_ofs.rdb); |
450 | else | 450 | else |
451 | writew(((1 << ndev->bits_per_vector) - 1) << | 451 | writew(((1 << ndev->bits_per_vector) - 1) << |
452 | (db * ndev->bits_per_vector), ndev->reg_ofs.sdb); | 452 | (db * ndev->bits_per_vector), ndev->reg_ofs.rdb); |
453 | } | 453 | } |
454 | 454 | ||
455 | static void bwd_recover_link(struct ntb_device *ndev) | 455 | static void bwd_recover_link(struct ntb_device *ndev) |
@@ -665,10 +665,10 @@ static int ntb_xeon_setup(struct ntb_device *ndev) | |||
665 | else | 665 | else |
666 | ndev->dev_type = NTB_DEV_DSD; | 666 | ndev->dev_type = NTB_DEV_DSD; |
667 | 667 | ||
668 | ndev->reg_ofs.pdb = ndev->reg_base + SNB_PDOORBELL_OFFSET; | 668 | ndev->reg_ofs.ldb = ndev->reg_base + SNB_PDOORBELL_OFFSET; |
669 | ndev->reg_ofs.pdb_mask = ndev->reg_base + SNB_PDBMSK_OFFSET; | 669 | ndev->reg_ofs.ldb_mask = ndev->reg_base + SNB_PDBMSK_OFFSET; |
670 | ndev->reg_ofs.sbar2_xlat = ndev->reg_base + SNB_SBAR2XLAT_OFFSET; | 670 | ndev->reg_ofs.bar2_xlat = ndev->reg_base + SNB_SBAR2XLAT_OFFSET; |
671 | ndev->reg_ofs.sbar4_xlat = ndev->reg_base + SNB_SBAR4XLAT_OFFSET; | 671 | ndev->reg_ofs.bar4_xlat = ndev->reg_base + SNB_SBAR4XLAT_OFFSET; |
672 | ndev->reg_ofs.lnk_cntl = ndev->reg_base + SNB_NTBCNTL_OFFSET; | 672 | ndev->reg_ofs.lnk_cntl = ndev->reg_base + SNB_NTBCNTL_OFFSET; |
673 | ndev->reg_ofs.lnk_stat = ndev->reg_base + SNB_LINK_STATUS_OFFSET; | 673 | ndev->reg_ofs.lnk_stat = ndev->reg_base + SNB_LINK_STATUS_OFFSET; |
674 | ndev->reg_ofs.spad_read = ndev->reg_base + SNB_SPAD_OFFSET; | 674 | ndev->reg_ofs.spad_read = ndev->reg_base + SNB_SPAD_OFFSET; |
@@ -687,7 +687,7 @@ static int ntb_xeon_setup(struct ntb_device *ndev) | |||
687 | ndev->limits.max_mw = SNB_ERRATA_MAX_MW; | 687 | ndev->limits.max_mw = SNB_ERRATA_MAX_MW; |
688 | ndev->reg_ofs.spad_write = ndev->mw[1].vbase + | 688 | ndev->reg_ofs.spad_write = ndev->mw[1].vbase + |
689 | SNB_SPAD_OFFSET; | 689 | SNB_SPAD_OFFSET; |
690 | ndev->reg_ofs.sdb = ndev->mw[1].vbase + | 690 | ndev->reg_ofs.rdb = ndev->mw[1].vbase + |
691 | SNB_PDOORBELL_OFFSET; | 691 | SNB_PDOORBELL_OFFSET; |
692 | 692 | ||
693 | /* Set the Limit register to 4k, the minimum size, to | 693 | /* Set the Limit register to 4k, the minimum size, to |
@@ -699,7 +699,7 @@ static int ntb_xeon_setup(struct ntb_device *ndev) | |||
699 | ndev->limits.max_mw = SNB_MAX_MW; | 699 | ndev->limits.max_mw = SNB_MAX_MW; |
700 | ndev->reg_ofs.spad_write = ndev->reg_base + | 700 | ndev->reg_ofs.spad_write = ndev->reg_base + |
701 | SNB_B2B_SPAD_OFFSET; | 701 | SNB_B2B_SPAD_OFFSET; |
702 | ndev->reg_ofs.sdb = ndev->reg_base + | 702 | ndev->reg_ofs.rdb = ndev->reg_base + |
703 | SNB_B2B_DOORBELL_OFFSET; | 703 | SNB_B2B_DOORBELL_OFFSET; |
704 | 704 | ||
705 | /* Disable the Limit register, just incase it is set to | 705 | /* Disable the Limit register, just incase it is set to |
@@ -801,21 +801,21 @@ static int ntb_bwd_setup(struct ntb_device *ndev) | |||
801 | if (rc) | 801 | if (rc) |
802 | return rc; | 802 | return rc; |
803 | 803 | ||
804 | ndev->reg_ofs.pdb = ndev->reg_base + BWD_PDOORBELL_OFFSET; | 804 | ndev->reg_ofs.ldb = ndev->reg_base + BWD_PDOORBELL_OFFSET; |
805 | ndev->reg_ofs.pdb_mask = ndev->reg_base + BWD_PDBMSK_OFFSET; | 805 | ndev->reg_ofs.ldb_mask = ndev->reg_base + BWD_PDBMSK_OFFSET; |
806 | ndev->reg_ofs.sbar2_xlat = ndev->reg_base + BWD_SBAR2XLAT_OFFSET; | 806 | ndev->reg_ofs.bar2_xlat = ndev->reg_base + BWD_SBAR2XLAT_OFFSET; |
807 | ndev->reg_ofs.sbar4_xlat = ndev->reg_base + BWD_SBAR4XLAT_OFFSET; | 807 | ndev->reg_ofs.bar4_xlat = ndev->reg_base + BWD_SBAR4XLAT_OFFSET; |
808 | ndev->reg_ofs.lnk_cntl = ndev->reg_base + BWD_NTBCNTL_OFFSET; | 808 | ndev->reg_ofs.lnk_cntl = ndev->reg_base + BWD_NTBCNTL_OFFSET; |
809 | ndev->reg_ofs.lnk_stat = ndev->reg_base + BWD_LINK_STATUS_OFFSET; | 809 | ndev->reg_ofs.lnk_stat = ndev->reg_base + BWD_LINK_STATUS_OFFSET; |
810 | ndev->reg_ofs.spad_read = ndev->reg_base + BWD_SPAD_OFFSET; | 810 | ndev->reg_ofs.spad_read = ndev->reg_base + BWD_SPAD_OFFSET; |
811 | ndev->reg_ofs.spci_cmd = ndev->reg_base + BWD_PCICMD_OFFSET; | 811 | ndev->reg_ofs.spci_cmd = ndev->reg_base + BWD_PCICMD_OFFSET; |
812 | 812 | ||
813 | if (ndev->conn_type == NTB_CONN_B2B) { | 813 | if (ndev->conn_type == NTB_CONN_B2B) { |
814 | ndev->reg_ofs.sdb = ndev->reg_base + BWD_B2B_DOORBELL_OFFSET; | 814 | ndev->reg_ofs.rdb = ndev->reg_base + BWD_B2B_DOORBELL_OFFSET; |
815 | ndev->reg_ofs.spad_write = ndev->reg_base + BWD_B2B_SPAD_OFFSET; | 815 | ndev->reg_ofs.spad_write = ndev->reg_base + BWD_B2B_SPAD_OFFSET; |
816 | ndev->limits.max_spads = BWD_MAX_SPADS; | 816 | ndev->limits.max_spads = BWD_MAX_SPADS; |
817 | } else { | 817 | } else { |
818 | ndev->reg_ofs.sdb = ndev->reg_base + BWD_PDOORBELL_OFFSET; | 818 | ndev->reg_ofs.rdb = ndev->reg_base + BWD_PDOORBELL_OFFSET; |
819 | ndev->reg_ofs.spad_write = ndev->reg_base + BWD_SPAD_OFFSET; | 819 | ndev->reg_ofs.spad_write = ndev->reg_base + BWD_SPAD_OFFSET; |
820 | ndev->limits.max_spads = BWD_MAX_COMPAT_SPADS; | 820 | ndev->limits.max_spads = BWD_MAX_COMPAT_SPADS; |
821 | } | 821 | } |
@@ -895,7 +895,7 @@ static irqreturn_t bwd_callback_msix_irq(int irq, void *data) | |||
895 | */ | 895 | */ |
896 | ndev->last_ts = jiffies; | 896 | ndev->last_ts = jiffies; |
897 | 897 | ||
898 | writeq((u64) 1 << db_cb->db_num, ndev->reg_ofs.pdb); | 898 | writeq((u64) 1 << db_cb->db_num, ndev->reg_ofs.ldb); |
899 | 899 | ||
900 | return IRQ_HANDLED; | 900 | return IRQ_HANDLED; |
901 | } | 901 | } |
@@ -917,7 +917,7 @@ static irqreturn_t xeon_callback_msix_irq(int irq, void *data) | |||
917 | * interrupts. | 917 | * interrupts. |
918 | */ | 918 | */ |
919 | writew(((1 << ndev->bits_per_vector) - 1) << | 919 | writew(((1 << ndev->bits_per_vector) - 1) << |
920 | (db_cb->db_num * ndev->bits_per_vector), ndev->reg_ofs.pdb); | 920 | (db_cb->db_num * ndev->bits_per_vector), ndev->reg_ofs.ldb); |
921 | 921 | ||
922 | return IRQ_HANDLED; | 922 | return IRQ_HANDLED; |
923 | } | 923 | } |
@@ -935,7 +935,7 @@ static irqreturn_t xeon_event_msix_irq(int irq, void *dev) | |||
935 | dev_err(&ndev->pdev->dev, "Error determining link status\n"); | 935 | dev_err(&ndev->pdev->dev, "Error determining link status\n"); |
936 | 936 | ||
937 | /* bit 15 is always the link bit */ | 937 | /* bit 15 is always the link bit */ |
938 | writew(1 << ndev->limits.max_db_bits, ndev->reg_ofs.pdb); | 938 | writew(1 << ndev->limits.max_db_bits, ndev->reg_ofs.ldb); |
939 | 939 | ||
940 | return IRQ_HANDLED; | 940 | return IRQ_HANDLED; |
941 | } | 941 | } |
@@ -946,29 +946,28 @@ static irqreturn_t ntb_interrupt(int irq, void *dev) | |||
946 | unsigned int i = 0; | 946 | unsigned int i = 0; |
947 | 947 | ||
948 | if (ndev->hw_type == BWD_HW) { | 948 | if (ndev->hw_type == BWD_HW) { |
949 | u64 pdb = readq(ndev->reg_ofs.pdb); | 949 | u64 ldb = readq(ndev->reg_ofs.ldb); |
950 | 950 | ||
951 | dev_dbg(&ndev->pdev->dev, "irq %d - pdb = %Lx\n", irq, pdb); | 951 | dev_dbg(&ndev->pdev->dev, "irq %d - ldb = %Lx\n", irq, ldb); |
952 | 952 | ||
953 | while (pdb) { | 953 | while (ldb) { |
954 | i = __ffs(pdb); | 954 | i = __ffs(ldb); |
955 | pdb &= pdb - 1; | 955 | ldb &= ldb - 1; |
956 | bwd_callback_msix_irq(irq, &ndev->db_cb[i]); | 956 | bwd_callback_msix_irq(irq, &ndev->db_cb[i]); |
957 | } | 957 | } |
958 | } else { | 958 | } else { |
959 | u16 pdb = readw(ndev->reg_ofs.pdb); | 959 | u16 ldb = readw(ndev->reg_ofs.ldb); |
960 | 960 | ||
961 | dev_dbg(&ndev->pdev->dev, "irq %d - pdb = %x sdb %x\n", irq, | 961 | dev_dbg(&ndev->pdev->dev, "irq %d - ldb = %x\n", irq, ldb); |
962 | pdb, readw(ndev->reg_ofs.sdb)); | ||
963 | 962 | ||
964 | if (pdb & SNB_DB_HW_LINK) { | 963 | if (ldb & SNB_DB_HW_LINK) { |
965 | xeon_event_msix_irq(irq, dev); | 964 | xeon_event_msix_irq(irq, dev); |
966 | pdb &= ~SNB_DB_HW_LINK; | 965 | ldb &= ~SNB_DB_HW_LINK; |
967 | } | 966 | } |
968 | 967 | ||
969 | while (pdb) { | 968 | while (ldb) { |
970 | i = __ffs(pdb); | 969 | i = __ffs(ldb); |
971 | pdb &= pdb - 1; | 970 | ldb &= ldb - 1; |
972 | xeon_callback_msix_irq(irq, &ndev->db_cb[i]); | 971 | xeon_callback_msix_irq(irq, &ndev->db_cb[i]); |
973 | } | 972 | } |
974 | } | 973 | } |
@@ -1126,10 +1125,10 @@ static int ntb_setup_interrupts(struct ntb_device *ndev) | |||
1126 | * Interrupt. The rest will be unmasked as callbacks are registered. | 1125 | * Interrupt. The rest will be unmasked as callbacks are registered. |
1127 | */ | 1126 | */ |
1128 | if (ndev->hw_type == BWD_HW) | 1127 | if (ndev->hw_type == BWD_HW) |
1129 | writeq(~0, ndev->reg_ofs.pdb_mask); | 1128 | writeq(~0, ndev->reg_ofs.ldb_mask); |
1130 | else | 1129 | else |
1131 | writew(~(1 << ndev->limits.max_db_bits), | 1130 | writew(~(1 << ndev->limits.max_db_bits), |
1132 | ndev->reg_ofs.pdb_mask); | 1131 | ndev->reg_ofs.ldb_mask); |
1133 | 1132 | ||
1134 | rc = ntb_setup_msix(ndev); | 1133 | rc = ntb_setup_msix(ndev); |
1135 | if (!rc) | 1134 | if (!rc) |
@@ -1158,9 +1157,9 @@ static void ntb_free_interrupts(struct ntb_device *ndev) | |||
1158 | 1157 | ||
1159 | /* mask interrupts */ | 1158 | /* mask interrupts */ |
1160 | if (ndev->hw_type == BWD_HW) | 1159 | if (ndev->hw_type == BWD_HW) |
1161 | writeq(~0, ndev->reg_ofs.pdb_mask); | 1160 | writeq(~0, ndev->reg_ofs.ldb_mask); |
1162 | else | 1161 | else |
1163 | writew(~0, ndev->reg_ofs.pdb_mask); | 1162 | writew(~0, ndev->reg_ofs.ldb_mask); |
1164 | 1163 | ||
1165 | if (ndev->num_msix) { | 1164 | if (ndev->num_msix) { |
1166 | struct msix_entry *msix; | 1165 | struct msix_entry *msix; |
diff --git a/drivers/ntb/ntb_hw.h b/drivers/ntb/ntb_hw.h index 4f42ed18103a..0a31cedae7d4 100644 --- a/drivers/ntb/ntb_hw.h +++ b/drivers/ntb/ntb_hw.h | |||
@@ -124,11 +124,11 @@ struct ntb_device { | |||
124 | unsigned char msix_cnt; | 124 | unsigned char msix_cnt; |
125 | } limits; | 125 | } limits; |
126 | struct { | 126 | struct { |
127 | void __iomem *pdb; | 127 | void __iomem *ldb; |
128 | void __iomem *pdb_mask; | 128 | void __iomem *ldb_mask; |
129 | void __iomem *sdb; | 129 | void __iomem *rdb; |
130 | void __iomem *sbar2_xlat; | 130 | void __iomem *bar2_xlat; |
131 | void __iomem *sbar4_xlat; | 131 | void __iomem *bar4_xlat; |
132 | void __iomem *spad_write; | 132 | void __iomem *spad_write; |
133 | void __iomem *spad_read; | 133 | void __iomem *spad_read; |
134 | void __iomem *lnk_cntl; | 134 | void __iomem *lnk_cntl; |
@@ -243,7 +243,7 @@ int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 *val); | |||
243 | resource_size_t ntb_get_mw_base(struct ntb_device *ndev, unsigned int mw); | 243 | resource_size_t ntb_get_mw_base(struct ntb_device *ndev, unsigned int mw); |
244 | void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw); | 244 | void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw); |
245 | u64 ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw); | 245 | u64 ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw); |
246 | void ntb_ring_sdb(struct ntb_device *ndev, unsigned int idx); | 246 | void ntb_ring_doorbell(struct ntb_device *ndev, unsigned int idx); |
247 | void *ntb_find_transport(struct pci_dev *pdev); | 247 | void *ntb_find_transport(struct pci_dev *pdev); |
248 | 248 | ||
249 | int ntb_transport_init(struct pci_dev *pdev); | 249 | int ntb_transport_init(struct pci_dev *pdev); |
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c index ae8657259ca0..ae61b443f412 100644 --- a/drivers/ntb/ntb_transport.c +++ b/drivers/ntb/ntb_transport.c | |||
@@ -1216,7 +1216,7 @@ static void ntb_tx_copy_callback(void *data) | |||
1216 | wmb(); | 1216 | wmb(); |
1217 | iowrite32(entry->flags | DESC_DONE_FLAG, &hdr->flags); | 1217 | iowrite32(entry->flags | DESC_DONE_FLAG, &hdr->flags); |
1218 | 1218 | ||
1219 | ntb_ring_sdb(qp->ndev, qp->qp_num); | 1219 | ntb_ring_doorbell(qp->ndev, qp->qp_num); |
1220 | 1220 | ||
1221 | /* The entry length can only be zero if the packet is intended to be a | 1221 | /* The entry length can only be zero if the packet is intended to be a |
1222 | * "link down" or similar. Since no payload is being sent in these | 1222 | * "link down" or similar. Since no payload is being sent in these |