Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/ttm drm/ttm: Handle io_mem_pfn, used b...



details:   https://anonhg.NetBSD.org/src/rev/85e17cbd45cd
branches:  trunk
changeset: 368576:85e17cbd45cd
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Jul 20 01:12:14 2022 +0000

description:
drm/ttm: Handle io_mem_pfn, used by amdgpu.

diffstat:

 sys/external/bsd/drm2/ttm/ttm_bo_vm.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r 4046d89ccaca -r 85e17cbd45cd sys/external/bsd/drm2/ttm/ttm_bo_vm.c
--- a/sys/external/bsd/drm2/ttm/ttm_bo_vm.c     Wed Jul 20 01:11:54 2022 +0000
+++ b/sys/external/bsd/drm2/ttm/ttm_bo_vm.c     Wed Jul 20 01:12:14 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ttm_bo_vm.c,v 1.20 2021/12/19 11:34:14 riastradh Exp $ */
+/*     $NetBSD: ttm_bo_vm.c,v 1.21 2022/07/20 01:12:14 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.20 2021/12/19 11:34:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.21 2022/07/20 01:12:14 riastradh Exp $");
 
 #include <sys/types.h>
 
@@ -192,14 +192,17 @@
                /* XXX PGO_ALLPAGES?  */
                if (pps[i] == PGO_DONTCARE)
                        continue;
-               if (bo->mem.bus.is_iomem) {
+               if (!bo->mem.bus.is_iomem) {
+                       paddr = page_to_phys(u.ttm->pages[startpage + i]);
+               } else if (bdev->driver->io_mem_pfn) {
+                       paddr = (*bdev->driver->io_mem_pfn)(bo, startpage + i)
+                           << PAGE_SHIFT;
+               } else {
                        const paddr_t cookie = bus_space_mmap(bdev->memt,
                            u.base, ((startpage + i) << PAGE_SHIFT), vm_prot,
                            0);
 
                        paddr = pmap_phys_address(cookie);
-               } else {
-                       paddr = page_to_phys(u.ttm->pages[startpage + i]);
                }
                ret = -pmap_enter(ufi->orig_map->pmap, vaddr + i*PAGE_SIZE,
                    paddr, vm_prot, (PMAP_CANFAIL | pgprot));



Home | Main Index | Thread Index | Old Index