Print this page
8626 make pcplusmp and apix warning-free
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
*** 19,28 ****
--- 19,29 ----
* CDDL HEADER END
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2013 Pluribus Networks, Inc.
+ * Copyright 2017 Joyent, Inc.
*/
/*
* apic_introp.c:
* Has code for Advanced DDI interrupt framework support.
*** 39,48 ****
--- 40,51 ----
#include <sys/trap.h>
#include <sys/pci.h>
#include <sys/pci_intr_lib.h>
#include <sys/apic_common.h>
+ #define UCHAR_MAX UINT8_MAX
+
extern struct av_head autovect[];
/*
* Local Function Prototypes
*/
*** 224,235 ****
while ((apic_vector_to_irq[i] == APIC_RESV_IRQ) &&
(i <= highest)) {
if (APIC_CHECK_RESERVE_VECTORS(i))
break;
navail++;
! if (navail >= count)
! return (start);
i++;
}
}
return (0);
}
--- 227,240 ----
while ((apic_vector_to_irq[i] == APIC_RESV_IRQ) &&
(i <= highest)) {
if (APIC_CHECK_RESERVE_VECTORS(i))
break;
navail++;
! if (navail >= count) {
! ASSERT(start >= 0 && start <= UCHAR_MAX);
! return ((uchar_t)start);
! }
i++;
}
}
return (0);
}
*** 503,515 ****
uint32_t orig_cpu;
ulong_t iflag;
apic_irq_t *irqps[PCI_MSI_MAX_INTRS];
int i;
int cap_ptr;
! int msi_mask_off;
ushort_t msi_ctrl;
! uint32_t msi_pvm;
ddi_acc_handle_t handle;
int num_vectors = 0;
uint32_t vector;
DDI_INTR_IMPLDBG((CE_CONT, "APIC_GRP_SET_CPU\n"));
--- 508,520 ----
uint32_t orig_cpu;
ulong_t iflag;
apic_irq_t *irqps[PCI_MSI_MAX_INTRS];
int i;
int cap_ptr;
! int msi_mask_off = 0;
ushort_t msi_ctrl;
! uint32_t msi_pvm = 0;
ddi_acc_handle_t handle;
int num_vectors = 0;
uint32_t vector;
DDI_INTR_IMPLDBG((CE_CONT, "APIC_GRP_SET_CPU\n"));
*** 639,649 ****
int
apic_get_vector_intr_info(int vecirq, apic_get_intr_t *intr_params_p)
{
struct autovec *av_dev;
uchar_t irqno;
! int i;
apic_irq_t *irq_p;
/* Sanity check the vector/irq argument. */
ASSERT((vecirq >= 0) || (vecirq <= APIC_MAX_VECTOR));
--- 644,654 ----
int
apic_get_vector_intr_info(int vecirq, apic_get_intr_t *intr_params_p)
{
struct autovec *av_dev;
uchar_t irqno;
! uint i;
apic_irq_t *irq_p;
/* Sanity check the vector/irq argument. */
ASSERT((vecirq >= 0) || (vecirq <= APIC_MAX_VECTOR));
*** 655,665 ****
*/
if ((intr_params_p->avgi_req_flags & PSMGI_INTRBY_FLAGS) ==
PSMGI_INTRBY_VEC)
irqno = apic_vector_to_irq[vecirq];
else
! irqno = vecirq;
irq_p = apic_irq_table[irqno];
if ((irq_p == NULL) ||
((irq_p->airq_mps_intr_index != RESERVE_INDEX) &&
--- 660,670 ----
*/
if ((intr_params_p->avgi_req_flags & PSMGI_INTRBY_FLAGS) ==
PSMGI_INTRBY_VEC)
irqno = apic_vector_to_irq[vecirq];
else
! irqno = (uchar_t)vecirq;
irq_p = apic_irq_table[irqno];
if ((irq_p == NULL) ||
((irq_p->airq_mps_intr_index != RESERVE_INDEX) &&
*** 698,708 ****
for (i = 0, av_dev = autovect[irqno].avh_link;
av_dev; av_dev = av_dev->av_link)
if (av_dev->av_vector && av_dev->av_dip)
i++;
intr_params_p->avgi_num_devs =
! MIN(intr_params_p->avgi_num_devs, i);
}
/* There are no viable dips to return. */
if (intr_params_p->avgi_num_devs == 0)
intr_params_p->avgi_dip_list = NULL;
--- 703,713 ----
for (i = 0, av_dev = autovect[irqno].avh_link;
av_dev; av_dev = av_dev->av_link)
if (av_dev->av_vector && av_dev->av_dip)
i++;
intr_params_p->avgi_num_devs =
! (uchar_t)MIN(intr_params_p->avgi_num_devs, i);
}
/* There are no viable dips to return. */
if (intr_params_p->avgi_num_devs == 0)
intr_params_p->avgi_dip_list = NULL;