Source-Changes-HG archive

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

[src/uebayasi-xip]: src/sys/dev At device attachment, register the given bus ...



details:   https://anonhg.NetBSD.org/src/rev/b1d045d35ef5
branches:  uebayasi-xip
changeset: 751696:b1d045d35ef5
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Wed Apr 28 13:41:41 2010 +0000

description:
At device attachment, register the given bus address region as possible
"managed" region using the new bus_space_physload_device(9) API.

diffstat:

 sys/dev/flash.c    |  11 ++++++++++-
 sys/dev/flashvar.h |   3 ++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diffs (42 lines):

diff -r 01ed24957f03 -r b1d045d35ef5 sys/dev/flash.c
--- a/sys/dev/flash.c   Wed Apr 28 13:28:42 2010 +0000
+++ b/sys/dev/flash.c   Wed Apr 28 13:41:41 2010 +0000
@@ -1,4 +1,4 @@
-/*     $Id: flash.c,v 1.1.2.4 2010/02/28 05:03:58 uebayasi Exp $       */
+/*     $Id: flash.c,v 1.1.2.5 2010/04/28 13:41:41 uebayasi Exp $       */
 
 /*-
  * Copyright (c) 2010 Tsubai Masanari.  All rights reserved.
@@ -237,6 +237,15 @@
            sc->sc_size / 1024, sc->sc_wordsize * 8);
 #endif
 
+#ifdef XIP
+#ifndef __HAVE_BUS_SPACE_PHYSLOAD
+#error bus_space_physload_device(9) must be supported to use XIP!
+#else
+       sc->sc_phys = bus_space_physload_device(sc->sc_iot, sc->sc_addr, sc->sc_size,
+           PROT_READ | PROT_WRITE, BUS_SPACE_MAP_LINEAR);
+#endif
+#endif
+
        disk_init(&sc->sc_dkdev, device_xname(&sc->sc_dev), NULL);
        disk_attach(&sc->sc_dkdev);
 }
diff -r 01ed24957f03 -r b1d045d35ef5 sys/dev/flashvar.h
--- a/sys/dev/flashvar.h        Wed Apr 28 13:28:42 2010 +0000
+++ b/sys/dev/flashvar.h        Wed Apr 28 13:41:41 2010 +0000
@@ -1,4 +1,4 @@
-/*     $Id: flashvar.h,v 1.1.2.2 2010/02/24 01:19:37 uebayasi Exp $    */
+/*     $Id: flashvar.h,v 1.1.2.3 2010/04/28 13:41:41 uebayasi Exp $    */
 
 /*-
  * Copyright (c) 2010 Tsubai Masanari.  All rights reserved.
@@ -50,6 +50,7 @@
        int (*sc_program)(struct flash_softc *, u_long, u_long);
        int (*sc_eraseblk)(struct flash_softc *, u_long);
        struct flash_product *sc_product;
+       void *sc_phys;
 };
 
 int flash_map(struct flash_softc *, u_long);



Home | Main Index | Thread Index | Old Index