diff options
Diffstat (limited to 'sys/dev/mpt/mpt_pci.c')
-rw-r--r-- | sys/dev/mpt/mpt_pci.c | 369 |
1 files changed, 196 insertions, 173 deletions
diff --git a/sys/dev/mpt/mpt_pci.c b/sys/dev/mpt/mpt_pci.c index 828d6e1..fba176c 100644 --- a/sys/dev/mpt/mpt_pci.c +++ b/sys/dev/mpt/mpt_pci.c @@ -29,25 +29,53 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ +/* + * Copyright (c) 2004, Avid Technology, Inc. and its contributors. + * Copyright (c) 2005, WHEEL Sp. z o.o. + * Copyright (c) 2004, 2005 Justin T. Gibbs + * All rights reserved. + * + * 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 at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon including + * a substantially similar Disclaimer requirement for further binary + * redistribution. + * 3. Neither the name of the LSI Logic Corporation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * 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 THE COPYRIGHT + * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> +#include <dev/mpt/mpt.h> +#include <dev/mpt/mpt_cam.h> +#include <dev/mpt/mpt_raid.h> +#if __FreeBSD_version < 500000 +#include <pci/pcireg.h> +#include <pci/pcivar.h> +#else #include <dev/pci/pcireg.h> #include <dev/pci/pcivar.h> - -#include <machine/bus.h> -#include <machine/resource.h> -#include <sys/rman.h> -#include <sys/malloc.h> - -#include <dev/mpt/mpt_freebsd.h> +#endif #ifndef PCI_VENDOR_LSI #define PCI_VENDOR_LSI 0x1000 @@ -69,10 +97,6 @@ __FBSDID("$FreeBSD$"); #define PCI_PRODUCT_LSI_FC929 0x0622 #endif -#ifndef PCI_PRODUCT_LSI_FC929X -#define PCI_PRODUCT_LSI_FC929X 0x0626 -#endif - #ifndef PCI_PRODUCT_LSI_1030 #define PCI_PRODUCT_LSI_1030 0x0030 #endif @@ -83,64 +107,37 @@ __FBSDID("$FreeBSD$"); -#define MEM_MAP_REG 0x14 -#define MEM_MAP_SRAM 0x1C +#define MPT_IO_BAR 0 +#define MPT_MEM_BAR 1 -static int mpt_probe(device_t); -static int mpt_attach(device_t); -static void mpt_free_bus_resources(mpt_softc_t *mpt); -static int mpt_detach(device_t); -static int mpt_shutdown(device_t); -static int mpt_dma_mem_alloc(mpt_softc_t *mpt); -static void mpt_dma_mem_free(mpt_softc_t *mpt); -static void mpt_read_config_regs(mpt_softc_t *mpt); +static int mpt_pci_probe(device_t); +static int mpt_pci_attach(device_t); +static void mpt_free_bus_resources(struct mpt_softc *mpt); +static int mpt_pci_detach(device_t); +static int mpt_pci_shutdown(device_t); +static int mpt_dma_mem_alloc(struct mpt_softc *mpt); +static void mpt_dma_mem_free(struct mpt_softc *mpt); +static void mpt_read_config_regs(struct mpt_softc *mpt); static void mpt_pci_intr(void *); static device_method_t mpt_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, mpt_probe), - DEVMETHOD(device_attach, mpt_attach), - DEVMETHOD(device_detach, mpt_detach), - DEVMETHOD(device_shutdown, mpt_shutdown), + DEVMETHOD(device_probe, mpt_pci_probe), + DEVMETHOD(device_attach, mpt_pci_attach), + DEVMETHOD(device_detach, mpt_pci_detach), + DEVMETHOD(device_shutdown, mpt_pci_shutdown), { 0, 0 } }; static driver_t mpt_driver = { - "mpt", mpt_methods, sizeof (mpt_softc_t) + "mpt", mpt_methods, sizeof(struct mpt_softc) }; static devclass_t mpt_devclass; DRIVER_MODULE(mpt, pci, mpt_driver, mpt_devclass, 0, 0); MODULE_VERSION(mpt, 1); -int -mpt_intr(void *dummy) -{ - int nrepl = 0; - u_int32_t reply; - mpt_softc_t *mpt = (mpt_softc_t *)dummy; - - if ((mpt_read(mpt, MPT_OFFSET_INTR_STATUS) & MPT_INTR_REPLY_READY) == 0) - return (0); - reply = mpt_pop_reply_queue(mpt); - while (reply != MPT_REPLY_EMPTY) { - nrepl++; - if (mpt->verbose > 1) { - if ((reply & MPT_CONTEXT_REPLY) != 0) { - /* Address reply; IOC has something to say */ - mpt_print_reply(MPT_REPLY_PTOV(mpt, reply)); - } else { - /* Context reply ; all went well */ - mpt_prt(mpt, "context %u reply OK", reply); - } - } - mpt_done(mpt, reply); - reply = mpt_pop_reply_queue(mpt); - } - return (nrepl != 0); -} - static int -mpt_probe(device_t dev) +mpt_pci_probe(device_t dev) { char *desc; @@ -160,9 +157,6 @@ mpt_probe(device_t dev) case PCI_PRODUCT_LSI_FC929: desc = "LSILogic FC929 FC Adapter"; break; - case PCI_PRODUCT_LSI_FC929X: - desc = "LSILogic FC929X FC Adapter"; - break; case PCI_PRODUCT_LSI_1030: desc = "LSILogic 1030 Ultra4 Adapter"; break; @@ -171,12 +165,12 @@ mpt_probe(device_t dev) } device_set_desc(dev, desc); - return (BUS_PROBE_DEFAULT); + return (0); } #ifdef RELENG_4 static void -mpt_set_options(mpt_softc_t *mpt) +mpt_set_options(struct mpt_softc *mpt) { int bitmap; @@ -190,14 +184,14 @@ mpt_set_options(mpt_softc_t *mpt) bitmap = 0; if (getenv_int("mpt_debug", &bitmap)) { if (bitmap & (1 << mpt->unit)) { - mpt->verbose = 2; + mpt->verbose = MPT_PRT_DEBUG; } } } #else static void -mpt_set_options(mpt_softc_t *mpt) +mpt_set_options(struct mpt_softc *mpt) { int tval; @@ -216,18 +210,17 @@ mpt_set_options(mpt_softc_t *mpt) static void -mpt_link_peer(mpt_softc_t *mpt) +mpt_link_peer(struct mpt_softc *mpt) { - mpt_softc_t *mpt2; + struct mpt_softc *mpt2; - if (mpt->unit == 0) { + if (mpt->unit == 0) return; - } /* * XXX: depends on probe order */ - mpt2 = (mpt_softc_t *) devclass_get_softc(mpt_devclass, mpt->unit-1); + mpt2 = (struct mpt_softc *)devclass_get_softc(mpt_devclass,mpt->unit-1); if (mpt2 == NULL) { return; @@ -240,27 +233,27 @@ mpt_link_peer(mpt_softc_t *mpt) } mpt->mpt2 = mpt2; mpt2->mpt2 = mpt; - if (mpt->verbose) { - mpt_prt(mpt, "linking with peer (mpt%d)", + if (mpt->verbose >= MPT_PRT_DEBUG) { + mpt_prt(mpt, "linking with peer (mpt%d)\n", device_get_unit(mpt2->dev)); } } static int -mpt_attach(device_t dev) +mpt_pci_attach(device_t dev) { - int iqd; - u_int32_t data, cmd; - mpt_softc_t *mpt; + struct mpt_softc *mpt; + int iqd; + uint32_t data, cmd; /* Allocate the softc structure */ - mpt = (mpt_softc_t*) device_get_softc(dev); + mpt = (struct mpt_softc*)device_get_softc(dev); if (mpt == NULL) { device_printf(dev, "cannot allocate softc\n"); return (ENOMEM); } - bzero(mpt, sizeof (mpt_softc_t)); + bzero(mpt, sizeof(struct mpt_softc)); switch ((pci_get_device(dev) & ~1)) { case PCI_PRODUCT_LSI_FC909: case PCI_PRODUCT_LSI_FC909A: @@ -273,7 +266,11 @@ mpt_attach(device_t dev) } mpt->dev = dev; mpt->unit = device_get_unit(dev); + mpt->raid_resync_rate = MPT_RAID_RESYNC_RATE_DEFAULT; + mpt->raid_mwce_setting = MPT_RAID_MWCE_DEFAULT; + mpt->raid_queue_depth = MPT_RAID_QUEUE_DEPTH_DEFAULT; mpt_set_options(mpt); + mpt->verbose = MPT_PRT_INFO; mpt->verbose += (bootverbose != 0)? 1 : 0; /* Make sure memory access decoders are enabled */ @@ -298,7 +295,6 @@ mpt_attach(device_t dev) data &= ~1; pci_write_config(dev, PCIR_BIOS, data, 4); - /* * Is this part a dual? * If so, link with our partner (around yet) @@ -308,29 +304,53 @@ mpt_attach(device_t dev) mpt_link_peer(mpt); } - /* Set up the memory regions */ + /* + * Set up register access. PIO mode is required for + * certain reset operations. + */ + mpt->pci_pio_rid = PCIR_BAR(MPT_IO_BAR); + mpt->pci_pio_reg = bus_alloc_resource(dev, SYS_RES_IOPORT, + &mpt->pci_pio_rid, 0, ~0, 0, RF_ACTIVE); + if (mpt->pci_pio_reg == NULL) { + device_printf(dev, "unable to map registers in PIO mode\n"); + goto bad; + } + mpt->pci_pio_st = rman_get_bustag(mpt->pci_pio_reg); + mpt->pci_pio_sh = rman_get_bushandle(mpt->pci_pio_reg); + /* Allocate kernel virtual memory for the 9x9's Mem0 region */ - mpt->pci_reg_id = MEM_MAP_REG; + mpt->pci_mem_rid = PCIR_BAR(MPT_MEM_BAR); mpt->pci_reg = bus_alloc_resource(dev, SYS_RES_MEMORY, - &mpt->pci_reg_id, 0, ~0, 0, RF_ACTIVE); + &mpt->pci_mem_rid, 0, ~0, 0, RF_ACTIVE); if (mpt->pci_reg == NULL) { - device_printf(dev, "unable to map any ports\n"); - goto bad; + device_printf(dev, "Unable to memory map registers.\n"); + device_printf(dev, "Falling back to PIO mode.\n"); + mpt->pci_st = mpt->pci_pio_st; + mpt->pci_sh = mpt->pci_pio_sh; + } else { + mpt->pci_st = rman_get_bustag(mpt->pci_reg); + mpt->pci_sh = rman_get_bushandle(mpt->pci_reg); } - mpt->pci_st = rman_get_bustag(mpt->pci_reg); - mpt->pci_sh = rman_get_bushandle(mpt->pci_reg); - /* Get the Physical Address */ - mpt->pci_pa = rman_get_start(mpt->pci_reg); /* Get a handle to the interrupt */ iqd = 0; +#if __FreeBSD_version < 500000 + mpt->pci_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &iqd, 0, ~0, 1, + RF_ACTIVE | RF_SHAREABLE); +#else mpt->pci_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd, RF_ACTIVE | RF_SHAREABLE); +#endif if (mpt->pci_irq == NULL) { device_printf(dev, "could not allocate interrupt\n"); goto bad; } + MPT_LOCK_SETUP(mpt); + + /* Disable interrupts at the part */ + mpt_disable_ints(mpt); + /* Register the interrupt handler */ if (bus_setup_intr(dev, mpt->pci_irq, MPT_IFLAGS, mpt_pci_intr, mpt, &mpt->ih)) { @@ -338,12 +358,8 @@ mpt_attach(device_t dev) goto bad; } - MPT_LOCK_SETUP(mpt); - - /* Disable interrupts at the part */ - mpt_disable_ints(mpt); - /* Allocate dma memory */ +/* XXX JGibbs -Should really be done based on IOCFacts. */ if (mpt_dma_mem_alloc(mpt)) { device_printf(dev, "Could not allocate DMA memory\n"); goto bad; @@ -364,18 +380,10 @@ mpt_attach(device_t dev) /* Initialize the hardware */ if (mpt->disabled == 0) { MPT_LOCK(mpt); - if (mpt_init(mpt, MPT_DB_INIT_HOST) != 0) { + if (mpt_attach(mpt) != 0) { MPT_UNLOCK(mpt); goto bad; } - - /* - * Attach to CAM - */ - MPTLOCK_2_CAMLOCK(mpt); - mpt_cam_attach(mpt); - CAMLOCK_2_MPTLOCK(mpt); - MPT_UNLOCK(mpt); } return (0); @@ -394,7 +402,7 @@ bad: * Free bus resources */ static void -mpt_free_bus_resources(mpt_softc_t *mpt) +mpt_free_bus_resources(struct mpt_softc *mpt) { if (mpt->ih) { bus_teardown_intr(mpt->dev, mpt->pci_irq, mpt->ih); @@ -406,8 +414,13 @@ mpt_free_bus_resources(mpt_softc_t *mpt) mpt->pci_irq = 0; } + if (mpt->pci_pio_reg) { + bus_release_resource(mpt->dev, SYS_RES_IOPORT, mpt->pci_pio_rid, + mpt->pci_pio_reg); + mpt->pci_pio_reg = 0; + } if (mpt->pci_reg) { - bus_release_resource(mpt->dev, SYS_RES_MEMORY, mpt->pci_reg_id, + bus_release_resource(mpt->dev, SYS_RES_MEMORY, mpt->pci_mem_rid, mpt->pci_reg); mpt->pci_reg = 0; } @@ -419,19 +432,41 @@ mpt_free_bus_resources(mpt_softc_t *mpt) * Disconnect ourselves from the system. */ static int -mpt_detach(device_t dev) +mpt_pci_detach(device_t dev) { - mpt_softc_t *mpt; - mpt = (mpt_softc_t*) device_get_softc(dev); + struct mpt_softc *mpt; - mpt_prt(mpt, "mpt_detach"); + mpt = (struct mpt_softc*)device_get_softc(dev); + mpt_prt(mpt, "mpt_detach\n"); if (mpt) { mpt_disable_ints(mpt); - mpt_cam_detach(mpt); - mpt_reset(mpt); + mpt_detach(mpt); + mpt_reset(mpt, /*reinit*/FALSE); mpt_dma_mem_free(mpt); mpt_free_bus_resources(mpt); + if (mpt->raid_volumes != NULL + && mpt->ioc_page2 != NULL) { + int i; + + for (i = 0; i < mpt->ioc_page2->MaxVolumes; i++) { + struct mpt_raid_volume *mpt_vol; + + mpt_vol = &mpt->raid_volumes[i]; + if (mpt_vol->config_page) + free(mpt_vol->config_page, M_DEVBUF); + } + } + if (mpt->ioc_page2 != NULL) + free(mpt->ioc_page2, M_DEVBUF); + if (mpt->ioc_page3 != NULL) + free(mpt->ioc_page3, M_DEVBUF); + if (mpt->raid_volumes != NULL) + free(mpt->raid_volumes, M_DEVBUF); + if (mpt->raid_disks != NULL) + free(mpt->raid_disks, M_DEVBUF); + if (mpt->eh != NULL) + EVENTHANDLER_DEREGISTER(shutdown_final, mpt->eh); } return(0); } @@ -439,43 +474,27 @@ mpt_detach(device_t dev) /* * Disable the hardware + * XXX - Called too early by New Bus!!! ??? */ static int -mpt_shutdown(device_t dev) +mpt_pci_shutdown(device_t dev) { - mpt_softc_t *mpt; - mpt = (mpt_softc_t*) device_get_softc(dev); + struct mpt_softc *mpt; - if (mpt) { - mpt_reset(mpt); - } + mpt = (struct mpt_softc *)device_get_softc(dev); + if (mpt) + return (mpt_shutdown(mpt)); return(0); } - -struct imush { - mpt_softc_t *mpt; - int error; - u_int32_t phys; -}; - -static void -mpt_map_rquest(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - struct imush *imushp = (struct imush *) arg; - imushp->error = error; - imushp->phys = segs->ds_addr; -} - - static int -mpt_dma_mem_alloc(mpt_softc_t *mpt) +mpt_dma_mem_alloc(struct mpt_softc *mpt) { int i, error; - u_char *vptr; - u_int32_t pptr, end; + uint8_t *vptr; + uint32_t pptr, end; size_t len; - struct imush im; + struct mpt_map_info mi; device_t dev = mpt->dev; /* Check if we alreay have allocated the reply memory */ @@ -483,17 +502,16 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt) return 0; } - len = sizeof (request_t *) * MPT_REQ_MEM_SIZE(mpt); + len = sizeof (request_t) * MPT_MAX_REQUESTS(mpt); #ifdef RELENG_4 - mpt->request_pool = (request_t *) malloc(len, M_DEVBUF, M_WAITOK); + mpt->request_pool = (request_t *)malloc(len, M_DEVBUF, M_WAITOK); if (mpt->request_pool == NULL) { device_printf(dev, "cannot allocate request pool\n"); return (1); } bzero(mpt->request_pool, len); #else - mpt->request_pool = (request_t *) - malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); + mpt->request_pool = (request_t *)malloc(len, M_DEVBUF, M_WAITOK|M_ZERO); if (mpt->request_pool == NULL) { device_printf(dev, "cannot allocate request pool\n"); return (1); @@ -501,24 +519,27 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt) #endif /* - * Create a dma tag for this device + * Create a parent dma tag for this device * - * Align at page boundaries, limit to 32-bit addressing + * Align at byte boundaries, limit to 32-bit addressing * (The chip supports 64-bit addressing, but this driver doesn't) */ - if (bus_dma_tag_create(NULL, PAGE_SIZE, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, - BUS_SPACE_MAXSIZE_32BIT, BUS_SPACE_UNRESTRICTED, 0, - busdma_lock_mutex, &Giant, &mpt->parent_dmat) != 0) { + if (mpt_dma_tag_create(mpt, /*parent*/NULL, /*alignment*/1, + /*boundary*/0, /*lowaddr*/BUS_SPACE_MAXADDR_32BIT, + /*highaddr*/BUS_SPACE_MAXADDR, /*filter*/NULL, /*filterarg*/NULL, + /*maxsize*/BUS_SPACE_MAXSIZE_32BIT, + /*nsegments*/BUS_SPACE_MAXSIZE_32BIT, + /*maxsegsz*/BUS_SPACE_UNRESTRICTED, /*flags*/0, + &mpt->parent_dmat) != 0) { device_printf(dev, "cannot create parent dma tag\n"); return (1); } /* Create a child tag for reply buffers */ - if (bus_dma_tag_create(mpt->parent_dmat, PAGE_SIZE, + if (mpt_dma_tag_create(mpt, mpt->parent_dmat, PAGE_SIZE, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, PAGE_SIZE, 1, BUS_SPACE_MAXSIZE_32BIT, 0, - busdma_lock_mutex, &Giant, &mpt->reply_dmat) != 0) { + &mpt->reply_dmat) != 0) { device_printf(dev, "cannot create a dma tag for replies\n"); return (1); } @@ -531,35 +552,35 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt) return (1); } - im.mpt = mpt; - im.error = 0; + mi.mpt = mpt; + mi.error = 0; /* Load and lock it into "bus space" */ bus_dmamap_load(mpt->reply_dmat, mpt->reply_dmap, mpt->reply, - PAGE_SIZE, mpt_map_rquest, &im, 0); + PAGE_SIZE, mpt_map_rquest, &mi, 0); - if (im.error) { + if (mi.error) { device_printf(dev, - "error %d loading dma map for DMA reply queue\n", im.error); + "error %d loading dma map for DMA reply queue\n", mi.error); return (1); } - mpt->reply_phys = im.phys; + mpt->reply_phys = mi.phys; /* Create a child tag for data buffers */ - if (bus_dma_tag_create(mpt->parent_dmat, PAGE_SIZE, + if (mpt_dma_tag_create(mpt, mpt->parent_dmat, 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MAXBSIZE, MPT_SGL_MAX, BUS_SPACE_MAXSIZE_32BIT, 0, - busdma_lock_mutex, &Giant, &mpt->buffer_dmat) != 0) { + &mpt->buffer_dmat) != 0) { device_printf(dev, "cannot create a dma tag for data buffers\n"); return (1); } /* Create a child tag for request buffers */ - if (bus_dma_tag_create(mpt->parent_dmat, PAGE_SIZE, + if (mpt_dma_tag_create(mpt, mpt->parent_dmat, PAGE_SIZE, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MPT_REQ_MEM_SIZE(mpt), 1, BUS_SPACE_MAXSIZE_32BIT, 0, - busdma_lock_mutex, &Giant, &mpt->request_dmat) != 0) { + &mpt->request_dmat) != 0) { device_printf(dev, "cannot create a dma tag for requests\n"); return (1); } @@ -573,20 +594,20 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt) return (1); } - im.mpt = mpt; - im.error = 0; + mi.mpt = mpt; + mi.error = 0; /* Load and lock it into "bus space" */ bus_dmamap_load(mpt->request_dmat, mpt->request_dmap, mpt->request, - MPT_REQ_MEM_SIZE(mpt), mpt_map_rquest, &im, 0); + MPT_REQ_MEM_SIZE(mpt), mpt_map_rquest, &mi, 0); - if (im.error) { + if (mi.error) { device_printf(dev, "error %d loading dma map for DMA request queue\n", - im.error); + mi.error); return (1); } - mpt->request_phys = im.phys; + mpt->request_phys = mi.phys; i = 0; pptr = mpt->request_phys; @@ -621,13 +642,13 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt) /* Deallocate memory that was allocated by mpt_dma_mem_alloc */ static void -mpt_dma_mem_free(mpt_softc_t *mpt) +mpt_dma_mem_free(struct mpt_softc *mpt) { int i; /* Make sure we aren't double destroying */ if (mpt->reply_dmat == 0) { - if (mpt->verbose) + if (mpt->verbose >= MPT_PRT_DEBUG) device_printf(mpt->dev,"Already released dma memory\n"); return; } @@ -653,7 +674,7 @@ mpt_dma_mem_free(mpt_softc_t *mpt) /* Reads modifiable (via PCI transactions) config registers */ static void -mpt_read_config_regs(mpt_softc_t *mpt) +mpt_read_config_regs(struct mpt_softc *mpt) { mpt->pci_cfg.Command = pci_read_config(mpt->dev, PCIR_COMMAND, 2); mpt->pci_cfg.LatencyTimer_LineSize = @@ -670,9 +691,9 @@ mpt_read_config_regs(mpt_softc_t *mpt) /* Sets modifiable config registers */ void -mpt_set_config_regs(mpt_softc_t *mpt) +mpt_set_config_regs(struct mpt_softc *mpt) { - u_int32_t val; + uint32_t val; #define MPT_CHECK(reg, offset, size) \ val = pci_read_config(mpt->dev, offset, size); \ @@ -682,7 +703,7 @@ mpt_set_config_regs(mpt_softc_t *mpt) mpt->pci_cfg.reg, val); \ } - if (mpt->verbose) { + if (mpt->verbose >= MPT_PRT_DEBUG) { MPT_CHECK(Command, PCIR_COMMAND, 2); MPT_CHECK(LatencyTimer_LineSize, PCIR_CACHELNSZ, 2); MPT_CHECK(IO_BAR, PCIR_BAR(0), 4); @@ -712,8 +733,10 @@ mpt_set_config_regs(mpt_softc_t *mpt) static void mpt_pci_intr(void *arg) { - mpt_softc_t *mpt = arg; + struct mpt_softc *mpt; + + mpt = (struct mpt_softc *)arg; MPT_LOCK(mpt); - (void) mpt_intr(mpt); + mpt_intr(mpt); MPT_UNLOCK(mpt); } |