diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-08-07 16:59:38 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-08-07 16:59:38 +0000 |
commit | 2777e1d478faa60f153bbd08d6860145ad4b63e2 (patch) | |
tree | c34d27b792bc26235c1817910502f7a700299978 /sys/arch/i386/pci/geodesc.c | |
parent | 29424fea9f0d362e3aec46277a3d2d9b0f755a58 (diff) |
better dmesg output and do some spaces; markus@ ok
Diffstat (limited to 'sys/arch/i386/pci/geodesc.c')
-rw-r--r-- | sys/arch/i386/pci/geodesc.c | 115 |
1 files changed, 55 insertions, 60 deletions
diff --git a/sys/arch/i386/pci/geodesc.c b/sys/arch/i386/pci/geodesc.c index 92675f387ed..ef70b184e15 100644 --- a/sys/arch/i386/pci/geodesc.c +++ b/sys/arch/i386/pci/geodesc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: geodesc.c,v 1.1 2003/08/07 08:32:56 markus Exp $ */ +/* $OpenBSD: geodesc.c,v 1.2 2003/08/07 16:59:37 mickey Exp $ */ /* * Copyright (c) 2003 Markus Friedl <markus@openbsd.org> @@ -16,7 +16,7 @@ * 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 */ @@ -34,32 +34,32 @@ #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; + 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); +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 + sizeof(struct geodesc_softc), geodesc_match, geodesc_attach }; struct cfdriver geodesc_cd = { - NULL, "geodesc", DV_DULL + NULL, "geodesc", DV_DULL }; int geodesc_match(struct device *parent, void *match, void *aux) { - struct pci_attach_args *pa = 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); + 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" @@ -67,54 +67,49 @@ geodesc_match(struct device *parent, void *match, void *aux) 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); + struct geodesc_softc *sc = (void *) self; + struct pci_attach_args *pa = aux; + uint16_t cnfg, cba; + uint8_t sts, rev, iid; + pcireg_t reg; + + 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(": unable to map registers at 0x%x\n", reg); + return; + } + cba = bus_space_read_2(sc->sc_iot, sc->sc_ioh, GCB_CBA); + if (cba != reg) { + printf(": cba mismatch: cba 0x%x != reg 0x%x\n", 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(": iid %d revision %d wdstatus %b\n", 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); + 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); } |