Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386 Move _i386_memio_unmap() into bus_machdep.c; t...



details:   https://anonhg.NetBSD.org/src/rev/6891a9917657
branches:  trunk
changeset: 509036:6891a9917657
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Apr 25 03:31:23 2001 +0000

description:
Move _i386_memio_unmap() into bus_machdep.c; the ACPI code wants it.

diffstat:

 sys/arch/i386/i386/bus_machdep.c     |  65 ++++++++++++++++++++++++++++++++-
 sys/arch/i386/i386/rbus_machdep.c    |  71 +-----------------------------------
 sys/arch/i386/include/bus.h          |   4 +-
 sys/arch/i386/include/rbus_machdep.h |   5 +--
 4 files changed, 69 insertions(+), 76 deletions(-)

diffs (201 lines):

diff -r 14b1c40315c8 -r 6891a9917657 sys/arch/i386/i386/bus_machdep.c
--- a/sys/arch/i386/i386/bus_machdep.c  Wed Apr 25 03:07:19 2001 +0000
+++ b/sys/arch/i386/i386/bus_machdep.c  Wed Apr 25 03:31:23 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_machdep.c,v 1.7 2001/04/24 04:30:58 thorpej Exp $  */
+/*     $NetBSD: bus_machdep.c,v 1.8 2001/04/25 03:31:23 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -319,6 +319,69 @@
        return 0;
 }
 
+/*
+ * void _i386_memio_unmap(bus_space_tag bst, bus_space_handle bsh,
+ *                        bus_size_t size, bus_addr_t *adrp)
+ *
+ *   This function unmaps memory- or io-space mapped by the function
+ *   _i386_memio_map().  This function works nearly as same as
+ *   i386_memio_unmap(), but this function does not ask kernel
+ *   built-in extents and returns physical address of the bus space,
+ *   for the convenience of the extra extent manager.
+ */
+void
+_i386_memio_unmap(t, bsh, size, adrp)
+       bus_space_tag_t t;
+       bus_space_handle_t bsh;
+       bus_size_t size;
+       bus_addr_t *adrp;
+{
+       u_long va, endva;
+       bus_addr_t bpa;
+
+       /*
+        * Find the correct extent and bus physical address.
+        */
+       if (t == I386_BUS_SPACE_IO) {
+               bpa = bsh;
+       } else if (t == I386_BUS_SPACE_MEM) {
+               if (bsh >= atdevbase && (bsh + size) <= (atdevbase + IOM_SIZE)) {
+                       bpa = (bus_addr_t)ISA_PHYSADDR(bsh);
+               } else {
+
+                       va = i386_trunc_page(bsh);
+                       endva = i386_round_page(bsh + size);
+
+#ifdef DIAGNOSTIC
+                       if (endva <= va) {
+                               panic("_i386_memio_unmap: overflow");
+                       }
+#endif
+
+#if __NetBSD_Version__ > 104050000
+                       if (pmap_extract(pmap_kernel(), va, &bpa) == FALSE) {
+                               panic("_i386_memio_unmap:"
+                                   "i386/rbus_machdep.c wrong virtual address");
+                       }
+                       bpa += (bsh & PGOFSET);
+#else
+                       bpa = pmap_extract(pmap_kernel(), va) + (bsh & PGOFSET);
+#endif
+
+                       /*
+                        * Free the kernel virtual mapping.
+                        */
+                       uvm_km_free(kernel_map, va, endva - va);
+               }
+       } else {
+               panic("_i386_memio_unmap: bad bus space tag");
+       }
+
+       if (adrp != NULL) {
+               *adrp = bpa;
+       }
+}
+
 void
 i386_memio_unmap(t, bsh, size)
        bus_space_tag_t t;
