diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2002-12-18 23:52:46 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2002-12-18 23:52:46 +0000 |
commit | fc877ee58f6d572a9d70bda817ee14104bfc83f6 (patch) | |
tree | 642c23942ed1feb3ae61f2fb1393da1adcf0592e /sys | |
parent | d39e07d3103f88f7d4e66509e3a5d4db23f6afe8 (diff) |
newer machines use phantom bus to attach lasi and other bus adapters.
oledr machines did not have a real device for the phantom bus port.
change the device scanning technique to both include a full device path
in the attach_args and do proper shifting in the pdc_scanbus() and
add a device for the newer machines as well as use a newer device
mapping (path to hpa) available on newer firmware versions, where
old (hversion-dependant) is not available.
tested on 712,715/33,c110, miod@ ok, weissmandude -- testing
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/hppa/conf/GENERIC | 4 | ||||
-rw-r--r-- | sys/arch/hppa/conf/files.hppa | 11 | ||||
-rw-r--r-- | sys/arch/hppa/dev/asp.c | 9 | ||||
-rw-r--r-- | sys/arch/hppa/dev/lasi.c | 47 | ||||
-rw-r--r-- | sys/arch/hppa/dev/phantomas.c | 83 | ||||
-rw-r--r-- | sys/arch/hppa/gsc/gscbus.c | 4 | ||||
-rw-r--r-- | sys/arch/hppa/gsc/gscbusvar.h | 4 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/autoconf.c | 63 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/mainbus.c | 7 | ||||
-rw-r--r-- | sys/arch/hppa/include/autoconf.h | 6 | ||||
-rw-r--r-- | sys/arch/hppa/stand/libsa/cmd_hppa.c | 104 |
11 files changed, 245 insertions, 97 deletions
diff --git a/sys/arch/hppa/conf/GENERIC b/sys/arch/hppa/conf/GENERIC index 315ae3eba7f..2cbdf5b3f5b 100644 --- a/sys/arch/hppa/conf/GENERIC +++ b/sys/arch/hppa/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.12 2002/12/18 01:20:03 deraadt Exp $ +# $OpenBSD: GENERIC,v 1.13 2002/12/18 23:52:41 mickey Exp $ # # Diskless kernel config # @@ -12,6 +12,7 @@ mainbus0 at root # root "bus" mem* at mainbus0 # /dev/*mem and memory controller pdc0 at mainbus0 # PDC/IODC wrapper for boot console cpu* at mainbus0 irq 31 # HP PA-RISC cpu +phantomas* at mainbus0 # Phantom PseudoBC GSC+ Port #fpu* at mainbus0 # HP PA-RISC fpu (iv N/A) #pmu* at mainbus0 # HP PA-RISC perfomance monitor unit (iv 29) #power* at mainbus0 # power/fail manager (iv 2) @@ -43,6 +44,7 @@ option USELEDS # blink 'em lasi0 at mainbus0 offset 0x100000 irq 28 # LASI host adapter (LSI PN???) lasi0 at mainbus0 offset 0xfd00000 irq 28 # LASI on J210 +lasi0 at phantomas0 offset 0xfd00000 irq 28 # LASI on [ABC]* lasi1 at mainbus0 offset 0x500000 irq 27 # GIO card asp* at mainbus0 irq 28 # this one comes w/ Viper and leds #wax* at mainbus0 irq 24 # Wax may host EISA as well diff --git a/sys/arch/hppa/conf/files.hppa b/sys/arch/hppa/conf/files.hppa index b60ea56937d..8d328d1de17 100644 --- a/sys/arch/hppa/conf/files.hppa +++ b/sys/arch/hppa/conf/files.hppa @@ -1,4 +1,4 @@ -# $OpenBSD: files.hppa,v 1.35 2002/03/16 01:14:27 mickey Exp $ +# $OpenBSD: files.hppa,v 1.36 2002/12/18 23:52:41 mickey Exp $ # # hppa-specific configuration info @@ -82,10 +82,17 @@ device fpu attach fpu at mainbus file arch/hppa/dev/fpu.c fpu +# Phantom PseudoBC GSC+ Port +define phantomas {[offset = -1], [irq = -1]} +device phantomas +attach phantomas at mainbus +file arch/hppa/dev/phantomas.c phantomas + # 1FT1-0002, 1FU2-0002 # as goes w/ 7100LC, 7300LC, 7200, 8000, 8200, 8500 device lasi: gscbus -attach lasi at mainbus +attach lasi at mainbus with lasi_mainbus +attach lasi at phantomas with lasi_phantomas file arch/hppa/dev/lasi.c lasi # all the older systems diff --git a/sys/arch/hppa/dev/asp.c b/sys/arch/hppa/dev/asp.c index 66ee0028a67..40c5ac92f91 100644 --- a/sys/arch/hppa/dev/asp.c +++ b/sys/arch/hppa/dev/asp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asp.c,v 1.8 2002/12/17 21:54:20 mickey Exp $ */ +/* $OpenBSD: asp.c,v 1.9 2002/12/18 23:52:45 mickey Exp $ */ /* * Copyright (c) 1998-2002 Michael Shalayeff @@ -201,6 +201,13 @@ aspattach(parent, self, aux) sc->sc_ic.gsc_base = sc->sc_trs; ga.ga_ca = *ca; /* clone from us */ + ga.ga_dp.dp_bc[0] = ga.ga_dp.dp_bc[1]; + ga.ga_dp.dp_bc[1] = ga.ga_dp.dp_bc[2]; + ga.ga_dp.dp_bc[2] = ga.ga_dp.dp_bc[3]; + ga.ga_dp.dp_bc[3] = ga.ga_dp.dp_bc[4]; + ga.ga_dp.dp_bc[4] = ga.ga_dp.dp_bc[5]; + ga.ga_dp.dp_bc[5] = ga.ga_dp.dp_mod; + ga.ga_dp.dp_mod = 0; ga.ga_hpamask = ASP_IOMASK; ga.ga_name = "gsc"; ga.ga_ic = &sc->sc_ic; diff --git a/sys/arch/hppa/dev/lasi.c b/sys/arch/hppa/dev/lasi.c index f0614519c95..dd7ebcc80c5 100644 --- a/sys/arch/hppa/dev/lasi.c +++ b/sys/arch/hppa/dev/lasi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lasi.c,v 1.10 2002/12/17 21:54:20 mickey Exp $ */ +/* $OpenBSD: lasi.c,v 1.11 2002/12/18 23:52:45 mickey Exp $ */ /* * Copyright (c) 1998-2002 Michael Shalayeff @@ -69,6 +69,7 @@ struct lasi_trs { struct lasi_softc { struct device sc_dev; struct gscbus_ic sc_ic; + int sc_phantomassed; struct lasi_hwr volatile *sc_hw; struct lasi_trs volatile *sc_trs; @@ -77,10 +78,16 @@ struct lasi_softc { int lasimatch(struct device *, void *, void *); void lasiattach(struct device *, struct device *, void *); +void lasi_mainbus_attach(struct device *, struct device *, void *); +void lasi_phantomas_attach(struct device *, struct device *, void *); void lasi_gsc_attach(struct device *); -struct cfattach lasi_ca = { - sizeof(struct lasi_softc), lasimatch, lasiattach +struct cfattach lasi_mainbus_ca = { + sizeof(struct lasi_softc), lasimatch, lasi_mainbus_attach +}; + +struct cfattach lasi_phantomas_ca = { + sizeof(struct lasi_softc), lasimatch, lasi_phantomas_attach }; struct cfdriver lasi_cd = { @@ -106,13 +113,34 @@ lasimatch(parent, cfdata, aux) } void +lasi_mainbus_attach(parent, self, aux) + struct device *parent; + struct device *self; + void *aux; +{ + lasiattach(parent, self, aux); +} + +void +lasi_phantomas_attach(parent, self, aux) + struct device *parent; + struct device *self; + void *aux; +{ + struct lasi_softc *sc = (struct lasi_softc *)self; + + sc->sc_phantomassed = 1; + lasiattach(parent, self, aux); +} + +void lasiattach(parent, self, aux) struct device *parent; struct device *self; void *aux; { - register struct confargs *ca = aux; - register struct lasi_softc *sc = (struct lasi_softc *)self; + struct lasi_softc *sc = (struct lasi_softc *)self; + struct confargs *ca = aux; bus_space_handle_t ioh; int s, in; @@ -146,6 +174,15 @@ lasiattach(parent, self, aux) sc->sc_ic.gsc_base = sc->sc_trs; sc->ga.ga_ca = *ca; /* clone from us */ + if (!sc->sc_phantomassed) { + sc->ga.ga_dp.dp_bc[0] = sc->ga.ga_dp.dp_bc[1]; + sc->ga.ga_dp.dp_bc[1] = sc->ga.ga_dp.dp_bc[2]; + sc->ga.ga_dp.dp_bc[2] = sc->ga.ga_dp.dp_bc[3]; + sc->ga.ga_dp.dp_bc[3] = sc->ga.ga_dp.dp_bc[4]; + sc->ga.ga_dp.dp_bc[4] = sc->ga.ga_dp.dp_bc[5]; + sc->ga.ga_dp.dp_bc[5] = sc->ga.ga_dp.dp_mod; + sc->ga.ga_dp.dp_mod = 0; + } if (sc->sc_dev.dv_unit) config_defer(self, lasi_gsc_attach); else { diff --git a/sys/arch/hppa/dev/phantomas.c b/sys/arch/hppa/dev/phantomas.c new file mode 100644 index 00000000000..e5d6b171863 --- /dev/null +++ b/sys/arch/hppa/dev/phantomas.c @@ -0,0 +1,83 @@ +/* $OpenBSD: phantomas.c,v 1.1 2002/12/18 23:52:45 mickey Exp $ */ + +/* + * Copyright (c) 2002 Michael Shalayeff + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Michael Shalayeff. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/device.h> + +#include <machine/pdc.h> +#include <machine/iomod.h> +#include <machine/autoconf.h> + +#include <hppa/dev/cpudevs.h> + +struct cfdriver phantomas_cd = { + NULL, "phantomas", DV_DULL +}; + +struct phantomas_softc { + struct device sc_dev; + +}; + +int phantomasmatch(struct device *, void *, void *); +void phantomasattach(struct device *, struct device *, void *); + +struct cfattach phantomas_ca = { + sizeof(struct phantomas_softc), phantomasmatch, phantomasattach +}; + +int +phantomasmatch(struct device *parent, void *cfdata, void *aux) +{ + struct confargs *ca = aux; + + if (ca->ca_type.iodc_type != HPPA_TYPE_BCPORT || + ca->ca_type.iodc_sv_model != HPPA_BCPORT_PHANTOM) + return (0); + + return (1); +} + +void +phantomasattach(struct device *parent, struct device *self, void *aux) +{ + struct confargs *ca = aux, nca; + + printf("\n"); + + nca = *ca; + nca.ca_name = "phantomas"; + nca.ca_hpamask = HPPA_IOSPACE; + pdc_scanbus(self, &nca, MAXMODBUS); +} diff --git a/sys/arch/hppa/gsc/gscbus.c b/sys/arch/hppa/gsc/gscbus.c index 35e42354386..17d1cd6f52c 100644 --- a/sys/arch/hppa/gsc/gscbus.c +++ b/sys/arch/hppa/gsc/gscbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gscbus.c,v 1.20 2002/12/17 21:54:25 mickey Exp $ */ +/* $OpenBSD: gscbus.c,v 1.21 2002/12/18 23:52:45 mickey Exp $ */ /* * Copyright (c) 1998 Michael Shalayeff @@ -167,7 +167,7 @@ gscattach(parent, self, aux) sc->sc_dmatag._dmamem_mmap = gsc_dmamem_mmap; ga->ga_hpamask = HPPA_FLEX_MASK; - pdc_scanbus(self, &ga->ga_ca, ga->ga_mod, MAXMODBUS); + pdc_scanbus(self, &ga->ga_ca, MAXMODBUS); } int diff --git a/sys/arch/hppa/gsc/gscbusvar.h b/sys/arch/hppa/gsc/gscbusvar.h index 5f7bac54ba2..653e5481d01 100644 --- a/sys/arch/hppa/gsc/gscbusvar.h +++ b/sys/arch/hppa/gsc/gscbusvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: gscbusvar.h,v 1.8 2002/12/17 21:54:25 mickey Exp $ */ +/* $OpenBSD: gscbusvar.h,v 1.9 2002/12/18 23:52:45 mickey Exp $ */ /* * Copyright (c) 1998-2002 Michael Shalayeff @@ -40,7 +40,7 @@ struct gsc_attach_args { struct confargs ga_ca; #define ga_name ga_ca.ca_name #define ga_iot ga_ca.ca_iot -#define ga_mod ga_ca.ca_mod +#define ga_dp ga_ca.ca_dp #define ga_type ga_ca.ca_type #define ga_hpa ga_ca.ca_hpa #define ga_hpamask ga_ca.ca_hpamask diff --git a/sys/arch/hppa/hppa/autoconf.c b/sys/arch/hppa/hppa/autoconf.c index dbb0ef8e54e..06b0cb64c6c 100644 --- a/sys/arch/hppa/hppa/autoconf.c +++ b/sys/arch/hppa/hppa/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.24 2002/12/18 20:56:59 miod Exp $ */ +/* $OpenBSD: autoconf.c,v 1.25 2002/12/18 23:52:45 mickey Exp $ */ /* * Copyright (c) 1998-2001 Michael Shalayeff @@ -588,47 +588,64 @@ getstr(cp, size) } void -pdc_scanbus(self, ca, bus, maxmod) +pdc_scanbus(self, ca, maxmod) struct device *self; struct confargs *ca; - int bus, maxmod; + int maxmod; { - struct pdc_memmap pdc_memmap; - struct device_path dp; int i; for (i = maxmod; i--; ) { - struct confargs nca; struct pdc_iodc_read pdc_iodc_read; + struct pdc_memmap pdc_memmap; + struct confargs nca; + hppa_hpa_t hpa; + int error; - dp.dp_bc[0] = dp.dp_bc[1] = dp.dp_bc[2] = dp.dp_bc[3] = -1; - dp.dp_bc[4] = bus; - dp.dp_bc[5] = bus < 0? -1 : 0; - dp.dp_mod = i; - - if (pdc_call((iodcio_t)pdc, 0, PDC_MEMMAP, - PDC_MEMMAP_HPA, &pdc_memmap, &dp) < 0) + hpa = 0; + nca = *ca; + nca.ca_dp.dp_bc[0] = ca->ca_dp.dp_bc[1]; + nca.ca_dp.dp_bc[1] = ca->ca_dp.dp_bc[2]; + nca.ca_dp.dp_bc[2] = ca->ca_dp.dp_bc[3]; + nca.ca_dp.dp_bc[3] = ca->ca_dp.dp_bc[4]; + nca.ca_dp.dp_bc[4] = ca->ca_dp.dp_bc[5]; + nca.ca_dp.dp_bc[5] = ca->ca_dp.dp_mod; + nca.ca_dp.dp_mod = i; + + if ((error = pdc_call((iodcio_t)pdc, 0, PDC_MEMMAP, + PDC_MEMMAP_HPA, &pdc_memmap, &nca.ca_dp)) == 0) + hpa = pdc_memmap.hpa; + else if ((error = pdc_call((iodcio_t)pdc, 0, PDC_SYSMAP, + PDC_SYSMAP_HPA, &pdc_memmap, &nca.ca_dp)) == 0) + hpa = pdc_memmap.hpa; + + if (!hpa) continue; - nca = *ca; - if (pdc_call((iodcio_t)pdc, 0, PDC_IODC, PDC_IODC_READ, - &pdc_iodc_read, pdc_memmap.hpa, IODC_DATA, - &nca.ca_type, sizeof(nca.ca_type)) < 0) + if (autoconf_verbose) + printf(">> HPA 0x%x\n", hpa); + + if ((error = pdc_call((iodcio_t)pdc, 0, PDC_IODC, + PDC_IODC_READ, &pdc_iodc_read, hpa, IODC_DATA, + &nca.ca_type, sizeof(nca.ca_type))) < 0) { + if (autoconf_verbose) + printf(">> iodc_data error %d\n", error); continue; + } - nca.ca_mod = i; - nca.ca_hpa = pdc_memmap.hpa; + nca.ca_hpa = hpa; nca.ca_pdc_iodc_read = &pdc_iodc_read; nca.ca_name = hppa_mod_info(nca.ca_type.iodc_type, nca.ca_type.iodc_sv_model); if (autoconf_verbose) { printf(">> probing: flags %b bc %d/%d/%d/%d/%d/%d ", - dp.dp_flags, PZF_BITS, - dp.dp_bc[0], dp.dp_bc[1], dp.dp_bc[2], - dp.dp_bc[3], dp.dp_bc[4], dp.dp_bc[5]); + nca.ca_dp.dp_flags, PZF_BITS, + nca.ca_dp.dp_bc[0], nca.ca_dp.dp_bc[1], + nca.ca_dp.dp_bc[2], nca.ca_dp.dp_bc[3], + nca.ca_dp.dp_bc[4], nca.ca_dp.dp_bc[5]); printf("mod %x hpa %x type %x sv %x\n", - dp.dp_mod, pdc_memmap.hpa, + nca.ca_dp.dp_mod, hpa, nca.ca_type.iodc_type, nca.ca_type.iodc_sv_model); } diff --git a/sys/arch/hppa/hppa/mainbus.c b/sys/arch/hppa/hppa/mainbus.c index 043fc1091dc..c856e8caa84 100644 --- a/sys/arch/hppa/hppa/mainbus.c +++ b/sys/arch/hppa/hppa/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.37 2002/10/21 15:58:21 mickey Exp $ */ +/* $OpenBSD: mainbus.c,v 1.38 2002/12/18 23:52:45 mickey Exp $ */ /* * Copyright (c) 1998-2001 Michael Shalayeff @@ -851,7 +851,10 @@ mbattach(parent, self, aux) nca.ca_hpamask = HPPA_IOSPACE; nca.ca_iot = &hppa_bustag; nca.ca_dmatag = &hppa_dmatag; - pdc_scanbus(self, &nca, -1, MAXMODBUS); + nca.ca_dp.dp_bc[0] = nca.ca_dp.dp_bc[1] = nca.ca_dp.dp_bc[2] = + nca.ca_dp.dp_bc[3] = nca.ca_dp.dp_bc[4] = nca.ca_dp.dp_bc[5] = -1; + nca.ca_dp.dp_mod = -1; + pdc_scanbus(self, &nca, MAXMODBUS); } /* diff --git a/sys/arch/hppa/include/autoconf.h b/sys/arch/hppa/include/autoconf.h index b898d09d293..9e6322c19bc 100644 --- a/sys/arch/hppa/include/autoconf.h +++ b/sys/arch/hppa/include/autoconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.h,v 1.16 2002/12/17 21:54:25 mickey Exp $ */ +/* $OpenBSD: autoconf.h,v 1.17 2002/12/18 23:52:45 mickey Exp $ */ /* * Copyright (c) 1998 Michael Shalayeff @@ -36,7 +36,7 @@ struct confargs { const char *ca_name; /* device name/description */ bus_space_tag_t ca_iot; /* io tag */ - int ca_mod; /* module number on the bus */ + struct device_path ca_dp; /* device_path as found by pdc_scan */ struct iodc_data ca_type; /* iodc-specific type descrition */ hppa_hpa_t ca_hpa; /* module HPA */ hppa_hpa_t ca_hpamask; /* mask for modules on the bus */ @@ -66,7 +66,7 @@ extern void (*cold_hook)(int); struct device; const char *hppa_mod_info(int, int); -void pdc_scanbus(struct device *, struct confargs *, int bus, int); +void pdc_scanbus(struct device *, struct confargs *, int); int mbprint(void *, const char *); int mbsubmatch(struct device *, void *, void *); void *cpu_intr_map(void *v, int pri, int irq, int (*handler)(void *), diff --git a/sys/arch/hppa/stand/libsa/cmd_hppa.c b/sys/arch/hppa/stand/libsa/cmd_hppa.c index 27317b1ebad..7222849a1b0 100644 --- a/sys/arch/hppa/stand/libsa/cmd_hppa.c +++ b/sys/arch/hppa/stand/libsa/cmd_hppa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd_hppa.c,v 1.5 2002/04/29 00:13:25 miod Exp $ */ +/* $OpenBSD: cmd_hppa.c,v 1.6 2002/12/18 23:52:45 mickey Exp $ */ /* * Copyright (c) 2002 Miodrag Vallat @@ -85,12 +85,16 @@ struct consoledev graphics[MAX_GRAPHICS]; /* Relaxed device comparison */ #define MATCH(dev1, dev2) \ (dev1).dp_mod == (dev2).dp_mod && \ + (dev1).dp_bc[0] == (dev2).dp_bc[0] && \ + (dev1).dp_bc[1] == (dev2).dp_bc[1] && \ + (dev1).dp_bc[2] == (dev2).dp_bc[2] && \ + (dev1).dp_bc[3] == (dev2).dp_bc[3] && \ (dev1).dp_bc[4] == (dev2).dp_bc[4] && \ (dev1).dp_bc[5] == (dev2).dp_bc[5] int walked; -void bus_walk(int); +void bus_walk(struct device_path *); void register_device(struct consoledev *, int, struct device_path *, struct iodc_data *, int, int); @@ -440,7 +444,7 @@ Xconsole() /* walk the device list if not already done */ if (walked == 0) { - bus_walk(-1); + bus_walk(NULL); walked++; } @@ -569,7 +573,7 @@ Xkeyboard() /* walk the device list if not already done */ if (walked == 0) { - bus_walk(-1); + bus_walk(NULL); walked++; } @@ -620,44 +624,43 @@ Xkeyboard() * serial ports, keyboard and graphics devices as they are found. */ void -bus_walk(bus) - int bus; +bus_walk(struct device_path *idp) { struct device_path dp; struct pdc_memmap memmap; struct iodc_data mptr; - struct iomod *io; - iodcio_t iodc; - int err; - int i; - int kluge_ps2 = 0; /* kluge, see below */ + int err, i, kluge_ps2 = 0; /* kluge, see below */ - iodc = (iodcio_t)(PAGE0->mem_free + IODC_MAXSIZE); - for (i = 0; i < MAXMODBUS; i++) { - dp.dp_bc[0] = dp.dp_bc[1] = - dp.dp_bc[2] = dp.dp_bc[3] = -1; - dp.dp_bc[4] = bus; - dp.dp_bc[5] = bus < 0 ? -1 : 0; + + if (idp) { + dp.dp_bc[0] = idp->dp_bc[1]; + dp.dp_bc[1] = idp->dp_bc[2]; + dp.dp_bc[2] = idp->dp_bc[3]; + dp.dp_bc[3] = idp->dp_bc[4]; + dp.dp_bc[4] = idp->dp_bc[5]; + dp.dp_bc[5] = idp->dp_mod; + } else { + dp.dp_bc[0] = dp.dp_bc[1] = dp.dp_bc[2] = + dp.dp_bc[3] = dp.dp_bc[4] = dp.dp_bc[5] = -1; + } + dp.dp_mod = i; - if ((pdc)(PDC_MEMMAP, PDC_MEMMAP_HPA, &memmap, - &dp) < 0) + if ((pdc)(PDC_MEMMAP, PDC_MEMMAP_HPA, &memmap, &dp) < 0 && + (pdc)(PDC_SYSMAP, PDC_SYSMAP_HPA, &memmap, &dp) < 0) continue; - io = (struct iomod *) memmap.hpa; - - if ((err = (pdc)(PDC_IODC, PDC_IODC_READ, &pdcbuf, io, - IODC_DATA, &mptr, sizeof(mptr))) < 0) { + if ((err = (pdc)(PDC_IODC, PDC_IODC_READ, &pdcbuf, memmap.hpa, + IODC_DATA, &mptr, sizeof(mptr))) < 0) continue; - } #ifdef DEBUG - printf("device %d/%d flags %d mod %x type %x model %x\n", - dp.dp_bc[4], dp.dp_bc[5], - dp.dp_flags, dp.dp_mod, + printf("device %d/%d/%d/%d/%d/%d " + "flags %d mod %x type %x model %x\n", + dp.dp_bc[0], dp.dp_bc[1], dp.dp_bc[2], dp.dp_bc[3], + dp.dp_bc[4], dp.dp_bc[5], dp.dp_flags, dp.dp_mod, mptr.iodc_type, mptr.iodc_sv_model); #endif - /* * If the device can be considered as a valid rs232, * graphics console or keyboard, register it. @@ -673,6 +676,23 @@ bus_walk(bus) * ports are not seen as attached to the same busses... */ switch (mptr.iodc_type) { + case HPPA_TYPE_BCPORT: + bus_walk(&dp); + break; + case HPPA_TYPE_BHA: + case HPPA_TYPE_BRIDGE: + /* if there was no phantomas here */ + if (dp.dp_bc[5] == -1) { + dp.dp_bc[0] = dp.dp_bc[1]; + dp.dp_bc[1] = dp.dp_bc[2]; + dp.dp_bc[2] = dp.dp_bc[3]; + dp.dp_bc[3] = dp.dp_bc[4]; + dp.dp_bc[4] = dp.dp_bc[5]; + dp.dp_bc[5] = dp.dp_mod; + dp.dp_mod = 0; + } + bus_walk(&dp); + break; case HPPA_TYPE_ADIRECT: switch (mptr.iodc_sv_model) { case HPPA_ADIRECT_RS232: @@ -753,34 +773,6 @@ bus_walk(bus) break; } } - - /* - * Do a second pass to scan all child busses - */ - for (i = 0; i < MAXMODBUS; i++) { - dp.dp_bc[0] = dp.dp_bc[1] = - dp.dp_bc[2] = dp.dp_bc[3] = -1; - dp.dp_bc[4] = bus; - dp.dp_bc[5] = bus < 0 ? -1 : 0; - dp.dp_mod = i; - if ((pdc)(PDC_MEMMAP, PDC_MEMMAP_HPA, &memmap, - &dp) < 0) - continue; - - io = (struct iomod *) memmap.hpa; - - if ((err = (pdc)(PDC_IODC, PDC_IODC_READ, &pdcbuf, io, - IODC_DATA, &mptr, sizeof(mptr))) < 0) { - continue; - } - - switch (mptr.iodc_type) { - case HPPA_TYPE_BHA: - case HPPA_TYPE_BRIDGE: - bus_walk(dp.dp_mod); - break; - } - } } void |