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().
This commit is contained in:
jkunz 2005-01-31 18:48:41 +00:00
parent 5d47a0a676
commit 1a54c65d22
2 changed files with 24 additions and 10 deletions

View File

@ -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 @@ init_intr_mpic(void)
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

View File

@ -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 @@ initppc(startkernel, endkernel, args, btinfo)
*/
consinit();
/*
* external interrupt handler install
*/
(*platform->init_intr)();
/*
* Set the page size.
*/
@ -254,6 +249,11 @@ cpu_startup()
if (!prep_intr_reg)
panic("startup: no room for interrupt register");
/*
* external interrupt handler install
*/
(*platform->init_intr)();
/*
* Do common startup.
*/