summaryrefslogtreecommitdiffstats
path: root/sys/dev/ubsec/ubsec.c
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2013-08-12 23:30:01 +0000
committerscottl <scottl@FreeBSD.org>2013-08-12 23:30:01 +0000
commit28bd1409da1e9911c4152b06c5c7b89235e2b17a (patch)
tree34ad11c71aadd28f5ff680b63e3f0fd70956bed5 /sys/dev/ubsec/ubsec.c
parentc8a53736fe9139a202d17ed7f95389d33326cb61 (diff)
downloadFreeBSD-src-28bd1409da1e9911c4152b06c5c7b89235e2b17a.zip
FreeBSD-src-28bd1409da1e9911c4152b06c5c7b89235e2b17a.tar.gz
Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCI
command register. The lazy BAR allocation code in FreeBSD sometimes disables this bit when it detects a range conflict, and will re-enable it on demand when a driver allocates the BAR. Thus, the bit is no longer a reliable indication of capability, and should not be checked. This results in the elimination of a lot of code from drivers, and also gives the opportunity to simplify a lot of drivers to use a helper API to set the busmaster enable bit. This changes fixes some recent reports of disk controllers and their associated drives/enclosures disappearing during boot. Submitted by: jhb Reviewed by: jfv, marius, achadd, achim MFC after: 1 day
Diffstat (limited to 'sys/dev/ubsec/ubsec.c')
-rw-r--r--sys/dev/ubsec/ubsec.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/sys/dev/ubsec/ubsec.c b/sys/dev/ubsec/ubsec.c
index 40e6d5e..2c0fad4 100644
--- a/sys/dev/ubsec/ubsec.c
+++ b/sys/dev/ubsec/ubsec.c
@@ -267,7 +267,7 @@ ubsec_attach(device_t dev)
{
struct ubsec_softc *sc = device_get_softc(dev);
struct ubsec_dma *dmap;
- u_int32_t cmd, i;
+ u_int32_t i;
int rid;
bzero(sc, sizeof (*sc));
@@ -312,20 +312,7 @@ ubsec_attach(device_t dev)
UBS_FLAGS_LONGCTX | UBS_FLAGS_HWNORM | UBS_FLAGS_BIGKEY;
}
- cmd = pci_read_config(dev, PCIR_COMMAND, 4);
- cmd |= PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN;
- pci_write_config(dev, PCIR_COMMAND, cmd, 4);
- cmd = pci_read_config(dev, PCIR_COMMAND, 4);
-
- if (!(cmd & PCIM_CMD_MEMEN)) {
- device_printf(dev, "failed to enable memory mapping\n");
- goto bad;
- }
-
- if (!(cmd & PCIM_CMD_BUSMASTEREN)) {
- device_printf(dev, "failed to enable bus mastering\n");
- goto bad;
- }
+ pci_enable_busmaster(dev);
/*
* Setup memory-mapping of PCI registers.
OpenPOWER on IntegriCloud