From 49921f1e25cfaf64c69b5c1fdc254c9d30cee1b8 Mon Sep 17 00:00:00 2001 From: Thomas Moestl Date: Mon, 11 Mar 2002 02:37:19 +0000 Subject: Use the pci_enable_* functions instead of manually fiddling with the command register. Pointed out by: msmith --- sys/dev/gem/if_gem_pci.c | 10 ++++------ sys/dev/hme/if_hme_pci.c | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/gem/if_gem_pci.c b/sys/dev/gem/if_gem_pci.c index 26bf635a80c9e..0e2544f1e85af 100644 --- a/sys/dev/gem/if_gem_pci.c +++ b/sys/dev/gem/if_gem_pci.c @@ -143,15 +143,13 @@ gem_pci_attach(dev) { struct gem_pci_softc *gsc = device_get_softc(dev); struct gem_softc *sc = &gsc->gsc_gem; - u_int16_t csr; /* - * Enable bus master access. The firmware does in some cases not do - * this for us on sparc64 machines. + * Enable bus master and memory access. The firmware does in some + * cases not do this for us on sparc64 machines. */ - csr = pci_read_config(dev, PCIR_COMMAND, 2); - csr |= PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN; - pci_write_config(dev, PCIR_COMMAND, csr, 2); + pci_enable_busmaster(dev); + pci_enable_io(dev, SYS_RES_MEMORY); sc->sc_dev = dev; sc->sc_pci = 1; /* XXX */ diff --git a/sys/dev/hme/if_hme_pci.c b/sys/dev/hme/if_hme_pci.c index 6128608f0dde4..3978e0027b80a 100644 --- a/sys/dev/hme/if_hme_pci.c +++ b/sys/dev/hme/if_hme_pci.c @@ -120,16 +120,14 @@ hme_pci_attach(device_t dev) { struct hme_pci_softc *hsc = device_get_softc(dev); struct hme_softc *sc = &hsc->hsc_hme; - u_int16_t csr; int error; /* - * enable io/memory-space accesses. this is kinda of gross; but - * the hme comes up with neither IO space enabled, or memory space. + * Enable memory-space and bus master accesses. This is kinda of + * gross; but the hme comes up with neither enabled. */ - csr = pci_read_config(dev, PCIR_COMMAND, 2); - csr |= PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN; - pci_write_config(dev, PCIR_COMMAND, csr, 2); + pci_enable_busmaster(dev); + pci_enable_io(dev, SYS_RES_MEMORY); sc->sc_pci = 1; /* XXXXX should all be done in bus_dma. */ sc->sc_dev = dev; -- cgit v1.3