Deleted Added
full compact
mpt_pci.c (162140) mpt_pci.c (164305)
1/*-
2 * PCI specific probe and attach routines for LSI Fusion Adapters
3 * FreeBSD Version.
4 *
5 * Copyright (c) 2000, 2001 by Greg Ansley
6 * Partially derived from Matt Jacob's ISP driver.
7 * Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002 by Matthew Jacob
8 * Feral Software

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

94 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
95 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
96 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
97 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
98 * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
99 */
100
101#include <sys/cdefs.h>
1/*-
2 * PCI specific probe and attach routines for LSI Fusion Adapters
3 * FreeBSD Version.
4 *
5 * Copyright (c) 2000, 2001 by Greg Ansley
6 * Partially derived from Matt Jacob's ISP driver.
7 * Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002 by Matthew Jacob
8 * Feral Software

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

94 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
95 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
96 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
97 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
98 * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
99 */
100
101#include <sys/cdefs.h>
102__FBSDID("$FreeBSD: head/sys/dev/mpt/mpt_pci.c 162140 2006-09-08 05:27:04Z mjacob $");
102__FBSDID("$FreeBSD: head/sys/dev/mpt/mpt_pci.c 164305 2006-11-15 20:04:57Z jhb $");
103
104#include <dev/mpt/mpt.h>
105#include <dev/mpt/mpt_cam.h>
106#include <dev/mpt/mpt_raid.h>
107
108
109#ifndef PCI_VENDOR_LSI
110#define PCI_VENDOR_LSI 0x1000

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

507 mpt->pci_sh = mpt->pci_pio_sh;
508 } else {
509 mpt->pci_st = rman_get_bustag(mpt->pci_reg);
510 mpt->pci_sh = rman_get_bushandle(mpt->pci_reg);
511 }
512
513 /* Get a handle to the interrupt */
514 iqd = 0;
103
104#include <dev/mpt/mpt.h>
105#include <dev/mpt/mpt_cam.h>
106#include <dev/mpt/mpt_raid.h>
107
108
109#ifndef PCI_VENDOR_LSI
110#define PCI_VENDOR_LSI 0x1000

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

507 mpt->pci_sh = mpt->pci_pio_sh;
508 } else {
509 mpt->pci_st = rman_get_bustag(mpt->pci_reg);
510 mpt->pci_sh = rman_get_bushandle(mpt->pci_reg);
511 }
512
513 /* Get a handle to the interrupt */
514 iqd = 0;
515 if (pci_msi_count(dev) == 1) {
516 mpt->pci_msi_count = 1;
517 if (pci_alloc_msi(dev, &mpt->pci_msi_count) == 0)
518 iqd = 1;
519 else
520 mpt->pci_msi_count = 0;
521 }
515 mpt->pci_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd,
516 RF_ACTIVE | RF_SHAREABLE);
517 if (mpt->pci_irq == NULL) {
518 device_printf(dev, "could not allocate interrupt\n");
519 goto bad;
520 }
521
522 MPT_LOCK_SETUP(mpt);

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

603mpt_free_bus_resources(struct mpt_softc *mpt)
604{
605 if (mpt->ih) {
606 bus_teardown_intr(mpt->dev, mpt->pci_irq, mpt->ih);
607 mpt->ih = 0;
608 }
609
610 if (mpt->pci_irq) {
522 mpt->pci_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd,
523 RF_ACTIVE | RF_SHAREABLE);
524 if (mpt->pci_irq == NULL) {
525 device_printf(dev, "could not allocate interrupt\n");
526 goto bad;
527 }
528
529 MPT_LOCK_SETUP(mpt);

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

610mpt_free_bus_resources(struct mpt_softc *mpt)
611{
612 if (mpt->ih) {
613 bus_teardown_intr(mpt->dev, mpt->pci_irq, mpt->ih);
614 mpt->ih = 0;
615 }
616
617 if (mpt->pci_irq) {
611 bus_release_resource(mpt->dev, SYS_RES_IRQ, 0, mpt->pci_irq);
618 bus_release_resource(mpt->dev, SYS_RES_IRQ,
619 mpt->pci_msi_count ? 1 : 0, mpt->pci_irq);
612 mpt->pci_irq = 0;
613 }
614
620 mpt->pci_irq = 0;
621 }
622
623 if (mpt->pci_msi_count) {
624 pci_release_msi(mpt->dev);
625 mpt->pci_msi_count = 0;
626 }
627
615 if (mpt->pci_pio_reg) {
616 bus_release_resource(mpt->dev, SYS_RES_IOPORT, mpt->pci_pio_rid,
617 mpt->pci_pio_reg);
618 mpt->pci_pio_reg = 0;
619 }
620 if (mpt->pci_reg) {
621 bus_release_resource(mpt->dev, SYS_RES_MEMORY, mpt->pci_mem_rid,
622 mpt->pci_reg);

--- 311 unchanged lines hidden ---
628 if (mpt->pci_pio_reg) {
629 bus_release_resource(mpt->dev, SYS_RES_IOPORT, mpt->pci_pio_rid,
630 mpt->pci_pio_reg);
631 mpt->pci_pio_reg = 0;
632 }
633 if (mpt->pci_reg) {
634 bus_release_resource(mpt->dev, SYS_RES_MEMORY, mpt->pci_mem_rid,
635 mpt->pci_reg);

--- 311 unchanged lines hidden ---