summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordamien <damien@openbsd.org>2011-01-08 10:02:32 +0000
committerdamien <damien@openbsd.org>2011-01-08 10:02:32 +0000
commit20ad812b3ddd371bfd308daa433211b0a53d03ed (patch)
tree4dc30ba17f75425575ea79e5d98e6a16be7c5e37
parentRemoved unused structure member (diff)
downloadwireguard-openbsd-20ad812b3ddd371bfd308daa433211b0a53d03ed.tar.xz
wireguard-openbsd-20ad812b3ddd371bfd308daa433211b0a53d03ed.zip
clear pci configuration register 0x41 on resume, like during attach.
only clear it if it is != 0 while i'm at it.
-rw-r--r--sys/dev/cardbus/if_athn_cardbus.c6
-rw-r--r--sys/dev/pci/if_athn_pci.c11
2 files changed, 11 insertions, 6 deletions
diff --git a/sys/dev/cardbus/if_athn_cardbus.c b/sys/dev/cardbus/if_athn_cardbus.c
index 5bad420b2b2..54a55f61a2d 100644
--- a/sys/dev/cardbus/if_athn_cardbus.c
+++ b/sys/dev/cardbus/if_athn_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_athn_cardbus.c,v 1.12 2010/12/31 14:52:47 damien Exp $ */
+/* $OpenBSD: if_athn_cardbus.c,v 1.13 2011/01/08 10:02:32 damien Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
@@ -257,8 +257,8 @@ athn_cardbus_setup(struct athn_cardbus_softc *csc)
* the card: http://bugzilla.kernel.org/show_bug.cgi?id=13483
*/
reg = pci_conf_read(pc, csc->sc_tag, 0x40);
- reg &= ~0xff00;
- pci_conf_write(pc, csc->sc_tag, 0x40, reg);
+ if (reg & 0xff00)
+ pci_conf_write(pc, csc->sc_tag, 0x40, reg & ~0xff00);
/* Change latency timer; default value yields poor results. */
reg = pci_conf_read(pc, csc->sc_tag, PCI_BHLC_REG);
diff --git a/sys/dev/pci/if_athn_pci.c b/sys/dev/pci/if_athn_pci.c
index 4c0600645ef..2bdc4d10735 100644
--- a/sys/dev/pci/if_athn_pci.c
+++ b/sys/dev/pci/if_athn_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_athn_pci.c,v 1.10 2010/12/31 14:52:46 damien Exp $ */
+/* $OpenBSD: if_athn_pci.c,v 1.11 2011/01/08 10:02:32 damien Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
@@ -146,8 +146,8 @@ athn_pci_attach(struct device *parent, struct device *self, void *aux)
* the card: http://bugzilla.kernel.org/show_bug.cgi?id=13483
*/
reg = pci_conf_read(pa->pa_pc, pa->pa_tag, 0x40);
- reg &= ~0xff00;
- pci_conf_write(pa->pa_pc, pa->pa_tag, 0x40, reg);
+ if (reg & 0xff00)
+ pci_conf_write(pa->pa_pc, pa->pa_tag, 0x40, reg & ~0xff00);
/* Change latency timer; default value yields poor results. */
reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_BHLC_REG);
@@ -232,8 +232,13 @@ athn_pci_resume(void *arg1, void *arg2)
{
struct athn_pci_softc *psc = arg1;
struct athn_softc *sc = &psc->sc_sc;
+ pcireg_t reg;
int s;
+ reg = pci_conf_read(psc->sc_pc, psc->sc_tag, 0x40);
+ if (reg & 0xff00)
+ pci_conf_write(psc->sc_pc, psc->sc_tag, 0x40, reg & ~0xff00);
+
s = splnet();
athn_resume(sc);
splx(s);