[PATCH] x86-64: Fix build with !CONFIG_SWIOTLB

Linux Kernel Mailing List <[email protected]> Thu, 30 Jun 2005 22:45:27 -0700
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
tree 682da35ca7a0fcfa52b63cbd10a7307b666997b9
parent 51e31546a2fc46cb978da2ee0330a6a68f07541e
author Andi Kleen <[email protected]> Thu, 30 Jun 2005 15:47:48 +0200
committer Marcelo Tosatti <[email protected]> Fri, 01 Jul 2005 02:02:16 -0300

[PATCH] x86-64: Fix build with !CONFIG_SWIOTLB

Allow compilation without CONFIG_SWIOTLB

Pointed out by Tymm Twillman. I did the patch slightly differently
than his version.

Signed-off-by: Andi Kleen <[email protected]>

 arch/x86_64/kernel/pci-gart.c |    8 ++++++--
 include/asm-x86_64/pci.h      |    3 ++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
--- a/arch/x86_64/kernel/pci-gart.c
+++ b/arch/x86_64/kernel/pci-gart.c
@@ -47,6 +47,10 @@ int iommu_fullflush = 1;
 extern int fallback_aper_order;
 extern int fallback_aper_force;
 
+#ifdef CONFIG_SWIOTLB
+extern char *io_tlb_start, *io_tlb_end;
+#endif
+ 
 /* Allocation bitmap for the remapping area */ 
 static spinlock_t iommu_bitmap_lock = SPIN_LOCK_UNLOCKED;
 static unsigned long *iommu_gart_bitmap; /* guarded by iommu_bitmap_lock */
@@ -234,10 +238,10 @@ void pci_free_consistent(struct pci_dev 
 			 void *vaddr, dma_addr_t bus)
 {
 	unsigned long iommu_page;
- 	extern  char *io_tlb_start, *io_tlb_end;
- 
+
 	size = round_up(size, PAGE_SIZE); 
 #ifdef CONFIG_SWIOTLB
+	/* Overlap should not happen */
  	if (swiotlb && vaddr >= (void *)io_tlb_start &&
  	    vaddr < (void *)io_tlb_end) {
  		swiotlb_unmap_single (hwdev, bus, size, PCI_DMA_TODEVICE);
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h
--- a/include/asm-x86_64/pci.h
+++ b/include/asm-x86_64/pci.h
@@ -65,8 +65,9 @@ extern void *pci_alloc_consistent(struct
 extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,
 				void *vaddr, dma_addr_t dma_handle);
 
-#ifdef CONFIG_SWIOTLB
 extern int swiotlb; 
+
+#ifdef CONFIG_SWIOTLB
 extern dma_addr_t swiotlb_map_single (struct pci_dev *hwdev, void *ptr, size_t size, 
                                      int dir);
 extern void swiotlb_unmap_single (struct pci_dev *hwdev, dma_addr_t dev_addr,