diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2004-09-23 18:00:59 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2004-09-23 18:00:59 +0000 |
commit | 2a587562ffefac951db256e624d4c10fb5464d54 (patch) | |
tree | e6c8fd8177a8725773ee0decee010a663319e8e8 /sys/arch | |
parent | 03afde90fdef2d05bb166cbf5f2f07a88a1c045f (diff) |
prepare the way for multi-bus attachment of zs (specifically zs@fhc).
Remove the zs@mainbus stuff from files.sparc64 (nothing uses it)
don't forget to rerun config...
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sparc64/conf/files.sparc64 | 5 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/zs.c | 69 |
2 files changed, 61 insertions, 13 deletions
diff --git a/sys/arch/sparc64/conf/files.sparc64 b/sys/arch/sparc64/conf/files.sparc64 index 87e3e3efebd..7d718a4ccdd 100644 --- a/sys/arch/sparc64/conf/files.sparc64 +++ b/sys/arch/sparc64/conf/files.sparc64 @@ -1,4 +1,4 @@ -# $OpenBSD: files.sparc64,v 1.50 2004/09/22 21:48:18 jason Exp $ +# $OpenBSD: files.sparc64,v 1.51 2004/09/23 18:00:58 jason Exp $ # $NetBSD: files.sparc64,v 1.50 2001/08/10 20:53:50 eeh Exp $ # maxpartitions must be first item in files.${ARCH} @@ -165,7 +165,8 @@ attach lpt at ebus with lpt_ebus file arch/sparc64/dev/lpt_ebus.c lpt_ebus device zs {[channel = -1]} -attach zs at mainbus, sbus +attach zs at sbus with zs_sbus +attach zs at fhc with zs_fhc file arch/sparc64/dev/zs.c zs needs-flag file arch/sparc64/dev/z8530sc.c zs diff --git a/sys/arch/sparc64/dev/zs.c b/sys/arch/sparc64/dev/zs.c index 5c3f822fc68..a5fc66e45d2 100644 --- a/sys/arch/sparc64/dev/zs.c +++ b/sys/arch/sparc64/dev/zs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zs.c,v 1.13 2003/06/24 21:54:39 henric Exp $ */ +/* $OpenBSD: zs.c,v 1.14 2004/09/23 18:00:58 jason Exp $ */ /* $NetBSD: zs.c,v 1.29 2001/05/30 15:24:24 lukem Exp $ */ /*- @@ -68,6 +68,7 @@ #include <dev/cons.h> #include <sparc64/dev/z8530reg.h> +#include <sparc64/dev/fhcvar.h> #include <ddb/db_output.h> #include <sparc64/dev/cons.h> @@ -157,22 +158,23 @@ struct consdev zs_consdev = { ****************************************************************/ /* Definition of the driver for autoconfig. */ -static int zs_match_mainbus(struct device *, void *, void *); -static void zs_attach_mainbus(struct device *, struct device *, void *); +static int zs_match_sbus(struct device *, void *, void *); +static void zs_attach_sbus(struct device *, struct device *, void *); + +static int zs_match_fhc(struct device *, void *, void *); +static void zs_attach_fhc(struct device *, struct device *, void *); static void zs_attach(struct zsc_softc *, struct zsdevice *, int); static int zs_print(void *, const char *name); -/* Do we really need this ? */ -struct cfattach zs_ca = { - sizeof(struct zsc_softc), zs_match_mainbus, zs_attach_mainbus +struct cfattach zs_sbus_ca = { + sizeof(struct zsc_softc), zs_match_sbus, zs_attach_sbus }; -struct cfattach zs_mainbus_ca = { - sizeof(struct zsc_softc), zs_match_mainbus, zs_attach_mainbus +struct cfattach zs_fhc_ca = { + sizeof(struct zsc_softc), zs_match_fhc, zs_attach_fhc }; -extern struct cfdriver zs_cd; extern int stdinnode; extern int fbnode; @@ -194,7 +196,7 @@ void zs_disable(struct zs_chanstate *); * Is the zs chip present? */ static int -zs_match_mainbus(parent, vcf, aux) +zs_match_sbus(parent, vcf, aux) struct device *parent; void *vcf; void *aux; @@ -208,8 +210,22 @@ zs_match_mainbus(parent, vcf, aux) return (1); } +static int +zs_match_fhc(parent, vcf, aux) + struct device *parent; + void *vcf; + void *aux; +{ + struct cfdata *cf = vcf; + struct fhc_attach_args *fa = aux; + + if (strcmp(cf->cf_driver->cd_name, fa->fa_name) != 0) + return (0); + return (1); +} + static void -zs_attach_mainbus(parent, self, aux) +zs_attach_sbus(parent, self, aux) struct device *parent; struct device *self; void *aux; @@ -263,6 +279,37 @@ zs_attach_mainbus(parent, self, aux) zs_attach(zsc, zsaddr[zs_unit], sa->sa_pri); } +static void +zs_attach_fhc(parent, self, aux) + struct device *parent; + struct device *self; + void *aux; +{ + struct zsc_softc *zsc = (void *) self; + struct fhc_attach_args *fa = aux; + int zs_unit = zsc->zsc_dev.dv_unit; + + bus_space_handle_t kvaddr; + + if (fhc_bus_map(fa->fa_bustag, fa->fa_reg[0].fbr_slot, + fa->fa_reg[0].fbr_offset, fa->fa_reg[0].fbr_size, + BUS_SPACE_MAP_LINEAR, &kvaddr) != 0) { + printf("%s @ fhc: cannot map registers\n", self->dv_xname); + return; + } + zsaddr[zs_unit] = + (struct zsdevice *) bus_space_vaddr(fa->fa_bustag, kvaddr); + + zsc->zsc_bustag = fa->fa_bustag; + zsc->zsc_dmatag = NULL; + zsc->zsc_promunit = getpropint(fa->fa_node, "slave", -2); + zsc->zsc_node = fa->fa_node; + printf("\n"); +#if 0 + zs_attach(zsc, zsaddr[zs_unit], sa->sa_pri); +#endif +} + /* * Attach a found zs. * |