diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-powerpc/iommu.h | 22 | ||||
-rw-r--r-- | include/asm-powerpc/tce.h | 3 |
2 files changed, 22 insertions, 3 deletions
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h index a5e98641a2ae..39fad685ffab 100644 --- a/include/asm-powerpc/iommu.h +++ b/include/asm-powerpc/iommu.h | |||
@@ -22,17 +22,35 @@ | |||
22 | #define _ASM_IOMMU_H | 22 | #define _ASM_IOMMU_H |
23 | #ifdef __KERNEL__ | 23 | #ifdef __KERNEL__ |
24 | 24 | ||
25 | #include <asm/types.h> | 25 | #include <linux/compiler.h> |
26 | #include <linux/spinlock.h> | 26 | #include <linux/spinlock.h> |
27 | #include <linux/device.h> | 27 | #include <linux/device.h> |
28 | #include <linux/dma-mapping.h> | 28 | #include <linux/dma-mapping.h> |
29 | #include <asm/types.h> | ||
30 | #include <asm/bitops.h> | ||
31 | |||
32 | #define IOMMU_PAGE_SHIFT 12 | ||
33 | #define IOMMU_PAGE_SIZE (ASM_CONST(1) << IOMMU_PAGE_SHIFT) | ||
34 | #define IOMMU_PAGE_MASK (~((1 << IOMMU_PAGE_SHIFT) - 1)) | ||
35 | #define IOMMU_PAGE_ALIGN(addr) _ALIGN_UP(addr, IOMMU_PAGE_SIZE) | ||
36 | |||
37 | #ifndef __ASSEMBLY__ | ||
38 | |||
39 | /* Pure 2^n version of get_order */ | ||
40 | static __inline__ __attribute_const__ int get_iommu_order(unsigned long size) | ||
41 | { | ||
42 | return __ilog2((size - 1) >> IOMMU_PAGE_SHIFT) + 1; | ||
43 | } | ||
44 | |||
45 | #endif /* __ASSEMBLY__ */ | ||
46 | |||
29 | 47 | ||
30 | /* | 48 | /* |
31 | * IOMAP_MAX_ORDER defines the largest contiguous block | 49 | * IOMAP_MAX_ORDER defines the largest contiguous block |
32 | * of dma space we can get. IOMAP_MAX_ORDER = 13 | 50 | * of dma space we can get. IOMAP_MAX_ORDER = 13 |
33 | * allows up to 2**12 pages (4096 * 4096) = 16 MB | 51 | * allows up to 2**12 pages (4096 * 4096) = 16 MB |
34 | */ | 52 | */ |
35 | #define IOMAP_MAX_ORDER 13 | 53 | #define IOMAP_MAX_ORDER 13 |
36 | 54 | ||
37 | struct iommu_table { | 55 | struct iommu_table { |
38 | unsigned long it_busno; /* Bus number this table belongs to */ | 56 | unsigned long it_busno; /* Bus number this table belongs to */ |
diff --git a/include/asm-powerpc/tce.h b/include/asm-powerpc/tce.h index c9483adbf599..f663634cccc9 100644 --- a/include/asm-powerpc/tce.h +++ b/include/asm-powerpc/tce.h | |||
@@ -22,6 +22,8 @@ | |||
22 | #define _ASM_POWERPC_TCE_H | 22 | #define _ASM_POWERPC_TCE_H |
23 | #ifdef __KERNEL__ | 23 | #ifdef __KERNEL__ |
24 | 24 | ||
25 | #include <asm/iommu.h> | ||
26 | |||
25 | /* | 27 | /* |
26 | * Tces come in two formats, one for the virtual bus and a different | 28 | * Tces come in two formats, one for the virtual bus and a different |
27 | * format for PCI | 29 | * format for PCI |
@@ -33,7 +35,6 @@ | |||
33 | 35 | ||
34 | #define TCE_SHIFT 12 | 36 | #define TCE_SHIFT 12 |
35 | #define TCE_PAGE_SIZE (1 << TCE_SHIFT) | 37 | #define TCE_PAGE_SIZE (1 << TCE_SHIFT) |
36 | #define TCE_PAGE_FACTOR (PAGE_SHIFT - TCE_SHIFT) | ||
37 | 38 | ||
38 | #define TCE_ENTRY_SIZE 8 /* each TCE is 64 bits */ | 39 | #define TCE_ENTRY_SIZE 8 /* each TCE is 64 bits */ |
39 | 40 | ||