aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sparc64/kernel/pci_iommu.c4
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c6
-rw-r--r--arch/sparc64/kernel/sbus.c12
-rw-r--r--include/asm-sparc64/iommu.h22
-rw-r--r--include/asm-sparc64/pbm.h8
5 files changed, 23 insertions, 29 deletions
diff --git a/arch/sparc64/kernel/pci_iommu.c b/arch/sparc64/kernel/pci_iommu.c
index aefdcc51045b..355ed0ba937a 100644
--- a/arch/sparc64/kernel/pci_iommu.c
+++ b/arch/sparc64/kernel/pci_iommu.c
@@ -77,7 +77,7 @@ static inline void iopte_make_dummy(struct pci_iommu *iommu, iopte_t *iopte)
77/* Based largely upon the ppc64 iommu allocator. */ 77/* Based largely upon the ppc64 iommu allocator. */
78static long pci_arena_alloc(struct pci_iommu *iommu, unsigned long npages) 78static long pci_arena_alloc(struct pci_iommu *iommu, unsigned long npages)
79{ 79{
80 struct pci_iommu_arena *arena = &iommu->arena; 80 struct iommu_arena *arena = &iommu->arena;
81 unsigned long n, i, start, end, limit; 81 unsigned long n, i, start, end, limit;
82 int pass; 82 int pass;
83 83
@@ -116,7 +116,7 @@ again:
116 return n; 116 return n;
117} 117}
118 118
119static void pci_arena_free(struct pci_iommu_arena *arena, unsigned long base, unsigned long npages) 119static void pci_arena_free(struct iommu_arena *arena, unsigned long base, unsigned long npages)
120{ 120{
121 unsigned long i; 121 unsigned long i;
122 122
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index 52bd4563492d..0e99808f2121 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -110,7 +110,7 @@ static inline long pci_iommu_batch_end(void)
110 return pci_iommu_batch_flush(p); 110 return pci_iommu_batch_flush(p);
111} 111}
112 112
113static long pci_arena_alloc(struct pci_iommu_arena *arena, unsigned long npages) 113static long pci_arena_alloc(struct iommu_arena *arena, unsigned long npages)
114{ 114{
115 unsigned long n, i, start, end, limit; 115 unsigned long n, i, start, end, limit;
116 int pass; 116 int pass;
@@ -149,7 +149,7 @@ again:
149 return n; 149 return n;
150} 150}
151 151
152static void pci_arena_free(struct pci_iommu_arena *arena, unsigned long base, unsigned long npages) 152static void pci_arena_free(struct iommu_arena *arena, unsigned long base, unsigned long npages)
153{ 153{
154 unsigned long i; 154 unsigned long i;
155 155
@@ -707,7 +707,7 @@ static void pci_sun4v_scan_bus(struct pci_controller_info *p)
707static unsigned long probe_existing_entries(struct pci_pbm_info *pbm, 707static unsigned long probe_existing_entries(struct pci_pbm_info *pbm,
708 struct pci_iommu *iommu) 708 struct pci_iommu *iommu)
709{ 709{
710 struct pci_iommu_arena *arena = &iommu->arena; 710 struct iommu_arena *arena = &iommu->arena;
711 unsigned long i, cnt = 0; 711 unsigned long i, cnt = 0;
712 u32 devhandle; 712 u32 devhandle;
713 713
diff --git a/arch/sparc64/kernel/sbus.c b/arch/sparc64/kernel/sbus.c
index d403f3df2dc2..279758d56b29 100644
--- a/arch/sparc64/kernel/sbus.c
+++ b/arch/sparc64/kernel/sbus.c
@@ -26,16 +26,10 @@
26 26
27#define MAP_BASE ((u32)0xc0000000) 27#define MAP_BASE ((u32)0xc0000000)
28 28
29struct sbus_iommu_arena {
30 unsigned long *map;
31 unsigned int hint;
32 unsigned int limit;
33};
34
35struct sbus_iommu { 29struct sbus_iommu {
36 spinlock_t lock; 30 spinlock_t lock;
37 31
38 struct sbus_iommu_arena arena; 32 struct iommu_arena arena;
39 33
40 iopte_t *page_table; 34 iopte_t *page_table;
41 unsigned long strbuf_regs; 35 unsigned long strbuf_regs;
@@ -123,7 +117,7 @@ static void sbus_strbuf_flush(struct sbus_iommu *iommu, u32 base, unsigned long
123/* Based largely upon the ppc64 iommu allocator. */ 117/* Based largely upon the ppc64 iommu allocator. */
124static long sbus_arena_alloc(struct sbus_iommu *iommu, unsigned long npages) 118static long sbus_arena_alloc(struct sbus_iommu *iommu, unsigned long npages)
125{ 119{
126 struct sbus_iommu_arena *arena = &iommu->arena; 120 struct iommu_arena *arena = &iommu->arena;
127 unsigned long n, i, start, end, limit; 121 unsigned long n, i, start, end, limit;
128 int pass; 122 int pass;
129 123
@@ -162,7 +156,7 @@ again:
162 return n; 156 return n;
163} 157}
164 158
165static void sbus_arena_free(struct sbus_iommu_arena *arena, unsigned long base, unsigned long npages) 159static void sbus_arena_free(struct iommu_arena *arena, unsigned long base, unsigned long npages)
166{ 160{
167 unsigned long i; 161 unsigned long i;
168 162
diff --git a/include/asm-sparc64/iommu.h b/include/asm-sparc64/iommu.h
index 0de7a3da79cd..d8d98f8f747f 100644
--- a/include/asm-sparc64/iommu.h
+++ b/include/asm-sparc64/iommu.h
@@ -7,15 +7,21 @@
7#define _SPARC64_IOMMU_H 7#define _SPARC64_IOMMU_H
8 8
9/* The format of an iopte in the page tables. */ 9/* The format of an iopte in the page tables. */
10#define IOPTE_VALID 0x8000000000000000UL /* IOPTE is valid */ 10#define IOPTE_VALID 0x8000000000000000UL
11#define IOPTE_64K 0x2000000000000000UL /* IOPTE is for 64k page */ 11#define IOPTE_64K 0x2000000000000000UL
12#define IOPTE_STBUF 0x1000000000000000UL /* DVMA can use streaming buffer */ 12#define IOPTE_STBUF 0x1000000000000000UL
13#define IOPTE_INTRA 0x0800000000000000UL /* SBUS slot-->slot direct transfer*/ 13#define IOPTE_INTRA 0x0800000000000000UL
14#define IOPTE_CONTEXT 0x07ff800000000000UL /* Context number */ 14#define IOPTE_CONTEXT 0x07ff800000000000UL
15#define IOPTE_PAGE 0x00007fffffffe000UL /* Physical page number (PA[42:13])*/ 15#define IOPTE_PAGE 0x00007fffffffe000UL
16#define IOPTE_CACHE 0x0000000000000010UL /* Cached (in UPA E-cache) */ 16#define IOPTE_CACHE 0x0000000000000010UL
17#define IOPTE_WRITE 0x0000000000000002UL /* Writeable */ 17#define IOPTE_WRITE 0x0000000000000002UL
18 18
19#define IOMMU_NUM_CTXS 4096 19#define IOMMU_NUM_CTXS 4096
20 20
21struct iommu_arena {
22 unsigned long *map;
23 unsigned int hint;
24 unsigned int limit;
25};
26
21#endif /* !(_SPARC_IOMMU_H) */ 27#endif /* !(_SPARC_IOMMU_H) */
diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h
index 9afcc06a575d..4a0ed2ea950c 100644
--- a/include/asm-sparc64/pbm.h
+++ b/include/asm-sparc64/pbm.h
@@ -35,19 +35,13 @@ struct pci_controller_info;
35/* This contains the software state necessary to drive a PCI 35/* This contains the software state necessary to drive a PCI
36 * controller's IOMMU. 36 * controller's IOMMU.
37 */ 37 */
38struct pci_iommu_arena {
39 unsigned long *map;
40 unsigned int hint;
41 unsigned int limit;
42};
43
44struct pci_iommu { 38struct pci_iommu {
45 /* This protects the controller's IOMMU and all 39 /* This protects the controller's IOMMU and all
46 * streaming buffers underneath. 40 * streaming buffers underneath.
47 */ 41 */
48 spinlock_t lock; 42 spinlock_t lock;
49 43
50 struct pci_iommu_arena arena; 44 struct iommu_arena arena;
51 45
52 /* IOMMU page table, a linear array of ioptes. */ 46 /* IOMMU page table, a linear array of ioptes. */
53 iopte_t *page_table; /* The page table itself. */ 47 iopte_t *page_table; /* The page table itself. */