aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/myri10ge
diff options
context:
space:
mode:
authorBrice Goglin <brice@myri.com>2007-03-07 14:00:45 -0500
committerJeff Garzik <jeff@garzik.org>2007-03-09 11:51:32 -0500
commit34fdccea93e858aaece3f127628365b546f96857 (patch)
tree4fce59b6306a3b71f6512ff6ab389b70c944f020 /drivers/net/myri10ge
parent355c7265f4745a2aa6f0482d466e2271e6b3c61a (diff)
myri10ge: use pci_map_page to prepare the dmatest buffer
Allocate a specific page and use pci_map_page for dma test instead of relying on another existing buffer. Signed-off-by: Brice Goglin <brice@myri.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/myri10ge')
-rw-r--r--drivers/net/myri10ge/myri10ge.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index db282ed9ab7d..eab9b5acd0cf 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -717,6 +717,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
717 int status; 717 int status;
718 size_t bytes; 718 size_t bytes;
719 u32 len; 719 u32 len;
720 struct page *dmatest_page;
721 dma_addr_t dmatest_bus;
720 722
721 /* try to send a reset command to the card to see if it 723 /* try to send a reset command to the card to see if it
722 * is alive */ 724 * is alive */
@@ -726,6 +728,11 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
726 dev_err(&mgp->pdev->dev, "failed reset\n"); 728 dev_err(&mgp->pdev->dev, "failed reset\n");
727 return -ENXIO; 729 return -ENXIO;
728 } 730 }
731 dmatest_page = alloc_page(GFP_KERNEL);
732 if (!dmatest_page)
733 return -ENOMEM;
734 dmatest_bus = pci_map_page(mgp->pdev, dmatest_page, 0, PAGE_SIZE,
735 DMA_BIDIRECTIONAL);
729 736
730 /* Now exchange information about interrupts */ 737 /* Now exchange information about interrupts */
731 738
@@ -764,8 +771,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
764 771
765 len = mgp->tx.boundary; 772 len = mgp->tx.boundary;
766 773
767 cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus); 774 cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus);
768 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus); 775 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus);
769 cmd.data2 = len * 0x10000; 776 cmd.data2 = len * 0x10000;
770 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); 777 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0);
771 if (status == 0) 778 if (status == 0)
@@ -774,8 +781,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
774 else 781 else
775 dev_warn(&mgp->pdev->dev, "DMA read benchmark failed: %d\n", 782 dev_warn(&mgp->pdev->dev, "DMA read benchmark failed: %d\n",
776 status); 783 status);
777 cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus); 784 cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus);
778 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus); 785 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus);
779 cmd.data2 = len * 0x1; 786 cmd.data2 = len * 0x1;
780 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); 787 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0);
781 if (status == 0) 788 if (status == 0)
@@ -785,8 +792,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
785 dev_warn(&mgp->pdev->dev, "DMA write benchmark failed: %d\n", 792 dev_warn(&mgp->pdev->dev, "DMA write benchmark failed: %d\n",
786 status); 793 status);
787 794
788 cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus); 795 cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus);
789 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus); 796 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus);
790 cmd.data2 = len * 0x10001; 797 cmd.data2 = len * 0x10001;
791 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); 798 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0);
792 if (status == 0) 799 if (status == 0)
@@ -796,6 +803,9 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
796 dev_warn(&mgp->pdev->dev, 803 dev_warn(&mgp->pdev->dev,
797 "DMA read/write benchmark failed: %d\n", status); 804 "DMA read/write benchmark failed: %d\n", status);
798 805
806 pci_unmap_page(mgp->pdev, dmatest_bus, PAGE_SIZE, DMA_BIDIRECTIONAL);
807 put_page(dmatest_page);
808
799 memset(mgp->rx_done.entry, 0, bytes); 809 memset(mgp->rx_done.entry, 0, bytes);
800 810
801 /* reset mcp/driver shared state back to 0 */ 811 /* reset mcp/driver shared state back to 0 */