diff -r 14b1c40315c8 -r 6891a9917657 sys/arch/i386/i386/rbus_machdep.c
--- a/sys/arch/i386/i386/rbus_machdep.c Wed Apr 25 03:07:19 2001 +0000
+++ b/sys/arch/i386/i386/rbus_machdep.c Wed Apr 25 03:31:23 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rbus_machdep.c,v 1.10 2000/08/22 08:42:55 joda Exp $   */
+/*     $NetBSD: rbus_machdep.c,v 1.11 2001/04/25 03:31:23 thorpej Exp $        */
 
 /*
  * Copyright (c) 1999
@@ -53,75 +53,6 @@
 #include <arch/i386/pci/pci_addr_fixup.h>
 #endif
 
-/*
- * void _i386_memio_unmap(bus_space_tag bst, bus_space_handle bsh,
- *                        bus_size_t size, bus_addr_t *adrp)
- *
- *   This function unmaps memory- or io-space mapped by the function
- *   _i386_memio_map().  This function works nearly as same as
- *   i386_memio_unmap(), but this function does not ask kernel
- *   built-in extents and returns physical address of the bus space,
- *   for the convenience of the extra extent manager.
- *
- *   I suppose this function should be in arch/i386/i386/machdep.c,
- *   but it is not.
- */
-void
-_i386_memio_unmap(t, bsh, size, adrp)
-       bus_space_tag_t t;
-       bus_space_handle_t bsh;
-       bus_size_t size;
-       bus_addr_t *adrp;
-{
-       u_long va, endva;
-       bus_addr_t bpa;
-
-       /*
-        * Find the correct extent and bus physical address.
-        */
-       if (t == I386_BUS_SPACE_IO) {
-               bpa = bsh;
-       } else if (t == I386_BUS_SPACE_MEM) {
-               if (bsh >= atdevbase && (bsh + size) <= (atdevbase + IOM_SIZE)) {
-                       bpa = (bus_addr_t)ISA_PHYSADDR(bsh);
-               } else {
-
-                       va = i386_trunc_page(bsh);
-                       endva = i386_round_page(bsh + size);
-
-#ifdef DIAGNOSTIC
-                       if (endva <= va) {
-                               panic("_i386_memio_unmap: overflow");
-                       }
-#endif
-
-#if __NetBSD_Version__ > 104050000
-                       if (pmap_extract(pmap_kernel(), va, &bpa) == FALSE) {
-                               panic("_i386_memio_unmap:"
-                                   "i386/rbus_machdep.c wrong virtual address");
-                       }
-                       bpa += (bsh & PGOFSET);
-#else
-                       bpa = pmap_extract(pmap_kernel(), va) + (bsh & PGOFSET);
-#endif
-
-                       /*
-                        * Free the kernel virtual mapping.
-                        */
-                       uvm_km_free(kernel_map, va, endva - va);
-               }
-       } else {
-               panic("_i386_memio_unmap: bad bus space tag");
-       }
-
-       if (adrp != NULL) {
-               *adrp = bpa;
-       }
-}
-
-
-
-
 #ifndef RBUS_MIN_START
 #define RBUS_MIN_START 0x40000000      /* 1GB */
 #endif
diff -r 14b1c40315c8 -r 6891a9917657 sys/arch/i386/include/bus.h
--- a/sys/arch/i386/include/bus.h       Wed Apr 25 03:07:19 2001 +0000
+++ b/sys/arch/i386/include/bus.h       Wed Apr 25 03:31:23 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus.h,v 1.32 2001/04/10 12:59:32 fvdl Exp $    */
+/*     $NetBSD: bus.h,v 1.33 2001/04/25 03:31:23 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -148,6 +148,8 @@
 
 void   i386_memio_unmap __P((bus_space_tag_t t, bus_space_handle_t bsh,
            bus_size_t size));
+void   _i386_memio_unmap __P((bus_space_tag_t t, bus_space_handle_t bsh,
+           bus_size_t size, bus_addr_t *));
 
 #define bus_space_unmap(t, h, s)                                       \
        i386_memio_unmap((t), (h), (s))
diff -r 14b1c40315c8 -r 6891a9917657 sys/arch/i386/include/rbus_machdep.h
--- a/sys/arch/i386/include/rbus_machdep.h      Wed Apr 25 03:07:19 2001 +0000
+++ b/sys/arch/i386/include/rbus_machdep.h      Wed Apr 25 03:31:23 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rbus_machdep.h,v 1.4 2000/06/06 08:20:06 haya Exp $    */
+/*     $NetBSD: rbus_machdep.h,v 1.5 2001/04/25 03:31:23 thorpej Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -36,9 +36,6 @@
 
 struct pci_attach_args;                /* XXX */
 
-void _i386_memio_unmap(bus_space_tag_t, bus_space_handle_t,
-                            bus_size_t, bus_addr_t *);
-
 #define md_space_map(bt, physaddr, size, flags, bshp) \
        _i386_memio_map((bt), (physaddr), (size), (flags), (bshp))
 



Home | Main Index | Thread Index | Old Index