Fix uninitialized pointer problem in rbus code ... just because the kernel is
compiled with PCIBIOS_ADDR_FIXUP doesn't necessarily mean that pcibios_addr_fixup() succeeded ...
This commit is contained in:
parent
51a6455183
commit
b7d7ac9d1a
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: rbus_machdep.c,v 1.15 2003/01/20 01:29:18 simonb Exp $ */
|
/* $NetBSD: rbus_machdep.c,v 1.16 2005/06/21 06:51:29 sekiya Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999
|
* Copyright (c) 1999
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.15 2003/01/20 01:29:18 simonb Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.16 2005/06/21 06:51:29 sekiya Exp $");
|
||||||
|
|
||||||
#include "opt_pcibios.h"
|
#include "opt_pcibios.h"
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.15 2003/01/20 01:29:18 simonb Exp
|
||||||
#include <dev/isa/isavar.h>
|
#include <dev/isa/isavar.h>
|
||||||
|
|
||||||
#include <dev/pci/pcivar.h>
|
#include <dev/pci/pcivar.h>
|
||||||
#ifdef PCIBIOS_ADDR_FIXUP
|
#if defined(PCIBIOS_ADDR_FIXUP)
|
||||||
#include <arch/i386/pci/pci_addr_fixup.h>
|
#include <arch/i386/pci/pci_addr_fixup.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -74,30 +74,29 @@ bus_addr_t rbus_min_start = RBUS_MIN_START;
|
||||||
* shares the all memory region of ex_iomem.
|
* shares the all memory region of ex_iomem.
|
||||||
*/
|
*/
|
||||||
rbus_tag_t
|
rbus_tag_t
|
||||||
rbus_pccbb_parent_mem(pa)
|
rbus_pccbb_parent_mem(struct pci_attach_args *pa)
|
||||||
struct pci_attach_args *pa;
|
|
||||||
{
|
{
|
||||||
bus_addr_t start;
|
bus_addr_t start;
|
||||||
bus_size_t size;
|
bus_size_t size;
|
||||||
struct extent *ex;
|
|
||||||
#ifdef PCIBIOS_ADDR_FIXUP
|
|
||||||
ex = pciaddr.extent_mem;
|
|
||||||
#else
|
|
||||||
extern struct extent *iomem_ex;
|
extern struct extent *iomem_ex;
|
||||||
ex = iomem_ex;
|
struct extent *ex = iomem_ex;
|
||||||
|
|
||||||
|
#if defined(PCIBIOS_ADDR_FIXUP)
|
||||||
|
if (pciaddr.extent_mem != NULL)
|
||||||
|
ex = pciaddr.extent_mem;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
start = ex->ex_start;
|
start = ex->ex_start;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX: unfortunately, iomem_ex cannot be used for the dynamic
|
* XXX: unfortunately, iomem_ex cannot be used for the dynamic
|
||||||
* bus_space allocatoin. There are some hidden memory (or
|
* bus_space allocation. There are some hidden memory (or
|
||||||
* some obstacles which do not recognised by the kernel) in
|
* some obstacles which are not recognised by the kernel) in
|
||||||
* the region governed by iomem_ex. So I decide to use only
|
* the region governed by iomem_ex. So I decide to use only
|
||||||
* very high address region.
|
* very high address region.
|
||||||
*
|
*
|
||||||
* if defined PCIBIOS_ADDR_FIXUP, PCI device using area
|
* If pcibios_addr_fixup() succeeded, the PCI device is using an area
|
||||||
* which do not recognised by the kernel are already reserved.
|
* which is not recognised by the kernel as already reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (start < rbus_min_start)
|
if (start < rbus_min_start)
|
||||||
|
@ -113,25 +112,25 @@ rbus_pccbb_parent_mem(pa)
|
||||||
* rbus_tag_t rbus_pccbb_parent_io(struct pci_attach_args *pa)
|
* rbus_tag_t rbus_pccbb_parent_io(struct pci_attach_args *pa)
|
||||||
*/
|
*/
|
||||||
rbus_tag_t
|
rbus_tag_t
|
||||||
rbus_pccbb_parent_io(pa)
|
rbus_pccbb_parent_io(struct pci_attach_args *pa)
|
||||||
struct pci_attach_args *pa;
|
|
||||||
{
|
{
|
||||||
struct extent *ex;
|
|
||||||
bus_addr_t start;
|
bus_addr_t start;
|
||||||
bus_size_t size;
|
bus_size_t size;
|
||||||
rbus_tag_t ret;
|
rbus_tag_t ret;
|
||||||
#ifdef PCIBIOS_ADDR_FIXUP
|
|
||||||
ex = pciaddr.extent_port;
|
|
||||||
#else
|
|
||||||
extern struct extent *ioport_ex;
|
extern struct extent *ioport_ex;
|
||||||
ex = ioport_ex;
|
struct extent *ex = ioport_ex;
|
||||||
|
|
||||||
|
#if defined(PCIBIOS_ADDR_FIXUP)
|
||||||
|
if (pciaddr.extent_port != NULL)
|
||||||
|
ex = pciaddr.extent_port;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
start = RBUS_IO_BASE;
|
start = RBUS_IO_BASE;
|
||||||
size = RBUS_IO_SIZE;
|
size = RBUS_IO_SIZE;
|
||||||
|
|
||||||
ret = rbus_new_root_share(pa->pa_iot, ex, start, size, 0);
|
ret = rbus_new_root_share(pa->pa_iot, ex, start, size, 0);
|
||||||
if(ret == NULL) {
|
if (ret == NULL)
|
||||||
panic("failed to alloc I/O space");
|
panic("failed to alloc I/O space");
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: pcibios.c,v 1.23 2005/06/20 11:04:15 sekiya Exp $ */
|
/* $NetBSD: pcibios.c,v 1.24 2005/06/21 06:51:29 sekiya Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: pcibios.c,v 1.23 2005/06/20 11:04:15 sekiya Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: pcibios.c,v 1.24 2005/06/21 06:51:29 sekiya Exp $");
|
||||||
|
|
||||||
#include "opt_pcibios.h"
|
#include "opt_pcibios.h"
|
||||||
|
|
||||||
|
@ -150,6 +150,17 @@ pcibios_init(void)
|
||||||
struct bios32_entry_info ei;
|
struct bios32_entry_info ei;
|
||||||
u_int32_t rev_maj, rev_min, mech1, mech2, scmech1, scmech2;
|
u_int32_t rev_maj, rev_min, mech1, mech2, scmech1, scmech2;
|
||||||
|
|
||||||
|
#if defined(PCIBIOS_ADDR_FIXUP)
|
||||||
|
/*
|
||||||
|
* Initialize pointers used by rbus routines here. That way, if
|
||||||
|
* PCIBIOS initialization fails, the rbus code doesn't break
|
||||||
|
* spectacularly when PCIBIOS_ADDR_FIXUP is defined.
|
||||||
|
*/
|
||||||
|
|
||||||
|
pciaddr.extent_port = NULL;
|
||||||
|
pciaddr.extent_mem = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (bios32_service(BIOS32_MAKESIG('$', 'P', 'C', 'I'),
|
if (bios32_service(BIOS32_MAKESIG('$', 'P', 'C', 'I'),
|
||||||
&pcibios_entry, &ei) == 0) {
|
&pcibios_entry, &ei) == 0) {
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue