From 5b29358f0242e0504a4f7ec8b7c22e1e4ed47afa Mon Sep 17 00:00:00 2001 From: jhb Date: Fri, 1 Sep 2006 16:11:12 +0000 Subject: - 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 --- sys/dev/em/if_em.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'sys/dev/em') 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)) -- cgit v1.1