summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_nge.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2012-10-18 21:44:22 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2012-10-18 21:44:22 +0000
commitc6f059840162b2c543b98d25d52c1ab9bef6abdb (patch)
tree995710b7c307dbd984f1a701ba82f8dd58ea7968 /sys/dev/pci/if_nge.c
parent3009bb760d67d343c20274e3b032edd5b53e2ea3 (diff)
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_nge.c')
-rw-r--r--sys/dev/pci/if_nge.c33
1 files changed, 2 insertions, 31 deletions
diff --git a/sys/dev/pci/if_nge.c b/sys/dev/pci/if_nge.c
index d85594f779b..d806adf868a 100644
--- a/sys/dev/pci/if_nge.c
+++ b/sys/dev/pci/if_nge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nge.c,v 1.71 2011/06/22 16:44:27 tedu Exp $ */
+/* $OpenBSD: if_nge.c,v 1.72 2012/10/18 21:44:21 deraadt Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
* Copyright (c) 1997, 1998, 1999, 2000, 2001
@@ -729,42 +729,13 @@ nge_attach(parent, self, aux)
bus_dmamap_t dmamap;
int rseg;
u_char eaddr[ETHER_ADDR_LEN];
- pcireg_t command;
#ifndef NGE_USEIOSPACE
pcireg_t memtype;
#endif
struct ifnet *ifp;
caddr_t kva;
- /*
- * Handle power management nonsense.
- */
- DPRINTFN(5, ("%s: preparing for conf read\n", sc->sc_dv.dv_xname));
- command = pci_conf_read(pc, pa->pa_tag, NGE_PCI_CAPID) & 0x000000FF;
- if (command == 0x01) {
- command = pci_conf_read(pc, pa->pa_tag, NGE_PCI_PWRMGMTCTRL);
- if (command & NGE_PSTATE_MASK) {
- pcireg_t iobase, membase, irq;
-
- /* Save important PCI config data. */
- iobase = pci_conf_read(pc, pa->pa_tag, NGE_PCI_LOIO);
- membase = pci_conf_read(pc, pa->pa_tag, NGE_PCI_LOMEM);
- irq = pci_conf_read(pc, pa->pa_tag, NGE_PCI_INTLINE);
-
- /* Reset the power state. */
- printf("%s: chip is in D%d power mode "
- "-- setting to D0\n", sc->sc_dv.dv_xname,
- command & NGE_PSTATE_MASK);
- command &= 0xFFFFFFFC;
- pci_conf_write(pc, pa->pa_tag,
- NGE_PCI_PWRMGMTCTRL, command);
-
- /* Restore PCI config data. */
- pci_conf_write(pc, pa->pa_tag, NGE_PCI_LOIO, iobase);
- pci_conf_write(pc, pa->pa_tag, NGE_PCI_LOMEM, membase);
- pci_conf_write(pc, pa->pa_tag, NGE_PCI_INTLINE, irq);
- }
- }
+ pci_set_powerstate(pa->pa_pc, pa->pa_tag, PCI_PMCSR_STATE_D0);
/*
* Map control/status registers.