Lines Matching +full:my +full:- +full:dma +full:- +full:window

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
42 #include <powerpc/pseries/phyp-hvcall.h>
55 static int papr_supports_stuff_tce = -1;
80 if (ofw_bus_has_prop(p, "ibm,my-dma-window")) in phyp_iommu_set_dma_tag()
82 if (ofw_bus_has_prop(p, "ibm,dma-window")) in phyp_iommu_set_dma_tag()
90 if (OF_getencprop(node, "ibm,#dma-size-cells", &dma_scells, in phyp_iommu_set_dma_tag()
92 OF_searchencprop(node, "#size-cells", &dma_scells, in phyp_iommu_set_dma_tag()
94 if (OF_getencprop(node, "ibm,#dma-address-cells", &dma_acells, in phyp_iommu_set_dma_tag()
96 OF_searchencprop(node, "#address-cells", &dma_acells, in phyp_iommu_set_dma_tag()
99 if (ofw_bus_has_prop(p, "ibm,my-dma-window")) in phyp_iommu_set_dma_tag()
100 OF_getencprop(node, "ibm,my-dma-window", dmawindow, in phyp_iommu_set_dma_tag()
103 OF_getencprop(node, "ibm,dma-window", dmawindow, in phyp_iommu_set_dma_tag()
106 struct dma_window *window = malloc(sizeof(struct dma_window), in phyp_iommu_set_dma_tag() local
108 window->start = 0; in phyp_iommu_set_dma_tag()
110 window->start <<= 32; in phyp_iommu_set_dma_tag()
111 window->start |= dmawindow[cell]; in phyp_iommu_set_dma_tag()
113 window->end = 0; in phyp_iommu_set_dma_tag()
115 window->end <<= 32; in phyp_iommu_set_dma_tag()
116 window->end |= dmawindow[cell]; in phyp_iommu_set_dma_tag()
118 window->end += window->start; in phyp_iommu_set_dma_tag()
122 window->map = NULL; in phyp_iommu_set_dma_tag()
124 if (i->iobn == dmawindow[0]) { in phyp_iommu_set_dma_tag()
125 window->map = i; in phyp_iommu_set_dma_tag()
130 if (window->map == NULL) { in phyp_iommu_set_dma_tag()
131 window->map = malloc(sizeof(struct iommu_map), M_PHYPIOMMU, in phyp_iommu_set_dma_tag()
133 window->map->iobn = dmawindow[0]; in phyp_iommu_set_dma_tag()
138 window->map->vmem = vmem_create("IOMMU mappings", PAGE_SIZE, in phyp_iommu_set_dma_tag()
139 trunc_page(VMEM_ADDR_MAX) - PAGE_SIZE, PAGE_SIZE, 0, in phyp_iommu_set_dma_tag()
141 SLIST_INSERT_HEAD(&iommu_map_head, window->map, entries); in phyp_iommu_set_dma_tag()
149 if (papr_supports_stuff_tce == -1) in phyp_iommu_set_dma_tag()
151 window->map->iobn, 0, 0, 0) == H_FUNCTION); in phyp_iommu_set_dma_tag()
153 bus_dma_tag_set_iommu(tag, bus, window); in phyp_iommu_set_dma_tag()
163 struct dma_window *window = cookie; in phyp_iommu_map() local
169 minaddr = window->start; in phyp_iommu_map()
170 maxaddr = window->end; in phyp_iommu_map()
180 error = vmem_xalloc(window->map->vmem, allocsize, in phyp_iommu_map()
195 error = phyp_hcall(H_PUT_TCE, window->map->iobn, in phyp_iommu_map()
219 struct dma_window *window = cookie; in phyp_iommu_unmap() local
231 phyp_hcall(H_STUFF_TCE, window->map->iobn, pageround, 0, in phyp_iommu_unmap()
235 phyp_hcall(H_PUT_TCE, window->map->iobn, in phyp_iommu_unmap()
239 vmem_xfree(window->map->vmem, pageround, roundedsize); in phyp_iommu_unmap()