aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/amso1100/c2.c
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2008-04-17 00:01:08 -0400
committerRoland Dreier <rolandd@cisco.com>2008-04-17 00:01:08 -0400
commitdc544bc9cb8aa91c5d7fc9116a302f88a8a97250 (patch)
treee8ae7a400584c94252371068e08f63373dd449fd /drivers/infiniband/hw/amso1100/c2.c
parentd23b9d8ff2fcadc6f2fba83f654a122b9e16f02c (diff)
RDMA/amso1100: Start of endianness annotation
Signed-off-by: Roland Dreier <rolandd@cisco.com> Acked-by: Steve Wise <swise@opengridcomputing.com>
Diffstat (limited to 'drivers/infiniband/hw/amso1100/c2.c')
-rw-r--r--drivers/infiniband/hw/amso1100/c2.c70
1 files changed, 38 insertions, 32 deletions
diff --git a/drivers/infiniband/hw/amso1100/c2.c b/drivers/infiniband/hw/amso1100/c2.c
index c50533b5999f..113f3c03c5b5 100644
--- a/drivers/infiniband/hw/amso1100/c2.c
+++ b/drivers/infiniband/hw/amso1100/c2.c
@@ -130,10 +130,10 @@ static int c2_tx_ring_alloc(struct c2_ring *tx_ring, void *vaddr,
130 tx_desc->status = 0; 130 tx_desc->status = 0;
131 131
132 /* Set TXP_HTXD_UNINIT */ 132 /* Set TXP_HTXD_UNINIT */
133 __raw_writeq(cpu_to_be64(0x1122334455667788ULL), 133 __raw_writeq((__force u64) cpu_to_be64(0x1122334455667788ULL),
134 (void __iomem *) txp_desc + C2_TXP_ADDR); 134 (void __iomem *) txp_desc + C2_TXP_ADDR);
135 __raw_writew(0, (void __iomem *) txp_desc + C2_TXP_LEN); 135 __raw_writew(0, (void __iomem *) txp_desc + C2_TXP_LEN);
136 __raw_writew(cpu_to_be16(TXP_HTXD_UNINIT), 136 __raw_writew((__force u16) cpu_to_be16(TXP_HTXD_UNINIT),
137 (void __iomem *) txp_desc + C2_TXP_FLAGS); 137 (void __iomem *) txp_desc + C2_TXP_FLAGS);
138 138
139 elem->skb = NULL; 139 elem->skb = NULL;
@@ -179,13 +179,13 @@ static int c2_rx_ring_alloc(struct c2_ring *rx_ring, void *vaddr,
179 rx_desc->status = 0; 179 rx_desc->status = 0;
180 180
181 /* Set RXP_HRXD_UNINIT */ 181 /* Set RXP_HRXD_UNINIT */
182 __raw_writew(cpu_to_be16(RXP_HRXD_OK), 182 __raw_writew((__force u16) cpu_to_be16(RXP_HRXD_OK),
183 (void __iomem *) rxp_desc + C2_RXP_STATUS); 183 (void __iomem *) rxp_desc + C2_RXP_STATUS);
184 __raw_writew(0, (void __iomem *) rxp_desc + C2_RXP_COUNT); 184 __raw_writew(0, (void __iomem *) rxp_desc + C2_RXP_COUNT);
185 __raw_writew(0, (void __iomem *) rxp_desc + C2_RXP_LEN); 185 __raw_writew(0, (void __iomem *) rxp_desc + C2_RXP_LEN);
186 __raw_writeq(cpu_to_be64(0x99aabbccddeeffULL), 186 __raw_writeq((__force u64) cpu_to_be64(0x99aabbccddeeffULL),
187 (void __iomem *) rxp_desc + C2_RXP_ADDR); 187 (void __iomem *) rxp_desc + C2_RXP_ADDR);
188 __raw_writew(cpu_to_be16(RXP_HRXD_UNINIT), 188 __raw_writew((__force u16) cpu_to_be16(RXP_HRXD_UNINIT),
189 (void __iomem *) rxp_desc + C2_RXP_FLAGS); 189 (void __iomem *) rxp_desc + C2_RXP_FLAGS);
190 190
191 elem->skb = NULL; 191 elem->skb = NULL;
@@ -239,10 +239,11 @@ static inline int c2_rx_alloc(struct c2_port *c2_port, struct c2_element *elem)
239 rxp_hdr->flags = RXP_HRXD_READY; 239 rxp_hdr->flags = RXP_HRXD_READY;
240 240
241 __raw_writew(0, elem->hw_desc + C2_RXP_STATUS); 241 __raw_writew(0, elem->hw_desc + C2_RXP_STATUS);
242 __raw_writew(cpu_to_be16((u16) maplen - sizeof(*rxp_hdr)), 242 __raw_writew((__force u16) cpu_to_be16((u16) maplen - sizeof(*rxp_hdr)),
243 elem->hw_desc + C2_RXP_LEN); 243 elem->hw_desc + C2_RXP_LEN);
244 __raw_writeq(cpu_to_be64(mapaddr), elem->hw_desc + C2_RXP_ADDR); 244 __raw_writeq((__force u64) cpu_to_be64(mapaddr), elem->hw_desc + C2_RXP_ADDR);
245 __raw_writew(cpu_to_be16(RXP_HRXD_READY), elem->hw_desc + C2_RXP_FLAGS); 245 __raw_writew((__force u16) cpu_to_be16(RXP_HRXD_READY),
246 elem->hw_desc + C2_RXP_FLAGS);
246 247
247 elem->skb = skb; 248 elem->skb = skb;
248 elem->mapaddr = mapaddr; 249 elem->mapaddr = mapaddr;
@@ -290,9 +291,9 @@ static void c2_rx_clean(struct c2_port *c2_port)
290 __raw_writew(0, elem->hw_desc + C2_RXP_STATUS); 291 __raw_writew(0, elem->hw_desc + C2_RXP_STATUS);
291 __raw_writew(0, elem->hw_desc + C2_RXP_COUNT); 292 __raw_writew(0, elem->hw_desc + C2_RXP_COUNT);
292 __raw_writew(0, elem->hw_desc + C2_RXP_LEN); 293 __raw_writew(0, elem->hw_desc + C2_RXP_LEN);
293 __raw_writeq(cpu_to_be64(0x99aabbccddeeffULL), 294 __raw_writeq((__force u64) cpu_to_be64(0x99aabbccddeeffULL),
294 elem->hw_desc + C2_RXP_ADDR); 295 elem->hw_desc + C2_RXP_ADDR);
295 __raw_writew(cpu_to_be16(RXP_HRXD_UNINIT), 296 __raw_writew((__force u16) cpu_to_be16(RXP_HRXD_UNINIT),
296 elem->hw_desc + C2_RXP_FLAGS); 297 elem->hw_desc + C2_RXP_FLAGS);
297 298
298 if (elem->skb) { 299 if (elem->skb) {
@@ -346,16 +347,16 @@ static void c2_tx_clean(struct c2_port *c2_port)
346 elem->hw_desc + C2_TXP_LEN); 347 elem->hw_desc + C2_TXP_LEN);
347 __raw_writeq(0, 348 __raw_writeq(0,
348 elem->hw_desc + C2_TXP_ADDR); 349 elem->hw_desc + C2_TXP_ADDR);
349 __raw_writew(cpu_to_be16(TXP_HTXD_DONE), 350 __raw_writew((__force u16) cpu_to_be16(TXP_HTXD_DONE),
350 elem->hw_desc + C2_TXP_FLAGS); 351 elem->hw_desc + C2_TXP_FLAGS);
351 c2_port->netstats.tx_dropped++; 352 c2_port->netstats.tx_dropped++;
352 break; 353 break;
353 } else { 354 } else {
354 __raw_writew(0, 355 __raw_writew(0,
355 elem->hw_desc + C2_TXP_LEN); 356 elem->hw_desc + C2_TXP_LEN);
356 __raw_writeq(cpu_to_be64(0x1122334455667788ULL), 357 __raw_writeq((__force u64) cpu_to_be64(0x1122334455667788ULL),
357 elem->hw_desc + C2_TXP_ADDR); 358 elem->hw_desc + C2_TXP_ADDR);
358 __raw_writew(cpu_to_be16(TXP_HTXD_UNINIT), 359 __raw_writew((__force u16) cpu_to_be16(TXP_HTXD_UNINIT),
359 elem->hw_desc + C2_TXP_FLAGS); 360 elem->hw_desc + C2_TXP_FLAGS);
360 } 361 }
361 362
@@ -390,7 +391,7 @@ static void c2_tx_interrupt(struct net_device *netdev)
390 for (elem = tx_ring->to_clean; elem != tx_ring->to_use; 391 for (elem = tx_ring->to_clean; elem != tx_ring->to_use;
391 elem = elem->next) { 392 elem = elem->next) {
392 txp_htxd.flags = 393 txp_htxd.flags =
393 be16_to_cpu(readw(elem->hw_desc + C2_TXP_FLAGS)); 394 be16_to_cpu((__force __be16) readw(elem->hw_desc + C2_TXP_FLAGS));
394 395
395 if (txp_htxd.flags != TXP_HTXD_DONE) 396 if (txp_htxd.flags != TXP_HTXD_DONE)
396 break; 397 break;
@@ -398,7 +399,7 @@ static void c2_tx_interrupt(struct net_device *netdev)
398 if (netif_msg_tx_done(c2_port)) { 399 if (netif_msg_tx_done(c2_port)) {
399 /* PCI reads are expensive in fast path */ 400 /* PCI reads are expensive in fast path */
400 txp_htxd.len = 401 txp_htxd.len =
401 be16_to_cpu(readw(elem->hw_desc + C2_TXP_LEN)); 402 be16_to_cpu((__force __be16) readw(elem->hw_desc + C2_TXP_LEN));
402 pr_debug("%s: tx done slot %3Zu status 0x%x len " 403 pr_debug("%s: tx done slot %3Zu status 0x%x len "
403 "%5u bytes\n", 404 "%5u bytes\n",
404 netdev->name, elem - tx_ring->start, 405 netdev->name, elem - tx_ring->start,
@@ -448,10 +449,12 @@ static void c2_rx_error(struct c2_port *c2_port, struct c2_element *elem)
448 /* Write the descriptor to the adapter's rx ring */ 449 /* Write the descriptor to the adapter's rx ring */
449 __raw_writew(0, elem->hw_desc + C2_RXP_STATUS); 450 __raw_writew(0, elem->hw_desc + C2_RXP_STATUS);
450 __raw_writew(0, elem->hw_desc + C2_RXP_COUNT); 451 __raw_writew(0, elem->hw_desc + C2_RXP_COUNT);
451 __raw_writew(cpu_to_be16((u16) elem->maplen - sizeof(*rxp_hdr)), 452 __raw_writew((__force u16) cpu_to_be16((u16) elem->maplen - sizeof(*rxp_hdr)),
452 elem->hw_desc + C2_RXP_LEN); 453 elem->hw_desc + C2_RXP_LEN);
453 __raw_writeq(cpu_to_be64(elem->mapaddr), elem->hw_desc + C2_RXP_ADDR); 454 __raw_writeq((__force u64) cpu_to_be64(elem->mapaddr),
454 __raw_writew(cpu_to_be16(RXP_HRXD_READY), elem->hw_desc + C2_RXP_FLAGS); 455 elem->hw_desc + C2_RXP_ADDR);
456 __raw_writew((__force u16) cpu_to_be16(RXP_HRXD_READY),
457 elem->hw_desc + C2_RXP_FLAGS);
455 458
456 pr_debug("packet dropped\n"); 459 pr_debug("packet dropped\n");
457 c2_port->netstats.rx_dropped++; 460 c2_port->netstats.rx_dropped++;
@@ -653,7 +656,7 @@ static int c2_up(struct net_device *netdev)
653 i++, elem++) { 656 i++, elem++) {
654 rxp_hdr = (struct c2_rxp_hdr *) elem->skb->data; 657 rxp_hdr = (struct c2_rxp_hdr *) elem->skb->data;
655 rxp_hdr->flags = 0; 658 rxp_hdr->flags = 0;
656 __raw_writew(cpu_to_be16(RXP_HRXD_READY), 659 __raw_writew((__force u16) cpu_to_be16(RXP_HRXD_READY),
657 elem->hw_desc + C2_RXP_FLAGS); 660 elem->hw_desc + C2_RXP_FLAGS);
658 } 661 }
659 662
@@ -787,9 +790,12 @@ static int c2_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
787 elem->maplen = maplen; 790 elem->maplen = maplen;
788 791
789 /* Tell HW to xmit */ 792 /* Tell HW to xmit */
790 __raw_writeq(cpu_to_be64(mapaddr), elem->hw_desc + C2_TXP_ADDR); 793 __raw_writeq((__force u64) cpu_to_be64(mapaddr),
791 __raw_writew(cpu_to_be16(maplen), elem->hw_desc + C2_TXP_LEN); 794 elem->hw_desc + C2_TXP_ADDR);
792 __raw_writew(cpu_to_be16(TXP_HTXD_READY), elem->hw_desc + C2_TXP_FLAGS); 795 __raw_writew((__force u16) cpu_to_be16(maplen),
796 elem->hw_desc + C2_TXP_LEN);
797 __raw_writew((__force u16) cpu_to_be16(TXP_HTXD_READY),
798 elem->hw_desc + C2_TXP_FLAGS);
793 799
794 c2_port->netstats.tx_packets++; 800 c2_port->netstats.tx_packets++;
795 c2_port->netstats.tx_bytes += maplen; 801 c2_port->netstats.tx_bytes += maplen;
@@ -810,11 +816,11 @@ static int c2_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
810 elem->maplen = maplen; 816 elem->maplen = maplen;
811 817
812 /* Tell HW to xmit */ 818 /* Tell HW to xmit */
813 __raw_writeq(cpu_to_be64(mapaddr), 819 __raw_writeq((__force u64) cpu_to_be64(mapaddr),
814 elem->hw_desc + C2_TXP_ADDR); 820 elem->hw_desc + C2_TXP_ADDR);
815 __raw_writew(cpu_to_be16(maplen), 821 __raw_writew((__force u16) cpu_to_be16(maplen),
816 elem->hw_desc + C2_TXP_LEN); 822 elem->hw_desc + C2_TXP_LEN);
817 __raw_writew(cpu_to_be16(TXP_HTXD_READY), 823 __raw_writew((__force u16) cpu_to_be16(TXP_HTXD_READY),
818 elem->hw_desc + C2_TXP_FLAGS); 824 elem->hw_desc + C2_TXP_FLAGS);
819 825
820 c2_port->netstats.tx_packets++; 826 c2_port->netstats.tx_packets++;
@@ -1029,10 +1035,10 @@ static int __devinit c2_probe(struct pci_dev *pcidev,
1029 } 1035 }
1030 1036
1031 /* Validate the adapter version */ 1037 /* Validate the adapter version */
1032 if (be32_to_cpu(readl(mmio_regs + C2_REGS_VERS)) != C2_VERSION) { 1038 if (be32_to_cpu((__force __be32) readl(mmio_regs + C2_REGS_VERS)) != C2_VERSION) {
1033 printk(KERN_ERR PFX "Version mismatch " 1039 printk(KERN_ERR PFX "Version mismatch "
1034 "[fw=%u, c2=%u], Adapter not claimed\n", 1040 "[fw=%u, c2=%u], Adapter not claimed\n",
1035 be32_to_cpu(readl(mmio_regs + C2_REGS_VERS)), 1041 be32_to_cpu((__force __be32) readl(mmio_regs + C2_REGS_VERS)),
1036 C2_VERSION); 1042 C2_VERSION);
1037 ret = -EINVAL; 1043 ret = -EINVAL;
1038 iounmap(mmio_regs); 1044 iounmap(mmio_regs);
@@ -1040,12 +1046,12 @@ static int __devinit c2_probe(struct pci_dev *pcidev,
1040 } 1046 }
1041 1047
1042 /* Validate the adapter IVN */ 1048 /* Validate the adapter IVN */
1043 if (be32_to_cpu(readl(mmio_regs + C2_REGS_IVN)) != C2_IVN) { 1049 if (be32_to_cpu((__force __be32) readl(mmio_regs + C2_REGS_IVN)) != C2_IVN) {
1044 printk(KERN_ERR PFX "Downlevel FIrmware level. You should be using " 1050 printk(KERN_ERR PFX "Downlevel FIrmware level. You should be using "
1045 "the OpenIB device support kit. " 1051 "the OpenIB device support kit. "
1046 "[fw=0x%x, c2=0x%x], Adapter not claimed\n", 1052 "[fw=0x%x, c2=0x%x], Adapter not claimed\n",
1047 be32_to_cpu(readl(mmio_regs + C2_REGS_IVN)), 1053 be32_to_cpu((__force __be32) readl(mmio_regs + C2_REGS_IVN)),
1048 C2_IVN); 1054 C2_IVN);
1049 ret = -EINVAL; 1055 ret = -EINVAL;
1050 iounmap(mmio_regs); 1056 iounmap(mmio_regs);
1051 goto bail2; 1057 goto bail2;
@@ -1068,7 +1074,7 @@ static int __devinit c2_probe(struct pci_dev *pcidev,
1068 1074
1069 /* Get the last RX index */ 1075 /* Get the last RX index */
1070 c2dev->cur_rx = 1076 c2dev->cur_rx =
1071 (be32_to_cpu(readl(mmio_regs + C2_REGS_HRX_CUR)) - 1077 (be32_to_cpu((__force __be32) readl(mmio_regs + C2_REGS_HRX_CUR)) -
1072 0xffffc000) / sizeof(struct c2_rxp_desc); 1078 0xffffc000) / sizeof(struct c2_rxp_desc);
1073 1079
1074 /* Request an interrupt line for the driver */ 1080 /* Request an interrupt line for the driver */
@@ -1090,7 +1096,7 @@ static int __devinit c2_probe(struct pci_dev *pcidev,
1090 } 1096 }
1091 1097
1092 /* Save off the actual size prior to unmapping mmio_regs */ 1098 /* Save off the actual size prior to unmapping mmio_regs */
1093 kva_map_size = be32_to_cpu(readl(mmio_regs + C2_REGS_PCI_WINSIZE)); 1099 kva_map_size = be32_to_cpu((__force __be32) readl(mmio_regs + C2_REGS_PCI_WINSIZE));
1094 1100
1095 /* Unmap the adapter PCI registers in BAR4 */ 1101 /* Unmap the adapter PCI registers in BAR4 */
1096 iounmap(mmio_regs); 1102 iounmap(mmio_regs);