Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/macppc Allow pci_init() to be called twice, once ju...
details: https://anonhg.NetBSD.org/src/rev/9844cc814f0e
branches: trunk
changeset: 472772:9844cc814f0e
user: thorpej <thorpej%NetBSD.org@localhost>
date: Thu May 06 19:16:44 1999 +0000
description:
Allow pci_init() to be called twice, once just to find the PCI-Host
bridges and determine the "pci chipset" values (for making PCI tags),
and again to actually map the configuration space registers.
diffstat:
sys/arch/macppc/include/pci_machdep.h | 8 ++++-
sys/arch/macppc/macppc/mainbus.c | 7 ++--
sys/arch/macppc/pci/bandit.c | 52 +++++++++++++++++++++-------------
3 files changed, 42 insertions(+), 25 deletions(-)
diffs (152 lines):
diff -r 6c837eb7c3ae -r 9844cc814f0e sys/arch/macppc/include/pci_machdep.h
--- a/sys/arch/macppc/include/pci_machdep.h Thu May 06 19:12:22 1999 +0000
+++ b/sys/arch/macppc/include/pci_machdep.h Thu May 06 19:16:44 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.h,v 1.7 1999/05/05 04:26:48 thorpej Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.8 1999/05/06 19:16:44 thorpej Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -58,6 +58,7 @@
bus_space_tag_t iot;
bus_space_tag_t memt;
pci_chipset_tag_t pc;
+ int present;
};
struct pci_bridge pci_bridges[2];
@@ -84,3 +85,8 @@
void *pci_intr_establish __P((pci_chipset_tag_t, pci_intr_handle_t,
int, int (*)(void *), void *));
void pci_intr_disestablish __P((pci_chipset_tag_t, void *));
+
+/*
+ * Internal functions.
+ */
+void pci_init __P((int));
diff -r 6c837eb7c3ae -r 9844cc814f0e sys/arch/macppc/macppc/mainbus.c
--- a/sys/arch/macppc/macppc/mainbus.c Thu May 06 19:12:22 1999 +0000
+++ b/sys/arch/macppc/macppc/mainbus.c Thu May 06 19:16:44 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.5 1999/05/05 04:40:00 thorpej Exp $ */
+/* $NetBSD: mainbus.c,v 1.6 1999/05/06 19:16:44 thorpej Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -49,8 +49,6 @@
sizeof(struct device), mainbus_match, mainbus_attach
};
-void pci_init();
-
/*
* Probe for the mainbus; always succeeds.
*/
@@ -88,7 +86,8 @@
ca.ca_name = "cpu";
config_found(self, &ca, NULL);
- pci_init();
+ /* Now can map PCI configuration space registers. */
+ pci_init(1);
for (n = 0; n < 2; n++) {
if (pci_bridges[n].addr) {
diff -r 6c837eb7c3ae -r 9844cc814f0e sys/arch/macppc/pci/bandit.c
--- a/sys/arch/macppc/pci/bandit.c Thu May 06 19:12:22 1999 +0000
+++ b/sys/arch/macppc/pci/bandit.c Thu May 06 19:16:44 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bandit.c,v 1.10 1999/05/05 08:43:53 tsubai Exp $ */
+/* $NetBSD: bandit.c,v 1.11 1999/05/06 19:16:45 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -107,14 +107,15 @@
#define BANDIT_SPECIAL_CYCLE 0xe00000 /* Special Cycle offset */
static void bandit_init __P((pci_chipset_tag_t));
-static void scan_pci_devs __P((void));
+static void scan_pci_devs __P((int));
static void config_slot __P((int, pci_chipset_tag_t, int));
void
-pci_init()
+pci_init(canmap)
+ int canmap;
{
- scan_pci_devs();
+ scan_pci_devs(canmap);
}
static void
@@ -138,7 +139,8 @@
static void
-scan_pci_devs()
+scan_pci_devs(canmap)
+ int canmap;
{
int reglen, node, child, n, is_bandit, is_mpc106;
char name[64];
@@ -223,6 +225,7 @@
continue;
pci_bridges[n].bus = reg[0];
+ pci_bridges[n].present = 1;
/*
* Map the PCI configuration space access registers,
@@ -230,27 +233,36 @@
*/
if (is_bandit) {
/* XXX magic numbers */
- if (OF_getprop(node, "reg", reg, sizeof(reg)) != 8)
- continue;
- pci_bridges[n].addr = mapiodev(reg[0] + 0x800000, 4);
- pci_bridges[n].data = mapiodev(reg[0] + 0xc00000, 4);
pci_bridges[n].pc = n;
- bandit_init(n);
+ if (canmap) {
+ if (OF_getprop(node, "reg", reg,
+ sizeof(reg)) != 8)
+ continue;
+ pci_bridges[n].addr =
+ mapiodev(reg[0] + 0x800000, 4);
+ pci_bridges[n].data =
+ mapiodev(reg[0] + 0xc00000, 4);
+ bandit_init(n);
+ }
} else if (is_mpc106) {
/* XXX magic numbers */
- pci_bridges[n].addr = mapiodev(0xfec00000, 4);
- pci_bridges[n].data = mapiodev(0xfee00000, 4);
pci_bridges[n].pc = PCI_CHIPSET_MPC106; /* for now */
+ if (canmap) {
+ pci_bridges[n].addr = mapiodev(0xfec00000, 4);
+ pci_bridges[n].data = mapiodev(0xfee00000, 4);
+ }
}
- /*
- * Configure all of the PCI devices attached to this
- * PCI-Host bridge.
- */
- child = OF_child(node);
- while (child) {
- config_slot(child, pci_bridges[n].pc, -1);
- child = OF_peer(child);
+ if (canmap) {
+ /*
+ * Configure all of the PCI devices attached to this
+ * PCI-Host bridge.
+ */
+ child = OF_child(node);
+ while (child) {
+ config_slot(child, pci_bridges[n].pc, -1);
+ child = OF_peer(child);
+ }
}
/* Bridge found, increment bridge instance. */
Home |
Main Index |
Thread Index |
Old Index