Source-Changes-HG archive

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

[src/uebayasi-xip]: src/sys/dev Adapt to thew new pmap(9) interfaces.



details:   https://anonhg.NetBSD.org/src/rev/6fa1955554de
branches:  uebayasi-xip
changeset: 751826:6fa1955554de
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Sat Oct 30 08:51:10 2010 +0000

description:
Adapt to thew new pmap(9) interfaces.

Don't conditionalize few lines of code for modularity.  As suggested
by Chuck Silvers.

diffstat:

 sys/dev/xmd.c    |  22 ++++++----------------
 sys/dev/xmdvar.h |  36 ------------------------------------
 2 files changed, 6 insertions(+), 52 deletions(-)

diffs (121 lines):

diff -r 248c2072a25c -r 6fa1955554de sys/dev/xmd.c
--- a/sys/dev/xmd.c     Sat Oct 30 08:43:12 2010 +0000
+++ b/sys/dev/xmd.c     Sat Oct 30 08:51:10 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xmd.c,v 1.1.2.4 2010/08/28 16:27:02 uebayasi Exp $     */
+/*     $NetBSD: xmd.c,v 1.1.2.5 2010/10/30 08:51:10 uebayasi Exp $     */
 
 /*-
  * Copyright (c) 2010 Tsubai Masanari.  All rights reserved.
@@ -28,15 +28,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xmd.c,v 1.1.2.4 2010/08/28 16:27:02 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xmd.c,v 1.1.2.5 2010/10/30 08:51:10 uebayasi Exp $");
 
 #include "opt_xip.h"
 #include "opt_xmd.h"
 
-#ifndef XIP
-#error xmd(4) needs options XIP
-#endif
-
 #include <sys/param.h>
 #include <sys/bus.h>
 #include <sys/conf.h>
@@ -53,7 +49,7 @@
 
 #include <machine/vmparam.h>
 
-#include <dev/xmdvar.h>
+#include <uvm/uvm_extern.h>
 
 struct xmd_softc {
        vaddr_t sc_addr;
@@ -127,9 +123,7 @@
        sc->sc_addr = (vaddr_t)md_root_image;
        sc->sc_size = (size_t)md_root_size;
 
-#ifdef XIP
-       sc->sc_phys = xmd_machdep_physload(sc->sc_addr, sc->sc_size);
-#endif
+       sc->sc_phys = pmap_physload_device(sc->sc_addr, sc->sc_size, PROT_READ, 0);
 
        disk_init(&sc->sc_dkdev, device_xname(self), NULL);
        disk_attach(&sc->sc_dkdev);
@@ -159,9 +153,7 @@
        disk_detach(&sc->sc_dkdev);
        disk_destroy(&sc->sc_dkdev);
 
-#ifdef XIP
-       xmd_machdep_physunload(sc->sc_phys);
-#endif
+       pmap_physunload_device(sc->sc_phys);
 
        return 0;
 }
@@ -210,14 +202,12 @@
                return -1;
 
        switch (cmd) {
-#ifdef XIP
        case DIOCGPHYSSEG:
                if (sc->sc_phys == NULL)
                        error = EINVAL;
                else
                        *(void **)data = sc->sc_phys;
                break;
-#endif
 
        case DIOCGDINFO:
                *(struct disklabel *)data = *sc->sc_dkdev.dk_label;
@@ -261,7 +251,7 @@
        if ((u_int64_t)off >= sc->sc_size)
                return -1;
 
-       return xmd_machdep_mmap(sc->sc_addr, off, prot);
+       return pmap_mmap(sc->sc_addr, off);
 }
 
 static void
diff -r 248c2072a25c -r 6fa1955554de sys/dev/xmdvar.h
--- a/sys/dev/xmdvar.h  Sat Oct 30 08:43:12 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*     $NetBSD: xmdvar.h,v 1.1.2.1 2010/08/19 12:36:58 uebayasi Exp $  */
-
-/*-
- * Copyright (c) 2010 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _DEV_XMDVAR_H_
-#define _DEV_XMDVAR_H_
-
-paddr_t xmd_machdep_mmap(vaddr_t, off_t, int);
-void *xmd_machdep_physload(vaddr_t, size_t);
-void xmd_machdep_physunload(void *);
-
-#endif



Home | Main Index | Thread Index | Old Index