mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
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@
This commit is contained in:
parent
f7bbb26e02
commit
c726023889
@ -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
|
||||
|
@ -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";
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
for (i = maxmod; 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 = 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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user