Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jun 2013 01:07:40 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r251402 - head/sys/dev/sym
Message-ID:  <201306050107.r5517eIl059890@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Wed Jun  5 01:07:40 2013
New Revision: 251402
URL: http://svnweb.freebsd.org/changeset/base/251402

Log:
  Handle/mark/nuke unused arguments.

Modified:
  head/sys/dev/sym/sym_hipd.c

Modified: head/sys/dev/sym/sym_hipd.c
==============================================================================
--- head/sys/dev/sym/sym_hipd.c	Wed Jun  5 00:45:19 2013	(r251401)
+++ head/sys/dev/sym/sym_hipd.c	Wed Jun  5 01:07:40 2013	(r251402)
@@ -595,18 +595,25 @@ static void sym_mfree(void *ptr, int siz
  * BUS handle. A reverse table (hashed) is maintained for virtual
  * to BUS address translation.
  */
-static void getbaddrcb(void *arg, bus_dma_segment_t *segs, int nseg, int error)
+static void getbaddrcb(void *arg, bus_dma_segment_t *segs, int nseg __unused,
+    int error)
 {
 	bus_addr_t *baddr;
+
+	KASSERT(nseg == 1, ("%s: too many DMA segments (%d)", __func__, nseg));
+
 	baddr = (bus_addr_t *)arg;
-	*baddr = segs->ds_addr;
+	if (error)
+		*baddr = 0;
+	else
+		*baddr = segs->ds_addr;
 }
 
 static m_addr_t ___dma_getp(m_pool_s *mp)
 {
 	m_vtob_s *vbp;
 	void *vaddr = NULL;
-	bus_addr_t baddr = 0;
+	bus_addr_t baddr;
 
 	vbp = __sym_calloc(&mp0, sizeof(*vbp), "VTOB");
 	if (!vbp)
@@ -1165,6 +1172,14 @@ struct sym_tcb {
 };
 
 /*
+ *  Assert some alignments required by the chip.
+ */
+CTASSERT(((offsetof(struct sym_reg, nc_sxfer) ^
+    offsetof(struct sym_tcb, head.sval)) &3) == 0);
+CTASSERT(((offsetof(struct sym_reg, nc_scntl3) ^
+    offsetof(struct sym_tcb, head.wval)) &3) == 0);
+
+/*
  *  Global LCB HEADER.
  *
  *  Due to lack of indirect addressing on earlier NCR chips,
@@ -1265,9 +1280,9 @@ struct sym_pmc {
  *  LUN(s) > 0.
  */
 #if SYM_CONF_MAX_LUN <= 1
-#define sym_lp(np, tp, lun) (!lun) ? (tp)->lun0p : 0
+#define sym_lp(tp, lun) (!lun) ? (tp)->lun0p : 0
 #else
-#define sym_lp(np, tp, lun) \
+#define sym_lp(tp, lun) \
 	(!lun) ? (tp)->lun0p : (tp)->lunmp ? (tp)->lunmp[(lun)] : 0
 #endif
 
@@ -2222,11 +2237,11 @@ static void sym_int_par (hcb_p np, u_sho
 static void sym_int_ma (hcb_p np);
 static int  sym_dequeue_from_squeue(hcb_p np, int i, int target, int lun,
 				    int task);
-static void sym_sir_bad_scsi_status (hcb_p np, int num, ccb_p cp);
+static void sym_sir_bad_scsi_status (hcb_p np, ccb_p cp);
 static int  sym_clear_tasks (hcb_p np, int status, int targ, int lun, int task);
 static void sym_sir_task_recovery (hcb_p np, int num);
 static int  sym_evaluate_dp (hcb_p np, ccb_p cp, u32 scr, int *ofs);
-static void sym_modify_dp (hcb_p np, tcb_p tp, ccb_p cp, int ofs);
+static void sym_modify_dp(hcb_p np, ccb_p cp, int ofs);
 static int  sym_compute_residual (hcb_p np, ccb_p cp);
 static int  sym_show_msg (u_char * msg);
 static void sym_print_msg (ccb_p cp, char *label, u_char *msg);
@@ -2260,7 +2275,7 @@ static int sym_fast_scatter_sg_physical(
 static int sym_scatter_sg_physical (hcb_p np, ccb_p cp,
 				    bus_dma_segment_t *psegs, int nsegs);
 static void sym_action2 (struct cam_sim *sim, union ccb *ccb);
-static void sym_update_trans (hcb_p np, tcb_p tp, struct sym_trans *tip,
+static void sym_update_trans(hcb_p np, struct sym_trans *tip,
 			      struct ccb_trans_settings *cts);
 static void sym_update_dflags(hcb_p np, u_char *flags,
 			      struct ccb_trans_settings *cts);
@@ -2355,6 +2370,7 @@ static void sym_enqueue_cam_ccb(ccb_p cp
 
 static void sym_xpt_done(hcb_p np, union ccb *ccb, ccb_p cp)
 {
+
 	SYM_LOCK_ASSERT(MA_OWNED);
 
 	if (ccb->ccb_h.status & CAM_SIM_QUEUED) {
@@ -2368,6 +2384,7 @@ static void sym_xpt_done(hcb_p np, union
 
 static void sym_xpt_done2(hcb_p np, union ccb *ccb, int cam_status)
 {
+
 	SYM_LOCK_ASSERT(MA_OWNED);
 
 	sym_set_cam_status(ccb, cam_status);
@@ -4659,7 +4676,7 @@ sym_flush_comp_queue(hcb_p np, int cam_s
  *  SCRATCHA is assumed to have been loaded with STARTPOS
  *  before the SCRIPTS called the C code.
  */
-static void sym_sir_bad_scsi_status(hcb_p np, int num, ccb_p cp)
+static void sym_sir_bad_scsi_status(hcb_p np, ccb_p cp)
 {
 	tcb_p tp	= &np->target[cp->target];
 	u32		startp;
@@ -5086,7 +5103,7 @@ static void sym_sir_task_recovery(hcb_p 
 		 *  an IDENTIFY(lun) + ABORT MESSAGE.
 		 */
 		if (lun != -1) {
-			lcb_p lp = sym_lp(np, tp, lun);
+			lcb_p lp = sym_lp(tp, lun);
 			lp->to_clear = 0; /* We donnot expect to fail here */
 			np->abrt_msg[0] = M_IDENTIFY | lun;
 			np->abrt_msg[1] = M_ABORT;
@@ -5379,7 +5396,7 @@ out_err:
  *  Btw, we assume in that situation that such a message
  *  is equivalent to a MODIFY DATA POINTER (offset=-1).
  */
-static void sym_modify_dp(hcb_p np, tcb_p tp, ccb_p cp, int ofs)
+static void sym_modify_dp(hcb_p np, ccb_p cp, int ofs)
 {
 	int dp_ofs	= ofs;
 	u32	dp_scr	= INL (nc_temp);
@@ -6108,7 +6125,7 @@ static void sym_int_sir (hcb_p np)
 	case SIR_BAD_SCSI_STATUS:
 		if (!cp)
 			goto out;
-		sym_sir_bad_scsi_status(np, num, cp);
+		sym_sir_bad_scsi_status(np, cp);
 		return;
 	/*
 	 *  We are asked by the SCRIPTS to prepare a
@@ -6182,7 +6199,7 @@ static void sym_int_sir (hcb_p np)
 					sym_print_msg(cp,"modify DP",np->msgin);
 				tmp = (np->msgin[3]<<24) + (np->msgin[4]<<16) +
 				      (np->msgin[5]<<8)  + (np->msgin[6]);
-				sym_modify_dp(np, tp, cp, tmp);
+				sym_modify_dp(np, cp, tmp);
 				return;
 			case M_X_SYNC_REQ:
 				sym_sync_nego(np, tp, cp);
@@ -6207,7 +6224,7 @@ static void sym_int_sir (hcb_p np)
 		case M_IGN_RESIDUE:
 			if (DEBUG_FLAGS & DEBUG_POINTER)
 				sym_print_msg(cp,"ign wide residue", np->msgin);
-			sym_modify_dp(np, tp, cp, -1);
+			sym_modify_dp(np, cp, -1);
 			return;
 		case M_REJECT:
 			if (INB (HS_PRT) == HS_NEGOTIATE)
@@ -6266,7 +6283,7 @@ out_stuck:
 static	ccb_p sym_get_ccb (hcb_p np, u_char tn, u_char ln, u_char tag_order)
 {
 	tcb_p tp = &np->target[tn];
-	lcb_p lp = sym_lp(np, tp, ln);
+	lcb_p lp = sym_lp(tp, ln);
 	u_short tag = NO_TAG;
 	SYM_QUEHEAD *qp;
 	ccb_p cp = (ccb_p) NULL;
@@ -6389,10 +6406,10 @@ out_free:
 /*
  *  Release one control block
  */
-static void sym_free_ccb (hcb_p np, ccb_p cp)
+static void sym_free_ccb(hcb_p np, ccb_p cp)
 {
 	tcb_p tp = &np->target[cp->target];
-	lcb_p lp = sym_lp(np, tp, cp->lun);
+	lcb_p lp = sym_lp(tp, cp->lun);
 
 	if (DEBUG_FLAGS & DEBUG_TAGS) {
 		PRINT_LUN(np, cp->target, cp->lun);
@@ -6577,27 +6594,12 @@ static ccb_p sym_ccb_from_dsa(hcb_p np, 
 }
 
 /*
- *  Target control block initialisation.
- *  Nothing important to do at the moment.
- */
-static void sym_init_tcb (hcb_p np, u_char tn)
-{
-	/*
-	 *  Check some alignments required by the chip.
-	 */
-	assert (((offsetof(struct sym_reg, nc_sxfer) ^
-		offsetof(struct sym_tcb, head.sval)) &3) == 0);
-	assert (((offsetof(struct sym_reg, nc_scntl3) ^
-		offsetof(struct sym_tcb, head.wval)) &3) == 0);
-}
-
-/*
  *  Lun control block allocation and initialization.
  */
 static lcb_p sym_alloc_lcb (hcb_p np, u_char tn, u_char ln)
 {
 	tcb_p tp = &np->target[tn];
-	lcb_p lp = sym_lp(np, tp, ln);
+	lcb_p lp = sym_lp(tp, ln);
 
 	/*
 	 *  Already done, just return.
@@ -6610,11 +6612,6 @@ static lcb_p sym_alloc_lcb (hcb_p np, u_
 	assert(!sym_is_bit(tp->busy0_map, ln));
 
 	/*
-	 *  Initialize the target control block if not yet.
-	 */
-	sym_init_tcb (np, tn);
-
-	/*
 	 *  Allocate the LCB bus address array.
 	 *  Compute the bus address of this table.
 	 */
@@ -6680,7 +6677,7 @@ fail:
 static void sym_alloc_lcb_tags (hcb_p np, u_char tn, u_char ln)
 {
 	tcb_p tp = &np->target[tn];
-	lcb_p lp = sym_lp(np, tp, ln);
+	lcb_p lp = sym_lp(tp, ln);
 	int i;
 
 	/*
@@ -7290,7 +7287,7 @@ static void sym_complete_ok (hcb_p np, c
 	 */
 	csio = &cp->cam_ccb->csio;
 	tp = &np->target[cp->target];
-	lp = sym_lp(np, tp, cp->lun);
+	lp = sym_lp(tp, cp->lun);
 
 	/*
 	 *  Assume device discovered on first success.
@@ -7489,7 +7486,7 @@ static void sym_action(struct cam_sim *s
 	 *  Retrieve the target and lun descriptors.
 	 */
 	tp = &np->target[ccb_h->target_id];
-	lp = sym_lp(np, tp, ccb_h->target_lun);
+	lp = sym_lp(tp, ccb_h->target_lun);
 
 	/*
 	 *  Complete the 1st INQUIRY command with error
@@ -7991,14 +7988,14 @@ static void sym_action2(struct cam_sim *
 		 *  Update SPI transport settings in TARGET control block.
 		 *  Update SCSI device settings in LUN control block.
 		 */
-		lp = sym_lp(np, tp, ccb_h->target_lun);
+		lp = sym_lp(tp, ccb_h->target_lun);
 		if (cts->type == CTS_TYPE_CURRENT_SETTINGS) {
-			sym_update_trans(np, tp, &tp->tinfo.goal, cts);
+			sym_update_trans(np, &tp->tinfo.goal, cts);
 			if (lp)
 				sym_update_dflags(np, &lp->current_flags, cts);
 		}
 		if (cts->type == CTS_TYPE_USER_SETTINGS) {
-			sym_update_trans(np, tp, &tp->tinfo.user, cts);
+			sym_update_trans(np, &tp->tinfo.user, cts);
 			if (lp)
 				sym_update_dflags(np, &lp->user_flags, cts);
 		}
@@ -8008,7 +8005,7 @@ static void sym_action2(struct cam_sim *
 	case XPT_GET_TRAN_SETTINGS:
 		cts = &ccb->cts;
 		tp = &np->target[ccb_h->target_id];
-		lp = sym_lp(np, tp, ccb_h->target_lun);
+		lp = sym_lp(tp, ccb_h->target_lun);
 
 #define	cts__scsi (&cts->proto_specific.scsi)
 #define	cts__spi  (&cts->xport_specific.spi)
@@ -8133,7 +8130,7 @@ static void sym_action2(struct cam_sim *
  *  Asynchronous notification handler.
  */
 static void
-sym_async(void *cb_arg, u32 code, struct cam_path *path, void *arg)
+sym_async(void *cb_arg, u32 code, struct cam_path *path, void *args __unused)
 {
 	hcb_p np;
 	struct cam_sim *sim;
@@ -8172,9 +8169,10 @@ sym_async(void *cb_arg, u32 code, struct
 /*
  *  Update transfer settings of a target.
  */
-static void sym_update_trans(hcb_p np, tcb_p tp, struct sym_trans *tip,
-			    struct ccb_trans_settings *cts)
+static void sym_update_trans(hcb_p np, struct sym_trans *tip,
+    struct ccb_trans_settings *cts)
 {
+
 	SYM_LOCK_ASSERT(MA_OWNED);
 
 	/*
@@ -8251,6 +8249,7 @@ static void sym_update_trans(hcb_p np, t
 static void
 sym_update_dflags(hcb_p np, u_char *flags, struct ccb_trans_settings *cts)
 {
+
 	SYM_LOCK_ASSERT(MA_OWNED);
 
 #define	cts__scsi (&cts->proto_specific.scsi)
@@ -8848,7 +8847,7 @@ static void sym_pci_free(hcb_p np)
 	for (target = 0; target < SYM_CONF_MAX_TARGET ; target++) {
 		tp = &np->target[target];
 		for (lun = 0 ; lun < SYM_CONF_MAX_LUN ; lun++) {
-			lp = sym_lp(np, tp, lun);
+			lp = sym_lp(tp, lun);
 			if (!lp)
 				continue;
 			if (lp->itlq_tbl)
@@ -8967,6 +8966,7 @@ fail:
  */
 static void sym_cam_free(hcb_p np)
 {
+
 	SYM_LOCK_ASSERT(MA_NOTOWNED);
 
 	if (np->intr) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306050107.r5517eIl059890>