diff options
author | wpaul <wpaul@FreeBSD.org> | 2001-02-21 20:54:22 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 2001-02-21 20:54:22 +0000 |
commit | d314c28e74fad228397fe7016c254f0b7863f0d5 (patch) | |
tree | f0ddb6671f9dc8b3b92c6340ff6494e08c374f82 /sys/dev | |
parent | e9eddbfc4a0506b08f0f036101a6f3d1b152c265 (diff) | |
download | FreeBSD-src-d314c28e74fad228397fe7016c254f0b7863f0d5.zip FreeBSD-src-d314c28e74fad228397fe7016c254f0b7863f0d5.tar.gz |
Big round of minor updates:
- Use pci_get_powerstate()/pci_set_powerstate() in all the other drivers
that need them so we don't have to fiddle with the PCI power management
registers directly.
- Use pci_enable_busmaster()/pci_enable_io() to turn on busmastering and
PIO/memory mapped accesses.
- Add support to the RealTek driver for the D-Link DFE-530TX+ which has
a RealTek 8139 with its own PCI ID. (Submitted by Jason Wright)
- Have the SiS 900/National DP83815 driver be sure to disable PME
mode in sis_reset(). This apparently fixes a problem on some
motherboards where the DP83815 chip fails to receive packets.
(Submitted by Chuck McCrobie <mccrobie@cablespeed.com>)
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/dc/if_dc.c | 6 | ||||
-rw-r--r-- | sys/dev/sf/if_sf.c | 47 | ||||
-rw-r--r-- | sys/dev/sk/if_sk.c | 47 | ||||
-rw-r--r-- | sys/dev/ti/if_ti.c | 5 | ||||
-rw-r--r-- | sys/dev/vr/if_vr.c | 40 |
5 files changed, 64 insertions, 81 deletions
diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c index 3b33d11..22037d8 100644 --- a/sys/dev/dc/if_dc.c +++ b/sys/dev/dc/if_dc.c @@ -1775,9 +1775,9 @@ static int dc_attach(dev) /* * Map control/status registers. */ - command = pci_read_config(dev, PCIR_COMMAND, 4); - command |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, command, 4); + pci_enable_busmaster(dev); + pci_enable_io(dev, PCIM_CMD_PORTEN); + pci_enable_io(dev, PCIM_CMD_MEMEN); command = pci_read_config(dev, PCIR_COMMAND, 4); #ifdef DC_USEIOSPACE diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c index 2e1cacf..dd26fca 100644 --- a/sys/dev/sf/if_sf.c +++ b/sys/dev/sf/if_sf.c @@ -675,37 +675,32 @@ static int sf_attach(dev) /* * Handle power management nonsense. */ - command = pci_read_config(dev, SF_PCI_CAPID, 4) & 0x000000FF; - if (command == 0x01) { - - command = pci_read_config(dev, SF_PCI_PWRMGMTCTRL, 4); - if (command & SF_PSTATE_MASK) { - u_int32_t iobase, membase, irq; - - /* Save important PCI config data. */ - iobase = pci_read_config(dev, SF_PCI_LOIO, 4); - membase = pci_read_config(dev, SF_PCI_LOMEM, 4); - irq = pci_read_config(dev, SF_PCI_INTLINE, 4); - - /* Reset the power state. */ - printf("sf%d: chip is in D%d power mode " - "-- setting to D0\n", unit, command & SF_PSTATE_MASK); - command &= 0xFFFFFFFC; - pci_write_config(dev, SF_PCI_PWRMGMTCTRL, command, 4); - - /* Restore PCI config data. */ - pci_write_config(dev, SF_PCI_LOIO, iobase, 4); - pci_write_config(dev, SF_PCI_LOMEM, membase, 4); - pci_write_config(dev, SF_PCI_INTLINE, irq, 4); - } + if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) { + u_int32_t iobase, membase, irq; + + /* Save important PCI config data. */ + iobase = pci_read_config(dev, SF_PCI_LOIO, 4); + membase = pci_read_config(dev, SF_PCI_LOMEM, 4); + irq = pci_read_config(dev, SF_PCI_INTLINE, 4); + + /* Reset the power state. */ + printf("sf%d: chip is in D%d power mode " + "-- setting to D0\n", unit, + pci_get_powerstate(dev)); + pci_set_powerstate(dev, PCI_POWERSTATE_D0); + + /* Restore PCI config data. */ + pci_write_config(dev, SF_PCI_LOIO, iobase, 4); + pci_write_config(dev, SF_PCI_LOMEM, membase, 4); + pci_write_config(dev, SF_PCI_INTLINE, irq, 4); } /* * Map control/status registers. */ - command = pci_read_config(dev, PCIR_COMMAND, 4); - command |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, command, 4); + pci_enable_busmaster(dev); + pci_enable_io(dev, PCIM_CMD_PORTEN); + pci_enable_io(dev, PCIM_CMD_MEMEN); command = pci_read_config(dev, PCIR_COMMAND, 4); #ifdef SF_USEIOSPACE diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c index 960b98b..4b5e7f6 100644 --- a/sys/dev/sk/if_sk.c +++ b/sys/dev/sk/if_sk.c @@ -1192,37 +1192,32 @@ static int sk_attach(dev) /* * Handle power management nonsense. */ - command = pci_read_config(dev, SK_PCI_CAPID, 4) & 0x000000FF; - if (command == 0x01) { - - command = pci_read_config(dev, SK_PCI_PWRMGMTCTRL, 4); - if (command & SK_PSTATE_MASK) { - u_int32_t iobase, membase, irq; - - /* Save important PCI config data. */ - iobase = pci_read_config(dev, SK_PCI_LOIO, 4); - membase = pci_read_config(dev, SK_PCI_LOMEM, 4); - irq = pci_read_config(dev, SK_PCI_INTLINE, 4); - - /* Reset the power state. */ - printf("skc%d: chip is in D%d power mode " - "-- setting to D0\n", unit, command & SK_PSTATE_MASK); - command &= 0xFFFFFFFC; - pci_write_config(dev, SK_PCI_PWRMGMTCTRL, command, 4); - - /* Restore PCI config data. */ - pci_write_config(dev, SK_PCI_LOIO, iobase, 4); - pci_write_config(dev, SK_PCI_LOMEM, membase, 4); - pci_write_config(dev, SK_PCI_INTLINE, irq, 4); - } + if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) { + u_int32_t iobase, membase, irq; + + /* Save important PCI config data. */ + iobase = pci_read_config(dev, SK_PCI_LOIO, 4); + membase = pci_read_config(dev, SK_PCI_LOMEM, 4); + irq = pci_read_config(dev, SK_PCI_INTLINE, 4); + + /* Reset the power state. */ + printf("skc%d: chip is in D%d power mode " + "-- setting to D0\n", unit, + pci_get_powerstate(dev)); + pci_set_powerstate(dev, PCI_POWERSTATE_D0); + + /* Restore PCI config data. */ + pci_write_config(dev, SK_PCI_LOIO, iobase, 4); + pci_write_config(dev, SK_PCI_LOMEM, membase, 4); + pci_write_config(dev, SK_PCI_INTLINE, irq, 4); } /* * Map control/status registers. */ - command = pci_read_config(dev, PCIR_COMMAND, 4); - command |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, command, 4); + pci_enable_busmaster(dev); + pci_enable_io(dev, PCIM_CMD_PORTEN); + pci_enable_io(dev, PCIM_CMD_MEMEN); command = pci_read_config(dev, PCIR_COMMAND, 4); #ifdef SK_USEIOSPACE diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index 818d6a2..a25c2f2 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -1481,9 +1481,8 @@ static int ti_attach(dev) /* * Map control/status registers. */ - command = pci_read_config(dev, PCIR_COMMAND, 4); - command |= (PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, command, 4); + pci_enable_busmaster(dev); + pci_enable_io(dev, PCIM_CMD_MEMEN); command = pci_read_config(dev, PCIR_COMMAND, 4); if (!(command & PCIM_CMD_MEMEN)) { diff --git a/sys/dev/vr/if_vr.c b/sys/dev/vr/if_vr.c index 0f44a1d..9c6591b 100644 --- a/sys/dev/vr/if_vr.c +++ b/sys/dev/vr/if_vr.c @@ -648,38 +648,32 @@ static int vr_attach(dev) /* * Handle power management nonsense. */ + if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) { + u_int32_t iobase, membase, irq; - command = pci_read_config(dev, VR_PCI_CAPID, 4) & 0x000000FF; - if (command == 0x01) { + /* Save important PCI config data. */ + iobase = pci_read_config(dev, VR_PCI_LOIO, 4); + membase = pci_read_config(dev, VR_PCI_LOMEM, 4); + irq = pci_read_config(dev, VR_PCI_INTLINE, 4); - command = pci_read_config(dev, VR_PCI_PWRMGMTCTRL, 4); - if (command & VR_PSTATE_MASK) { - u_int32_t iobase, membase, irq; - - /* Save important PCI config data. */ - iobase = pci_read_config(dev, VR_PCI_LOIO, 4); - membase = pci_read_config(dev, VR_PCI_LOMEM, 4); - irq = pci_read_config(dev, VR_PCI_INTLINE, 4); - - /* Reset the power state. */ - printf("vr%d: chip is in D%d power mode " - "-- setting to D0\n", unit, command & VR_PSTATE_MASK); - command &= 0xFFFFFFFC; - pci_write_config(dev, VR_PCI_PWRMGMTCTRL, command, 4); + /* Reset the power state. */ + printf("vr%d: chip is in D%d power mode " + "-- setting to D0\n", unit, + pci_get_powerstate(dev)); + pci_set_powerstate(dev, PCI_POWERSTATE_D0); /* Restore PCI config data. */ - pci_write_config(dev, VR_PCI_LOIO, iobase, 4); - pci_write_config(dev, VR_PCI_LOMEM, membase, 4); - pci_write_config(dev, VR_PCI_INTLINE, irq, 4); - } + pci_write_config(dev, VR_PCI_LOIO, iobase, 4); + pci_write_config(dev, VR_PCI_LOMEM, membase, 4); + pci_write_config(dev, VR_PCI_INTLINE, irq, 4); } /* * Map control/status registers. */ - command = pci_read_config(dev, PCIR_COMMAND, 4); - command |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, command, 4); + pci_enable_busmaster(dev); + pci_enable_io(dev, PCIM_CMD_PORTEN); + pci_enable_io(dev, PCIM_CMD_MEMEN); command = pci_read_config(dev, PCIR_COMMAND, 4); #ifdef VR_USEIOSPACE |