From d4c68f93dc3b59f50991aad50fc6d1175f988124 Mon Sep 17 00:00:00 2001 From: "Federico G. Schwindt" Date: Mon, 22 Oct 2007 03:16:36 +0000 Subject: Use pci_set_powerstate(), shrinking the code and unifying the different versions. ok by many. --- sys/dev/pci/cs4281.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'sys/dev/pci/cs4281.c') diff --git a/sys/dev/pci/cs4281.c b/sys/dev/pci/cs4281.c index 84b236ddd95..8e6cc2cd47c 100644 --- a/sys/dev/pci/cs4281.c +++ b/sys/dev/pci/cs4281.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cs4281.c,v 1.19 2005/11/29 05:42:17 tedu Exp $ */ +/* $OpenBSD: cs4281.c,v 1.20 2007/10/22 03:16:35 fgsch Exp $ */ /* $Tera: cs4281.c,v 1.18 2000/12/27 14:24:45 tacha Exp $ */ /* @@ -295,7 +295,6 @@ cs4281_attach(parent, self, aux) pci_chipset_tag_t pc = pa->pa_pc; char const *intrstr; pci_intr_handle_t ih; - int pci_pwrmgmt_cap_reg, pci_pwrmgmt_csr_reg; /* Map I/O register */ if (pci_mapreg_map(pa, CSCC_PCI_BA0, @@ -319,18 +318,7 @@ cs4281_attach(parent, self, aux) * using Windows and rebooting into OpenBSD. * On my IBM ThinkPad X20, it is set to D3 after using Windows2000. */ - if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_PWRMGMT, - &pci_pwrmgmt_cap_reg, 0)) { - pcireg_t reg; - - pci_pwrmgmt_csr_reg = pci_pwrmgmt_cap_reg + PCI_PMCSR; - reg = pci_conf_read(pa->pa_pc, pa->pa_tag, pci_pwrmgmt_csr_reg); - if ((reg & PCI_PMCSR_STATE_MASK) != PCI_PMCSR_STATE_D0) { - pci_conf_write(pc, pa->pa_tag, pci_pwrmgmt_csr_reg, - (reg & ~PCI_PMCSR_STATE_MASK) | - PCI_PMCSR_STATE_D0); - } - } + pci_set_powerstate(pc, pa->pa_tag, PCI_PMCSR_STATE_D0); /* Map and establish the interrupt. */ if (pci_intr_map(pa, &ih)) { -- cgit v1.2.3