aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r--drivers/ieee1394/ohci1394.c51
1 files changed, 8 insertions, 43 deletions
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index 5dadfd296f79..a75b1446b6ed 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -138,19 +138,6 @@ printk(KERN_INFO "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->
138#define DBGMSG(fmt, args...) do {} while (0) 138#define DBGMSG(fmt, args...) do {} while (0)
139#endif 139#endif
140 140
141#ifdef CONFIG_IEEE1394_OHCI_DMA_DEBUG
142#define OHCI_DMA_ALLOC(fmt, args...) \
143 HPSB_ERR("%s(%s)alloc(%d): "fmt, OHCI1394_DRIVER_NAME, __FUNCTION__, \
144 ++global_outstanding_dmas, ## args)
145#define OHCI_DMA_FREE(fmt, args...) \
146 HPSB_ERR("%s(%s)free(%d): "fmt, OHCI1394_DRIVER_NAME, __FUNCTION__, \
147 --global_outstanding_dmas, ## args)
148static int global_outstanding_dmas = 0;
149#else
150#define OHCI_DMA_ALLOC(fmt, args...) do {} while (0)
151#define OHCI_DMA_FREE(fmt, args...) do {} while (0)
152#endif
153
154/* print general (card independent) information */ 141/* print general (card independent) information */
155#define PRINT_G(level, fmt, args...) \ 142#define PRINT_G(level, fmt, args...) \
156printk(level "%s: " fmt "\n" , OHCI1394_DRIVER_NAME , ## args) 143printk(level "%s: " fmt "\n" , OHCI1394_DRIVER_NAME , ## args)
@@ -733,7 +720,6 @@ static void insert_packet(struct ti_ohci *ohci,
733 pci_map_single(ohci->dev, packet->data, 720 pci_map_single(ohci->dev, packet->data,
734 packet->data_size, 721 packet->data_size,
735 PCI_DMA_TODEVICE)); 722 PCI_DMA_TODEVICE));
736 OHCI_DMA_ALLOC("single, block transmit packet");
737 723
738 d->prg_cpu[idx]->end.branchAddress = 0; 724 d->prg_cpu[idx]->end.branchAddress = 0;
739 d->prg_cpu[idx]->end.status = 0; 725 d->prg_cpu[idx]->end.status = 0;
@@ -783,7 +769,6 @@ static void insert_packet(struct ti_ohci *ohci,
783 d->prg_cpu[idx]->end.address = cpu_to_le32( 769 d->prg_cpu[idx]->end.address = cpu_to_le32(
784 pci_map_single(ohci->dev, packet->data, 770 pci_map_single(ohci->dev, packet->data,
785 packet->data_size, PCI_DMA_TODEVICE)); 771 packet->data_size, PCI_DMA_TODEVICE));
786 OHCI_DMA_ALLOC("single, iso transmit packet");
787 772
788 d->prg_cpu[idx]->end.branchAddress = 0; 773 d->prg_cpu[idx]->end.branchAddress = 0;
789 d->prg_cpu[idx]->end.status = 0; 774 d->prg_cpu[idx]->end.status = 0;
@@ -2869,12 +2854,10 @@ static void dma_trm_tasklet (unsigned long data)
2869 list_del_init(&packet->driver_list); 2854 list_del_init(&packet->driver_list);
2870 hpsb_packet_sent(ohci->host, packet, ack); 2855 hpsb_packet_sent(ohci->host, packet, ack);
2871 2856
2872 if (datasize) { 2857 if (datasize)
2873 pci_unmap_single(ohci->dev, 2858 pci_unmap_single(ohci->dev,
2874 cpu_to_le32(d->prg_cpu[d->sent_ind]->end.address), 2859 cpu_to_le32(d->prg_cpu[d->sent_ind]->end.address),
2875 datasize, PCI_DMA_TODEVICE); 2860 datasize, PCI_DMA_TODEVICE);
2876 OHCI_DMA_FREE("single Xmit data packet");
2877 }
2878 2861
2879 d->sent_ind = (d->sent_ind+1)%d->num_desc; 2862 d->sent_ind = (d->sent_ind+1)%d->num_desc;
2880 d->free_prgs++; 2863 d->free_prgs++;
@@ -2913,23 +2896,19 @@ static void free_dma_rcv_ctx(struct dma_rcv_ctx *d)
2913 2896
2914 if (d->buf_cpu) { 2897 if (d->buf_cpu) {
2915 for (i=0; i<d->num_desc; i++) 2898 for (i=0; i<d->num_desc; i++)
2916 if (d->buf_cpu[i] && d->buf_bus[i]) { 2899 if (d->buf_cpu[i] && d->buf_bus[i])
2917 pci_free_consistent( 2900 pci_free_consistent(
2918 ohci->dev, d->buf_size, 2901 ohci->dev, d->buf_size,
2919 d->buf_cpu[i], d->buf_bus[i]); 2902 d->buf_cpu[i], d->buf_bus[i]);
2920 OHCI_DMA_FREE("consistent dma_rcv buf[%d]", i);
2921 }
2922 kfree(d->buf_cpu); 2903 kfree(d->buf_cpu);
2923 kfree(d->buf_bus); 2904 kfree(d->buf_bus);
2924 } 2905 }
2925 if (d->prg_cpu) { 2906 if (d->prg_cpu) {
2926 for (i=0; i<d->num_desc; i++) 2907 for (i=0; i<d->num_desc; i++)
2927 if (d->prg_cpu[i] && d->prg_bus[i]) { 2908 if (d->prg_cpu[i] && d->prg_bus[i])
2928 pci_pool_free(d->prg_pool, d->prg_cpu[i], d->prg_bus[i]); 2909 pci_pool_free(d->prg_pool, d->prg_cpu[i],
2929 OHCI_DMA_FREE("consistent dma_rcv prg[%d]", i); 2910 d->prg_bus[i]);
2930 }
2931 pci_pool_destroy(d->prg_pool); 2911 pci_pool_destroy(d->prg_pool);
2932 OHCI_DMA_FREE("dma_rcv prg pool");
2933 kfree(d->prg_cpu); 2912 kfree(d->prg_cpu);
2934 kfree(d->prg_bus); 2913 kfree(d->prg_bus);
2935 } 2914 }
@@ -2998,13 +2977,10 @@ alloc_dma_rcv_ctx(struct ti_ohci *ohci, struct dma_rcv_ctx *d,
2998 } 2977 }
2999 num_allocs++; 2978 num_allocs++;
3000 2979
3001 OHCI_DMA_ALLOC("dma_rcv prg pool");
3002
3003 for (i=0; i<d->num_desc; i++) { 2980 for (i=0; i<d->num_desc; i++) {
3004 d->buf_cpu[i] = pci_alloc_consistent(ohci->dev, 2981 d->buf_cpu[i] = pci_alloc_consistent(ohci->dev,
3005 d->buf_size, 2982 d->buf_size,
3006 d->buf_bus+i); 2983 d->buf_bus+i);
3007 OHCI_DMA_ALLOC("consistent dma_rcv buf[%d]", i);
3008 2984
3009 if (d->buf_cpu[i] != NULL) { 2985 if (d->buf_cpu[i] != NULL) {
3010 memset(d->buf_cpu[i], 0, d->buf_size); 2986 memset(d->buf_cpu[i], 0, d->buf_size);
@@ -3016,7 +2992,6 @@ alloc_dma_rcv_ctx(struct ti_ohci *ohci, struct dma_rcv_ctx *d,
3016 } 2992 }
3017 2993
3018 d->prg_cpu[i] = pci_pool_alloc(d->prg_pool, GFP_KERNEL, d->prg_bus+i); 2994 d->prg_cpu[i] = pci_pool_alloc(d->prg_pool, GFP_KERNEL, d->prg_bus+i);
3019 OHCI_DMA_ALLOC("pool dma_rcv prg[%d]", i);
3020 2995
3021 if (d->prg_cpu[i] != NULL) { 2996 if (d->prg_cpu[i] != NULL) {
3022 memset(d->prg_cpu[i], 0, sizeof(struct dma_cmd)); 2997 memset(d->prg_cpu[i], 0, sizeof(struct dma_cmd));
@@ -3057,12 +3032,10 @@ static void free_dma_trm_ctx(struct dma_trm_ctx *d)
3057 3032
3058 if (d->prg_cpu) { 3033 if (d->prg_cpu) {
3059 for (i=0; i<d->num_desc; i++) 3034 for (i=0; i<d->num_desc; i++)
3060 if (d->prg_cpu[i] && d->prg_bus[i]) { 3035 if (d->prg_cpu[i] && d->prg_bus[i])
3061 pci_pool_free(d->prg_pool, d->prg_cpu[i], d->prg_bus[i]); 3036 pci_pool_free(d->prg_pool, d->prg_cpu[i],
3062 OHCI_DMA_FREE("pool dma_trm prg[%d]", i); 3037 d->prg_bus[i]);
3063 }
3064 pci_pool_destroy(d->prg_pool); 3038 pci_pool_destroy(d->prg_pool);
3065 OHCI_DMA_FREE("dma_trm prg pool");
3066 kfree(d->prg_cpu); 3039 kfree(d->prg_cpu);
3067 kfree(d->prg_bus); 3040 kfree(d->prg_bus);
3068 } 3041 }
@@ -3108,11 +3081,8 @@ alloc_dma_trm_ctx(struct ti_ohci *ohci, struct dma_trm_ctx *d,
3108 } 3081 }
3109 num_allocs++; 3082 num_allocs++;
3110 3083
3111 OHCI_DMA_ALLOC("dma_rcv prg pool");
3112
3113 for (i = 0; i < d->num_desc; i++) { 3084 for (i = 0; i < d->num_desc; i++) {
3114 d->prg_cpu[i] = pci_pool_alloc(d->prg_pool, GFP_KERNEL, d->prg_bus+i); 3085 d->prg_cpu[i] = pci_pool_alloc(d->prg_pool, GFP_KERNEL, d->prg_bus+i);
3115 OHCI_DMA_ALLOC("pool dma_trm prg[%d]", i);
3116 3086
3117 if (d->prg_cpu[i] != NULL) { 3087 if (d->prg_cpu[i] != NULL) {
3118 memset(d->prg_cpu[i], 0, sizeof(struct at_dma_prg)); 3088 memset(d->prg_cpu[i], 0, sizeof(struct at_dma_prg));
@@ -3294,7 +3264,6 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
3294 ohci->csr_config_rom_cpu = 3264 ohci->csr_config_rom_cpu =
3295 pci_alloc_consistent(ohci->dev, OHCI_CONFIG_ROM_LEN, 3265 pci_alloc_consistent(ohci->dev, OHCI_CONFIG_ROM_LEN,
3296 &ohci->csr_config_rom_bus); 3266 &ohci->csr_config_rom_bus);
3297 OHCI_DMA_ALLOC("consistent csr_config_rom");
3298 if (ohci->csr_config_rom_cpu == NULL) 3267 if (ohci->csr_config_rom_cpu == NULL)
3299 FAIL(-ENOMEM, "Failed to allocate buffer config rom"); 3268 FAIL(-ENOMEM, "Failed to allocate buffer config rom");
3300 ohci->init_state = OHCI_INIT_HAVE_CONFIG_ROM_BUFFER; 3269 ohci->init_state = OHCI_INIT_HAVE_CONFIG_ROM_BUFFER;
@@ -3303,8 +3272,6 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
3303 ohci->selfid_buf_cpu = 3272 ohci->selfid_buf_cpu =
3304 pci_alloc_consistent(ohci->dev, OHCI1394_SI_DMA_BUF_SIZE, 3273 pci_alloc_consistent(ohci->dev, OHCI1394_SI_DMA_BUF_SIZE,
3305 &ohci->selfid_buf_bus); 3274 &ohci->selfid_buf_bus);
3306 OHCI_DMA_ALLOC("consistent selfid_buf");
3307
3308 if (ohci->selfid_buf_cpu == NULL) 3275 if (ohci->selfid_buf_cpu == NULL)
3309 FAIL(-ENOMEM, "Failed to allocate DMA buffer for self-id packets"); 3276 FAIL(-ENOMEM, "Failed to allocate DMA buffer for self-id packets");
3310 ohci->init_state = OHCI_INIT_HAVE_SELFID_BUFFER; 3277 ohci->init_state = OHCI_INIT_HAVE_SELFID_BUFFER;
@@ -3490,13 +3457,11 @@ static void ohci1394_pci_remove(struct pci_dev *pdev)
3490 pci_free_consistent(ohci->dev, OHCI1394_SI_DMA_BUF_SIZE, 3457 pci_free_consistent(ohci->dev, OHCI1394_SI_DMA_BUF_SIZE,
3491 ohci->selfid_buf_cpu, 3458 ohci->selfid_buf_cpu,
3492 ohci->selfid_buf_bus); 3459 ohci->selfid_buf_bus);
3493 OHCI_DMA_FREE("consistent selfid_buf");
3494 3460
3495 case OHCI_INIT_HAVE_CONFIG_ROM_BUFFER: 3461 case OHCI_INIT_HAVE_CONFIG_ROM_BUFFER:
3496 pci_free_consistent(ohci->dev, OHCI_CONFIG_ROM_LEN, 3462 pci_free_consistent(ohci->dev, OHCI_CONFIG_ROM_LEN,
3497 ohci->csr_config_rom_cpu, 3463 ohci->csr_config_rom_cpu,
3498 ohci->csr_config_rom_bus); 3464 ohci->csr_config_rom_bus);
3499 OHCI_DMA_FREE("consistent csr_config_rom");
3500 3465
3501 case OHCI_INIT_HAVE_IOMAPPING: 3466 case OHCI_INIT_HAVE_IOMAPPING:
3502 iounmap(ohci->registers); 3467 iounmap(ohci->registers);