summaryrefslogtreecommitdiffstats
path: root/sys/dev/dc
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2000-12-18 21:53:05 +0000
committerwpaul <wpaul@FreeBSD.org>2000-12-18 21:53:05 +0000
commit29d9ced63d2cf6eded71df28817fa9e8ae59ee1b (patch)
treee3519b2ccedc704ee1a4d7f8328fa5073f68dd5d /sys/dev/dc
parentc5b98ef61d504239bd2e1470af7539364f3e0e53 (diff)
downloadFreeBSD-src-29d9ced63d2cf6eded71df28817fa9e8ae59ee1b.zip
FreeBSD-src-29d9ced63d2cf6eded71df28817fa9e8ae59ee1b.tar.gz
Use pci_get_powerstate()/pci_set_powerstate() which now exists in the
PCI code. This saves each driver from having to grovel around looking for the right registers to twiddle. I should eventually convert the other PCI drivers to do this; for now, these three are ones which I know need power state handling.
Diffstat (limited to 'sys/dev/dc')
-rw-r--r--sys/dev/dc/if_dc.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c
index a07c4dc..63e7adb 100644
--- a/sys/dev/dc/if_dc.c
+++ b/sys/dev/dc/if_dc.c
@@ -1564,38 +1564,30 @@ static int dc_probe(dev)
static void dc_acpi(dev)
device_t dev;
{
- u_int32_t r, cptr;
int unit;
unit = device_get_unit(dev);
- /* Find the location of the capabilities block */
- cptr = pci_read_config(dev, DC_PCI_CCAP, 4) & 0xFF;
+ if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
+ u_int32_t iobase, membase, irq;
- r = pci_read_config(dev, cptr, 4) & 0xFF;
- if (r == 0x01) {
+ /* Save important PCI config data. */
+ iobase = pci_read_config(dev, DC_PCI_CFBIO, 4);
+ membase = pci_read_config(dev, DC_PCI_CFBMA, 4);
+ irq = pci_read_config(dev, DC_PCI_CFIT, 4);
- r = pci_read_config(dev, cptr + 4, 4);
- if (r & DC_PSTATE_D3) {
- u_int32_t iobase, membase, irq;
+ /* Reset the power state. */
+ printf("dc%d: chip is in D%d power mode "
+ "-- setting to D0\n", unit,
+ pci_get_powerstate(dev));
+ pci_set_powerstate(dev, PCI_POWERSTATE_D0);
- /* Save important PCI config data. */
- iobase = pci_read_config(dev, DC_PCI_CFBIO, 4);
- membase = pci_read_config(dev, DC_PCI_CFBMA, 4);
- irq = pci_read_config(dev, DC_PCI_CFIT, 4);
-
- /* Reset the power state. */
- printf("dc%d: chip is in D%d power mode "
- "-- setting to D0\n", unit, r & DC_PSTATE_D3);
- r &= 0xFFFFFFFC;
- pci_write_config(dev, cptr + 4, r, 4);
-
- /* Restore PCI config data. */
- pci_write_config(dev, DC_PCI_CFBIO, iobase, 4);
- pci_write_config(dev, DC_PCI_CFBMA, membase, 4);
- pci_write_config(dev, DC_PCI_CFIT, irq, 4);
- }
+ /* Restore PCI config data. */
+ pci_write_config(dev, DC_PCI_CFBIO, iobase, 4);
+ pci_write_config(dev, DC_PCI_CFBMA, membase, 4);
+ pci_write_config(dev, DC_PCI_CFIT, irq, 4);
}
+
return;
}
OpenPOWER on IntegriCloud