diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2005-07-08 12:36:39 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2005-07-08 12:36:39 +0000 |
commit | 21702b31450d01b80d8baa0d1f752135a65f4a04 (patch) | |
tree | 3f8178554f7a36b0dc808ab66d4a8c3cebe42fc4 /sys/arch/sparc | |
parent | b02a6979f78a350d5fc3ca846a4e4d161aefb902 (diff) |
Allow more than one auxio device to attach, and attach both SPARCbook auxio
registers. However, those are handled specifically since they do not have
the same meaning as the regular sun4c/sun4m auxio register.
A specific auxregbisc() function is provided for explicit sparcbook operation.
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r-- | sys/arch/sparc/conf/GENERIC | 6 | ||||
-rw-r--r-- | sys/arch/sparc/conf/RAMDISK | 6 | ||||
-rw-r--r-- | sys/arch/sparc/conf/SUN4C | 4 | ||||
-rw-r--r-- | sys/arch/sparc/conf/SUN4M | 4 | ||||
-rw-r--r-- | sys/arch/sparc/conf/files.sparc | 4 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/auxioreg.h | 16 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/auxreg.c | 101 |
7 files changed, 95 insertions, 46 deletions
diff --git a/sys/arch/sparc/conf/GENERIC b/sys/arch/sparc/conf/GENERIC index bad6c5112ec..d56e7005322 100644 --- a/sys/arch/sparc/conf/GENERIC +++ b/sys/arch/sparc/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.82 2005/04/30 00:49:36 deraadt Exp $ +# $OpenBSD: GENERIC,v 1.83 2005/07/08 12:36:36 miod Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -52,8 +52,8 @@ audio* at audioamd? audiocs0 at sbus0 # sun4m audio* at audiocs? -auxreg0 at mainbus0 # sun4c -auxreg0 at obio0 # sun4m +auxreg* at mainbus0 # sun4c +auxreg* at obio0 # sun4m # Power status and control register found on Sun4m systems power0 at obio0 diff --git a/sys/arch/sparc/conf/RAMDISK b/sys/arch/sparc/conf/RAMDISK index 8de8a6629e9..10667ced5b8 100644 --- a/sys/arch/sparc/conf/RAMDISK +++ b/sys/arch/sparc/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.55 2005/05/01 07:54:42 david Exp $ +# $OpenBSD: RAMDISK,v 1.56 2005/07/08 12:36:36 miod Exp $ # $NetBSD: GENERIC,v 1.28.2.1 1996/07/02 23:55:22 jtc Exp $ # Machine architecture; required by config(8) @@ -64,8 +64,8 @@ sbus0 at iommu0 # sun4m #audioamd0 at sbus0 # sun4m #audio* at audioamd? -auxreg0 at mainbus0 # sun4c -auxreg0 at obio0 # sun4m +auxreg* at mainbus0 # sun4c +auxreg* at obio0 # sun4m # Power status and control register found on Sun4m systems power0 at obio0 diff --git a/sys/arch/sparc/conf/SUN4C b/sys/arch/sparc/conf/SUN4C index 09cb4bc94af..7989278104b 100644 --- a/sys/arch/sparc/conf/SUN4C +++ b/sys/arch/sparc/conf/SUN4C @@ -1,4 +1,4 @@ -# $OpenBSD: SUN4C,v 1.52 2005/05/01 07:54:42 david Exp $ +# $OpenBSD: SUN4C,v 1.53 2005/07/08 12:36:36 miod Exp $ # $NetBSD: GENERIC,v 1.48 1997/08/23 19:19:01 mjacob Exp $ # Machine architecture; required by config(8) @@ -32,7 +32,7 @@ sbus0 at mainbus0 # sun4c audioamd0 at mainbus0 # sun4c audio* at audioamd? -auxreg0 at mainbus0 # sun4c +auxreg* at mainbus0 # sun4c # Mostek clock found on 4/300, sun4c, and sun4m systems. # The Mostek clock NVRAM is the "eeprom" on sun4/300 systems. diff --git a/sys/arch/sparc/conf/SUN4M b/sys/arch/sparc/conf/SUN4M index 3ffdd558103..f2d78ba7433 100644 --- a/sys/arch/sparc/conf/SUN4M +++ b/sys/arch/sparc/conf/SUN4M @@ -1,4 +1,4 @@ -# $OpenBSD: SUN4M,v 1.67 2005/05/01 07:54:42 david Exp $ +# $OpenBSD: SUN4M,v 1.68 2005/07/08 12:36:36 miod Exp $ # $NetBSD: GENERIC,v 1.28.2.1 1996/07/02 23:55:22 jtc Exp $ # Machine architecture; required by config(8) @@ -40,7 +40,7 @@ audio* at audioamd? audiocs0 at sbus0 # sun4m audio* at audiocs? -auxreg0 at obio0 # sun4m +auxreg* at obio0 # sun4m # Power status and control register found on Sun4m systems power0 at obio0 diff --git a/sys/arch/sparc/conf/files.sparc b/sys/arch/sparc/conf/files.sparc index 708250a6a7f..4b01ee5618d 100644 --- a/sys/arch/sparc/conf/files.sparc +++ b/sys/arch/sparc/conf/files.sparc @@ -1,4 +1,4 @@ -# $OpenBSD: files.sparc,v 1.67 2005/05/03 00:39:39 brad Exp $ +# $OpenBSD: files.sparc,v 1.68 2005/07/08 12:36:36 miod Exp $ # $NetBSD: files.sparc,v 1.44 1997/08/31 21:29:16 pk Exp $ # @(#)files.sparc 8.1 (Berkeley) 7/19/93 @@ -30,7 +30,7 @@ file arch/sparc/dev/obio.c (obio | vmel | vmes | vme) & !solbourne device auxreg attach auxreg at mainbus, obio -file arch/sparc/sparc/auxreg.c auxreg needs-count +file arch/sparc/sparc/auxreg.c auxreg needs-flag device clock attach clock at mainbus, obio diff --git a/sys/arch/sparc/sparc/auxioreg.h b/sys/arch/sparc/sparc/auxioreg.h index ad8223c325b..b79a0c76fcc 100644 --- a/sys/arch/sparc/sparc/auxioreg.h +++ b/sys/arch/sparc/sparc/auxioreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: auxioreg.h,v 1.4 2003/06/02 23:27:55 millert Exp $ */ +/* $OpenBSD: auxioreg.h,v 1.5 2005/07/08 12:36:38 miod Exp $ */ /* $NetBSD: auxreg.h,v 1.7 1997/05/17 17:52:52 pk Exp $ */ /* @@ -62,6 +62,18 @@ #define AUXIO4M_LED 0x01 /* front panel LED */ /* + * Tadpole Auxiliary I/O registers. Those control various power management + * features. + */ + +#define AUXIO_MODEM 0x01 /* enable modem power */ +#define AUXIO_ISDN 0x04 /* enable ISDN power */ +#define AUXIO_MODEM_RESET 0x08 /* reset modem line (active low) */ +#define AUXIO_TFT 0x80 /* S3000 XT tft power */ + +#define AUXIO2_SERIAL 0x01 /* enable serial ports power */ + +/* * We use a fixed virtual address for the register because we use it for * timing short sections of code (via external hardware attached to the LED). */ @@ -119,8 +131,8 @@ ) #ifndef _LOCORE -extern volatile u_char *auxio_reg; /* Copy of AUXIO_REG */ extern u_char auxio_regval; unsigned int auxregbisc(int, int); +unsigned int sb_auxregbisc(int, int, int); #endif diff --git a/sys/arch/sparc/sparc/auxreg.c b/sys/arch/sparc/sparc/auxreg.c index b9f0cb5dafd..221d3b0c1a3 100644 --- a/sys/arch/sparc/sparc/auxreg.c +++ b/sys/arch/sparc/sparc/auxreg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auxreg.c,v 1.12 2005/04/17 18:47:50 miod Exp $ */ +/* $OpenBSD: auxreg.c,v 1.13 2005/07/08 12:36:38 miod Exp $ */ /* $NetBSD: auxreg.c,v 1.21 1997/05/24 20:15:59 pk Exp $ */ /* @@ -67,6 +67,12 @@ struct cfdriver auxreg_cd = { volatile u_char *auxio_reg; /* Copy of AUXIO_REG */ u_char auxio_regval; + +#ifdef SUN4M /* Tadpole SPARCbook */ +volatile u_char *sb_auxio_reg; +volatile u_char *sb_auxio2_reg; +#endif + extern int sparc_led_blink; /* from machdep */ struct timeout sparc_led_to; @@ -77,7 +83,7 @@ led_blink(zero) int s; /* Don't do anything if there's no auxreg, ok? */ - if (auxio_reg == 0) + if (auxio_reg == NULL) return; if (!sparc_led_blink) { @@ -106,64 +112,75 @@ led_blink(zero) /* * The OPENPROM calls this "auxiliary-io". + * We also need to match the "auxio2" register on Tadpole SPARCbooks. */ static int -auxregmatch(parent, cf, aux) - struct device *parent; - void *cf, *aux; +auxregmatch(struct device *parent, void *cf, void *aux) { - register struct confargs *ca = aux; + struct confargs *ca = aux; switch (cputyp) { - case CPU_SUN4: + case CPU_SUN4: + default: return (0); - case CPU_SUN4C: + case CPU_SUN4C: return (strcmp("auxiliary-io", ca->ca_ra.ra_name) == 0); - case CPU_SUN4M: - return (strcmp("auxio", ca->ca_ra.ra_name) == 0); - default: - panic("auxregmatch"); + case CPU_SUN4M: + return (strcmp("auxio", ca->ca_ra.ra_name) == 0 || + strcmp("auxio2", ca->ca_ra.ra_name) == 0); } } /* ARGSUSED */ static void -auxregattach(parent, self, aux) - struct device *parent, *self; - void *aux; +auxregattach(struct device *parent, struct device *self, void *aux) { struct confargs *ca = aux; struct romaux *ra = &ca->ca_ra; - - (void)mapdev(ra->ra_reg, AUXREG_VA, 0, sizeof(long)); - if (CPU_ISSUN4M) { - auxio_reg = AUXIO4M_REG; - auxio_regval = *AUXIO4M_REG | AUXIO4M_MB1; - } else { - auxio_reg = AUXIO4C_REG; - auxio_regval = *AUXIO4C_REG | AUXIO4C_FEJ | AUXIO4C_MB1; +#ifdef SUN4M + volatile u_char **regp; + + if (CPU_ISSUN4M && strncmp("Tadpole", mainbus_model, 7) == 0) { + if (strcmp("auxio", ra->ra_name) == 0) + regp = &sb_auxio_reg; + else + regp = &sb_auxio2_reg; + if (*regp == NULL) + *regp = mapdev(ra->ra_reg, 0, 0, sizeof(char)); + } else +#endif + if (auxio_reg == NULL) { + (void)mapdev(ra->ra_reg, AUXREG_VA, 0, sizeof(long)); + if (CPU_ISSUN4M) { + auxio_reg = AUXIO4M_REG; + auxio_regval = *AUXIO4M_REG | AUXIO4M_MB1; + } else { + auxio_reg = AUXIO4C_REG; + auxio_regval = *AUXIO4C_REG | AUXIO4C_FEJ | AUXIO4C_MB1; + } + + timeout_set(&sparc_led_to, led_blink, NULL); + /* In case it's initialized to true... */ + if (sparc_led_blink) + led_blink((caddr_t)0); } printf("\n"); - - timeout_set(&sparc_led_to, led_blink, NULL); - /* In case it's initialized to true... */ - if (sparc_led_blink) - led_blink((caddr_t)0); } unsigned int -auxregbisc(bis, bic) - int bis, bic; +auxregbisc(int bis, int bic) { - register int s; + int s; - if (auxio_reg == 0) +#ifdef DIAGNOSTIC + if (auxio_reg == NULL) /* * Not all machines have an `aux' register; devices that * depend on it should not get configured if it's absent. */ panic("no aux register"); +#endif s = splhigh(); auxio_regval = (auxio_regval | bis) & ~bic; @@ -171,3 +188,23 @@ auxregbisc(bis, bic) splx(s); return (auxio_regval); } + +#ifdef SUN4M +unsigned int +sb_auxregbisc(int isreg2, int bis, int bic) +{ + int s; + volatile u_char *auxreg; + u_char aux; + + auxreg = isreg2 ? sb_auxio2_reg : sb_auxio_reg; + if (auxreg == NULL) + return (0); + + s = splhigh(); + aux = (*auxreg | bis) & ~bic; + *auxreg = aux; + splx(s); + return (aux); +} +#endif |