- prepared for kernel >= 2.6.13: link Module.symvers
[packages/xorg-driver-video-nvidia.git] / NVIDIA_kernel-1.0-6629-1175225.diff
1 diff -ru usr/src/nv/nv-linux.h usr/src/nv.1175225/nv-linux.h
2 --- usr/src/nv/nv-linux.h       2004-11-03 22:53:00.000000000 +0100
3 +++ usr/src/nv.1175225/nv-linux.h       2004-12-21 21:03:33.000000000 +0100
4 @@ -533,6 +533,7 @@
5   */
6  #if defined(CONFIG_SWIOTLB)
7  #define NV_SWIOTLB 1
8 +#define NV_SWIOTLB_MAX_RETRIES 16
9  extern int nv_swiotlb;
10  #endif
11  
12 @@ -950,10 +951,48 @@
13      sg_ptr->offset = (unsigned long)base & ~PAGE_MASK;
14      sg_ptr->length  = num_pages * PAGE_SIZE;
15  
16 +#if defined(NV_SWIOTLB)
17 +    i = NV_SWIOTLB_MAX_RETRIES;
18 +    do {
19 +        if (pci_map_sg(dev, sg_ptr, 1, PCI_DMA_BIDIRECTIONAL) == 0)
20 +            return 1;
21 +
22 +        if (sg_ptr->dma_address & ~PAGE_MASK)
23 +        {
24 +            struct scatterlist sg_tmp;
25 +            pci_unmap_sg(dev, sg_ptr, num_pages, PCI_DMA_BIDIRECTIONAL);
26 +
27 +            memset(&sg_tmp, 0, sizeof(struct scatterlist));
28 +            sg_tmp.page = sg_ptr->page;
29 +            sg_tmp.offset = sg_ptr->offset;
30 +            sg_tmp.length = 2048;
31 +
32 +            if (pci_map_sg(dev, &sg_tmp, 1, PCI_DMA_BIDIRECTIONAL) == 0)
33 +                return 1;
34 +
35 +            if (pci_map_sg(dev, sg_ptr, 1, PCI_DMA_BIDIRECTIONAL) == 0)
36 +            {
37 +                pci_unmap_sg(dev, &sg_tmp, num_pages, PCI_DMA_BIDIRECTIONAL);
38 +                return 1;
39 +            }
40 +
41 +            pci_unmap_sg(dev, &sg_tmp, num_pages, PCI_DMA_BIDIRECTIONAL);
42 +        }
43 +    } while (i-- && sg_ptr->dma_address & ~PAGE_MASK);
44 +#else
45      if (pci_map_sg(dev, sg_ptr, 1, PCI_DMA_BIDIRECTIONAL) == 0)
46      {
47          return 1;
48      }
49 +#endif
50 +
51 +    if (sg_ptr->dma_address & ~PAGE_MASK)
52 +    {
53 +        nv_printf(NV_DBG_ERRORS,
54 +            "NVRM: VM: nv_sg_map_buffer: failed to obtain aligned mapping\n");
55 +        pci_unmap_sg(dev, sg_ptr, num_pages, PCI_DMA_BIDIRECTIONAL);
56 +        return 1;
57 +    }
58  
59      NV_FIXUP_SWIOTLB_VIRT_ADDR_BUG(sg_ptr->dma_address);
60  
This page took 0.038698 seconds and 3 git commands to generate.