6309084 gcc and wrsm don't get along
authormathue
Mon, 31 Oct 2005 16:06:29 -0800
changeset 795 422765778db0
parent 794 b3c8d1210809
child 796 e9b20e3531f8
6309084 gcc and wrsm don't get along
usr/src/cmd/wrsmstat/wrsmstat.c
usr/src/lib/libwrsmconf/libwrsmconf.c
usr/src/lib/wrsm/librsmwrsm.c
usr/src/uts/sun4u/io/wrsm/wrsm_cf.c
usr/src/uts/sun4u/io/wrsm/wrsm_driver.c
usr/src/uts/sun4u/io/wrsm/wrsm_getput.c
usr/src/uts/sun4u/io/wrsm/wrsm_intr.c
usr/src/uts/sun4u/io/wrsm/wrsm_lc.c
usr/src/uts/sun4u/io/wrsm/wrsm_mh.c
usr/src/uts/sun4u/io/wrsm/wrsm_nc.c
usr/src/uts/sun4u/io/wrsm/wrsm_nr.c
usr/src/uts/sun4u/sys/wrsm_memseg_impl.h
--- a/usr/src/cmd/wrsmstat/wrsmstat.c	Mon Oct 31 15:29:53 2005 -0800
+++ b/usr/src/cmd/wrsmstat/wrsmstat.c	Mon Oct 31 16:06:29 2005 -0800
@@ -20,8 +20,8 @@
  * CDDL HEADER END
  */
 /*
- * Copyright (c) 2001 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -154,7 +154,7 @@
 static boolean_t msg_test = B_FALSE;
 
 #define	NOT_FOUND	0xffffffff
-#define	NOT_FOUND64	0xffffffffffffffff
+#define	NOT_FOUND64	0xffffffffffffffffULL
 static uint32_t find_named(kstat_t *ksp, char *name);
 static uint64_t find_named64(kstat_t *ksp, char *name);
 static char *find_named_char(kstat_t *ksp, char *name);
--- a/usr/src/lib/libwrsmconf/libwrsmconf.c	Mon Oct 31 15:29:53 2005 -0800
+++ b/usr/src/lib/libwrsmconf/libwrsmconf.c	Mon Oct 31 16:06:29 2005 -0800
@@ -20,7 +20,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -125,11 +125,6 @@
 			DPRINTF(("ERROR: members[%d] is null\n", i));
 			return (EINVAL);
 		}
-		if (member->cnodeid >= WRSM_MAX_CNODES) {
-			DPRINTF(("ERROR: cnode id %d exceeds max of %d\n",
-			    member->cnodeid, WRSM_MAX_CNODES));
-			return (EINVAL);
-		}
 		if (WRSM_IN_SET(cnode_bitmask, member->cnodeid)) {
 			DPRINTF(("ERROR: cnode id %d appears twice\n",
 			    member->cnodeid));
--- a/usr/src/lib/wrsm/librsmwrsm.c	Mon Oct 31 15:29:53 2005 -0800
+++ b/usr/src/lib/wrsm/librsmwrsm.c	Mon Oct 31 16:06:29 2005 -0800
@@ -20,7 +20,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2001-2003 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -225,8 +225,8 @@
 
 	DEBUGP(PLUGIN_DEBUG, ("librsmwrsm: wrsmlib_align\n"));
 
-	addr = (void *)(((uint64_t)raw_msg + WRSMLIB_ALIGN) &
-	    ~WRSMLIB_CACHELINE_MASK);
+	addr = (void *)(((uintptr_t)raw_msg + (uintptr_t)WRSMLIB_ALIGN) &
+	    ~(uintptr_t)WRSMLIB_CACHELINE_MASK);
 
 	return (addr);
 
@@ -869,7 +869,7 @@
 	size_t len = (size_t)(sizeof (uint16_t) * rep_cnt);
 
 	/* Check for valid alignment */
