diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2012-10-18 21:44:22 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2012-10-18 21:44:22 +0000 |
commit | c6f059840162b2c543b98d25d52c1ab9bef6abdb (patch) | |
tree | 995710b7c307dbd984f1a701ba82f8dd58ea7968 /sys/dev/pci/if_msk.c | |
parent | 3009bb760d67d343c20274e3b032edd5b53e2ea3 (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_msk.c')
-rw-r--r-- | sys/dev/pci/if_msk.c | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/sys/dev/pci/if_msk.c b/sys/dev/pci/if_msk.c index a1d4ef4abde..e60d3458c68 100644 --- a/sys/dev/pci/if_msk.c +++ b/sys/dev/pci/if_msk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_msk.c,v 1.94 2012/03/28 12:02:49 jsg Exp $ */ +/* $OpenBSD: if_msk.c,v 1.95 2012/10/18 21:44:21 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -1118,7 +1118,7 @@ mskc_attach(struct device *parent, struct device *self, void *aux) struct pci_attach_args *pa = aux; struct skc_attach_args skca; pci_chipset_tag_t pc = pa->pa_pc; - pcireg_t command, memtype; + pcireg_t memtype; pci_intr_handle_t ih; const char *intrstr = NULL; u_int8_t hw, pmd; @@ -1127,35 +1127,7 @@ mskc_attach(struct device *parent, struct device *self, void *aux) DPRINTFN(2, ("begin mskc_attach\n")); - /* - * Handle power management nonsense. - */ - command = pci_conf_read(pc, pa->pa_tag, SK_PCI_CAPID) & 0x000000FF; - - if (command == 0x01) { - command = pci_conf_read(pc, pa->pa_tag, SK_PCI_PWRMGMTCTRL); - if (command & SK_PSTATE_MASK) { - u_int32_t iobase, membase, irq; - - /* Save important PCI config data. */ - iobase = pci_conf_read(pc, pa->pa_tag, SK_PCI_LOIO); - membase = pci_conf_read(pc, pa->pa_tag, SK_PCI_LOMEM); - irq = pci_conf_read(pc, pa->pa_tag, SK_PCI_INTLINE); - - /* Reset the power state. */ - printf("%s chip is in D%d power mode " - "-- setting to D0\n", sc->sk_dev.dv_xname, - command & SK_PSTATE_MASK); - command &= 0xFFFFFFFC; - pci_conf_write(pc, pa->pa_tag, - SK_PCI_PWRMGMTCTRL, command); - - /* Restore PCI config data. */ - pci_conf_write(pc, pa->pa_tag, SK_PCI_LOIO, iobase); - pci_conf_write(pc, pa->pa_tag, SK_PCI_LOMEM, membase); - pci_conf_write(pc, pa->pa_tag, SK_PCI_INTLINE, irq); - } - } + pci_set_powerstate(pa->pa_pc, pa->pa_tag, PCI_PMCSR_STATE_D0); /* * Map control/status registers. |