Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/prep/prep Only a part of the PCI memory space is ma...



details:   https://anonhg.NetBSD.org/src/rev/fa778496c850
branches:  trunk
changeset: 573539:fa778496c850
user:      jkunz <jkunz%NetBSD.org@localhost>
date:      Mon Jan 31 18:48:41 2005 +0000

description:
Only a part of the PCI memory space is mapped via BAT registers in machdep.c.
Depending on where the firmware relocated the OpenPIC register window it may
be unmapped causing a kernel panic early in bootup when the OpenPIC is
initialized. So take care of mapping it if it is outside the already mapped
region. As mapiodev() requires UVM move this initialization to cpu_startup().

diffstat:

 sys/arch/prep/prep/ibm_7043_140.c |  20 +++++++++++++++++---
 sys/arch/prep/prep/machdep.c      |  14 +++++++-------
 2 files changed, 24 insertions(+), 10 deletions(-)

diffs (83 lines):

diff -r 9872ddb48e2d -r fa778496c850 sys/arch/prep/prep/ibm_7043_140.c
--- a/sys/arch/prep/prep/ibm_7043_140.c Mon Jan 31 18:22:24 2005 +0000
+++ b/sys/arch/prep/prep/ibm_7043_140.c Mon Jan 31 18:48:41 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ibm_7043_140.c,v 1.3 2005/01/13 23:57:04 kleink Exp $  */
+/*     $NetBSD: ibm_7043_140.c,v 1.4 2005/01/31 18:48:41 jkunz Exp $   */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibm_7043_140.c,v 1.3 2005/01/13 23:57:04 kleink Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibm_7043_140.c,v 1.4 2005/01/31 18:48:41 jkunz Exp $");
 
 #include "opt_openpic.h"
 #if !defined(OPENPIC)
@@ -99,7 +99,21 @@
                address = pci_conf_read(&pc, tag, 0x10);
                if ((address & PCI_MAPREG_TYPE_MASK) == PCI_MAPREG_TYPE_MEM) {
                        address &= PCI_MAPREG_MEM_ADDR_MASK;
-                       baseaddr = (unsigned char *)(PREP_BUS_SPACE_MEM | address);
+                       /*
+                        * PReP PCI memory space is from 0xc0000000 to
+                        * 0xffffffff but machdep.c maps only 0xc0000000 to
+                        * 0xcfffffff of PCI memory space. So look if the 
+                        * address offset is bigger then 0xfffffff. If it is
+                        * we are outside the already mapped region and we need
+                        * to add an additional mapping for the OpenPIC.
+                        * The OpenPIC register window is always 256kB.
+                        */
+                       if (address > 0xfffffff)
+                               baseaddr = (unsigned char *) mapiodev(
+                                   PREP_BUS_SPACE_MEM | address, 0x40000);
+                       else
+                               baseaddr = (unsigned char *)
+                                   (PREP_BUS_SPACE_MEM | address);
                }
        }
 #endif
diff -r 9872ddb48e2d -r fa778496c850 sys/arch/prep/prep/machdep.c
--- a/sys/arch/prep/prep/machdep.c      Mon Jan 31 18:22:24 2005 +0000
+++ b/sys/arch/prep/prep/machdep.c      Mon Jan 31 18:48:41 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.51 2003/10/20 00:12:10 matt Exp $        */
+/*     $NetBSD: machdep.c,v 1.52 2005/01/31 18:48:41 jkunz Exp $       */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.51 2003/10/20 00:12:10 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.52 2005/01/31 18:48:41 jkunz Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_ddb.h"
@@ -207,11 +207,6 @@
         */
        consinit();
 
-       /*
-        * external interrupt handler install
-        */
-       (*platform->init_intr)();
-
         /*
         * Set the page size.
         */
@@ -255,6 +250,11 @@
                panic("startup: no room for interrupt register");
 
        /*
+        * external interrupt handler install
+        */
+       (*platform->init_intr)();
+
+       /*
         * Do common startup.
         */
        oea_startup(res->VitalProductData.PrintableModel);



Home | Main Index | Thread Index | Old Index