-	if ((((uint64_t)datap & 0x1) != 0) ||
+	if ((((uintptr_t)datap & 0x1) != 0) ||
 	    (((uint64_t)offset & 0x1) != 0)) {
 		return (RSMERR_BAD_MEM_ALIGNMENT);
 	}
@@ -884,7 +884,7 @@
 	size_t len = (size_t)(sizeof (uint32_t) * rep_cnt);
 
 	/* Check for valid alignment */
-	if ((((uint64_t)datap & 0x3) != 0) ||
+	if ((((uintptr_t)datap & 0x3) != 0) ||
 	    (((uint64_t)offset & 0x3) != 0)) {
 		return (RSMERR_BAD_MEM_ALIGNMENT);
 	}
@@ -899,7 +899,7 @@
 	size_t len = (size_t)(sizeof (uint64_t) * rep_cnt);
 
 	/* Check for valid alignment */
-	if ((((uint64_t)datap & 0x7) != 0) ||
+	if ((((uintptr_t)datap & 0x7) != 0) ||
 	    (((uint64_t)offset & 0x7) != 0)) {
 		return (RSMERR_BAD_MEM_ALIGNMENT);
 	}
@@ -1003,7 +1003,7 @@
 		seg = RSMNDI_GET_MAPADDR(im_memseg, offset);
 		ASSERT(seg);
 
-		if (((uint64_t)dp & (uint64_t)WRSMLIB_CACHELINE_MASK)
+		if (((uintptr_t)dp & (uintptr_t)WRSMLIB_CACHELINE_MASK)
 		    == 0) {
 			/* aligned cacheline - this is to be fixed */
 			if (!importsegp->isloopback) {
@@ -1069,7 +1069,7 @@
 	size_t len = (size_t)(sizeof (uint16_t) * rep_cnt);
 
 	/* Check for valid alignment */
-	if ((((uint64_t)datap & 0x1) != 0) ||
+	if ((((uintptr_t)datap & 0x1) != 0) ||
 	    (((uint64_t)offset & 0x1) != 0)) {
 		return (RSMERR_BAD_MEM_ALIGNMENT);
 	}
@@ -1084,7 +1084,7 @@
 	size_t len = (size_t)(sizeof (uint32_t) * rep_cnt);
 
 	/* Check for valid alignment */
-	if ((((uint64_t)datap & 0x3) != 0) ||
+	if ((((uintptr_t)datap & 0x3) != 0) ||
 	    (((uint64_t)offset & 0x3) != 0)) {
 		return (RSMERR_BAD_MEM_ALIGNMENT);
 	}
@@ -1099,7 +1099,7 @@
 	size_t len = (size_t)(sizeof (uint64_t) * rep_cnt);
 
 	/* Check for valid alignment */
-	if ((((uint64_t)datap & 0x7) != 0) ||
+	if ((((uintptr_t)datap & 0x7) != 0) ||
 	    (((uint64_t)offset & 0x7) != 0)) {
 		return (RSMERR_BAD_MEM_ALIGNMENT);
 	}
--- a/usr/src/uts/sun4u/io/wrsm/wrsm_cf.c	Mon Oct 31 15:29:53 2005 -0800
+++ b/usr/src/uts/sun4u/io/wrsm/wrsm_cf.c	Mon Oct 31 16:06:29 2005 -0800
@@ -1693,12 +1693,6 @@
 	int err;
 	wrsm_net_member_t *member;
 
-	if (config->cnodeid < 0 || config->cnodeid >= WRSM_MAX_CNODES) {
-		cmn_err(CE_NOTE, "verify: illegal local cnodeid %d",
-		    config->cnodeid);
-		return (EINVAL);
-	}
-
 	/*
 	 * Verify that the local wnode is mentioned in the reachable
 	 * list and that it points to the local cnode
@@ -1757,14 +1751,6 @@
 			return (EINVAL);
 		}
 
-		/* Check that the remote cnodeid is valid */
-		if (member->cnodeid < 0 ||
-		    member->cnodeid >= WRSM_MAX_CNODES) {
-			cmn_err(CE_NOTE, "verify: illegal local cnodeid %d",
-			    member->cnodeid);
-			return (EINVAL);
-		}
-
 		/* Check that in and out driver comm offsets are unique */
 
 		for (j = 0; j < config->nmembers; ++j) {
@@ -2739,7 +2725,7 @@
 	int i;
 
 	*small_ncslicep = slice_array.id[0];
-	if (*small_ncslicep == 0 || *small_ncslicep >= WRSM_MAX_NCSLICES) {
+	if (*small_ncslicep == 0) {
 		return (EINVAL);
 	}
 
@@ -2754,9 +2740,6 @@
 		if (slice_array.id[i] == 0) {
 			continue;
 		}
-		if (slice_array.id[i] >= WRSM_MAX_NCSLICES) {
-			return (EINVAL);
-		}
 		if (!wrsm_large_pages_supported) {
 			cmn_err(CE_NOTE,
 			    "verify: large page ncslices not supported");
--- a/usr/src/uts/sun4u/io/wrsm/wrsm_driver.c	Mon Oct 31 15:29:53 2005 -0800
+++ b/usr/src/uts/sun4u/io/wrsm/wrsm_driver.c	Mon Oct 31 16:06:29 2005 -0800
@@ -20,7 +20,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -384,7 +384,7 @@
 		instance = minor_to_instance[minor];
 		if (instance == -1)
 			return (DDI_FAILURE);
-		*result = (void *) instance;
+		*result = (void *)(uintptr_t)instance;
 		return (DDI_SUCCESS);
 
 	default:
--- a/usr/src/uts/sun4u/io/wrsm/wrsm_getput.c	Mon Oct 31 15:29:53 2005 -0800
+++ b/usr/src/uts/sun4u/io/wrsm/wrsm_getput.c	Mon Oct 31 16:06:29 2005 -0800
@@ -20,7 +20,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -733,7 +733,7 @@
 		pluginmsg.remote_cnodeid = pluginmsg32.remote_cnodeid;
 		pluginmsg.offset = pluginmsg32.offset;
 
-		if (ddi_copyin((void *)pluginmsg32.buf, msg->putdata,
+		if (ddi_copyin((void *)(uintptr_t)pluginmsg32.buf, msg->putdata,
 		    pluginmsg32.len, mode)
 		    != 0) {
 			DPRINTF(DBG_SMPUT, (CE_WARN, "wrsm_smallput_plugin_"
--- a/usr/src/uts/sun4u/io/wrsm/wrsm_intr.c	Mon Oct 31 15:29:53 2005 -0800
+++ b/usr/src/uts/sun4u/io/wrsm/wrsm_intr.c	Mon Oct 31 16:06:29 2005 -0800
@@ -127,8 +127,9 @@
  * Macro RECVQ2MONDO extracts the mondo value from the aforementioned format.
  * Macro RECVQ_VALID tests to see if the item is indeed a valid recvq pointer.
  */
-#define	CAST_MONDO2RECVQ(mondo)	(wrsm_intr_recvq_t *)(((mondo) << 16) | 0x1)
-#define	CAST_RECVQ2MONDO(recvq)	(((uint_t)(recvq)) >> 16)
+#define	CAST_MONDO2RECVQ(mondo)	\
+	(wrsm_intr_recvq_t *)(uintptr_t)(((mondo) << 16) | 0x1)
+#define	CAST_RECVQ2MONDO(recvq)	(((uint_t)(uintptr_t)(recvq)) >> 16)
 #define	RECVQ_VALID(recvq)	((recvq) && (((uint64_t)(recvq)) & 0x1) == 0)
 
 /*
--- a/usr/src/uts/sun4u/io/wrsm/wrsm_lc.c	Mon Oct 31 15:29:53 2005 -0800
+++ b/usr/src/uts/sun4u/io/wrsm/wrsm_lc.c	Mon Oct 31 16:06:29 2005 -0800
@@ -20,7 +20,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -1270,7 +1270,7 @@
 	DPRINTF(LC_DEBUG, (CE_CONT, "in wrsm_lc_wciinit wci %d",
 	    softsp->portid));
 	ASSERT(softsp != NULL);
-	ASSERT(local_wnode < 16 && local_wnode >= 0);
+	ASSERT(local_wnode < 16);
 
 
 	softsp->restart_timeout_id = 0;
@@ -2830,7 +2830,7 @@
 				cmn_err(CE_NOTE, "wci %u link %d, "
 				    "wci_sw_link_error_count = %lu, "
 				    "wci_sw_link_error_sum = %lu, "
-				    "crc = %ld, framing = %ld, clocking = %ld",
+				    "crc = %d, framing = %d, clocking = %d",
 				    softsp->portid, i, num_errs,
 				    softsp->wci_common_softst.
 				    wci_sw_link_error_count_sum[i],
--- a/usr/src/uts/sun4u/io/wrsm/wrsm_mh.c	Mon Oct 31 15:29:53 2005 -0800
+++ b/usr/src/uts/sun4u/io/wrsm/wrsm_mh.c	Mon Oct 31 16:06:29 2005 -0800
@@ -20,8 +20,9 @@
  * CDDL HEADER END
  */
 /*
- * Copyright (c) 1999-2001 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+
  */
 
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -250,7 +251,7 @@
 
 	wci->mh_state->link_state[local_linknum] = mh_link_up;
 
-	ASSERT(remote_wnode >= 0 && remote_wnode < WRSM_MAX_WNODES);
+	ASSERT(remote_wnode < WRSM_MAX_WNODES);
 
 	/*
 	 * Use the one hop route if the current route uses more hops, or
--- a/usr/src/uts/sun4u/io/wrsm/wrsm_nc.c	Mon Oct 31 15:29:53 2005 -0800
+++ b/usr/src/uts/sun4u/io/wrsm/wrsm_nc.c	Mon Oct 31 16:06:29 2005 -0800
@@ -20,7 +20,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -122,7 +122,6 @@
 	 * used by the remote node.
 	 */
 	ASSERT(node->config->imported_ncslices.id[0]);
-	ASSERT(node->config->imported_ncslices.id[0] < WRSM_MAX_NCSLICES);
 	/*
 	 * Note:  no lock is needed because config operations are single
 	 * threaded, and only imported ncslices are managed during
@@ -143,7 +142,6 @@
 	for (i = 1; i < WRSM_NODE_NCSLICES; i++) {
 		id = node->config->imported_ncslices.id[i];
 		if (id != 0) {
-			ASSERT(id < WRSM_MAX_NCSLICES);
 			/*
 			 * Note:  no lock is needed because config
 			 * operations are single threaded, and only
--- a/usr/src/uts/sun4u/io/wrsm/wrsm_nr.c	Mon Oct 31 15:29:53 2005 -0800
+++ b/usr/src/uts/sun4u/io/wrsm/wrsm_nr.c	Mon Oct 31 16:06:29 2005 -0800
@@ -20,7 +20,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -6421,15 +6421,6 @@
 		wrsm_tl_dump_message("pt_ptlist_recv_hdlr: ", msg);
 #endif
 
-	if (cnodeid > WRSM_MAX_CNODES) {
-		/*
-		 * ignore message! can't send a response to a non-existent
-		 * node
-		 */
-		DPRINTF(DBG_ROUTE_EXTRA, (CE_CONT, "ctlr %d no node %d\n",
-		    network->rsm_ctlr_id, cnodeid));
-		return (B_FALSE);
-	}
 	node = network->nodes[cnodeid];
 
 	bcopy(&(msg->body), &args, sizeof (args));
--- a/usr/src/uts/sun4u/sys/wrsm_memseg_impl.h	Mon Oct 31 15:29:53 2005 -0800
+++ b/usr/src/uts/sun4u/sys/wrsm_memseg_impl.h	Mon Oct 31 16:06:29 2005 -0800
@@ -20,7 +20,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2001-2003 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -83,7 +83,7 @@
 #define	WRSM_PTR_HASH_MASK \
 	((WRSM_PTR_HASH_SIZE - 1) << WRSM_PTR_HASH_SHIFT)
 #define	WRSM_PTR_HASH_FUNC(r) \
-	((((uint_t)r) & WRSM_PTR_HASH_MASK) >> WRSM_PTR_HASH_SHIFT)
+	((((uint_t)(uintptr_t)r) & WRSM_PTR_HASH_MASK) >> WRSM_PTR_HASH_SHIFT)