aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>2000-12-18 21:53:05 +0000
committerBill Paul <wpaul@FreeBSD.org>2000-12-18 21:53:05 +0000
commit14a00c6c688193adcd21b7e89a2d13432c884efb (patch)
treea18f4bd1c74f7740cec347d1b589f1fc3971edcd
parent70d8bdef9d8b1df2b524ceafb1428bf39d602ec7 (diff)
Notes
-rw-r--r--sys/dev/dc/if_dc.c40
-rw-r--r--sys/pci/if_dc.c40
-rw-r--r--sys/pci/if_rl.c34
-rw-r--r--sys/pci/if_xl.c34
4 files changed, 62 insertions, 86 deletions
diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c
index a07c4dc4c9347..63e7adba526dd 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;
}
diff --git a/sys/pci/if_dc.c b/sys/pci/if_dc.c
index a07c4dc4c9347..63e7adba526dd 100644
--- a/sys/pci/if_dc.c
+++ b/sys/pci/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;
}
diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c
index f8b3606b4a217..3c815b65d5d83 100644
--- a/sys/pci/if_rl.c
+++ b/sys/pci/if_rl.c
@@ -809,29 +809,25 @@ static int rl_attach(dev)
* Handle power management nonsense.
*/
- command = pci_read_config(dev, RL_PCI_CAPID, 4) & 0x000000FF;
- if (command == 0x01) {
+ if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
+ u_int32_t iobase, membase, irq;
- command = pci_read_config(dev, RL_PCI_PWRMGMTCTRL, 4);
- if (command & RL_PSTATE_MASK) {
- u_int32_t iobase, membase, irq;
+ /* Save important PCI config data. */
+ iobase = pci_read_config(dev, RL_PCI_LOIO, 4);
+ membase = pci_read_config(dev, RL_PCI_LOMEM, 4);
+ irq = pci_read_config(dev, RL_PCI_INTLINE, 4);
- /* Save important PCI config data. */
- iobase = pci_read_config(dev, RL_PCI_LOIO, 4);
- membase = pci_read_config(dev, RL_PCI_LOMEM, 4);
- irq = pci_read_config(dev, RL_PCI_INTLINE, 4);
+ /* Reset the power state. */
+ printf("rl%d: chip is is in D%d power mode "
+ "-- setting to D0\n", unit,
+ pci_get_powerstate(dev));
- /* Reset the power state. */
- printf("rl%d: chip is is in D%d power mode "
- "-- setting to D0\n", unit, command & RL_PSTATE_MASK);
- command &= 0xFFFFFFFC;
- pci_write_config(dev, RL_PCI_PWRMGMTCTRL, command, 4);
+ pci_set_powerstate(dev, PCI_POWERSTATE_D0);
- /* Restore PCI config data. */
- pci_write_config(dev, RL_PCI_LOIO, iobase, 4);
- pci_write_config(dev, RL_PCI_LOMEM, membase, 4);
- pci_write_config(dev, RL_PCI_INTLINE, irq, 4);
- }
+ /* Restore PCI config data. */
+ pci_write_config(dev, RL_PCI_LOIO, iobase, 4);
+ pci_write_config(dev, RL_PCI_LOMEM, membase, 4);
+ pci_write_config(dev, RL_PCI_INTLINE, irq, 4);
}
/*
diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c
index eaa890184efdf..e7a3174092b24 100644
--- a/sys/pci/if_xl.c
+++ b/sys/pci/if_xl.c
@@ -1282,29 +1282,25 @@ static int xl_attach(dev)
* back in the D0 state, then restore the PCI config ourselves.
*/
- command = pci_read_config(dev, XL_PCI_CAPID, 4) & 0x000000FF;
- if (command == 0x01) {
+ if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
+ u_int32_t iobase, membase, irq;
- command = pci_read_config(dev, XL_PCI_PWRMGMTCTRL, 4);
- if (command & XL_PSTATE_MASK) {
- u_int32_t iobase, membase, irq;
+ /* Save important PCI config data. */
+ iobase = pci_read_config(dev, XL_PCI_LOIO, 4);
+ membase = pci_read_config(dev, XL_PCI_LOMEM, 4);
+ irq = pci_read_config(dev, XL_PCI_INTLINE, 4);
- /* Save important PCI config data. */
- iobase = pci_read_config(dev, XL_PCI_LOIO, 4);
- membase = pci_read_config(dev, XL_PCI_LOMEM, 4);
- irq = pci_read_config(dev, XL_PCI_INTLINE, 4);
+ /* Reset the power state. */
+ printf("xl%d: chip is in D%d power mode "
+ "-- setting to D0\n", unit,
+ pci_get_powerstate(dev));
- /* Reset the power state. */
- printf("xl%d: chip is in D%d power mode "
- "-- setting to D0\n", unit, command & XL_PSTATE_MASK);
- command &= 0xFFFFFFFC;
- pci_write_config(dev, XL_PCI_PWRMGMTCTRL, command, 4);
+ pci_set_powerstate(dev, PCI_POWERSTATE_D0);
- /* Restore PCI config data. */
- pci_write_config(dev, XL_PCI_LOIO, iobase, 4);
- pci_write_config(dev, XL_PCI_LOMEM, membase, 4);
- pci_write_config(dev, XL_PCI_INTLINE, irq, 4);
- }
+ /* Restore PCI config data. */
+ pci_write_config(dev, XL_PCI_LOIO, iobase, 4);
+ pci_write_config(dev, XL_PCI_LOMEM, membase, 4);
+ pci_write_config(dev, XL_PCI_INTLINE, irq, 4);
}
/*