Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Set PCI_COMMAND_MASTER_ENABLE and PCI_COMMAND_ME...



details:   https://anonhg.NetBSD.org/src/rev/437f86c781e9
branches:  trunk
changeset: 936023:437f86c781e9
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Thu Jul 16 01:20:38 2020 +0000

description:
Set PCI_COMMAND_MASTER_ENABLE and PCI_COMMAND_MEM_ENABLE
to activate the pci devices

This configuration is needed when BIOS or UEFI do not make them set.

diffstat:

 sys/dev/pci/if_ixl.c |  20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diffs (55 lines):

diff -r c75658d70680 -r 437f86c781e9 sys/dev/pci/if_ixl.c
--- a/sys/dev/pci/if_ixl.c      Wed Jul 15 19:23:44 2020 +0000
+++ b/sys/dev/pci/if_ixl.c      Thu Jul 16 01:20:38 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ixl.c,v 1.67 2020/06/11 02:39:30 thorpej Exp $      */
+/*     $NetBSD: if_ixl.c,v 1.68 2020/07/16 01:20:38 yamaguchi Exp $    */
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -74,7 +74,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.67 2020/06/11 02:39:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.68 2020/07/16 01:20:38 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -764,7 +764,8 @@
 static unsigned int     ixl_param_rx_ndescs = 1024;
 
 static enum i40e_mac_type
-    ixl_mactype(pci_product_id_t);
+           ixl_mactype(pci_product_id_t);
+static void    ixl_pci_csr_setup(pci_chipset_tag_t, pcitag_t);
 static void    ixl_clear_hw(struct ixl_softc *);
 static int     ixl_pf_reset(struct ixl_softc *);
 
@@ -1107,6 +1108,8 @@
 
        sc->sc_mac_type = ixl_mactype(PCI_PRODUCT(pa->pa_id));
 
+       ixl_pci_csr_setup(pa->pa_pc, pa->pa_tag);
+
        memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, IXL_PCIREG);
        if (pci_mapreg_map(pa, IXL_PCIREG, memtype, 0,
            &sc->sc_memt, &sc->sc_memh, NULL, &sc->sc_mems)) {
@@ -1943,6 +1946,17 @@
        return I40E_MAC_GENERIC;
 }
 
+static void
+ixl_pci_csr_setup(pci_chipset_tag_t pc, pcitag_t tag)
+{
+       pcireg_t csr;
+
+       csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
+       csr |= (PCI_COMMAND_MASTER_ENABLE |
+           PCI_COMMAND_MEM_ENABLE);
+       pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, csr);
+}
+
 static inline void *
 ixl_hmc_kva(struct ixl_softc *sc, enum ixl_hmc_types type, unsigned int i)
 {



Home | Main Index | Thread Index | Old Index