From df373873b59782f4b522fccec4b6071c20558e8f Mon Sep 17 00:00:00 2001 From: Wes Peters Date: Sat, 20 Mar 1999 04:51:25 +0000 Subject: [PATCH] Turn on PCI bus mastering in driver attach routine to avoid hanging the system if the BIOS has not initialized the interface. PR: 10150 Reviewed by: dg --- sys/dev/fxp/if_fxp.c | 11 ++++++++++- sys/pci/if_fxp.c | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index 65689290d277..77f0ade1d5af 100644 --- a/sys/dev/fxp/if_fxp.c +++ b/sys/dev/fxp/if_fxp.c @@ -27,7 +27,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_fxp.c,v 1.64 1999/02/12 17:56:23 julian Exp $ + * $Id: if_fxp.c,v 1.65 1999/03/17 16:44:53 luigi Exp $ */ /* @@ -98,6 +98,7 @@ #include /* for DELAY */ #include +#include /* for PCIM_CMD_xxx */ #include #include @@ -529,6 +530,7 @@ fxp_attach(config_id, unit) vm_offset_t pbase; struct ifnet *ifp; int s; + u_long val; sc = malloc(sizeof(struct fxp_softc), M_DEVBUF, M_NOWAIT); if (sc == NULL) @@ -538,6 +540,13 @@ fxp_attach(config_id, unit) s = splimp(); + /* + * Enable bus mastering. + */ + val = pci_conf_read(config_id, PCI_COMMAND_STATUS_REG); + val |= (PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN); + pci_conf_write(config_id, PCI_COMMAND_STATUS_REG, val); + /* * Map control/status registers. */ diff --git a/sys/pci/if_fxp.c b/sys/pci/if_fxp.c index 65689290d277..77f0ade1d5af 100644 --- a/sys/pci/if_fxp.c +++ b/sys/pci/if_fxp.c @@ -27,7 +27,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_fxp.c,v 1.64 1999/02/12 17:56:23 julian Exp $ + * $Id: if_fxp.c,v 1.65 1999/03/17 16:44:53 luigi Exp $ */ /* @@ -98,6 +98,7 @@ #include /* for DELAY */ #include +#include /* for PCIM_CMD_xxx */ #include #include @@ -529,6 +530,7 @@ fxp_attach(config_id, unit) vm_offset_t pbase; struct ifnet *ifp; int s; + u_long val; sc = malloc(sizeof(struct fxp_softc), M_DEVBUF, M_NOWAIT); if (sc == NULL) @@ -538,6 +540,13 @@ fxp_attach(config_id, unit) s = splimp(); + /* + * Enable bus mastering. + */ + val = pci_conf_read(config_id, PCI_COMMAND_STATUS_REG); + val |= (PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN); + pci_conf_write(config_id, PCI_COMMAND_STATUS_REG, val); + /* * Map control/status registers. */