Source-Changes-HG archive

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

[src/uebayasi-xip]: src/sys When mounting a block device as XIP, pass registe...



details:   https://anonhg.NetBSD.org/src/rev/49c86684eded
branches:  uebayasi-xip
changeset: 751698:49c86684eded
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Wed Apr 28 16:33:47 2010 +0000

description:
When mounting a block device as XIP, pass registered struct vm_physseg
* as a cookie from the block device to the caller (== mount code).
struct vm_physseg * will be passed to XIP vnode pager
(genfs_do_getpages_xip()), then converted back to paddr_t.

(My future plan is to pass struct vm_physseg * back to the fault handler,
and to pmap_enter() as is.)

diffstat:

 sys/dev/flash.c             |   5 ++---
 sys/miscfs/genfs/genfs_io.c |  10 +++++++---
 sys/miscfs/specfs/specdev.h |   4 ++--
 sys/ufs/ffs/ffs_vfsops.c    |  12 ++++++------
 4 files changed, 17 insertions(+), 14 deletions(-)

diffs (108 lines):

diff -r f95f9e2ee2ab -r 49c86684eded sys/dev/flash.c
--- a/sys/dev/flash.c   Wed Apr 28 14:56:13 2010 +0000
+++ b/sys/dev/flash.c   Wed Apr 28 16:33:47 2010 +0000
@@ -1,4 +1,4 @@
-/*     $Id: flash.c,v 1.1.2.6 2010/04/28 14:56:13 uebayasi Exp $       */
+/*     $Id: flash.c,v 1.1.2.7 2010/04/28 16:33:47 uebayasi Exp $       */
 
 /*-
  * Copyright (c) 2010 Tsubai Masanari.  All rights reserved.
@@ -100,8 +100,7 @@
                if (sc->sc_addr == 0)
                        error = EINVAL;
                else
-                       *(paddr_t *)data = bus_space_mmap(sc->sc_iot,
-                           sc->sc_addr, 0, 0/* XXX prot */, BUS_SPACE_MAP_LINEAR);
+                       *(void **)data = sc->sc_phys;
                break;
 #endif
 
diff -r f95f9e2ee2ab -r 49c86684eded sys/miscfs/genfs/genfs_io.c
--- a/sys/miscfs/genfs/genfs_io.c       Wed Apr 28 14:56:13 2010 +0000
+++ b/sys/miscfs/genfs/genfs_io.c       Wed Apr 28 16:33:47 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: genfs_io.c,v 1.36.2.6 2010/03/23 01:58:13 uebayasi Exp $       */
+/*     $NetBSD: genfs_io.c,v 1.36.2.7 2010/04/28 16:33:47 uebayasi Exp $       */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.36.2.6 2010/03/23 01:58:13 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.36.2.7 2010/04/28 16:33:47 uebayasi Exp $");
 
 #include "opt_device_page.h"
 #include "opt_xip.h"
@@ -812,8 +812,12 @@
                        /* unallocated page is redirected to read-only zero-filled page */
                        phys_addr = uvm_pageofzero_xip_phys_addr();
                } else {
+                       struct vm_physseg *seg;
+
+                       seg = devvp->v_physseg;
+                       KASSERT(seg != NULL);
                        /* bus_space_mmap cookie -> paddr_t */
-                       phys_addr = pmap_phys_address(devvp->v_phys_addr) +
+                       phys_addr = pmap_phys_address(seg->start) +
                            (blkno << dev_bshift) +
                            (off - (lbn << fs_bshift));
                }
diff -r f95f9e2ee2ab -r 49c86684eded sys/miscfs/specfs/specdev.h
--- a/sys/miscfs/specfs/specdev.h       Wed Apr 28 14:56:13 2010 +0000
+++ b/sys/miscfs/specfs/specdev.h       Wed Apr 28 16:33:47 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: specdev.h,v 1.39.2.1 2010/03/23 01:58:13 uebayasi Exp $        */
+/*     $NetBSD: specdev.h,v 1.39.2.2 2010/04/28 16:33:47 uebayasi Exp $        */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
        u_int           sd_opencnt;
        u_int           sd_refcnt;
        dev_t           sd_rdev;
-       paddr_t         sd_phys_addr;   /* XIP */
+       void            *sd_physseg;    /* XIP */
 } specdev_t;
 
 /*
diff -r f95f9e2ee2ab -r 49c86684eded sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Wed Apr 28 14:56:13 2010 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Wed Apr 28 16:33:47 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.257.2.3 2010/03/23 01:58:14 uebayasi Exp $    */
+/*     $NetBSD: ffs_vfsops.c,v 1.257.2.4 2010/04/28 16:33:47 uebayasi Exp $    */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.257.2.3 2010/03/23 01:58:14 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.257.2.4 2010/04/28 16:33:47 uebayasi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1175,16 +1175,16 @@
        mp->mnt_flag |= MNT_LOCAL;
        mp->mnt_iflag |= IMNT_MPSAFE;
 #ifdef XIP
-       paddr_t phys_addr = 0;
+       void *physseg = 0;
        if (mp->mnt_flag & MNT_XIP) {
                if ((mp->mnt_flag & MNT_RDONLY) == 0)
                        printf("XIP needs read-only mount\n");
                else {
-                       if ((VOP_IOCTL(devvp, DIOCGPHYSADDR, &phys_addr, FREAD,
+                       if ((VOP_IOCTL(devvp, DIOCGPHYSADDR, &physseg, FREAD,
                            cred) == 0) &&
-                           phys_addr != 0) {
+                           physseg != NULL) {
                                mp->mnt_iflag |= IMNT_XIP;
-                               devvp->v_phys_addr = phys_addr; /* XXX */
+                               devvp->v_physseg = physseg;
                        } else
                                printf("device doesn't support DIOCGPHYSADDR\n");
                }



Home | Main Index | Thread Index | Old Index