Deleted Added
full compact
if_bce.c (163814) if_bce.c (164305)
1/*-
2 * Copyright (c) 2006 Broadcom Corporation
3 * David Christensen <davidch@broadcom.com>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *

--- 15 unchanged lines hidden (view full) ---

24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2006 Broadcom Corporation
3 * David Christensen <davidch@broadcom.com>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *

--- 15 unchanged lines hidden (view full) ---

24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/dev/bce/if_bce.c 163814 2006-10-31 03:28:25Z scottl $");
32__FBSDID("$FreeBSD: head/sys/dev/bce/if_bce.c 164305 2006-11-15 20:04:57Z jhb $");
33
34/*
35 * The following controllers are supported by this driver:
36 * BCM5706C A2, A3
37 * BCM5708C B1
38 *
39 * The following controllers are not supported by this driver:
40 * (These are not "Production" versions of the controller.)

--- 406 unchanged lines hidden (view full) ---

447/* 0 on success, positive value on failure. */
448/****************************************************************************/
449static int
450bce_attach(device_t dev)
451{
452 struct bce_softc *sc;
453 struct ifnet *ifp;
454 u32 val;
33
34/*
35 * The following controllers are supported by this driver:
36 * BCM5706C A2, A3
37 * BCM5708C B1
38 *
39 * The following controllers are not supported by this driver:
40 * (These are not "Production" versions of the controller.)

--- 406 unchanged lines hidden (view full) ---

447/* 0 on success, positive value on failure. */
448/****************************************************************************/
449static int
450bce_attach(device_t dev)
451{
452 struct bce_softc *sc;
453 struct ifnet *ifp;
454 u32 val;
455 int mbuf, rid, rc = 0;
455 int count, mbuf, rid, rc = 0;
456
457 sc = device_get_softc(dev);
458 sc->bce_dev = dev;
459
460 DBPRINT(sc, BCE_VERBOSE_RESET, "Entering %s()\n", __FUNCTION__);
461
462 mbuf = device_get_unit(dev);
463 sc->bce_unit = mbuf;

--- 16 unchanged lines hidden (view full) ---

480 }
481
482 /* Get various resource handles. */
483 sc->bce_btag = rman_get_bustag(sc->bce_res);
484 sc->bce_bhandle = rman_get_bushandle(sc->bce_res);
485 sc->bce_vhandle = (vm_offset_t) rman_get_virtual(sc->bce_res);
486
487 /* Allocate PCI IRQ resources. */
456
457 sc = device_get_softc(dev);
458 sc->bce_dev = dev;
459
460 DBPRINT(sc, BCE_VERBOSE_RESET, "Entering %s()\n", __FUNCTION__);
461
462 mbuf = device_get_unit(dev);
463 sc->bce_unit = mbuf;

--- 16 unchanged lines hidden (view full) ---

480 }
481
482 /* Get various resource handles. */
483 sc->bce_btag = rman_get_bustag(sc->bce_res);
484 sc->bce_bhandle = rman_get_bushandle(sc->bce_res);
485 sc->bce_vhandle = (vm_offset_t) rman_get_virtual(sc->bce_res);
486
487 /* Allocate PCI IRQ resources. */
488 rid = 0;
488 count = pci_msi_count(dev);
489 if (count == 1 && pci_alloc_msi(dev, &count) == 0) {
490 rid = 1;
491 sc->bce_flags |= BCE_USING_MSI_FLAG;
492 } else
493 rid = 0;
489 sc->bce_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
490 RF_SHAREABLE | RF_ACTIVE);
491
492 if (sc->bce_irq == NULL) {
493 BCE_PRINTF(sc, "%s(%d): PCI map interrupt failed\n",
494 __FILE__, __LINE__);
495 rc = ENXIO;
496 goto bce_attach_fail;

--- 2037 unchanged lines hidden (view full) ---

2534 bce_dma_free(sc);
2535
2536 if (sc->bce_intrhand != NULL)
2537 bus_teardown_intr(dev, sc->bce_irq, sc->bce_intrhand);
2538
2539 if (sc->bce_irq != NULL)
2540 bus_release_resource(dev,
2541 SYS_RES_IRQ,
494 sc->bce_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
495 RF_SHAREABLE | RF_ACTIVE);
496
497 if (sc->bce_irq == NULL) {
498 BCE_PRINTF(sc, "%s(%d): PCI map interrupt failed\n",
499 __FILE__, __LINE__);
500 rc = ENXIO;
501 goto bce_attach_fail;

--- 2037 unchanged lines hidden (view full) ---

2539 bce_dma_free(sc);
2540
2541 if (sc->bce_intrhand != NULL)
2542 bus_teardown_intr(dev, sc->bce_irq, sc->bce_intrhand);
2543
2544 if (sc->bce_irq != NULL)
2545 bus_release_resource(dev,
2546 SYS_RES_IRQ,
2542 0,
2547 sc->bce_flags & BCE_USING_MSI_FLAG ? 1 : 0,
2543 sc->bce_irq);
2544
2548 sc->bce_irq);
2549
2550 if (sc->bce_flags & BCE_USING_MSI_FLAG)
2551 pci_release_msi(dev);
2552
2545 if (sc->bce_res != NULL)
2546 bus_release_resource(dev,
2547 SYS_RES_MEMORY,
2548 PCIR_BAR(0),
2549 sc->bce_res);
2550
2551 if (sc->bce_ifp != NULL)
2552 if_free(sc->bce_ifp);

--- 4239 unchanged lines hidden ---
2553 if (sc->bce_res != NULL)
2554 bus_release_resource(dev,
2555 SYS_RES_MEMORY,
2556 PCIR_BAR(0),
2557 sc->bce_res);
2558
2559 if (sc->bce_ifp != NULL)
2560 if_free(sc->bce_ifp);

--- 4239 unchanged lines hidden ---