Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64 Use the PCI function code to distinguish si...
details: https://anonhg.NetBSD.org/src/rev/549cbd05930b
branches: trunk
changeset: 486532:549cbd05930b
user: eeh <eeh%NetBSD.org@localhost>
date: Wed May 24 20:27:52 2000 +0000
description:
Use the PCI function code to distinguish simba bus A from bus B instead
of the current hack.
diffstat:
sys/arch/sparc64/dev/pci_machdep.c | 7 +------
sys/arch/sparc64/dev/psycho.c | 31 +++++++++++++++++++++++--------
sys/arch/sparc64/dev/psychoreg.h | 7 ++++++-
sys/arch/sparc64/dev/psychovar.h | 5 +++--
sys/arch/sparc64/dev/simba.c | 20 +++++++++-----------
sys/arch/sparc64/include/pci_machdep.h | 7 ++++---
6 files changed, 46 insertions(+), 31 deletions(-)
diffs (207 lines):
diff -r 13cfab8f6de9 -r 549cbd05930b sys/arch/sparc64/dev/pci_machdep.c
--- a/sys/arch/sparc64/dev/pci_machdep.c Wed May 24 20:24:58 2000 +0000
+++ b/sys/arch/sparc64/dev/pci_machdep.c Wed May 24 20:27:52 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.6 2000/05/17 09:25:58 mrg Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.7 2000/05/24 20:27:52 eeh Exp $ */
/*
* Copyright (c) 1999, 2000 Matthew R. Green
@@ -74,11 +74,6 @@
NULL,
};
-/* commonly used */
-#define TAG2BUS(tag) ((tag) >> 16) & 0xff;
-#define TAG2DEV(tag) ((tag) >> 11) & 0x1f;
-#define TAG2FN(tag) ((tag) >> 8) & 0x7;
-
/*
* functions provided to the MI code.
*/
diff -r 13cfab8f6de9 -r 549cbd05930b sys/arch/sparc64/dev/psycho.c
--- a/sys/arch/sparc64/dev/psycho.c Wed May 24 20:24:58 2000 +0000
+++ b/sys/arch/sparc64/dev/psycho.c Wed May 24 20:27:52 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: psycho.c,v 1.11 2000/05/17 10:28:14 mrg Exp $ */
+/* $NetBSD: psycho.c,v 1.12 2000/05/24 20:27:52 eeh Exp $ */
/*
* Copyright (c) 1999, 2000 Matthew R. Green
@@ -252,7 +252,8 @@
printf("sabre: ");
/* setup the PCI control register; there is only one for the sabre */
- csr = bus_space_read_8(sc->sc_bustag, (bus_space_handle_t)(u_long)&sc->sc_regs->psy_pcictl[0].pci_csr, 0);
+ csr = bus_space_read_8(sc->sc_bustag, (bus_space_handle_t)(u_long)
+ &sc->sc_regs->psy_pcictl[0].pci_csr, 0);
csr |= PCICTL_MRLM |
PCICTL_ARB_PARK |
PCICTL_ERRINTEN |
@@ -261,7 +262,8 @@
PCICTL_CPU_PRIO |
PCICTL_ARB_PRIO |
PCICTL_RTRYWAIT);
- bus_space_write_8(sc->sc_bustag, &sc->sc_regs->psy_pcictl[0].pci_csr, 0, csr);
+ bus_space_write_8(sc->sc_bustag, &sc->sc_regs->psy_pcictl[0].pci_csr,
+ 0, csr);
/* allocate a pair of psycho_pbm's for our simba's */
sc->sc_sabre = malloc(sizeof *pp, M_DEVBUF, M_NOWAIT);
@@ -293,6 +295,8 @@
for (node = firstchild(sc->sc_node); node; node = nextsibling(node)) {
char *name = getpropstring(node, "name");
char *model, who;
+ struct psycho_registers *regs;
+ int nregs, fn;
if (strcmp(name, ROM_PCI_NAME) != 0)
continue;
@@ -302,13 +306,24 @@
continue;
psycho_get_bus_range(node, simba_br);
+ psycho_get_registers(node, ®s, &nregs);
- if (simba_br[0] == 1) { /* PCI B */
+ fn = TAG2FN(regs->phys_hi);
+ switch (fn) {
+ case 0:
+ pp = sc->sc_simba_a;
+ who = 'a';
+ pp->pp_regs = regs;
+ pp->pp_nregs = nregs;
+ break;
+ case 1:
pp = sc->sc_simba_b;
who = 'b';
- } else { /* PCI A */
- pp = sc->sc_simba_a;
- who = 'a';
+ pp->pp_regs = regs;
+ pp->pp_nregs = nregs;
+ break;
+ default:
+ panic("illegal simba funcion %d\n");
}
pp->pp_pcictl = &sc->sc_regs->psy_pcictl[0];
/* link us in .. */
@@ -317,7 +332,6 @@
printf("; simba %c, PCI bus %d", who, simba_br[0]);
/* grab the simba registers, interrupt map and map mask */
- psycho_get_registers(node, &pp->pp_regs, &pp->pp_nregs);
psycho_get_intmap(node, &pp->pp_intmap, &pp->pp_nintmap);
psycho_get_intmapmask(node, &pp->pp_intmapmask);
@@ -330,6 +344,7 @@
/* allocate a chipset for this */
pp->pp_pc = psycho_alloc_chipset(pp, node, &_sparc_pci_chipset);
+ pp->pp_pc->busno = pp->pp_bus = simba_br[0];
}
/* setup the rest of the sabre pbm */
diff -r 13cfab8f6de9 -r 549cbd05930b sys/arch/sparc64/dev/psychoreg.h
--- a/sys/arch/sparc64/dev/psychoreg.h Wed May 24 20:24:58 2000 +0000
+++ b/sys/arch/sparc64/dev/psychoreg.h Wed May 24 20:27:52 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: psychoreg.h,v 1.3 2000/04/10 16:04:02 mrg Exp $ */
+/* $NetBSD: psychoreg.h,v 1.4 2000/05/24 20:27:52 eeh Exp $ */
/*
* Copyright (c) 1998, 1999 Eduardo E. Horvath
@@ -296,6 +296,11 @@
* with offset handling being driver via `n == 0' as for I/O space.
*/
+/* commonly used */
+#define TAG2BUS(tag) ((tag) >> 16) & 0xff;
+#define TAG2DEV(tag) ((tag) >> 11) & 0x1f;
+#define TAG2FN(tag) ((tag) >> 8) & 0x7;
+
struct psycho_registers {
u_int32_t phys_hi;
u_int32_t phys_mid;
diff -r 13cfab8f6de9 -r 549cbd05930b sys/arch/sparc64/dev/psychovar.h
--- a/sys/arch/sparc64/dev/psychovar.h Wed May 24 20:24:58 2000 +0000
+++ b/sys/arch/sparc64/dev/psychovar.h Wed May 24 20:27:52 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: psychovar.h,v 1.2 2000/04/10 16:11:23 mrg Exp $ */
+/* $NetBSD: psychovar.h,v 1.3 2000/05/24 20:27:52 eeh Exp $ */
/*
* Copyright (c) 1999, 2000 Matthew R. Green
@@ -60,6 +60,7 @@
bus_space_tag_t pp_memt;
bus_space_tag_t pp_iot;
bus_dma_tag_t pp_dmat;
+ int pp_bus;
int pp_flags;
/* and pointers into the psycho regs for our bits */
@@ -98,7 +99,7 @@
/* config space */
bus_space_tag_t sc_configtag;
- paddr_t sc_configaddr;
+ bus_space_handle_t sc_configaddr;
int sc_clockfreq;
int sc_node; /* prom node */
diff -r 13cfab8f6de9 -r 549cbd05930b sys/arch/sparc64/dev/simba.c
--- a/sys/arch/sparc64/dev/simba.c Wed May 24 20:24:58 2000 +0000
+++ b/sys/arch/sparc64/dev/simba.c Wed May 24 20:27:52 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: simba.c,v 1.1 1999/06/04 13:42:15 mrg Exp $ */
+/* $NetBSD: simba.c,v 1.2 2000/05/24 20:27:52 eeh Exp $ */
/*
* Copyright (c) 1996, 1998 Christopher G. Demetriou. All rights reserved.
@@ -111,17 +111,15 @@
* perhaps it would be all better to probe the simba's and get all
* the info ourselves.. we'll see.
*/
- switch (PPB_BUSINFO_SECONDARY(busdata)) {
- default:
- printf("%s: not configured by system firmware (bus %d)\n",
- self->dv_xname, PPB_BUSINFO_SECONDARY(busdata));
+
+ if (PPB_BUSINFO_SECONDARY(busdata) == sc->sc_simba_a->pp_bus) {
+ pp = sc->sc_simba_a;
+ } else if (PPB_BUSINFO_SECONDARY(busdata) == sc->sc_simba_b->pp_bus) {
+ pp = sc->sc_simba_b;
+ } else {
+ printf("%s: strange bus mapping (bus %d)\n",
+ self->dv_xname, PPB_BUSINFO_SECONDARY(busdata));
return;
- case 1: /* PCI B */
- pp = sc->sc_simba_b;
- break;
- case 2: /* PCI A */
- pp = sc->sc_simba_a;
- break;
}
/*
diff -r 13cfab8f6de9 -r 549cbd05930b sys/arch/sparc64/include/pci_machdep.h
--- a/sys/arch/sparc64/include/pci_machdep.h Wed May 24 20:24:58 2000 +0000
+++ b/sys/arch/sparc64/include/pci_machdep.h Wed May 24 20:27:52 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.h,v 1.1 1999/06/04 13:42:15 mrg Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.2 2000/05/24 20:27:52 eeh Exp $ */
/*
* Copyright (c) 1999 Matthew R. Green
@@ -40,8 +40,9 @@
typedef u_int pci_intr_handle_t;
struct sparc_pci_chipset {
- void *cookie; /* psycho_pbm, but sssh! */
- int node; /* OFW node */
+ void *cookie; /* psycho_pbm, but sssh! */
+ int node; /* OFW node */
+ int busno; /* PCI bus number */
/* do we need any more here? */
};
Home |
Main Index |
Thread Index |
Old Index