summaryrefslogtreecommitdiff
path: root/sys/arch/hppa
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2010-04-29 13:48:30 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2010-04-29 13:48:30 +0000
commit65baaf07a5db9eea322dac5c02f783630761f248 (patch)
tree861a52049edc3f9a0255bdb367d8f3e593c69e7b /sys/arch/hppa
parent7dc30236662e846932e2f38fd4d67a7f7d7a07d9 (diff)
Currently pdc_scanbus() scans in reverse, which results in physical CPU0
attaching as cpu1 and physical CPU1 attaching as cpu0. Split the device scan into two parts - the first pass scans forward and attaches memory and CPUs, whilst the second pass scans in reverse attaching the remaining devices, thus preserving current semantics. Found the hard way whilst trying to spin up the secondary CPU on my j6750. ok miod@ kettenis@
Diffstat (limited to 'sys/arch/hppa')
-rw-r--r--sys/arch/hppa/dev/astro.c4
-rw-r--r--sys/arch/hppa/dev/dino.c4
-rw-r--r--sys/arch/hppa/dev/phantomas.c4
-rw-r--r--sys/arch/hppa/dev/uturn.c6
-rw-r--r--sys/arch/hppa/gsc/gscbus.c4
-rw-r--r--sys/arch/hppa/hppa/autoconf.c38
-rw-r--r--sys/arch/hppa/hppa/mainbus.c11
-rw-r--r--sys/arch/hppa/include/autoconf.h5
8 files changed, 51 insertions, 25 deletions
diff --git a/sys/arch/hppa/dev/astro.c b/sys/arch/hppa/dev/astro.c
index 2edf4596dcd..70318e804a4 100644
--- a/sys/arch/hppa/dev/astro.c
+++ b/sys/arch/hppa/dev/astro.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: astro.c,v 1.9 2009/04/14 16:01:04 oga Exp $ */
+/* $OpenBSD: astro.c,v 1.10 2010/04/29 13:48:29 jsing Exp $ */
/*
* Copyright (c) 2007 Mark Kettenis
@@ -322,7 +322,7 @@ astro_attach(struct device *parent, struct device *self, void *aux)
nca = *ca; /* clone from us */
nca.ca_hpamask = HPPA_IOBEGIN;
nca.ca_dmatag = &sc->sc_dmatag;
- pdc_scanbus(self, &nca, MAXMODBUS, 0);
+ pdc_scanbus(self, &nca, MAXMODBUS, 0, 0);
}
int
diff --git a/sys/arch/hppa/dev/dino.c b/sys/arch/hppa/dev/dino.c
index e06acfdf213..0d88cbce619 100644
--- a/sys/arch/hppa/dev/dino.c
+++ b/sys/arch/hppa/dev/dino.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dino.c,v 1.26 2009/08/22 02:54:50 mk Exp $ */
+/* $OpenBSD: dino.c,v 1.27 2010/04/29 13:48:29 jsing Exp $ */
/*
* Copyright (c) 2003-2005 Michael Shalayeff
@@ -1781,7 +1781,7 @@ dinoattach(parent, self, aux)
/* scan for ps2 kbd/ms, serial, and flying toasters */
ca->ca_hpamask = -1;
- pdc_scanbus(self, ca, MAXMODBUS, 0);
+ pdc_scanbus(self, ca, MAXMODBUS, 0, 0);
bzero(&pba, sizeof(pba));
pba.pba_busname = "pci";
diff --git a/sys/arch/hppa/dev/phantomas.c b/sys/arch/hppa/dev/phantomas.c
index 9f32bf27595..5cb4b25de08 100644
--- a/sys/arch/hppa/dev/phantomas.c
+++ b/sys/arch/hppa/dev/phantomas.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: phantomas.c,v 1.4 2005/04/07 00:21:51 mickey Exp $ */
+/* $OpenBSD: phantomas.c,v 1.5 2010/04/29 13:48:29 jsing Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -73,5 +73,5 @@ phantomasattach(struct device *parent, struct device *self, void *aux)
nca = *ca;
nca.ca_hpamask = HPPA_IOBEGIN;
- pdc_scanbus(self, &nca, MAXMODBUS, 0);
+ pdc_scanbus(self, &nca, MAXMODBUS, 0, 0);
}
diff --git a/sys/arch/hppa/dev/uturn.c b/sys/arch/hppa/dev/uturn.c
index c171d80d3f0..513869f208c 100644
--- a/sys/arch/hppa/dev/uturn.c
+++ b/sys/arch/hppa/dev/uturn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uturn.c,v 1.6 2007/12/29 01:26:14 kettenis Exp $ */
+/* $OpenBSD: uturn.c,v 1.7 2010/04/29 13:48:29 jsing Exp $ */
/*
* Copyright (c) 2004 Michael Shalayeff
@@ -116,7 +116,7 @@ uturnattach(parent, self, aux)
*/
nca = *ca;
nca.ca_hpamask = HPPA_IOBEGIN;
- pdc_scanbus(self, &nca, MAXMODBUS - 1, 0);
+ pdc_scanbus(self, &nca, MAXMODBUS - 1, 0, 0);
/* XXX On some machines, PDC doesn't tell us about all devices. */
switch (cpu_hvers) {
@@ -128,7 +128,7 @@ uturnattach(parent, self, aux)
case HPPA_BOARD_HP859:
case HPPA_BOARD_HP869:
hpa = ((struct iomod *)ioh)->io_io_low << 16;
- pdc_scanbus(self, &nca, MAXMODBUS - 1, hpa);
+ pdc_scanbus(self, &nca, MAXMODBUS - 1, hpa, 0);
break;
default:
break;
diff --git a/sys/arch/hppa/gsc/gscbus.c b/sys/arch/hppa/gsc/gscbus.c
index 2731d157dea..a0302bef907 100644
--- a/sys/arch/hppa/gsc/gscbus.c
+++ b/sys/arch/hppa/gsc/gscbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gscbus.c,v 1.28 2010/04/20 23:35:16 deraadt Exp $ */
+/* $OpenBSD: gscbus.c,v 1.29 2010/04/29 13:48:29 jsing Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -122,7 +122,7 @@ gscattach(parent, self, aux)
sc->sc_dmatag._dmamem_unmap = gsc_dmamem_unmap;
sc->sc_dmatag._dmamem_mmap = gsc_dmamem_mmap;
- pdc_scanbus(self, &ga->ga_ca, MAXMODBUS, 0);
+ pdc_scanbus(self, &ga->ga_ca, MAXMODBUS, 0, 0);
}
int
diff --git a/sys/arch/hppa/hppa/autoconf.c b/sys/arch/hppa/hppa/autoconf.c
index 15551aab5fd..d7ef576055e 100644
--- a/sys/arch/hppa/hppa/autoconf.c
+++ b/sys/arch/hppa/hppa/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.53 2008/07/21 04:35:54 todd Exp $ */
+/* $OpenBSD: autoconf.c,v 1.54 2010/04/29 13:48:29 jsing Exp $ */
/*
* Copyright (c) 1998-2003 Michael Shalayeff
@@ -197,15 +197,23 @@ struct pdc_sysmap_addrs pdc_addr PDC_ALIGNMENT;
struct pdc_iodc_read pdc_iodc_read PDC_ALIGNMENT;
void
-pdc_scanbus(self, ca, maxmod, hpa)
- struct device *self;
- struct confargs *ca;
- int maxmod;
- hppa_hpa_t hpa;
+pdc_scanbus(struct device *self, struct confargs *ca, int maxmod,
+ hppa_hpa_t hpa, int cpu_scan)
{
- int i;
+ int start, end, incr, i;
+
+ /* Scan forwards for CPUs, backwards for everything else. */
+ if (cpu_scan) {
+ start = 0;
+ incr = 1;
+ end = maxmod;
+ } else {
+ start = maxmod - 1;
+ incr = -1;
+ end = -1;
+ }
- for (i = maxmod; i--; ) {
+ for (i = start; i != end; i += incr) {
struct confargs nca;
int error;
@@ -303,6 +311,20 @@ pdc_scanbus(self, ca, maxmod, hpa)
nca.ca_type.iodc_type, nca.ca_type.iodc_sv_model);
}
+ if (cpu_scan &&
+ ((nca.ca_type.iodc_type != HPPA_TYPE_NPROC ||
+ nca.ca_type.iodc_sv_model != HPPA_NPROC_HPPA) &&
+ (nca.ca_type.iodc_type != HPPA_TYPE_MEMORY ||
+ nca.ca_type.iodc_sv_model != HPPA_MEMORY_PDEP)))
+ continue;
+
+ if (!cpu_scan &&
+ ((nca.ca_type.iodc_type == HPPA_TYPE_NPROC &&
+ nca.ca_type.iodc_sv_model == HPPA_NPROC_HPPA) ||
+ (nca.ca_type.iodc_type == HPPA_TYPE_MEMORY &&
+ nca.ca_type.iodc_sv_model == HPPA_MEMORY_PDEP)))
+ continue;
+
config_found_sm(self, &nca, mbprint, mbsubmatch);
}
}
diff --git a/sys/arch/hppa/hppa/mainbus.c b/sys/arch/hppa/hppa/mainbus.c
index fd8d9759eb2..56e1df0eb3e 100644
--- a/sys/arch/hppa/hppa/mainbus.c
+++ b/sys/arch/hppa/hppa/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.77 2010/04/27 18:29:39 kettenis Exp $ */
+/* $OpenBSD: mainbus.c,v 1.78 2010/04/29 13:48:29 jsing Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -1140,11 +1140,14 @@ mbattach(parent, self, aux)
case HPPA_BOARD_HP780_C230:
case HPPA_BOARD_HP780_C240:
case HPPA_BOARD_HP785_C360:
- pdc_scanbus(self, &nca, MAXMODBUS, HPPA_FPA);
+ /* Attach CPUs first, then everything else... */
+ pdc_scanbus(self, &nca, MAXMODBUS, HPPA_FPA, 1);
+ pdc_scanbus(self, &nca, MAXMODBUS, HPPA_FPA, 0);
break;
default:
- pdc_scanbus(self, &nca, MAXMODBUS, 0);
- break;
+ /* Attach CPUs first, then everything else... */
+ pdc_scanbus(self, &nca, MAXMODBUS, 0, 1);
+ pdc_scanbus(self, &nca, MAXMODBUS, 0, 0);
}
}
diff --git a/sys/arch/hppa/include/autoconf.h b/sys/arch/hppa/include/autoconf.h
index 9e6d923a8cb..37d8c28a1ce 100644
--- a/sys/arch/hppa/include/autoconf.h
+++ b/sys/arch/hppa/include/autoconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.h,v 1.22 2007/05/27 16:36:07 kettenis Exp $ */
+/* $OpenBSD: autoconf.h,v 1.23 2010/04/29 13:48:29 jsing Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -69,7 +69,8 @@ extern void (*cold_hook)(int);
struct device;
const char *hppa_mod_info(int, int);
-void pdc_scanbus(struct device *, struct confargs *, int, hppa_hpa_t hpa);
+void pdc_scanbus(struct device *, struct confargs *, int, hppa_hpa_t hpa,
+ int);
int mbprint(void *, const char *);
int mbsubmatch(struct device *, void *, void *);
int cpu_intr_findirq(void);