diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/files.pci | 7 | ||||
-rw-r--r-- | sys/dev/pci/pcidevs | 6 | ||||
-rw-r--r-- | sys/dev/pci/pcidevs.h | 4 | ||||
-rw-r--r-- | sys/dev/pci/pcidevs_data.h | 8 | ||||
-rw-r--r-- | sys/dev/pci/pwdog.c | 107 |
5 files changed, 130 insertions, 2 deletions
diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci index a05da955c0f..18d98f256ed 100644 --- a/sys/dev/pci/files.pci +++ b/sys/dev/pci/files.pci @@ -1,4 +1,4 @@ -# $OpenBSD: files.pci,v 1.218 2006/11/19 14:20:55 mglocker Exp $ +# $OpenBSD: files.pci,v 1.219 2006/11/25 17:18:31 mbalmer Exp $ # $NetBSD: files.pci,v 1.20 1996/09/24 17:47:15 christos Exp $ # # Config file and device description for machine-independent PCI code. @@ -412,6 +412,11 @@ device wdt: pcibus attach wdt at pci file dev/pci/wdt.c wdt needs-flag +# Quancom PWDOG1 +device pwdog: pcibus +attach pwdog at pci +file dev/pci/pwdog.c pwdog + # UHCI USB controller attach uhci at pci with uhci_pci file dev/pci/uhci_pci.c uhci diff --git a/sys/dev/pci/pcidevs b/sys/dev/pci/pcidevs index f7b4c538773..4487f8621f2 100644 --- a/sys/dev/pci/pcidevs +++ b/sys/dev/pci/pcidevs @@ -1,4 +1,4 @@ -$OpenBSD: pcidevs,v 1.1193 2006/11/24 18:46:23 brad Exp $ +$OpenBSD: pcidevs,v 1.1194 2006/11/25 17:18:31 mbalmer Exp $ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ /* @@ -303,6 +303,7 @@ vendor TURTLEBEACH 0x5053 Turtle Beach vendor S3 0x5333 S3 vendor C4T 0x6374 c't Magazin vendor DCI 0x6666 Decision Computer Inc +vendor QUANCOM 0x8008 Quancom Informationssysteme vendor INTEL 0x8086 Intel vendor WINBOND2 0x8c4a Winbond vendor KTI 0x8e2e KTI @@ -3199,6 +3200,9 @@ product QLOGIC ISP2312 0x2312 ISP2312 product QLOGIC ISP2322 0x2322 ISP2322 product QLOGIC ISP6312 0x6312 ISP6312 +/* Quancom products */ +product QUANCOM PWDOG1 0x0010 PWDOG1 + /* Quantum Designs products */ product QUANTUMDESIGNS 8500 0x0001 8500 product QUANTUMDESIGNS 8580 0x0002 8580 diff --git a/sys/dev/pci/pcidevs.h b/sys/dev/pci/pcidevs.h index bb601e3f176..0ef1c5f6b66 100644 --- a/sys/dev/pci/pcidevs.h +++ b/sys/dev/pci/pcidevs.h @@ -308,6 +308,7 @@ #define PCI_VENDOR_S3 0x5333 /* S3 */ #define PCI_VENDOR_C4T 0x6374 /* c't Magazin */ #define PCI_VENDOR_DCI 0x6666 /* Decision Computer Inc */ +#define PCI_VENDOR_QUANCOM 0x8008 /* Quancom Informationssysteme */ #define PCI_VENDOR_INTEL 0x8086 /* Intel */ #define PCI_VENDOR_WINBOND2 0x8c4a /* Winbond */ #define PCI_VENDOR_KTI 0x8e2e /* KTI */ @@ -3204,6 +3205,9 @@ #define PCI_PRODUCT_QLOGIC_ISP2322 0x2322 /* ISP2322 */ #define PCI_PRODUCT_QLOGIC_ISP6312 0x6312 /* ISP6312 */ +/* Quancom products */ +#define PCI_PRODUCT_QUANCOM_PWDOG1 0x0010 /* PWDOG1 */ + /* Quantum Designs products */ #define PCI_PRODUCT_QUANTUMDESIGNS_8500 0x0001 /* 8500 */ #define PCI_PRODUCT_QUANTUMDESIGNS_8580 0x0002 /* 8580 */ diff --git a/sys/dev/pci/pcidevs_data.h b/sys/dev/pci/pcidevs_data.h index a7e21cca3f5..5f186cddf29 100644 --- a/sys/dev/pci/pcidevs_data.h +++ b/sys/dev/pci/pcidevs_data.h @@ -10035,6 +10035,10 @@ static const struct pci_known_product pci_known_products[] = { "ISP6312", }, { + PCI_VENDOR_QUANCOM, PCI_PRODUCT_QUANCOM_PWDOG1, + "PWDOG1", + }, + { PCI_VENDOR_QUANTUMDESIGNS, PCI_PRODUCT_QUANTUMDESIGNS_8500, "8500", }, @@ -13855,6 +13859,10 @@ static const struct pci_known_vendor pci_known_vendors[] = { "Decision Computer Inc", }, { + PCI_VENDOR_QUANCOM, + "Quancom Informationssysteme", + }, + { PCI_VENDOR_INTEL, "Intel", }, diff --git a/sys/dev/pci/pwdog.c b/sys/dev/pci/pwdog.c new file mode 100644 index 00000000000..b7b9e804986 --- /dev/null +++ b/sys/dev/pci/pwdog.c @@ -0,0 +1,107 @@ +/* $OpenBSD: pwdog.c,v 1.1 2006/11/25 17:18:31 mbalmer Exp $ */ + +/* + * Copyright (c) 2006 Marc Balmer <mbalmer@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. + */ + +#include <sys/types.h> +#include <sys/param.h> +#include <sys/device.h> +#include <sys/kernel.h> +#include <sys/malloc.h> +#include <sys/proc.h> +#include <sys/systm.h> + +#include <machine/bus.h> + +#include <dev/pci/pcivar.h> +#include <dev/pci/pcireg.h> +#include <dev/pci/pcidevs.h> + +struct pwdog_softc { + struct device pwdog_dev; + bus_space_tag_t iot; + bus_space_handle_t ioh; +}; + +/* registers */ +#define PWDOG_ACTIVATE 0 +#define PWDOG_DISABLE 1 + +int pwdog_probe(struct device *, void *, void *); +void pwdog_attach(struct device *, struct device *, void *); +void pwdog_init_timer(struct pwdog_softc *); +int pwdog_set_timeout(void *, int); +void pwdog_disable_timer(struct pwdog_softc *); + +struct cfattach pwdog_ca = { + sizeof(struct pwdog_softc), pwdog_probe, pwdog_attach +}; + +struct cfdriver pwdog_cd = { + NULL, "pwdog", DV_DULL +}; + +int +pwdog_probe(struct device *parent, void *match, void *aux) +{ + struct pci_attach_args *const pa = (struct pci_attach_args *)aux; + + if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_QUANCOM || + PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_QUANCOM_PWDOG1) + return 0; + return 1; +} + +void +pwdog_attach(struct device *parent, struct device *self, void *aux) +{ + struct pwdog_softc *pwdog = (struct pwdog_softc *)self; + struct pci_attach_args *const pa = (struct pci_attach_args *)aux; + bus_size_t iosize; + + if (pci_mapreg_map(pa, 0x10, PCI_MAPREG_TYPE_IO, 0, &pwdog->iot, + &pwdog->ioh, NULL, &iosize, 0)) { + printf("\n%s: PCI I/O region not found\n", + pwdog->pwdog_dev.dv_xname); + return; + } + pwdog_disable_timer(pwdog); + wdog_register(pwdog, pwdog_set_timeout); +} + +/* ARGSUSED */ +int +pwdog_set_timeout(void *self, int seconds) +{ + struct pwdog_softc *pwdog = (struct pwdog_softc *)self; + int s; + + s = splclock(); + pwdog_disable_timer(pwdog); + if (!seconds) { + splx(s); + return 0; + } + bus_space_write_1(pwdog->iot, pwdog->ioh, PWDOG_ACTIVATE, 0); + splx(s); + return seconds; +} + +void +pwdog_disable_timer(struct pwdog_softc *pwdog) +{ + bus_space_write_1(pwdog->iot, pwdog->ioh, PWDOG_DISABLE, 0); +} |