diff options
author | Marc Balmer <mbalmer@cvs.openbsd.org> | 2006-11-25 18:06:02 +0000 |
---|---|---|
committer | Marc Balmer <mbalmer@cvs.openbsd.org> | 2006-11-25 18:06:02 +0000 |
commit | 2db0b8cf67297a6807a655929b526c916d9bbb9b (patch) | |
tree | 17fa59876f2002307c08b9a795dc651a585d8610 /sys/dev/pci/pwdog.c | |
parent | f41ee523bf784d4e8fb513e2beb95047bf92f6ee (diff) |
The PWDOG1 card can be jumpered to work I/O or memory mapped. Detect
the correct type and use it.
Use a macro for the first BAR and remove an unneeded header file.
help & ok uwe & jsg.
Diffstat (limited to 'sys/dev/pci/pwdog.c')
-rw-r--r-- | sys/dev/pci/pwdog.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/dev/pci/pwdog.c b/sys/dev/pci/pwdog.c index b7b9e804986..c370e68319d 100644 --- a/sys/dev/pci/pwdog.c +++ b/sys/dev/pci/pwdog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pwdog.c,v 1.1 2006/11/25 17:18:31 mbalmer Exp $ */ +/* $OpenBSD: pwdog.c,v 1.2 2006/11/25 18:06:01 mbalmer Exp $ */ /* * Copyright (c) 2006 Marc Balmer <mbalmer@openbsd.org> @@ -20,7 +20,6 @@ #include <sys/param.h> #include <sys/device.h> #include <sys/kernel.h> -#include <sys/malloc.h> #include <sys/proc.h> #include <sys/systm.h> @@ -70,14 +69,18 @@ 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; + pcireg_t memtype; bus_size_t iosize; - if (pci_mapreg_map(pa, 0x10, PCI_MAPREG_TYPE_IO, 0, &pwdog->iot, + memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, PCI_MAPREG_START); + if (pci_mapreg_map(pa, PCI_MAPREG_START, memtype, 0, &pwdog->iot, &pwdog->ioh, NULL, &iosize, 0)) { - printf("\n%s: PCI I/O region not found\n", - pwdog->pwdog_dev.dv_xname); + printf("\n%s: PCI %s region not found\n", + pwdog->pwdog_dev.dv_xname, + memtype == PCI_MAPREG_TYPE_IO ? "I/O" : "memory"); return; } + printf("\n"); pwdog_disable_timer(pwdog); wdog_register(pwdog, pwdog_set_timeout); } |