aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/pci_sun4v.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-04-27 00:08:21 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-27 00:08:21 -0400
commit16ce82d846f2e6b652a064f91c5019cfe8682be4 (patch)
tree9100d2baface8ec8d5b7911e00e093fd177cb9e4 /arch/sparc64/kernel/pci_sun4v.c
parentee5ac9ddf2ea13be2418ac7d0ce5a930e78af013 (diff)
[SPARC64]: Convert PCI over to generic struct iommu/strbuf.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/pci_sun4v.c')
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index 0e99808f212..94295c21932 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -29,7 +29,7 @@
29 29
30#define PGLIST_NENTS (PAGE_SIZE / sizeof(u64)) 30#define PGLIST_NENTS (PAGE_SIZE / sizeof(u64))
31 31
32struct pci_iommu_batch { 32struct iommu_batch {
33 struct pci_dev *pdev; /* Device mapping is for. */ 33 struct pci_dev *pdev; /* Device mapping is for. */
34 unsigned long prot; /* IOMMU page protections */ 34 unsigned long prot; /* IOMMU page protections */
35 unsigned long entry; /* Index into IOTSB. */ 35 unsigned long entry; /* Index into IOTSB. */
@@ -37,12 +37,12 @@ struct pci_iommu_batch {
37 unsigned long npages; /* Number of pages in list. */ 37 unsigned long npages; /* Number of pages in list. */
38}; 38};
39 39
40static DEFINE_PER_CPU(struct pci_iommu_batch, pci_iommu_batch); 40static DEFINE_PER_CPU(struct iommu_batch, pci_iommu_batch);
41 41
42/* Interrupts must be disabled. */ 42/* Interrupts must be disabled. */
43static inline void pci_iommu_batch_start(struct pci_dev *pdev, unsigned long prot, unsigned long entry) 43static inline void pci_iommu_batch_start(struct pci_dev *pdev, unsigned long prot, unsigned long entry)
44{ 44{
45 struct pci_iommu_batch *p = &__get_cpu_var(pci_iommu_batch); 45 struct iommu_batch *p = &__get_cpu_var(pci_iommu_batch);
46 46
47 p->pdev = pdev; 47 p->pdev = pdev;
48 p->prot = prot; 48 p->prot = prot;
@@ -51,7 +51,7 @@ static inline void pci_iommu_batch_start(struct pci_dev *pdev, unsigned long pro
51} 51}
52 52
53/* Interrupts must be disabled. */ 53/* Interrupts must be disabled. */
54static long pci_iommu_batch_flush(struct pci_iommu_batch *p) 54static long pci_iommu_batch_flush(struct iommu_batch *p)
55{ 55{
56 struct pci_pbm_info *pbm = p->pdev->dev.archdata.host_controller; 56 struct pci_pbm_info *pbm = p->pdev->dev.archdata.host_controller;
57 unsigned long devhandle = pbm->devhandle; 57 unsigned long devhandle = pbm->devhandle;
@@ -89,7 +89,7 @@ static long pci_iommu_batch_flush(struct pci_iommu_batch *p)
89/* Interrupts must be disabled. */ 89/* Interrupts must be disabled. */
90static inline long pci_iommu_batch_add(u64 phys_page) 90static inline long pci_iommu_batch_add(u64 phys_page)
91{ 91{
92 struct pci_iommu_batch *p = &__get_cpu_var(pci_iommu_batch); 92 struct iommu_batch *p = &__get_cpu_var(pci_iommu_batch);
93 93
94 BUG_ON(p->npages >= PGLIST_NENTS); 94 BUG_ON(p->npages >= PGLIST_NENTS);
95 95
@@ -103,7 +103,7 @@ static inline long pci_iommu_batch_add(u64 phys_page)
103/* Interrupts must be disabled. */ 103/* Interrupts must be disabled. */
104static inline long pci_iommu_batch_end(void) 104static inline long pci_iommu_batch_end(void)
105{ 105{
106 struct pci_iommu_batch *p = &__get_cpu_var(pci_iommu_batch); 106 struct iommu_batch *p = &__get_cpu_var(pci_iommu_batch);
107 107
108 BUG_ON(p->npages >= PGLIST_NENTS); 108 BUG_ON(p->npages >= PGLIST_NENTS);
109 109
@@ -159,7 +159,7 @@ static void pci_arena_free(struct iommu_arena *arena, unsigned long base, unsign
159 159
160static void *pci_4v_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp, gfp_t gfp) 160static void *pci_4v_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp, gfp_t gfp)
161{ 161{
162 struct pci_iommu *iommu; 162 struct iommu *iommu;
163 unsigned long flags, order, first_page, npages, n; 163 unsigned long flags, order, first_page, npages, n;
164 void *ret; 164 void *ret;
165 long entry; 165 long entry;
@@ -225,7 +225,7 @@ arena_alloc_fail:
225static void pci_4v_free_consistent(struct pci_dev *pdev, size_t size, void *cpu, dma_addr_t dvma) 225static void pci_4v_free_consistent(struct pci_dev *pdev, size_t size, void *cpu, dma_addr_t dvma)
226{ 226{
227 struct pci_pbm_info *pbm; 227 struct pci_pbm_info *pbm;
228 struct pci_iommu *iommu; 228 struct iommu *iommu;
229 unsigned long flags, order, npages, entry; 229 unsigned long flags, order, npages, entry;
230 u32 devhandle; 230 u32 devhandle;
231 231
@@ -257,7 +257,7 @@ static void pci_4v_free_consistent(struct pci_dev *pdev, size_t size, void *cpu,
257 257
258static dma_addr_t pci_4v_map_single(struct pci_dev *pdev, void *ptr, size_t sz, int direction) 258static dma_addr_t pci_4v_map_single(struct pci_dev *pdev, void *ptr, size_t sz, int direction)
259{ 259{
260 struct pci_iommu *iommu; 260 struct iommu *iommu;
261 unsigned long flags, npages, oaddr; 261 unsigned long flags, npages, oaddr;
262 unsigned long i, base_paddr; 262 unsigned long i, base_paddr;
263 u32 bus_addr, ret; 263 u32 bus_addr, ret;
@@ -321,7 +321,7 @@ iommu_map_fail:
321static void pci_4v_unmap_single(struct pci_dev *pdev, dma_addr_t bus_addr, size_t sz, int direction) 321static void pci_4v_unmap_single(struct pci_dev *pdev, dma_addr_t bus_addr, size_t sz, int direction)
322{ 322{
323 struct pci_pbm_info *pbm; 323 struct pci_pbm_info *pbm;
324 struct pci_iommu *iommu; 324 struct iommu *iommu;
325 unsigned long flags, npages; 325 unsigned long flags, npages;
326 long entry; 326 long entry;
327 u32 devhandle; 327 u32 devhandle;
@@ -456,7 +456,7 @@ iommu_map_failed:
456 456
457static int pci_4v_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction) 457static int pci_4v_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction)
458{ 458{
459 struct pci_iommu *iommu; 459 struct iommu *iommu;
460 unsigned long flags, npages, prot; 460 unsigned long flags, npages, prot;
461 u32 dma_base; 461 u32 dma_base;
462 struct scatterlist *sgtmp; 462 struct scatterlist *sgtmp;
@@ -532,7 +532,7 @@ iommu_map_failed:
532static void pci_4v_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction) 532static void pci_4v_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction)
533{ 533{
534 struct pci_pbm_info *pbm; 534 struct pci_pbm_info *pbm;
535 struct pci_iommu *iommu; 535 struct iommu *iommu;
536 unsigned long flags, i, npages; 536 unsigned long flags, i, npages;
537 long entry; 537 long entry;
538 u32 devhandle, bus_addr; 538 u32 devhandle, bus_addr;
@@ -705,7 +705,7 @@ static void pci_sun4v_scan_bus(struct pci_controller_info *p)
705} 705}
706 706
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 iommu *iommu)
709{ 709{
710 struct iommu_arena *arena = &iommu->arena; 710 struct iommu_arena *arena = &iommu->arena;
711 unsigned long i, cnt = 0; 711 unsigned long i, cnt = 0;
@@ -734,7 +734,7 @@ static unsigned long probe_existing_entries(struct pci_pbm_info *pbm,
734 734
735static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm) 735static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
736{ 736{
737 struct pci_iommu *iommu = pbm->iommu; 737 struct iommu *iommu = pbm->iommu;
738 struct property *prop; 738 struct property *prop;
739 unsigned long num_tsb_entries, sz; 739 unsigned long num_tsb_entries, sz;
740 u32 vdma[2], dma_mask, dma_offset; 740 u32 vdma[2], dma_mask, dma_offset;
@@ -1279,7 +1279,7 @@ static void pci_sun4v_pbm_init(struct pci_controller_info *p, struct device_node
1279void sun4v_pci_init(struct device_node *dp, char *model_name) 1279void sun4v_pci_init(struct device_node *dp, char *model_name)
1280{ 1280{
1281 struct pci_controller_info *p; 1281 struct pci_controller_info *p;
1282 struct pci_iommu *iommu; 1282 struct iommu *iommu;
1283 struct property *prop; 1283 struct property *prop;
1284 struct linux_prom64_registers *regs; 1284 struct linux_prom64_registers *regs;
1285 u32 devhandle; 1285 u32 devhandle;
@@ -1319,13 +1319,13 @@ void sun4v_pci_init(struct device_node *dp, char *model_name)
1319 if (!p) 1319 if (!p)
1320 goto fatal_memory_error; 1320 goto fatal_memory_error;
1321 1321
1322 iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC); 1322 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC);
1323 if (!iommu) 1323 if (!iommu)
1324 goto fatal_memory_error; 1324 goto fatal_memory_error;
1325 1325
1326 p->pbm_A.iommu = iommu; 1326 p->pbm_A.iommu = iommu;
1327 1327
1328 iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC); 1328 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC);
1329 if (!iommu) 1329 if (!iommu)
1330 goto fatal_memory_error; 1330 goto fatal_memory_error;
1331 1331