diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2005-04-19 21:30:21 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2005-04-19 21:30:21 +0000 |
commit | f8113ea52367852315892e656e7e49e3ea7e957c (patch) | |
tree | f1a8704d1210070606065840879eea1909dd61cd /sys/arch/sparc/dev | |
parent | 21df6903b631dbf2a966418f3e9d09aba3fa262e (diff) |
As a late birthday present, a preliminary port to the Solbourne IDT systems
(S3000, S4000 and S4000DX).
Currently limited to diskless and serial console, and userland has issues.
Things will get better in the near future.
Diffstat (limited to 'sys/arch/sparc/dev')
-rw-r--r-- | sys/arch/sparc/dev/if_le.c | 77 | ||||
-rw-r--r-- | sys/arch/sparc/dev/if_lereg.h | 5 | ||||
-rw-r--r-- | sys/arch/sparc/dev/zs.c | 51 |
3 files changed, 128 insertions, 5 deletions
diff --git a/sys/arch/sparc/dev/if_le.c b/sys/arch/sparc/dev/if_le.c index a933b5abc38..f7c7ef6045e 100644 --- a/sys/arch/sparc/dev/if_le.c +++ b/sys/arch/sparc/dev/if_le.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le.c,v 1.25 2005/02/27 22:01:04 miod Exp $ */ +/* $OpenBSD: if_le.c,v 1.26 2005/04/19 21:30:19 miod Exp $ */ /* $NetBSD: if_le.c,v 1.50 1997/09/09 20:54:48 pk Exp $ */ /*- @@ -77,6 +77,12 @@ #include <sparc/dev/if_lereg.h> #include <sparc/dev/if_levar.h> +#ifdef solbourne +#include <sparc/sparc/asm.h> +#include <machine/idt.h> +#include <machine/kap.h> +#endif + int lematch(struct device *, void *, void *); void leattach(struct device *, struct device *, void *); @@ -131,6 +137,10 @@ hide void lehwinit(struct am7990_softc *); #if defined(SUN4M) hide void lenocarrier(struct am7990_softc *); #endif +#if defined(solbourne) +hide void kap_copytobuf(struct am7990_softc *, void *, int, int); +hide void kap_copyfrombuf(struct am7990_softc *, void *, int, int); +#endif hide void lewrcsr(sc, port, val) @@ -392,6 +402,11 @@ lematch(parent, vcf, aux) if (strcmp(cf->cf_driver->cd_name, ra->ra_name)) return (0); +#if defined(solbourne) + if (CPU_ISKAP) { + return (ca->ca_bustype == BUS_OBIO); + } +#endif #if defined(SUN4C) || defined(SUN4M) if (ca->ca_bustype == BUS_SBUS) { if (!sbus_testdma((struct sbus_softc *)parent, ca)) @@ -476,6 +491,27 @@ leattach(parent, self, aux) { u_long laddr; +#if defined(solbourne) + if (CPU_ISKAP && ca->ca_bustype == BUS_OBIO) { + /* + * Use the fixed buffer allocated in pmap_bootstrap(). + * for now, until I get the iCU translation to work... + */ + extern vaddr_t lance_va; + + laddr = PTW1_TO_PHYS(lance_va); + sc->sc_mem = (void *)PHYS_TO_PTW2(laddr); + + /* disable ICU translations for ethernet */ + sta(ICU_TER, ASI_PHYS_IO, + lda(ICU_TER, ASI_PHYS_IO) & ~TER_ETHERNET); + + /* stash the high 15 bits of the physical address */ + sta(SE_BASE + 0x18, ASI_PHYS_IO, + laddr & 0xfffe0000); + } /* else */ +#endif /* solbourne */ +#if defined(SUN4) || defined(SUN4C) || defined(SUN4M) #if defined(SUN4C) || defined(SUN4M) if (sbuschild && CPU_ISSUN4M) laddr = (u_long)dvma_malloc_space(MEMSIZE, @@ -484,13 +520,24 @@ leattach(parent, self, aux) #endif laddr = (u_long)dvma_malloc(MEMSIZE, &sc->sc_mem, M_NOWAIT); +#endif /* SUN4 || SUN4C || SUN4M */ #if defined (SUN4M) if ((laddr & 0xffffff) >= (laddr & 0xffffff) + MEMSIZE) panic("if_le: Lance buffer crosses 16MB boundary"); #endif - sc->sc_addr = laddr & 0xffffff; +#if defined(solbourne) + if (CPU_ISKAP && ca->ca_bustype == BUS_OBIO) + sc->sc_addr = laddr & 0x01ffff; + else +#endif + sc->sc_addr = laddr & 0xffffff; sc->sc_memsize = MEMSIZE; - sc->sc_conf3 = LE_C3_BSWP | LE_C3_ACON | LE_C3_BCON; +#if defined(solbourne) + if (CPU_ISKAP && ca->ca_bustype == BUS_OBIO) + sc->sc_conf3 = LE_C3_BSWP; + else +#endif + sc->sc_conf3 = LE_C3_BSWP | LE_C3_ACON | LE_C3_BCON; #if defined(SUN4C) || defined(SUN4M) if (dmachild) { lesc->sc_dma = (struct dma_softc *)parent; @@ -568,6 +615,17 @@ leattach(parent, self, aux) am7990_config(sc); +#if defined(solbourne) + if (CPU_ISKAP && ca->ca_bustype == BUS_OBIO) { + sc->sc_copytodesc = kap_copytobuf; + sc->sc_copyfromdesc = kap_copyfrombuf; + + sc->sc_initaddr = 1 << 23 | (sc->sc_initaddr & 0x01ffff); + sc->sc_rmdaddr = 1 << 23 | (sc->sc_rmdaddr & 0x01ffff); + sc->sc_tmdaddr = 1 << 23 | (sc->sc_tmdaddr & 0x01ffff); + } +#endif + lesc->sc_ih.ih_fun = am7990_intr; #if defined(SUN4M) /*XXX*/ if (CPU_ISSUN4M && lesc->sc_dma) @@ -579,3 +637,16 @@ leattach(parent, self, aux) /* now initialize DMA */ lehwreset(sc); } + +#if defined(solbourne) +hide void +kap_copytobuf(struct am7990_softc *sc, void *to, int boff, int len) +{ + return (am7990_copytobuf_contig(sc, to, boff & ~(1 << 23), len)); +} +hide void +kap_copyfrombuf(struct am7990_softc *sc, void *from, int boff, int len) +{ + return (am7990_copyfrombuf_contig(sc, from, boff & ~(1 << 23), len)); +} +#endif diff --git a/sys/arch/sparc/dev/if_lereg.h b/sys/arch/sparc/dev/if_lereg.h index ce4a71e2895..020d4d025f1 100644 --- a/sys/arch/sparc/dev/if_lereg.h +++ b/sys/arch/sparc/dev/if_lereg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lereg.h,v 1.5 2003/06/02 23:27:54 millert Exp $ */ +/* $OpenBSD: if_lereg.h,v 1.6 2005/04/19 21:30:19 miod Exp $ */ /* $NetBSD: if_lereg.h,v 1.5 1995/12/10 10:15:07 mycroft Exp $ */ /*- @@ -43,5 +43,8 @@ */ struct lereg1 { volatile u_int16_t ler1_rdp; /* data port */ +#ifdef solbourne + volatile u_char ler1_pad[6]; +#endif volatile u_int16_t ler1_rap; /* register select port */ }; diff --git a/sys/arch/sparc/dev/zs.c b/sys/arch/sparc/dev/zs.c index 259e6fb8ce4..233679fe18e 100644 --- a/sys/arch/sparc/dev/zs.c +++ b/sys/arch/sparc/dev/zs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zs.c,v 1.40 2004/09/29 07:35:12 miod Exp $ */ +/* $OpenBSD: zs.c,v 1.41 2005/04/19 21:30:19 miod Exp $ */ /* $NetBSD: zs.c,v 1.50 1997/10/18 00:00:40 gwr Exp $ */ /*- @@ -75,6 +75,10 @@ #include <sparc/sparc/auxioreg.h> #include <sparc/dev/cons.h> +#ifdef solbourne +#include <machine/prom.h> +#endif + #include <uvm/uvm_extern.h> #include "zskbd.h" @@ -116,10 +120,18 @@ int zs_major = 12; /* The layout of this is hardware-dependent (padding, order). */ struct zschan { +#if defined(SUN4) || defined(SUN4C) || defined(SUN4M) volatile u_char zc_csr; /* ctrl,status, and indirect access */ u_char zc_xxx0; volatile u_char zc_data; /* data */ u_char zc_xxx1; +#endif +#if defined(solbourne) + volatile u_char zc_csr; /* ctrl,status, and indirect access */ + u_char zc_xxx0[7]; + volatile u_char zc_data; /* data */ + u_char zc_xxx1[7]; +#endif }; struct zsdevice { /* Yes, they are backwards. */ @@ -225,6 +237,12 @@ zs_match(parent, vcf, aux) if (strcmp(cf->cf_driver->cd_name, ra->ra_name)) return (0); + +#ifdef solbourne + if (CPU_ISKAP) + return (ca->ca_bustype == BUS_OBIO); +#endif + if ((ca->ca_bustype == BUS_MAIN && !CPU_ISSUN4) || (ca->ca_bustype == BUS_OBIO && CPU_ISSUN4M)) return (getpropint(ra->ra_node, "slave", -2) == cf->cf_unit); @@ -808,6 +826,8 @@ zscnpollc(dev, on) /*****************************************************************/ +#if defined(SUN4) || defined(SUN4C) || defined(SUN4M) + cons_decl(prom); /* @@ -912,6 +932,8 @@ promcnputc(dev, c) splx(s); } +#endif /* SUN4 || SUN4C || SUN4M */ + /*****************************************************************/ #if 0 @@ -936,6 +958,7 @@ consinit() int channel, zs_unit; int inSource, outSink; +#if defined(SUN4) || defined(SUN4C) || defined(SUN4M) if (promvec->pv_romvec_vers > 2) { /* We need to probe the PROM device tree */ int node,fd; @@ -1043,8 +1066,34 @@ setup_output: inSource = *promvec->pv_stdin; outSink = *promvec->pv_stdout; } +#endif /* SUN4 || SUN4C || SUN4M */ +#ifdef solbourne + if (CPU_ISKAP) { + const char *dev; + + inSource = PROMDEV_TTYA; /* default */ + dev = prom_getenv(ENV_INPUTDEVICE); + if (dev != NULL) { + if (strcmp(dev, "ttyb") == 0) + inSource = PROMDEV_TTYB; + if (strcmp(dev, "keyboard") == 0) + inSource = PROMDEV_KBD; + } + + outSink = PROMDEV_TTYA; /* default */ + dev = prom_getenv(ENV_OUTPUTDEVICE); + if (dev != NULL) { + if (strcmp(dev, "ttyb") == 0) + outSink = PROMDEV_TTYB; + if (strcmp(dev, "screen") == 0) + outSink = PROMDEV_SCREEN; + } + } +#endif +#if defined(SUN4) || defined(SUN4C) || defined(SUN4M) setup_console: +#endif if (inSource != outSink) { printf("cninit: mismatched PROM output selector\n"); |