bnx2x: fix build on FreeBSD
[dpdk.git] / drivers / net / bnx2x / bnx2x.c
index a5f4069..6782349 100644 (file)
@@ -1,37 +1,16 @@
 /*-
- * Copyright (c) 2007-2013 QLogic Corporation. All rights reserved.
+ * Copyright (c) 2007-2013 Broadcom Corporation.
  *
  * Eric Davis        <edavis@broadcom.com>
  * David Christensen <davidch@broadcom.com>
  * Gary Zambrano     <zambrano@broadcom.com>
  *
  * Copyright (c) 2013-2015 Brocade Communications Systems, Inc.
+ * Copyright (c) 2015 QLogic Corporation.
  * All rights reserved.
+ * www.qlogic.com
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Broadcom Corporation nor the name of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written consent.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS'
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
+ * See LICENSE.bnx2x_pmd for copyright and licensing details.
  */
 
 #define BNX2X_DRIVER_VERSION "1.78.18"
@@ -4343,7 +4322,7 @@ static void bnx2x_eq_int(struct bnx2x_softc *sc)
 /* handle eq element */
                switch (opcode) {
                case EVENT_RING_OPCODE_STAT_QUERY:
-                       PMD_DRV_LOG(DEBUG, "got statistics completion event %d",
+                       PMD_DEBUG_PERIODIC_LOG(DEBUG, "got statistics completion event %d",
                                    sc->stats_comp++);
                        /* nothing to do with stats comp */
                        goto next_spqe;
@@ -4494,7 +4473,7 @@ static int bnx2x_handle_sp_tq(struct bnx2x_softc *sc)
        /* SP events: STAT_QUERY and others */
        if (status & BNX2X_DEF_SB_IDX) {
 /* handle EQ completions */
-               PMD_DRV_LOG(DEBUG, "---> EQ INTR <---");
+               PMD_DEBUG_PERIODIC_LOG(DEBUG, "---> EQ INTR <---");
                bnx2x_eq_int(sc);
                bnx2x_ack_sb(sc, sc->igu_dsb_id, USTORM_ID,
                           le16toh(sc->def_idx), IGU_INT_NOP, 1);
@@ -4567,7 +4546,7 @@ int bnx2x_intr_legacy(struct bnx2x_softc *sc, int scan_fp)
                return 0;
        }
 
-       PMD_DRV_LOG(DEBUG, "Interrupt status 0x%04x", status);
+       PMD_DEBUG_PERIODIC_LOG(DEBUG, "Interrupt status 0x%04x", status);
        //bnx2x_dump_status_block(sc);
 
        FOR_EACH_ETH_QUEUE(sc, i) {
@@ -9540,13 +9519,22 @@ static int bnx2x_pci_get_caps(struct bnx2x_softc *sc)
                return -ENOMEM;
        }
 
+#ifndef __FreeBSD__
        pci_read(sc, PCI_STATUS, &status, 2);
        if (!(status & PCI_STATUS_CAP_LIST)) {
+#else
+       pci_read(sc, PCIR_STATUS, &status, 2);
+       if (!(status & PCIM_STATUS_CAPPRESENT)) {
+#endif
                PMD_DRV_LOG(NOTICE, "PCIe capability reading failed");
                return -1;
        }
 
+#ifndef __FreeBSD__
        pci_read(sc, PCI_CAPABILITY_LIST, &pci_cap.next, 1);
+#else
+       pci_read(sc, PCIR_CAP_PTR, &pci_cap.next, 1);
+#endif
        while (pci_cap.next) {
                cap->addr = pci_cap.next & ~3;
                pci_read(sc, pci_cap.next & ~3, &pci_cap, 2);