summaryrefslogtreecommitdiff
path: root/sys/arch/mvme88k/dev/pcctwo.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/mvme88k/dev/pcctwo.c')
-rw-r--r--sys/arch/mvme88k/dev/pcctwo.c75
1 files changed, 47 insertions, 28 deletions
diff --git a/sys/arch/mvme88k/dev/pcctwo.c b/sys/arch/mvme88k/dev/pcctwo.c
index 6cd485df2a2..6cf93f58b29 100644
--- a/sys/arch/mvme88k/dev/pcctwo.c
+++ b/sys/arch/mvme88k/dev/pcctwo.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pcctwo.c,v 1.10 2001/03/08 00:03:14 miod Exp $ */
+/* $OpenBSD: pcctwo.c,v 1.11 2001/12/13 08:55:51 smurph Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -56,6 +56,8 @@
#include <mvme88k/dev/pcctwofunc.h>
#include <mvme88k/dev/pcctworeg.h>
+#include "bussw.h"
+
struct pcctwosoftc {
struct device sc_dev;
void *sc_vaddr; /* PCC2 space */
@@ -76,6 +78,8 @@ struct cfdriver pcctwo_cd = {
struct pcctworeg *sys_pcc2 = NULL;
+int pcc2bus;
+
int pcctwo_print __P((void *args, const char *bus));
int pcctwo_scan __P((struct device *parent, void *child, void *args));
@@ -88,25 +92,25 @@ pcctwomatch(parent, vcf, args)
struct pcctworeg *pcc2;
/* Bomb if wrong cpu */
- switch (cputyp) {
- case CPU_187:
- pcc2 = (struct pcctworeg *)(IIOV(ca->ca_paddr) + PCC2_PCC2CHIP_OFF);
- break;
- case CPU_197: /* pcctwo is a child of buswitch XXX smurph */
- pcc2 = (struct pcctworeg *)(IIOV(ca->ca_paddr));
- break;
- default:
- /* Bomb if wrong cpu */
- return (0);
- }
+ switch (brdtyp) {
+ case BRD_187:
+ pcc2 = (struct pcctworeg *)(IIOV(ca->ca_paddr) + PCC2_PCC2CHIP_OFF);
+ break;
+ case BRD_197: /* pcctwo is a child of buswitch XXX smurph */
+ pcc2 = (struct pcctworeg *)(IIOV(ca->ca_paddr));
+ break;
+ default:
+ /* Bomb if wrong board */
+ return (0);
+ }
- if (badvaddr((vm_offset_t)pcc2, 4) <= 0){
- printf("==> pcctwo: failed address check.\n");
- return (0);
+ if (badvaddr((vm_offset_t)pcc2, 4)) {
+ printf("==> pcctwo: failed address check.\n");
+ return (0);
}
- if (pcc2->pcc2_chipid != PCC2_CHIPID){
- printf("==> pcctwo: wrong chip id %x.\n", pcc2->pcc2_chipid);
- return (0);
+ if (pcc2->pcc2_chipid != PCC2_CHIPID) {
+ printf("==> pcctwo: wrong chip id %x.\n", pcc2->pcc2_chipid);
+ return (0);
}
return (1);
}
@@ -175,14 +179,27 @@ pcctwoattach(parent, self, args)
*/
sc->sc_paddr = ca->ca_paddr;
sc->sc_vaddr = (void *)IIOV(sc->sc_paddr);
- switch (cputyp) {
- case CPU_187:
- sc->sc_pcc2 = (struct pcctworeg *)(sc->sc_vaddr + PCC2_PCC2CHIP_OFF);
- break;
- case CPU_197: /* pcctwo is a child of buswitch XXX smurph */
- sc->sc_pcc2 = (struct pcctworeg *)sc->sc_vaddr;
- break;
- }
+
+ pcc2bus = ca->ca_bustype;
+
+ switch (pcc2bus) {
+ case BUS_MAIN:
+ sc->sc_pcc2 = (struct pcctworeg *)(sc->sc_vaddr + PCC2_PCC2CHIP_OFF);
+ break;
+#if NBUSSW > 0
+ case BUS_BUSSWITCH:
+ sc->sc_pcc2 = (struct pcctworeg *)sc->sc_vaddr;
+ /*
+ * fake up our address so that pcc2 child devices
+ * are offeset of 0xFFF00000 - XXX smurph
+ */
+ sc->sc_paddr -= PCC2_PCC2CHIP_OFF;
+ sc->sc_vaddr -= PCC2_PCC2CHIP_OFF;
+ /* make sure the bus is mc68040 compatible */
+ sc->sc_pcc2->pcc2_genctl |= PCC2_GENCTL_C040;
+ break;
+#endif
+ }
sys_pcc2 = sc->sc_pcc2;
printf(": rev %d\n", sc->sc_pcc2->pcc2_chiprev);
@@ -193,8 +210,10 @@ pcctwoattach(parent, self, args)
/*
* Set pcc2intr_mask and pcc2intr_ipl.
*/
- pcc2intr_ipl = (u_char *)&(sc->sc_pcc2->pcc2_ipl);
- pcc2intr_mask = (u_char *)&(sc->sc_pcc2->pcc2_mask);
+#if 0
+ md.intr_mask = (u_char *)&(sc->sc_pcc2->pcc2_mask);
+ md.intr_ipl = (u_char *)&(sc->sc_pcc2->pcc2_ipl);
+#endif
config_search(pcctwo_scan, self, args);
}