summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/if_sis.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2012-10-18 21:44:21 +0000
committerderaadt <deraadt@openbsd.org>2012-10-18 21:44:21 +0000
commit0832e3b101f81f7e90fa60104de154244d9742c2 (patch)
treefc45a8967486cf25e5db66004d8d91fee1e5608a /sys/dev/pci/if_sis.c
parentUse pci_set_powerstate() unconditionally for all chip variants, rather (diff)
downloadwireguard-openbsd-0832e3b101f81f7e90fa60104de154244d9742c2.tar.xz
wireguard-openbsd-0832e3b101f81f7e90fa60104de154244d9742c2.zip
Convert a number of old private copies of code which predates
pci_set_powerstate() to using it instead. Many of these chunks of code had bugs in them, especially missing delay() calls. Some of them were doing things our PCI subsystem is now responsible for handling. If you have any of the affected devices, please keep an eye out for regressions. ok kettenis
Diffstat (limited to 'sys/dev/pci/if_sis.c')
-rw-r--r--sys/dev/pci/if_sis.c31
1 files changed, 2 insertions, 29 deletions
diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c
index 60fecc63595..c267720f08a 100644
--- a/sys/dev/pci/if_sis.c
+++ b/sys/dev/pci/if_sis.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sis.c,v 1.105 2011/06/22 16:44:27 tedu Exp $ */
+/* $OpenBSD: if_sis.c,v 1.106 2012/10/18 21:44:21 deraadt Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
@@ -873,7 +873,6 @@ sis_attach(struct device *parent, struct device *self, void *aux)
{
int i;
const char *intrstr = NULL;
- pcireg_t command;
struct sis_softc *sc = (struct sis_softc *)self;
struct pci_attach_args *pa = aux;
pci_chipset_tag_t pc = pa->pa_pc;
@@ -883,33 +882,7 @@ sis_attach(struct device *parent, struct device *self, void *aux)
sc->sis_stopped = 1;
- /*
- * Handle power management nonsense.
- */
- command = pci_conf_read(pc, pa->pa_tag, SIS_PCI_CAPID) & 0x000000FF;
- if (command == 0x01) {
-
- command = pci_conf_read(pc, pa->pa_tag, SIS_PCI_PWRMGMTCTRL);
- if (command & SIS_PSTATE_MASK) {
- u_int32_t iobase, membase, irq;
-
- /* Save important PCI config data. */
- iobase = pci_conf_read(pc, pa->pa_tag, SIS_PCI_LOIO);
- membase = pci_conf_read(pc, pa->pa_tag, SIS_PCI_LOMEM);
- irq = pci_conf_read(pc, pa->pa_tag, SIS_PCI_INTLINE);
-
- /* Reset the power state. */
- printf("%s: chip is in D%d power mode -- setting to D0\n",
- sc->sc_dev.dv_xname, command & SIS_PSTATE_MASK);
- command &= 0xFFFFFFFC;
- pci_conf_write(pc, pa->pa_tag, SIS_PCI_PWRMGMTCTRL, command);
-
- /* Restore PCI config data. */
- pci_conf_write(pc, pa->pa_tag, SIS_PCI_LOIO, iobase);
- pci_conf_write(pc, pa->pa_tag, SIS_PCI_LOMEM, membase);
- pci_conf_write(pc, pa->pa_tag, SIS_PCI_INTLINE, irq);
- }
- }
+ pci_set_powerstate(pa->pa_pc, pa->pa_tag, PCI_PMCSR_STATE_D0);
/*
* Map control/status registers.