--- old/usr/src/uts/i86pc/apix/Makefile	Thu Sep  7 15:25:31 2017
+++ new/usr/src/uts/i86pc/apix/Makefile	Thu Sep  7 15:25:31 2017
@@ -63,9 +63,6 @@
 #
 LDFLAGS		+= -dy -N misc/acpica
 
-CERRWARN	+= -_gcc=-Wno-uninitialized
-CERRWARN	+= -_gcc=-Wno-unused-function
-
 #
 #	Default build targets.
 #
--- old/usr/src/uts/i86pc/io/apix/apix.c	Thu Sep  7 15:25:31 2017
+++ new/usr/src/uts/i86pc/io/apix/apix.c	Thu Sep  7 15:25:31 2017
@@ -1606,8 +1606,8 @@
 	ddi_acc_handle_t handle;
 	ddi_intr_msix_t *msix_p = NULL;
 	ushort_t msix_ctrl;
-	uintptr_t off;
-	uint32_t mask;
+	uintptr_t off = 0;
+	uint32_t mask = 0;
 
 	ASSERT(LOCK_HELD(&apix_lock));
 	*result = ENXIO;
@@ -1665,8 +1665,8 @@
 	apix_vector_t *newp, *vp;
 	uint32_t orig_cpu = vecp->v_cpuid;
 	int orig_vect = vecp->v_vector;
-	int i, num_vectors, cap_ptr, msi_mask_off;
-	uint32_t msi_pvm;
+	int i, num_vectors, cap_ptr, msi_mask_off = 0;
+	uint32_t msi_pvm = 0;
 	ushort_t msi_ctrl;
 	ddi_acc_handle_t handle;
 	dev_info_t *dip;
--- old/usr/src/uts/i86pc/io/mp_platform_common.c	Thu Sep  7 15:25:32 2017
+++ new/usr/src/uts/i86pc/io/mp_platform_common.c	Thu Sep  7 15:25:32 2017
@@ -22,6 +22,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2016 Nexenta Systems, Inc.
  * Copyright (c) 2017 by Delphix. All rights reserved.
