diff options
author | jhb <jhb@FreeBSD.org> | 2006-09-01 16:11:12 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2006-09-01 16:11:12 +0000 |
commit | 5b29358f0242e0504a4f7ec8b7c22e1e4ed47afa (patch) | |
tree | e6b950e6c459160b25575e705a3494c8d2e99f83 /sys | |
parent | d8270676efcc05ec63aa80b7ee698b5f5aea7515 (diff) | |
download | FreeBSD-src-5b29358f0242e0504a4f7ec8b7c22e1e4ed47afa.zip FreeBSD-src-5b29358f0242e0504a4f7ec8b7c22e1e4ed47afa.tar.gz |
- Use pci_enable_busmaster() and pci_enable_io() to update the command
register. This really shouldn't be using pci_enable_io() directly as
bus_alloc_resource() does it already, but the cached copy of the
command word needs to be correct so the enable/disable mwi functions
work properly.
- Use pci bus accessors to read revision ID and subvendor IDs.
Reviewed by: jvogel
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/em/if_em.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/sys/dev/em/if_em.c b/sys/dev/em/if_em.c index 8d9a1d3..b0f8783 100644 --- a/sys/dev/em/if_em.c +++ b/sys/dev/em/if_em.c @@ -1978,22 +1978,16 @@ em_identify_hardware(struct adapter *adapter) device_t dev = adapter->dev; /* Make sure our PCI config space has the necessary stuff set */ + pci_enable_busmaster(dev); + pci_enable_io(dev, SYS_RES_MEMORY); adapter->hw.pci_cmd_word = pci_read_config(dev, PCIR_COMMAND, 2); - if (!((adapter->hw.pci_cmd_word & PCIM_CMD_BUSMASTEREN) && - (adapter->hw.pci_cmd_word & PCIM_CMD_MEMEN))) { - device_printf(dev, "Memory Access and/or Bus Master bits " - "were not set!\n"); - adapter->hw.pci_cmd_word |= - (PCIM_CMD_BUSMASTEREN | PCIM_CMD_MEMEN); - pci_write_config(dev, PCIR_COMMAND, adapter->hw.pci_cmd_word, 2); - } /* Save off the information about this board */ adapter->hw.vendor_id = pci_get_vendor(dev); adapter->hw.device_id = pci_get_device(dev); - adapter->hw.revision_id = pci_read_config(dev, PCIR_REVID, 1); - adapter->hw.subsystem_vendor_id = pci_read_config(dev, PCIR_SUBVEND_0, 2); - adapter->hw.subsystem_id = pci_read_config(dev, PCIR_SUBDEV_0, 2); + adapter->hw.revision_id = pci_get_revid(dev); + adapter->hw.subsystem_vendor_id = pci_get_subvendor(dev); + adapter->hw.subsystem_id = pci_get_subdevice(dev); /* Identify the MAC */ if (em_set_mac_type(&adapter->hw)) |