diff options
Diffstat (limited to 'arch/powerpc/platforms/powernv/pci.c')
-rw-r--r-- | arch/powerpc/platforms/powernv/pci.c | 48 |
1 files changed, 3 insertions, 45 deletions
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index 861e185483fe..55dfca844ddf 100644 --- a/arch/powerpc/platforms/powernv/pci.c +++ b/arch/powerpc/platforms/powernv/pci.c | |||
@@ -329,48 +329,6 @@ struct pci_ops pnv_pci_ops = { | |||
329 | .write = pnv_pci_write_config, | 329 | .write = pnv_pci_write_config, |
330 | }; | 330 | }; |
331 | 331 | ||
332 | |||
333 | static void pnv_tce_invalidate(struct iommu_table *tbl, | ||
334 | u64 *startp, u64 *endp) | ||
335 | { | ||
336 | u64 __iomem *invalidate = (u64 __iomem *)tbl->it_index; | ||
337 | unsigned long start, end, inc; | ||
338 | |||
339 | start = __pa(startp); | ||
340 | end = __pa(endp); | ||
341 | |||
342 | |||
343 | /* BML uses this case for p6/p7/galaxy2: Shift addr and put in node */ | ||
344 | if (tbl->it_busno) { | ||
345 | start <<= 12; | ||
346 | end <<= 12; | ||
347 | inc = 128 << 12; | ||
348 | start |= tbl->it_busno; | ||
349 | end |= tbl->it_busno; | ||
350 | } | ||
351 | /* p7ioc-style invalidation, 2 TCEs per write */ | ||
352 | else if (tbl->it_type & TCE_PCI_SWINV_PAIR) { | ||
353 | start |= (1ull << 63); | ||
354 | end |= (1ull << 63); | ||
355 | inc = 16; | ||
356 | } | ||
357 | /* Default (older HW) */ | ||
358 | else | ||
359 | inc = 128; | ||
360 | |||
361 | end |= inc - 1; /* round up end to be different than start */ | ||
362 | |||
363 | mb(); /* Ensure above stores are visible */ | ||
364 | while (start <= end) { | ||
365 | __raw_writeq(start, invalidate); | ||
366 | start += inc; | ||
367 | } | ||
368 | /* The iommu layer will do another mb() for us on build() and | ||
369 | * we don't care on free() | ||
370 | */ | ||
371 | } | ||
372 | |||
373 | |||
374 | static int pnv_tce_build(struct iommu_table *tbl, long index, long npages, | 332 | static int pnv_tce_build(struct iommu_table *tbl, long index, long npages, |
375 | unsigned long uaddr, enum dma_data_direction direction, | 333 | unsigned long uaddr, enum dma_data_direction direction, |
376 | struct dma_attrs *attrs) | 334 | struct dma_attrs *attrs) |
@@ -395,7 +353,7 @@ static int pnv_tce_build(struct iommu_table *tbl, long index, long npages, | |||
395 | * of flags if that becomes the case | 353 | * of flags if that becomes the case |
396 | */ | 354 | */ |
397 | if (tbl->it_type & TCE_PCI_SWINV_CREATE) | 355 | if (tbl->it_type & TCE_PCI_SWINV_CREATE) |
398 | pnv_tce_invalidate(tbl, tces, tcep - 1); | 356 | pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1); |
399 | 357 | ||
400 | return 0; | 358 | return 0; |
401 | } | 359 | } |
@@ -409,8 +367,8 @@ static void pnv_tce_free(struct iommu_table *tbl, long index, long npages) | |||
409 | while (npages--) | 367 | while (npages--) |
410 | *(tcep++) = 0; | 368 | *(tcep++) = 0; |
411 | 369 | ||
412 | if (tbl->it_type & TCE_PCI_SWINV_FREE) | 370 | if (tbl->it_type & TCE_PCI_SWINV_CREATE) |
413 | pnv_tce_invalidate(tbl, tces, tcep - 1); | 371 | pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1); |
414 | } | 372 | } |
415 | 373 | ||
416 | static unsigned long pnv_tce_get(struct iommu_table *tbl, long index) | 374 | static unsigned long pnv_tce_get(struct iommu_table *tbl, long index) |