return 0;
}
- STUB();
- return -ENOSYS;
-#ifdef notyet
+#ifdef __linux__
if (mem->io_size &&
!io_mapping_init_wc(&mem->iomap, mem->io_start, mem->io_size))
goto err_cleanup;
+#else
+ if (mem->io_size) {
+ paddr_t start, end;
+ struct vm_page *pgs;
+ int i;
+ bus_space_handle_t bsh;
+
+ start = atop(mem->io_start);
+ end = start + atop(mem->io_size);
+ uvm_page_physload(start, end, start, end, PHYSLOAD_DEVICE);
+
+ pgs = PHYS_TO_VM_PAGE(mem->io_start);
+ for (i = 0; i < atop(mem->io_size); i++)
+ atomic_setbits_int(&(pgs[i].pg_flags), PG_PMAP_WC);
+
+ if (bus_space_map(i915->bst, mem->io_start, mem->io_size,
+ BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE, &bsh))
+ panic("can't map stolen lmem");
+
+ mem->iomap.base = mem->io_start;
+ mem->iomap.size = mem->io_size;
+ mem->iomap.iomem = bus_space_vaddr(i915->bst, bsh);
+ }
+#endif
drm_dbg(&i915->drm, "Stolen Local memory IO start: %pa\n",
&mem->io_start);
drm_dbg(&i915->drm, "Stolen Local DSM base: %pa\n", &mem->region.start);
return 0;
-
+#ifdef __linux__
err_cleanup:
i915_gem_cleanup_stolen(mem->i915);
return err;
static int
region_lmem_init(struct intel_memory_region *mem)
{
- STUB();
- return -ENOSYS;
-#ifdef notyet
int ret;
+#ifdef __linux__
if (!io_mapping_init_wc(&mem->iomap,
mem->io_start,
mem->io_size))
return -EIO;
+#else
+ struct drm_i915_private *i915 = mem->i915;
+ paddr_t start, end;
+ struct vm_page *pgs;
+ int i;
+ bus_space_handle_t bsh;
+
+ start = atop(mem->io_start);
+ end = start + atop(mem->io_size);
+ uvm_page_physload(start, end, start, end, PHYSLOAD_DEVICE);
+
+ pgs = PHYS_TO_VM_PAGE(mem->io_start);
+ for (i = 0; i < atop(mem->io_size); i++)
+ atomic_setbits_int(&(pgs[i].pg_flags), PG_PMAP_WC);
+
+ if (bus_space_map(i915->bst, mem->io_start, mem->io_size,
+ BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE, &bsh))
+ panic("can't map lmem");
+
+ mem->iomap.base = mem->io_start;
+ mem->iomap.size = mem->io_size;
+ mem->iomap.iomem = bus_space_vaddr(i915->bst, bsh);
+#endif
ret = intel_region_ttm_init(mem);
if (ret)
return 0;
out_no_buddy:
+#ifdef __linux__
io_mapping_fini(&mem->iomap);
+#endif
return ret;
-#endif
}
static const struct intel_memory_region_ops intel_region_lmem_ops = {
const struct intel_memory_region_ops *ops;
-#ifdef notyet
struct io_mapping iomap;
-#endif
struct resource region;
resource_size_t io_start;