xc_impl.h revision 8b9d661eebb0946e8334fdbe8813867ff6b7c838
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_XC_IMPL_H
#define _SYS_XC_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASM
#include <sys/cpu_module.h>
#ifdef TRAPTRACE
#endif /* TRAPTRACE */
extern uint64_t xc_func_time_limit;
extern uint_t sendmondo_in_recover;
/*
* Lightweight XTrap Sync
*/
#ifdef sun4v
#define XT_SYNC_ONE(cpuid) \
{ \
}
#define XT_SYNC_SOME(cpuset) \
{ \
}
#else /* sun4v */
#define XT_SYNC_ONE(cpuid) \
{ \
send_one_mondo(cpuid); \
}
#define XT_SYNC_SOME(cpuset) \
{ \
send_mondo_set(cpuset); \
}
#endif /* sun4v */
/*
* Protect the dispatching of the mondo vector
*/
{ \
cpuid); \
}
{ \
xc_spl_enter[cpuid] = 0; \
}
/*
* set up a x-call request
*/
{ \
}
/*
* set up x-call requests to the cpuset
*/
{ \
int pix; \
membar_stld(); \
if (CPUSET_ISNULL(tmpset)) \
break; \
} \
} \
}
/*
* set up and notify a x-call request to the cpuset
*/
{ \
int pix; \
if (CPUSET_ISNULL(tmpset)) \
break; \
} \
} \
membar_stld(); \
}
/*
* set up and notify a x-call request, signalling xc_cpuset
* cpus to enter xc_loop()
*/
#define SEND_MBOX_MONDO_XC_ENTER(xc_cpuset) \
{ \
int pix; \
XC_IDLE); \
if (CPUSET_ISNULL(tmpset)) { \
break; \
} \
} \
} \
}
/*
* wait x-call requests to be completed
*/
{ \
int pix; \
int first_time = 1; \
} \
} \
if (CPUSET_ISNULL(tmpset)) \
break; \
} \
if (loop_cnt++ > xc_func_time_limit) { \
if (sendmondo_in_recover) { \
drv_usecwait(1); \
loop_cnt = 0; \
continue; \
} \
if (sync && first_time) { \
first_time = 0; \
loop_cnt = 0; \
continue; \
} \
panic("WAIT_MBOX_DONE() timeout, " \
"recv_cpuset 0x%lx, xc cpuset 0x%lx ", \
*(ulong_t *)&recv_cpuset, \
} \
} \
}
/*
* xc_state flags
*/
enum xc_states {
XC_IDLE = 0, /* not in the xc_loop(); set by xc_loop */
XC_ENTER, /* entering xc_loop(); set by xc_attention */
XC_WAIT, /* entered xc_loop(); set by xc_loop */
XC_DOIT, /* xcall request; set by xc_one, xc_some, or xc_all */
XC_EXIT /* exiting xc_loop(); set by xc_dismissed */
};
/*
* user provided handlers must be pc aligned
*/
#define PC_ALIGN 4
#ifdef TRAPTRACE
#else /* !TRAPTRACE */
#endif /* TRAPTRACE */
/*
*/
#define XC_STAT_INC(a) (a)++;
#define XC_CPUID 0
#define XT_ONE_SELF 1
#define XT_ONE_OTHER 2
#define XT_SOME_SELF 3
#define XT_SOME_OTHER 4
#define XT_ALL_SELF 5
#define XT_ALL_OTHER 6
#define XC_ONE_SELF 7
#define XC_ONE_OTHER 8
#define XC_ONE_OTHER_H 9
#define XC_SOME_SELF 10
#define XC_SOME_OTHER 11
#define XC_SOME_OTHER_H 12
#define XC_ALL_SELF 13
#define XC_ALL_OTHER 14
#define XC_ALL_OTHER_H 15
#define XC_ATTENTION 16
#define XC_DISMISSED 17
#define XC_LOOP_ENTER 18
#define XC_LOOP_DOIT 19
#define XC_LOOP_EXIT 20
#define XC_LOOP 1
#define XC_SERV 2
#define XC_STAT_INIT(cpuid) \
{ \
}
#else /* DEBUG || TRAPTRACE */
#define XC_STAT_INIT(cpuid)
#define XC_STAT_INC(a)
#define XC_ATTENTION_CPUSET(x)
#define XC_DISMISSED_CPUSET(x)
#endif /* DEBUG || TRAPTRACE */
#endif /* !_ASM */
/*
* Maximum delay in milliseconds to wait for send_mondo to complete
*/
#define XC_SEND_MONDO_MSEC 1000
#ifdef __cplusplus
}
#endif
#endif /* _SYS_XC_IMPL_H */