Thu Aug 23 12:24:34 2012 UTC ()
Avoid "unused variable" warning for non-DIAGNOSTIC kernels.
Pointed out by Havard Eidnes


(bouyer)
diff -r1.43 -r1.44 src/sys/dev/ic/mfi.c

cvs diff -r1.43 -r1.44 src/sys/dev/ic/mfi.c (expand / switch to unified diff)

--- src/sys/dev/ic/mfi.c 2012/08/23 09:59:13 1.43
+++ src/sys/dev/ic/mfi.c 2012/08/23 12:24:33 1.44
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mfi.c,v 1.43 2012/08/23 09:59:13 bouyer Exp $ */ 1/* $NetBSD: mfi.c,v 1.44 2012/08/23 12:24:33 bouyer Exp $ */
2/* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */ 2/* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 2012 Manuel Bouyer. 5 * Copyright (c) 2012 Manuel Bouyer.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -63,27 +63,27 @@ @@ -63,27 +63,27 @@
63 * EXEMPLARY,OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 63 * EXEMPLARY,OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
64 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 64 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
65 * PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY THEORY 65 * PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY THEORY
66 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 66 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
67 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 67 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
68 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 68 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
69 * 69 *
70 * The views and conclusions contained in the software and documentation 70 * The views and conclusions contained in the software and documentation
71 * are those of the authors and should not be interpreted as representing 71 * are those of the authors and should not be interpreted as representing
72 * official policies,either expressed or implied, of the FreeBSD Project. 72 * official policies,either expressed or implied, of the FreeBSD Project.
73 */ 73 */
74 74
75#include <sys/cdefs.h> 75#include <sys/cdefs.h>
76__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.43 2012/08/23 09:59:13 bouyer Exp $"); 76__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.44 2012/08/23 12:24:33 bouyer Exp $");
77 77
78#include "bio.h" 78#include "bio.h"
79 79
80#include <sys/param.h> 80#include <sys/param.h>
81#include <sys/systm.h> 81#include <sys/systm.h>
82#include <sys/buf.h> 82#include <sys/buf.h>
83#include <sys/ioctl.h> 83#include <sys/ioctl.h>
84#include <sys/device.h> 84#include <sys/device.h>
85#include <sys/kernel.h> 85#include <sys/kernel.h>
86#include <sys/malloc.h> 86#include <sys/malloc.h>
87#include <sys/proc.h> 87#include <sys/proc.h>
88#include <sys/cpu.h> 88#include <sys/cpu.h>
89 89
@@ -2702,27 +2702,26 @@ mfi_tbolt_build_mpt_ccb(struct mfi_ccb * @@ -2702,27 +2702,26 @@ mfi_tbolt_build_mpt_ccb(struct mfi_ccb *
2702 MFIMEM_DVA(ccb->ccb_sc->sc_tbolt_reqmsgpool), 2702 MFIMEM_DVA(ccb->ccb_sc->sc_tbolt_reqmsgpool),
2703 MEGASAS_THUNDERBOLT_NEW_MSG_SIZE, 2703 MEGASAS_THUNDERBOLT_NEW_MSG_SIZE,
2704 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); 2704 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
2705} 2705}
2706 2706
2707/* 2707/*
2708 * Description: 2708 * Description:
2709 * This function will prepare message pools for the Thunderbolt controller 2709 * This function will prepare message pools for the Thunderbolt controller
2710 */ 2710 */
2711static int 2711static int
2712mfi_tbolt_init_desc_pool(struct mfi_softc *sc) 2712mfi_tbolt_init_desc_pool(struct mfi_softc *sc)
2713{ 2713{
2714 uint32_t offset = 0; 2714 uint32_t offset = 0;
2715 uint32_t tbolt_contg_length = sc->sc_tbolt_reqmsgpool->am_size; 
2716 uint8_t *addr = MFIMEM_KVA(sc->sc_tbolt_reqmsgpool); 2715 uint8_t *addr = MFIMEM_KVA(sc->sc_tbolt_reqmsgpool);
2717 2716
2718 /* Request Decriptors alignement restrictions */ 2717 /* Request Decriptors alignement restrictions */
2719 KASSERT(((uintptr_t)addr & 0xFF) == 0); 2718 KASSERT(((uintptr_t)addr & 0xFF) == 0);
2720 2719
2721 /* Skip request message pool */ 2720 /* Skip request message pool */
2722 addr = &addr[MEGASAS_THUNDERBOLT_NEW_MSG_SIZE * (sc->sc_max_cmds + 1)]; 2721 addr = &addr[MEGASAS_THUNDERBOLT_NEW_MSG_SIZE * (sc->sc_max_cmds + 1)];
2723 2722
2724 /* Reply Frame Pool is initialized */ 2723 /* Reply Frame Pool is initialized */
2725 sc->sc_reply_frame_pool = (struct mfi_mpi2_reply_header *) addr; 2724 sc->sc_reply_frame_pool = (struct mfi_mpi2_reply_header *) addr;
2726 KASSERT(((uintptr_t)addr & 0xFF) == 0); 2725 KASSERT(((uintptr_t)addr & 0xFF) == 0);
2727 2726
2728 offset = (uintptr_t)sc->sc_reply_frame_pool 2727 offset = (uintptr_t)sc->sc_reply_frame_pool
@@ -2735,27 +2734,27 @@ mfi_tbolt_init_desc_pool(struct mfi_soft @@ -2735,27 +2734,27 @@ mfi_tbolt_init_desc_pool(struct mfi_soft
2735 (MEGASAS_THUNDERBOLT_REPLY_SIZE * sc->sc_reply_pool_size)); 2734 (MEGASAS_THUNDERBOLT_REPLY_SIZE * sc->sc_reply_pool_size));
2736 2735
2737 /* Skip Reply Frame Pool */ 2736 /* Skip Reply Frame Pool */
2738 addr += MEGASAS_THUNDERBOLT_REPLY_SIZE * sc->sc_reply_pool_size; 2737 addr += MEGASAS_THUNDERBOLT_REPLY_SIZE * sc->sc_reply_pool_size;
2739 sc->sc_reply_pool_limit = (void *)addr; 2738 sc->sc_reply_pool_limit = (void *)addr;
2740 2739
2741 offset = MEGASAS_THUNDERBOLT_REPLY_SIZE * sc->sc_reply_pool_size; 2740 offset = MEGASAS_THUNDERBOLT_REPLY_SIZE * sc->sc_reply_pool_size;
2742 sc->sc_sg_frame_busaddr = sc->sc_reply_frame_busaddr + offset; 2741 sc->sc_sg_frame_busaddr = sc->sc_reply_frame_busaddr + offset;
2743 2742
2744 /* initialize the last_reply_idx to 0 */ 2743 /* initialize the last_reply_idx to 0 */
2745 sc->sc_last_reply_idx = 0; 2744 sc->sc_last_reply_idx = 0;
2746 offset = (sc->sc_sg_frame_busaddr + (MEGASAS_MAX_SZ_CHAIN_FRAME * 2745 offset = (sc->sc_sg_frame_busaddr + (MEGASAS_MAX_SZ_CHAIN_FRAME *
2747 sc->sc_max_cmds)) - MFIMEM_DVA(sc->sc_tbolt_reqmsgpool); 2746 sc->sc_max_cmds)) - MFIMEM_DVA(sc->sc_tbolt_reqmsgpool);
2748 KASSERT(offset <= tbolt_contg_length); 2747 KASSERT(offset <= sc->sc_tbolt_reqmsgpool->am_size);
2749 bus_dmamap_sync(sc->sc_dmat, MFIMEM_MAP(sc->sc_tbolt_reqmsgpool), 0, 2748 bus_dmamap_sync(sc->sc_dmat, MFIMEM_MAP(sc->sc_tbolt_reqmsgpool), 0,
2750 MFIMEM_MAP(sc->sc_tbolt_reqmsgpool)->dm_mapsize, 2749 MFIMEM_MAP(sc->sc_tbolt_reqmsgpool)->dm_mapsize,
2751 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); 2750 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
2752 return 0; 2751 return 0;
2753} 2752}
2754 2753
2755/* 2754/*
2756 * This routine prepare and issue INIT2 frame to the Firmware 2755 * This routine prepare and issue INIT2 frame to the Firmware
2757 */ 2756 */
2758 2757
2759static int 2758static int
2760mfi_tbolt_init_MFI_queue(struct mfi_softc *sc) 2759mfi_tbolt_init_MFI_queue(struct mfi_softc *sc)
2761{ 2760{