+ * Copyright 2017 Joyent, Inc.
  */
 /*
  * Copyright (c) 2010, Intel Corporation.
@@ -330,9 +331,9 @@
 {
 	uint32_t mpct_addr, ebda_start = 0, base_mem_end;
 	caddr_t	biosdatap;
-	caddr_t	mpct = 0;
+	caddr_t	mpct = NULL;
 	caddr_t	fptr;
-	int	i, mpct_size, mapsize, retval = PSM_FAILURE;
+	int	i, mpct_size = 0, mapsize, retval = PSM_FAILURE;
 	ushort_t	ebda_seg, base_mem_size;
 	struct	apic_mpfps_hdr	*fpsp;
 	struct	apic_mp_cnf_hdr	*hdrp;
--- old/usr/src/uts/i86pc/io/mp_platform_misc.c	Thu Sep  7 15:25:32 2017
+++ new/usr/src/uts/i86pc/io/mp_platform_misc.c	Thu Sep  7 15:25:32 2017
@@ -20,6 +20,7 @@
  */
 /*
  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2017 Joyent, Inc.
  */
 /*
  * Copyright (c) 2010, Intel Corporation.
@@ -644,7 +645,7 @@
 			ASSERT(hwpri >= 0);
 			ASSERT(hwpri < MAXIPL);
 			max_ipl = apic_vectortoipl[hwpri];
-			apic_ipls[apic_ipls_index] = max_ipl;
+			apic_ipls[apic_ipls_index] = (uchar_t)max_ipl;
 
 			irqp = irqheadptr;
 			while (irqp) {
@@ -945,7 +946,7 @@
  */
 static int
 apic_share_vector(int irqno, iflag_t *intr_flagp, short intr_index, int ipl,
-	uchar_t ioapicindex, uchar_t ipin, apic_irq_t **irqptrp)
+    uchar_t ioapicindex, uchar_t ipin, apic_irq_t **irqptrp)
 {
 #ifdef DEBUG
 	apic_irq_t *tmpirqp = NULL;
@@ -1050,8 +1051,8 @@
 apic_setup_irq_table(dev_info_t *dip, int irqno, struct apic_io_intr *intrp,
     struct intrspec *ispec, iflag_t *intr_flagp, int type)
 {
-	int origirq = ispec->intrspec_vec;
-	uchar_t ipl = ispec->intrspec_pri;
+	int origirq;
+	uchar_t ipl;
 	int	newirq, intr_index;
 	uchar_t	ipin, ioapic, ioapicindex, vector;
 	apic_irq_t *irqptr;
@@ -1058,11 +1059,14 @@
 	major_t	major;
 	dev_info_t	*sdip;
 
+	ASSERT(ispec != NULL);
+
+	origirq = ispec->intrspec_vec;
+	ipl = ispec->intrspec_pri;
+
 	DDI_INTR_IMPLDBG((CE_CONT, "apic_setup_irq_table: dip=0x%p type=%d "
 	    "irqno=0x%x origirq=0x%x\n", (void *)dip, type, irqno, origirq));
 
-	ASSERT(ispec != NULL);
-
 	major =  (dip != NULL) ? ddi_driver_major(dip) : 0;
 
 	if (DDI_INTR_IS_MSI_OR_MSIX(type)) {
@@ -1121,10 +1125,7 @@
 		intr_index = DEFAULT_INDEX;
 	}
 
-	if (ispec == NULL) {
-		APIC_VERBOSE_IOAPIC((CE_WARN, "No intrspec for irqno = %x\n",
-		    irqno));
-	} else if ((vector = apic_allocate_vector(ipl, irqno, 0)) == 0) {
+	if ((vector = apic_allocate_vector(ipl, irqno, 0)) == 0) {
 		if ((newirq = apic_share_vector(irqno, intr_flagp, intr_index,
 		    ipl, ioapicindex, ipin, &irqptr)) != -1) {
 			irqptr->airq_ipl = ipl;
@@ -1228,61 +1229,68 @@
 	if (apic_nproc == 1)
 		return (0);
 
-	drv_name = NULL;
-	rc = DDI_PROP_NOT_FOUND;
-	major = (major_t)-1;
-	if (dip != NULL) {
-		name = ddi_get_name(dip);
-		major = ddi_name_to_major(name);
-		drv_name = ddi_major_to_name(major);
-		instance = ddi_get_instance(dip);
-		if (apic_intr_policy == INTR_ROUND_ROBIN_WITH_AFFINITY) {
-			i = apic_min_device_irq;
-			for (; i <= apic_max_device_irq; i++) {
+	if (dip == NULL) {
+		iflag = intr_clear();
+		lock_set(&apic_ioapic_lock);
+		bind_cpu = apic_get_next_bind_cpu();
+		lock_clear(&apic_ioapic_lock);
+		intr_restore(iflag);
 
-				if ((i == irq) || (apic_irq_table[i] == NULL) ||
-				    (apic_irq_table[i]->airq_mps_intr_index
-				    == FREE_INDEX))
-					continue;
+		cmn_err(CE_CONT, "!%s: irq 0x%x "
+		    "vector 0x%x ioapic 0x%x intin 0x%x is bound to cpu %d\n",
+		    psm_name, irq, apic_irq_table[irq]->airq_vector, ioapicid,
+		    intin, bind_cpu & ~IRQ_USER_BOUND);
 
-				if ((apic_irq_table[i]->airq_major == major) &&
-				    (!(apic_irq_table[i]->airq_cpu &
-				    IRQ_USER_BOUND))) {
+		return ((uint32_t)bind_cpu);
+	}
 
-					cpu = apic_irq_table[i]->airq_cpu;
+	name = ddi_get_name(dip);
+	major = ddi_name_to_major(name);
+	drv_name = ddi_major_to_name(major);
+	instance = ddi_get_instance(dip);
+	if (apic_intr_policy == INTR_ROUND_ROBIN_WITH_AFFINITY) {
+		i = apic_min_device_irq;
+		for (; i <= apic_max_device_irq; i++) {
+			if ((i == irq) || (apic_irq_table[i] == NULL) ||
+			    (apic_irq_table[i]->airq_mps_intr_index
+			    == FREE_INDEX))
+				continue;
 
-					cmn_err(CE_CONT,
-					    "!%s: %s (%s) instance #%d "
-					    "irq 0x%x vector 0x%x ioapic 0x%x "
-					    "intin 0x%x is bound to cpu %d\n",
-					    psm_name,
-					    name, drv_name, instance, irq,
-					    apic_irq_table[irq]->airq_vector,
-					    ioapicid, intin, cpu);
-					return (cpu);
-				}
+			if ((apic_irq_table[i]->airq_major == major) &&
+			    (!(apic_irq_table[i]->airq_cpu & IRQ_USER_BOUND))) {
+				cpu = apic_irq_table[i]->airq_cpu;
+
+				cmn_err(CE_CONT,
+				    "!%s: %s (%s) instance #%d "
+				    "irq 0x%x vector 0x%x ioapic 0x%x "
+				    "intin 0x%x is bound to cpu %d\n",
+				    psm_name,
+				    name, drv_name, instance, irq,
+				    apic_irq_table[irq]->airq_vector,
+				    ioapicid, intin, cpu);
+				return (cpu);
 			}
 		}
-		/*
-		 * search for "drvname"_intpt_bind_cpus property first, the
-		 * syntax of the property should be "a[,b,c,...]" where
-		 * instance 0 binds to cpu a, instance 1 binds to cpu b,
-		 * instance 3 binds to cpu c...
-		 * ddi_getlongprop() will search /option first, then /
-		 * if "drvname"_intpt_bind_cpus doesn't exist, then find
-		 * intpt_bind_cpus property.  The syntax is the same, and
-		 * it applies to all the devices if its "drvname" specific
-		 * property doesn't exist
-		 */
-		(void) strcpy(prop_name, drv_name);
-		(void) strcat(prop_name, "_intpt_bind_cpus");
-		rc = ddi_getlongprop(DDI_DEV_T_ANY, dip, 0, prop_name,
-		    (caddr_t)&prop_val, &prop_len);
-		if (rc != DDI_PROP_SUCCESS) {
-			rc = ddi_getlongprop(DDI_DEV_T_ANY, dip, 0,
-			    "intpt_bind_cpus", (caddr_t)&prop_val, &prop_len);
-		}
 	}
+	/*
+	 * search for "drvname"_intpt_bind_cpus property first, the
+	 * syntax of the property should be "a[,b,c,...]" where
+	 * instance 0 binds to cpu a, instance 1 binds to cpu b,
+	 * instance 3 binds to cpu c...
+	 * ddi_getlongprop() will search /option first, then /
+	 * if "drvname"_intpt_bind_cpus doesn't exist, then find
+	 * intpt_bind_cpus property.  The syntax is the same, and
+	 * it applies to all the devices if its "drvname" specific
+	 * property doesn't exist
+	 */
+	(void) strcpy(prop_name, drv_name);
+	(void) strcat(prop_name, "_intpt_bind_cpus");
+	rc = ddi_getlongprop(DDI_DEV_T_ANY, dip, 0, prop_name,
+	    (caddr_t)&prop_val, &prop_len);
+	if (rc != DDI_PROP_SUCCESS) {
+		rc = ddi_getlongprop(DDI_DEV_T_ANY, dip, 0,
+		    "intpt_bind_cpus", (caddr_t)&prop_val, &prop_len);
+	}
 	if (rc == DDI_PROP_SUCCESS) {
 		for (i = count = 0; i < (prop_len - 1); i++)
 			if (prop_val[i] == ',')
@@ -1317,6 +1325,7 @@
 		 * not up, then post_cpu_start will handle it.
 		 */
 	}
+
 	if (rc != DDI_PROP_SUCCESS) {
 		iflag = intr_clear();
 		lock_set(&apic_ioapic_lock);
@@ -1325,17 +1334,11 @@
 		intr_restore(iflag);
 	}
 
-	if (drv_name != NULL)
-		cmn_err(CE_CONT, "!%s: %s (%s) instance %d irq 0x%x "
-		    "vector 0x%x ioapic 0x%x intin 0x%x is bound to cpu %d\n",
-		    psm_name, name, drv_name, instance, irq,
-		    apic_irq_table[irq]->airq_vector, ioapicid, intin,
-		    bind_cpu & ~IRQ_USER_BOUND);
-	else
-		cmn_err(CE_CONT, "!%s: irq 0x%x "
-		    "vector 0x%x ioapic 0x%x intin 0x%x is bound to cpu %d\n",
-		    psm_name, irq, apic_irq_table[irq]->airq_vector, ioapicid,
-		    intin, bind_cpu & ~IRQ_USER_BOUND);
+	cmn_err(CE_CONT, "!%s: %s (%s) instance %d irq 0x%x "
+	    "vector 0x%x ioapic 0x%x intin 0x%x is bound to cpu %d\n",
+	    psm_name, name, drv_name, instance, irq,
+	    apic_irq_table[irq]->airq_vector, ioapicid, intin,
+	    bind_cpu & ~IRQ_USER_BOUND);
 
 	return ((uint32_t)bind_cpu);
 }
--- old/usr/src/uts/i86pc/io/pcplusmp/apic.c	Thu Sep  7 15:25:32 2017
+++ new/usr/src/uts/i86pc/io/pcplusmp/apic.c	Thu Sep  7 15:25:32 2017
@@ -108,6 +108,8 @@
 static int		apic_get_ipivect(int ipl, int type);
 static void	apic_post_cyclic_setup(void *arg);
 
+#define	UCHAR_MAX	UINT8_MAX
+
 /*
  * The following vector assignments influence the value of ipltopri and
  * vectortoipl. Note that vectors 0 - 0x1f are not used. We can program
@@ -1068,7 +1070,7 @@
 {
 	int	rcount, i;
 	uchar_t	start, irqno;
-	uint32_t cpu;
+	uint32_t cpu = 0;
 	major_t	major;
 	apic_irq_t	*irqptr;
 
@@ -1140,7 +1142,8 @@
 		irqptr->airq_vector = (uchar_t)(start + i);
 		irqptr->airq_ioapicindex = (uchar_t)inum;	/* start */
 		irqptr->airq_intin_no = (uchar_t)rcount;
-		irqptr->airq_ipl = pri;
+		ASSERT(pri >= 0 && pri <= UCHAR_MAX);
+		irqptr->airq_ipl = (uchar_t)pri;
 		irqptr->airq_vector = start + i;
 		irqptr->airq_origirq = (uchar_t)(inum + i);
 		irqptr->airq_share_id = 0;
@@ -1217,7 +1220,8 @@
 		apic_min_device_irq = min(irqno, apic_min_device_irq);
 		irqptr = apic_irq_table[irqno];
 		irqptr->airq_vector = (uchar_t)vector;
-		irqptr->airq_ipl = pri;
+		ASSERT(pri >= 0 && pri <= UCHAR_MAX);
+		irqptr->airq_ipl = (uchar_t)pri;
 		irqptr->airq_origirq = (uchar_t)(inum + i);
 		irqptr->airq_share_id = 0;
 		irqptr->airq_mps_intr_index = MSIX_INDEX;
@@ -1259,7 +1263,8 @@
 			continue;
 		if (apic_vector_to_irq[i] == APIC_RESV_IRQ) {
 			apic_vector_to_irq[i] = (uchar_t)irq;
-			return (i);
+			ASSERT(i >= 0 && i <= UCHAR_MAX);
+			return ((uchar_t)i);
 		}
 	}
 
--- old/usr/src/uts/i86pc/io/pcplusmp/apic_common.c	Thu Sep  7 15:25:32 2017
+++ new/usr/src/uts/i86pc/io/pcplusmp/apic_common.c	Thu Sep  7 15:25:32 2017
@@ -848,7 +848,7 @@
 	int i, rv = 0;
 	ulong_t iflag;
 	boolean_t first = B_TRUE;
-	uchar_t localver;
+	uchar_t localver = 0;
 	uint32_t localid, procid;
 	processorid_t cpuid = (processorid_t)-1;
 	mach_cpu_add_arg_t *ap;
--- old/usr/src/uts/i86pc/io/pcplusmp/apic_introp.c	Thu Sep  7 15:25:32 2017
+++ new/usr/src/uts/i86pc/io/pcplusmp/apic_introp.c	Thu Sep  7 15:25:32 2017
@@ -21,6 +21,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2013 Pluribus Networks, Inc.
+ * Copyright 2017 Joyent, Inc.
  */
 
 /*
@@ -41,6 +42,8 @@
 #include <sys/pci_intr_lib.h>
 #include <sys/apic_common.h>
 
+#define	UCHAR_MAX	UINT8_MAX
+
 extern struct av_head autovect[];
 
 /*
@@ -226,8 +229,10 @@
 			if (APIC_CHECK_RESERVE_VECTORS(i))
 				break;
 			navail++;
-			if (navail >= count)
-				return (start);
+			if (navail >= count) {
+				ASSERT(start >= 0 && start <= UCHAR_MAX);
+				return ((uchar_t)start);
+			}
 			i++;
 		}
 	}
@@ -505,9 +510,9 @@
 	apic_irq_t *irqps[PCI_MSI_MAX_INTRS];
 	int i;
 	int cap_ptr;
-	int msi_mask_off;
+	int msi_mask_off = 0;
 	ushort_t msi_ctrl;
-	uint32_t msi_pvm;
+	uint32_t msi_pvm = 0;
 	ddi_acc_handle_t handle;
 	int num_vectors = 0;
 	uint32_t vector;
@@ -641,7 +646,7 @@
 {
 	struct autovec *av_dev;
 	uchar_t irqno;
-	int i;
+	uint i;
 	apic_irq_t *irq_p;
 
 	/* Sanity check the vector/irq argument. */
@@ -657,7 +662,7 @@
 	    PSMGI_INTRBY_VEC)
 		irqno = apic_vector_to_irq[vecirq];
 	else
-		irqno = vecirq;
+		irqno = (uchar_t)vecirq;
 
 	irq_p = apic_irq_table[irqno];
 
@@ -700,7 +705,7 @@
 				if (av_dev->av_vector && av_dev->av_dip)
 					i++;
 			intr_params_p->avgi_num_devs =
-			    MIN(intr_params_p->avgi_num_devs, i);
+			    (uchar_t)MIN(intr_params_p->avgi_num_devs, i);
 		}
 
 		/* There are no viable dips to return. */
--- old/usr/src/uts/i86pc/pcplusmp/Makefile	Thu Sep  7 15:25:33 2017
+++ new/usr/src/uts/i86pc/pcplusmp/Makefile	Thu Sep  7 15:25:33 2017
@@ -24,7 +24,7 @@
 # Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# Copyright 2016, Joyent, Inc.
+# Copyright 2017, Joyent, Inc.
 #
 
 #
@@ -67,21 +67,7 @@
 #
 LDFLAGS		+= -dy -N misc/acpica
 
-CERRWARN	+= -_gcc=-Wno-unused-function
-
 #
-# For now, disable these lint checks; maintainers should endeavor
-# to investigate and remove these for maximum lint coverage.
-# Please do not carry these forward to new Makefiles.
-#
-LINTTAGS	+= -erroff=E_BAD_PTR_CAST_ALIGN
-LINTTAGS	+= -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
-LINTTAGS	+= -erroff=E_STATIC_UNUSED
-LINTTAGS	+= -erroff=E_ASSIGN_NARROW_CONV
-
-CERRWARN	+= -_gcc=-Wno-uninitialized
-
-#
 #	Default build targets.
 #
 .KEEP_STATE:
--- old/usr/src/uts/i86pc/sys/apix.h	Thu Sep  7 15:25:33 2017
+++ new/usr/src/uts/i86pc/sys/apix.h	Thu Sep  7 15:25:33 2017
@@ -20,6 +20,7 @@
  */
 /*
  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2017 Joyent, Inc.
  */
 
 #ifndef __SYS_APIX_APIX_H
@@ -287,11 +288,12 @@
 
 #define	APIX_DO_FAKE_INTR(_cpu, _vector)\
 	if (APIX_IS_FAKE_INTR(_vector)) {\
-		struct autovec *tp;\
+		struct autovec *tp = NULL;\
 		if ((_cpu) == apix_rebindinfo.i_old_cpuid)\
 			tp = apix_rebindinfo.i_old_av;\
 		else if ((_cpu) == apix_rebindinfo.i_new_cpuid)\
 			tp = apix_rebindinfo.i_new_av;\
+		ASSERT(tp != NULL);\
 		if (tp->av_vector != NULL &&\
 		    (tp->av_flags & AV_PENTRY_PEND) == 0) {\
 			tp->av_flags |= AV_PENTRY_PEND;\
