diff options
-rw-r--r-- | share/man/man4/man4.i386/Makefile | 6 | ||||
-rw-r--r-- | share/man/man4/man4.i386/elansc.4 | 3 | ||||
-rw-r--r-- | share/man/man4/man4.i386/geodesc.4 | 50 | ||||
-rw-r--r-- | share/man/man4/man4.i386/intro.4 | 6 | ||||
-rw-r--r-- | sys/arch/i386/conf/files.i386 | 7 | ||||
-rw-r--r-- | sys/arch/i386/pci/geodesc.c | 120 | ||||
-rw-r--r-- | sys/arch/i386/pci/geodescreg.h | 44 |
7 files changed, 230 insertions, 6 deletions
diff --git a/share/man/man4/man4.i386/Makefile b/share/man/man4/man4.i386/Makefile index 99735e26f09..89a06f6b084 100644 --- a/share/man/man4/man4.i386/Makefile +++ b/share/man/man4/man4.i386/Makefile @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile,v 1.46 2003/01/21 21:59:47 markus Exp $ +# $OpenBSD: Makefile,v 1.47 2003/08/07 08:33:09 markus Exp $ # from: @(#)Makefile 5.1 (Berkeley) 2/12/91 # Id: Makefile,v 1.4 1995/12/14 05:41:38 deraadt Exp $ -MAN= apm.4 autoconf.4 bios.4 elansc.4 gus.4 ie.4 intro.4 iy.4 joy.4 \ - le.4 lms.4 mcd.4 mem.4 mms.4 mtrr.4 npx.4 pcibios.4 \ +MAN= apm.4 autoconf.4 bios.4 elansc.4 geodesc.4 gus.4 ie.4 intro.4 iy.4 \ + joy.4 le.4 lms.4 mcd.4 mem.4 mms.4 mtrr.4 npx.4 pcibios.4 \ pctr.4 pss.4 sb.4 \ sea.4 speaker.4 uha.4 wdt.4 wss.4 wt.4 diff --git a/share/man/man4/man4.i386/elansc.4 b/share/man/man4/man4.i386/elansc.4 index 1c2a93073eb..8e9289885ba 100644 --- a/share/man/man4/man4.i386/elansc.4 +++ b/share/man/man4/man4.i386/elansc.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: elansc.4,v 1.6 2003/07/09 13:26:20 jmc Exp $ +.\" $OpenBSD: elansc.4,v 1.7 2003/08/07 08:33:10 markus Exp $ .\" $NetBSD: elansc.4,v 1.1 2002/08/12 03:45:25 thorpej Exp $ .\" .\" Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -62,6 +62,7 @@ The watchdog timer may be configured for a 1 second, 2 second, 4 second, 8 second, 16 second, or 32 second expiration period. .El .Sh SEE ALSO +.Xr geodesc 4 , .Xr sysctl 8 .Sh HISTORY Support for the diff --git a/share/man/man4/man4.i386/geodesc.4 b/share/man/man4/man4.i386/geodesc.4 new file mode 100644 index 00000000000..6a224613ba0 --- /dev/null +++ b/share/man/man4/man4.i386/geodesc.4 @@ -0,0 +1,50 @@ +.\" $OpenBSD: geodesc.4,v 1.1 2003/08/07 08:33:10 markus Exp $ +.\" +.\"Copyright (c) 2003 Markus Friedl <markus@openbsd.org> +.\" +.\"Permission to use, copy, modify, and distribute this software for any +.\"purpose with or without fee is hereby granted, provided that the above +.\"copyright notice and this permission notice appear in all copies. +.\" +.\"THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\"WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\"MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\"ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\"WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\"ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\"OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.\" +.Dd August 6, 2002 +.Dt GEODESC 4 i386 +.Os +.Sh NAME +.Nm geodesc +.Nd Geode SC1100 IAOC driver +.Sh SYNOPSIS +.Cd "geodesc* at pci? dev ? function ?" +.Sh DESCRIPTION +.Pp +The +.Nm +driver supports the watchdog timer of the Geode SC1100. +.Pp +The Geode SC1100 is a member of the National +Semiconductor Information Appliance On a Chip (IAOC) +family of fully integrated x86 system chips. +.Pp +The watchdog timer may be configured via +.Xr sysctl 8 . +.Sh SEE ALSO +.Xr elansc 4 , +.Xr sysctl 8 +.Sh HISTORY +Support for the +.Nm +was added in +.Ox 3.4 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Markus Friedl . diff --git a/share/man/man4/man4.i386/intro.4 b/share/man/man4/man4.i386/intro.4 index 8255ab9ae6e..3235a8e07a9 100644 --- a/share/man/man4/man4.i386/intro.4 +++ b/share/man/man4/man4.i386/intro.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: intro.4,v 1.43 2003/07/09 13:26:20 jmc Exp $ +.\" $OpenBSD: intro.4,v 1.44 2003/08/07 08:33:10 markus Exp $ .\" .\" Copyright (c) 1994 Christopher G. Demetriou .\" All rights reserved. @@ -175,6 +175,8 @@ Ensoniq AudioPCI (ES137x) audio. 3Com EtherLink Plus Ethernet (3C505). .It Xr el 4 3Com EtherLink Ethernet (3C501). +.It Xr elansc 4 +AMD Elan SC520 System Controller. .It Xr em 4 Intel i82542, i82543, and i82544 Pro/1000 Gigabit Ethernet. .It Xr emu 4 @@ -202,6 +204,8 @@ DEFPA PCI FDDI controller. .It Xr fxp 4 .Tn Intel EtherExpress PRO/100 Ethernet. +.It Xr geodesc 4 +Geode SC1100 System Controller. .It Xr gdt 4 ICP-Vortex GDT RAID controllers. .It Xr gtp 4 diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386 index 400687ff3f0..bd91b939417 100644 --- a/sys/arch/i386/conf/files.i386 +++ b/sys/arch/i386/conf/files.i386 @@ -1,4 +1,4 @@ -# $OpenBSD: files.i386,v 1.107 2003/07/30 05:26:33 mickey Exp $ +# $OpenBSD: files.i386,v 1.108 2003/08/07 08:32:56 markus Exp $ # $NetBSD: files.i386,v 1.73 1996/05/07 00:58:36 thorpej Exp $ # # new style config file for i386 architecture @@ -110,6 +110,11 @@ device elansc attach elansc at pci file arch/i386/pci/elan520.c elansc +# Geode SC1100 +device geodesc +attach geodesc at pci +file arch/i386/pci/geodesc.c geodesc + # PCI-ISA bridge chipsets device pcib: isabus attach pcib at pci diff --git a/sys/arch/i386/pci/geodesc.c b/sys/arch/i386/pci/geodesc.c new file mode 100644 index 00000000000..92675f387ed --- /dev/null +++ b/sys/arch/i386/pci/geodesc.c @@ -0,0 +1,120 @@ +/* $OpenBSD: geodesc.c,v 1.1 2003/08/07 08:32:56 markus Exp $ */ + +/* + * Copyright (c) 2003 Markus Friedl <markus@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * Geode SC1100 Information Appliance On a Chip + * http://www.national.com/ds.cgi/SC/SC1100.pdf + */ + +#include <sys/cdefs.h> +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/device.h> + +#include <machine/bus.h> + +#include <dev/pci/pcivar.h> +#include <dev/pci/pcidevs.h> + +#include <arch/i386/pci/geodescreg.h> + +struct geodesc_softc { + struct device sc_dev; + bus_space_tag_t sc_iot; + bus_space_handle_t sc_ioh; +}; + +int geodesc_match(struct device *, void *, void *); +void geodesc_attach(struct device *, struct device *, void *); +int geodesc_wdogctl_cb(void *, int); + +struct cfattach geodesc_ca = { + sizeof(struct geodesc_softc), geodesc_match, geodesc_attach +}; + +struct cfdriver geodesc_cd = { + NULL, "geodesc", DV_DULL +}; + +int +geodesc_match(struct device *parent, void *match, void *aux) +{ + struct pci_attach_args *pa = aux; + + if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_NS && + PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_NS_SC1100_XBUS) + return (1); + return (0); +} + +#define WDSTSBITS "\20\x04WDRST\x03WDSMI\x02WDINT\x01WDOVF" + +void +geodesc_attach(struct device *parent, struct device *self, void *aux) +{ + struct geodesc_softc *sc = (void *) self; + struct pci_attach_args *pa = aux; + uint16_t cnfg, cba; + uint8_t sts, rev, iid; + pcireg_t reg; + + printf("\n"); + + reg = pci_conf_read(pa->pa_pc, pa->pa_tag, SC1100_F5_SCRATCHPAD); + sc->sc_iot = pa->pa_iot; + if (bus_space_map(sc->sc_iot, reg, 64, 0, &sc->sc_ioh)) { + printf("%s: unable to map registers at %p\n", + sc->sc_dev.dv_xname, reg); + return; + } + cba = bus_space_read_2(sc->sc_iot, sc->sc_ioh, GCB_CBA); + if (cba != reg) { + printf("%s: cba mismatch: cba %p != reg %p\n", + sc->sc_dev.dv_xname, cba, reg); + bus_space_unmap(sc->sc_iot, sc->sc_ioh, 64); + return; + } + sts = bus_space_read_1(sc->sc_iot, sc->sc_ioh, GCB_WDSTS); + cnfg = bus_space_read_2(sc->sc_iot, sc->sc_ioh, GCB_WDCNFG); + iid = bus_space_read_1(sc->sc_iot, sc->sc_ioh, GCB_IID); + rev = bus_space_read_1(sc->sc_iot, sc->sc_ioh, GCB_REV); + + printf("%s: iid %d revision %d wdstatus %b\n", + sc->sc_dev.dv_xname, iid, rev, sts, WDSTSBITS); + + /* setup and register watchdog */ + bus_space_write_2(sc->sc_iot, sc->sc_ioh, GCB_WDTO, 0); + sts |= WDOVF_CLEAR; + bus_space_write_1(sc->sc_iot, sc->sc_ioh, GCB_WDSTS, sts); + cnfg &= ~WDCNFG_MASK;; + cnfg |= WDTYPE1_RESET|WDPRES_DIV_512; + bus_space_write_2(sc->sc_iot, sc->sc_ioh, GCB_WDCNFG, cnfg); + + wdog_register(sc, geodesc_wdogctl_cb); +} + +int +geodesc_wdogctl_cb(void *self, int period) +{ + struct geodesc_softc *sc = self; + + if (period > 0x03ff) + period = 0x03ff; + bus_space_write_2(sc->sc_iot, sc->sc_ioh, GCB_WDTO, period * 64); + return (period); +} diff --git a/sys/arch/i386/pci/geodescreg.h b/sys/arch/i386/pci/geodescreg.h new file mode 100644 index 00000000000..2bfcf2be036 --- /dev/null +++ b/sys/arch/i386/pci/geodescreg.h @@ -0,0 +1,44 @@ +/* $OpenBSD: geodescreg.h,v 1.1 2003/08/07 08:32:56 markus Exp $ */ + +/* + * Copyright (c) 2003 Markus Friedl <markus@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * Geode SC1100 Information Appliance On a Chip + * http://www.national.com/ds.cgi/SC/SC1100.pdf + */ + +/* Configuration Space Register Map */ + +#define SC1100_F5_SCRATCHPAD 0x64 + +#define GCB_WDTO 0x0000 /* WATCHDOG Timeout */ +#define GCB_WDCNFG 0x0002 /* WATCHDOG Configuration */ +#define GCB_WDSTS 0x0004 /* WATCHDOG Status */ +#define GCB_IID 0x003c /* IA On a Chip ID */ +#define GCB_REV 0x003d /* Revision */ +#define GCB_CBA 0x003e /* Configuration Base Address */ + +/* Watchdog */ + +#define WD32KPD_ENABLE 0x0000 +#define WD32KPD_DISABLE 0x0100 +#define WDTYPE1_RESET 0x0030 +#define WDTYPE2_RESET 0x00c0 +#define WDPRES_DIV_512 0x0009 +#define WDPRES_DIV_8192 0x000d +#define WDCNFG_MASK 0x00ff +#define WDOVF_CLEAR 0x0001 |