Commit 18397944 authored by David S. Miller's avatar David S. Miller

[SPARC64]: First cut at SUN4V PCI IOMMU handling.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 164c220f
...@@ -562,9 +562,9 @@ static int pci_4u_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int n ...@@ -562,9 +562,9 @@ static int pci_4u_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int n
/* Fast path single entry scatterlists. */ /* Fast path single entry scatterlists. */
if (nelems == 1) { if (nelems == 1) {
sglist->dma_address = sglist->dma_address =
pci_map_single(pdev, pci_4u_map_single(pdev,
(page_address(sglist->page) + sglist->offset), (page_address(sglist->page) + sglist->offset),
sglist->length, direction); sglist->length, direction);
if (unlikely(sglist->dma_address == PCI_DMA_ERROR_CODE)) if (unlikely(sglist->dma_address == PCI_DMA_ERROR_CODE))
return 0; return 0;
sglist->dma_length = sglist->length; sglist->dma_length = sglist->length;
......
This diff is collapsed.
...@@ -16,6 +16,10 @@ extern unsigned long pci_sun4v_iommu_map(unsigned long devhandle, ...@@ -16,6 +16,10 @@ extern unsigned long pci_sun4v_iommu_map(unsigned long devhandle,
extern unsigned long pci_sun4v_iommu_demap(unsigned long devhandle, extern unsigned long pci_sun4v_iommu_demap(unsigned long devhandle,
unsigned long tsbid, unsigned long tsbid,
unsigned long num_ttes); unsigned long num_ttes);
extern unsigned long pci_sun4v_iommu_getmap(unsigned long devhandle,
unsigned long tsbid,
unsigned long *io_attributes,
unsigned long *real_address);
extern unsigned long pci_sun4v_config_get(unsigned long devhandle, extern unsigned long pci_sun4v_config_get(unsigned long devhandle,
unsigned long pci_device, unsigned long pci_device,
unsigned long config_offset, unsigned long config_offset,
......
...@@ -12,9 +12,7 @@ ...@@ -12,9 +12,7 @@
*/ */
.globl pci_sun4v_devino_to_sysino .globl pci_sun4v_devino_to_sysino
pci_sun4v_devino_to_sysino: pci_sun4v_devino_to_sysino:
mov %o1, %o2 mov HV_FAST_INTR_DEVINO2SYSINO, %o5
mov %o0, %o1
mov HV_FAST_INTR_DEVINO2SYSINO, %o0
ta HV_FAST_TRAP ta HV_FAST_TRAP
retl retl
mov %o1, %o0 mov %o1, %o0
...@@ -29,12 +27,7 @@ pci_sun4v_devino_to_sysino: ...@@ -29,12 +27,7 @@ pci_sun4v_devino_to_sysino:
*/ */
.globl pci_sun4v_iommu_map .globl pci_sun4v_iommu_map
pci_sun4v_iommu_map: pci_sun4v_iommu_map:
mov %o4, %o5 mov HV_FAST_PCI_IOMMU_MAP, %o5
mov %o3, %o4
mov %o2, %o3
mov %o1, %o2
mov %o0, %o1
mov HV_FAST_PCI_IOMMU_MAP, %o0
ta HV_FAST_TRAP ta HV_FAST_TRAP
retl retl
mov %o1, %o0 mov %o1, %o0
...@@ -47,14 +40,28 @@ pci_sun4v_iommu_map: ...@@ -47,14 +40,28 @@ pci_sun4v_iommu_map:
*/ */
.globl pci_sun4v_iommu_demap .globl pci_sun4v_iommu_demap
pci_sun4v_iommu_demap: pci_sun4v_iommu_demap:
mov %o2, %o3 mov HV_FAST_PCI_IOMMU_DEMAP, %o5
mov %o1, %o2
mov %o0, %o1
mov HV_FAST_PCI_IOMMU_DEMAP, %o0
ta HV_FAST_TRAP ta HV_FAST_TRAP
retl retl
mov %o1, %o0 mov %o1, %o0
/* %o0: devhandle
* %o1: tsbid
* %o2: &io_attributes
* %o3: &real_address
*
* returns %o0: status
*/
.globl pci_sun4v_iommu_getmap
pci_sun4v_iommu_getmap:
mov %o2, %o4
mov HV_FAST_PCI_IOMMU_GETMAP, %o5
ta HV_FAST_TRAP
stx %o1, [%o4]
stx %o2, [%o3]
retl
mov %o0, %o0
/* %o0: devhandle /* %o0: devhandle
* %o1: pci_device * %o1: pci_device
* %o2: pci_config_offset * %o2: pci_config_offset
...@@ -67,11 +74,7 @@ pci_sun4v_iommu_demap: ...@@ -67,11 +74,7 @@ pci_sun4v_iommu_demap:
*/ */
.globl pci_sun4v_config_get .globl pci_sun4v_config_get
pci_sun4v_config_get: pci_sun4v_config_get:
mov %o3, %o4 mov HV_FAST_PCI_CONFIG_GET, %o5
mov %o2, %o3
mov %o1, %o2
mov %o0, %o1
mov HV_FAST_PCI_CONFIG_GET, %o0
ta HV_FAST_TRAP ta HV_FAST_TRAP
brnz,a,pn %o1, 1f brnz,a,pn %o1, 1f
mov -1, %o2 mov -1, %o2
...@@ -91,14 +94,9 @@ pci_sun4v_config_get: ...@@ -91,14 +94,9 @@ pci_sun4v_config_get:
*/ */
.globl pci_sun4v_config_put .globl pci_sun4v_config_put
pci_sun4v_config_put: pci_sun4v_config_put:
mov %o3, %o4 mov HV_FAST_PCI_CONFIG_PUT, %o5
mov %o2, %o3
mov %o1, %o2
mov %o0, %o1
mov HV_FAST_PCI_CONFIG_PUT, %o0
ta HV_FAST_TRAP ta HV_FAST_TRAP
brnz,a,pn %o1, 1f brnz,a,pn %o1, 1f
mov -1, %o1 mov -1, %o1
1: retl 1: retl
mov %o1, %o0 mov %o1, %o0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment