xpv_psm.c revision 0bc46f0d82f5e2ab983b9daff3aa7c9abb447ff2
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck * CDDL HEADER START
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck * The contents of this file are subject to the terms of the
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck * Common Development and Distribution License (the "License").
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck * You may not use this file except in compliance with the License.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck * See the License for the specific language governing permissions
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck * and limitations under the License.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck * When distributing Covered Code, include this CDDL HEADER in each
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck * If applicable, add the following below this CDDL HEADER, with the
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck * fields enclosed by brackets "[]" replaced with your own identifying
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck * information: Portions Copyright [yyyy] [name of copyright owner]
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck * CDDL HEADER END
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck * Use is subject to license terms.
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskey * Global Data
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskey/* As of now we don't support x2apic in xVM */
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskeyvolatile uint32_t *apicadr = NULL; /* dummy, so common code will link */
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeckuchar_t apic_vectortoipl[APIC_AVAIL_VECTOR / APIC_VECTOR_PER_IPL] = {
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskeyint xen_psm_intr_policy = INTR_ROUND_ROBIN_WITH_AFFINITY;
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck/* use to make sure only one cpu handles the nmi */
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeckint xen_psm_kmdb_on_nmi = 0; /* 0 - no, 1 - yes enter kmdb */
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeckint xen_psm_next_bind_cpu; /* next cpu to bind an interrupt to */
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskey/* flag definitions for xen_psm_verbose */
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskey#define XEN_PSM_VERBOSE_POWEROFF_FLAG 0x00000002
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskey#define XEN_PSM_VERBOSE_POWEROFF_PAUSE_FLAG 0x00000004
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskey if (xen_psm_verbose & XEN_PSM_VERBOSE_IRQ_FLAG) \
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskey if (xen_psm_verbose & XEN_PSM_VERBOSE_POWEROFF_FLAG) \
static void xen_psm_setspl(int);
int behavior);
int behavior);
int bind_cpu;
return (bind_cpu);
bind_cpu = 0;
goto done;
bind_cpu = 0;
done:
return (bind_cpu);
xen_psm_probe(void)
return (ret);
xen_psm_softinit(void)
extern int dosynctodr;
dosynctodr = 0;
return (XEN_NSEC_PER_TICK);
xen_psm_hrtimeinit(void)
extern int gethrtime_hires;
} else if (xen_psm_panic_on_nmi) {
if (apic_imcrp) {
return (ret);
int cpuid;
return (err);
return (err);
static processorid_t
return (id);
int ret;
return (ret);
return (xen_clock_irq);
return (xen_clock_irq);
switch (cmd) {
case A_SHUTDOWN:
switch (fcn) {
case AD_BOOT:
case AD_IBOOT:
case AD_POWEROFF:
if (apic_enable_acpi)
(void) acpi_poweroff();
case AD_HALT:
case A_REBOOT:
return (irqno);
return (irqno);
int newipl;
if (newipl == 0) {
return (newipl);
psm_intr_exit_fn(void)
return (xen_psm_intr_exit);
if (pending) {
int cap;
int err;
int new_priority;
switch (intr_op) {
case PSM_INTR_OP_CHECK_MSI:
if (xen_support_msi == 0) {
case PSM_INTR_OP_FREE_VECTORS:
case PSM_INTR_OP_XLATE_VECTOR:
case PSM_INTR_OP_GET_PENDING:
case PSM_INTR_OP_CLEAR_MASK:
return (PSM_FAILURE);
case PSM_INTR_OP_SET_MASK:
return (PSM_FAILURE);
case PSM_INTR_OP_GET_CAP:
case PSM_INTR_OP_GET_SHARED:
return (PSM_FAILURE);
== NULL)
return (PSM_FAILURE);
return (PSM_FAILURE);
case PSM_INTR_OP_SET_PRI:
if (err != 0)
return (PSM_FAILURE);
case PSM_INTR_OP_GET_INTR:
return (PSM_FAILURE);
return (PSM_FAILURE);
case PSM_INTR_OP_SET_CAP:
return (PSM_FAILURE);
return (PSM_SUCCESS);
int irq;
if (cpun == 0)
return (PSM_FAILURE);
return (PSM_SUCCESS);
int irq;
if (cpun == 0)
return (PSM_SUCCESS);
* xpv_timestamp.c).
xen_psm_timer_enable(void)
xen_psm_timer_disable(void)
int rc;
return (vector);
count = 0;
(i < highest)) {
count++;
return (navail);
static int mdev_cnt;
for (i = 0; i < mdev_cnt; i++) {
if (rc < 0) {
if (i == mdev_size) {
mdev_cnt++;
return (irq);
static uchar_t
return (vector);
int reglen;
int behavior)
apic_multi_msi_enable == 0)
if (apic_multi_msi_enable == 0)
for (i = 0; i < rcount; i++) {
if (rc < 0) {
if (irqno < 0) {
#ifdef DEBUG
return (rcount);
int behavior)
rcount = 0;
goto out;
for (i = 0; i < rcount; i++) {
int irqno;
if (rc < 0) {
if (irqno < 0) {
out:
return (rcount);
static apic_irq_t *
return (irqp);
return (NULL);
int i, rc;
for (i = 0; i < count; i++) {
if (rc < 0) {
uint32_t *
return (xen_psm_dummy_apic);
uint32_t *
apic_ret()
if (deferred) {
if (rv) {
cpu = 0;
if (rv == 0) {
return (rv);
static void *xen_psm_hdlp;
_init(void)
_fini(void)