BSD 4_3_Net_2 release
[unix-history] / usr / src / sys / i386 / isa / isa.c
index f38b614..df6464b 100644 (file)
@@ -1,22 +1,55 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ *     @(#)isa.c       7.2 (Berkeley) 5/13/91
+ */
+
 /*
  * code to manage AT bus
 /*
  * code to manage AT bus
- * @(#)isa.c   1.3 (Berkeley) %G%
  */
 
 #include "param.h"
 #include "systm.h"
 #include "conf.h"
 #include "file.h"
  */
 
 #include "param.h"
 #include "systm.h"
 #include "conf.h"
 #include "file.h"
-#include "dir.h"
-#include "user.h"
 #include "buf.h"
 #include "buf.h"
-#include "vm.h"
 #include "uio.h"
 #include "syslog.h"
 #include "machine/segments.h"
 #include "uio.h"
 #include "syslog.h"
 #include "machine/segments.h"
-#include "machine/pte.h"
-#include "machine/isa/isa_device.h"
-#include "machine/isa/icu.h"
+#include "i386/isa/isa_device.h"
+#include "i386/isa/icu.h"
 
 /*
  * Configure all ISA devices
 
 /*
  * Configure all ISA devices
@@ -52,10 +85,10 @@ config_isadev(isdp, mp)
  
        if (dp = isdp->id_driver) {
                if (isdp->id_maddr) {
  
        if (dp = isdp->id_driver) {
                if (isdp->id_maddr) {
-                       extern int atdevbase[];
+                       extern int atdevbase;
 
                        isdp->id_maddr -= 0xa0000;
 
                        isdp->id_maddr -= 0xa0000;
-                       isdp->id_maddr += (int)&atdevbase;
+                       isdp->id_maddr += atdevbase;
                }
                isdp->id_alive = (*dp->probe)(isdp);
                if (isdp->id_alive) {
                }
                isdp->id_alive = (*dp->probe)(isdp);
                if (isdp->id_alive) {
@@ -79,7 +112,7 @@ config_isadev(isdp, mp)
        } else  return(0);
 }
 
        } else  return(0);
 }
 
-#define        IDTVEC(name)    X/**/name
+#define        IDTVEC(name)    __CONCAT(X,name)
 /* default interrupt vector table */
 extern IDTVEC(intr0), IDTVEC(intr1), IDTVEC(intr2), IDTVEC(intr3),
        IDTVEC(intr4), IDTVEC(intr5), IDTVEC(intr6), IDTVEC(intr7),
 /* default interrupt vector table */
 extern IDTVEC(intr0), IDTVEC(intr1), IDTVEC(intr2), IDTVEC(intr3),
        IDTVEC(intr4), IDTVEC(intr5), IDTVEC(intr6), IDTVEC(intr7),
@@ -128,17 +161,15 @@ isa_defaultirq() {
 }
 
 /* stuff needed for virtual to physical calculations */
 }
 
 /* stuff needed for virtual to physical calculations */
-extern char Sysbase;
-static unsigned long sbase = (unsigned long) &Sysbase;
 
 struct buf *dma_bounce[8];
 #define MAXDMASZ 512
 
 
 struct buf *dma_bounce[8];
 #define MAXDMASZ 512
 
-/* XXX temporary */
+/* XXX temporary crud */
 kernel_space(x)
 unsigned long x;
 {
 kernel_space(x)
 unsigned long x;
 {
-       if ((x >= sbase) & (x < sbase + 0x800000)) return 1;
+       if (x >= KERNBASE) return 1;
        else return 0;
 }
 
        else return 0;
 }
 
@@ -178,7 +209,7 @@ int nbytes;
        if (raw) phys = (unsigned long) bounce;
        else phys = addr;
        /* translate to physical */
        if (raw) phys = (unsigned long) bounce;
        else phys = addr;
        /* translate to physical */
-       phys = phys - sbase;
+       phys = pmap_extract(pmap_kernel(), (vm_offset_t)phys);
        outb(0x4,phys & 0xFF);
        outb(0x4,(phys>>8) & 0xFF);
        outb(0x81,(phys>>16) & 0xFF);
        outb(0x4,phys & 0xFF);
        outb(0x4,(phys>>8) & 0xFF);
        outb(0x81,(phys>>16) & 0xFF);