3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24
25 #ifndef __SYS_APIX_APIX_H
26 #define __SYS_APIX_APIX_H
27
28 #include <sys/note.h>
29 #include <sys/avintr.h>
30 #include <sys/traptrace.h>
31 #include <sys/apic.h>
32 #include <sys/apic_common.h>
33 #include <sys/apic_timer.h>
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 #ifdef DEBUG
40 #ifndef TRAPTRACE
41 #define TRAPTRACE
42 #endif
270 extern struct apix_rebind_info apix_rebindinfo;
271
272 #define APIX_SET_REBIND_INFO(_ovp, _nvp)\
273 if (((_ovp)->v_flags & APIX_VECT_MASKABLE) == 0) {\
274 apix_rebindinfo.i_pri = (_ovp)->v_pri;\
275 apix_rebindinfo.i_old_cpuid = (_ovp)->v_cpuid;\
276 apix_rebindinfo.i_old_av = (_ovp)->v_autovect;\
277 apix_rebindinfo.i_new_cpuid = (_nvp)->v_cpuid;\
278 apix_rebindinfo.i_new_av = (_nvp)->v_autovect;\
279 apix_rebindinfo.i_go = 1;\
280 }
281
282 #define APIX_CLR_REBIND_INFO() \
283 apix_rebindinfo.i_go = 0
284
285 #define APIX_IS_FAKE_INTR(_vector)\
286 (apix_rebindinfo.i_go && (_vector) == APIX_RESV_VECTOR)
287
288 #define APIX_DO_FAKE_INTR(_cpu, _vector)\
289 if (APIX_IS_FAKE_INTR(_vector)) {\
290 struct autovec *tp;\
291 if ((_cpu) == apix_rebindinfo.i_old_cpuid)\
292 tp = apix_rebindinfo.i_old_av;\
293 else if ((_cpu) == apix_rebindinfo.i_new_cpuid)\
294 tp = apix_rebindinfo.i_new_av;\
295 if (tp->av_vector != NULL &&\
296 (tp->av_flags & AV_PENTRY_PEND) == 0) {\
297 tp->av_flags |= AV_PENTRY_PEND;\
298 apix_insert_pending_av(apixs[(_cpu)], tp,\
299 tp->av_prilevel);\
300 apixs[(_cpu)]->x_intr_pending |=\
301 (1 << tp->av_prilevel);\
302 }\
303 }
304
305 extern int apix_add_avintr(void *intr_id, int ipl, avfunc xxintr, char *name,
306 int vector, caddr_t arg1, caddr_t arg2, uint64_t *ticksp, dev_info_t *dip);
307 extern void apix_rem_avintr(void *intr_id, int ipl, avfunc xxintr,
308 int virt_vect);
309
310 extern uint32_t apix_bind_cpu_locked(dev_info_t *dip);
311 extern apix_vector_t *apix_rebind(apix_vector_t *vecp, processorid_t tocpu,
312 int count);
313
314 extern uchar_t apix_alloc_ipi(int ipl);
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2017 Joyent, Inc.
24 */
25
26 #ifndef __SYS_APIX_APIX_H
27 #define __SYS_APIX_APIX_H
28
29 #include <sys/note.h>
30 #include <sys/avintr.h>
31 #include <sys/traptrace.h>
32 #include <sys/apic.h>
33 #include <sys/apic_common.h>
34 #include <sys/apic_timer.h>
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 #ifdef DEBUG
41 #ifndef TRAPTRACE
42 #define TRAPTRACE
43 #endif
271 extern struct apix_rebind_info apix_rebindinfo;
272
273 #define APIX_SET_REBIND_INFO(_ovp, _nvp)\
274 if (((_ovp)->v_flags & APIX_VECT_MASKABLE) == 0) {\
275 apix_rebindinfo.i_pri = (_ovp)->v_pri;\
276 apix_rebindinfo.i_old_cpuid = (_ovp)->v_cpuid;\
277 apix_rebindinfo.i_old_av = (_ovp)->v_autovect;\
278 apix_rebindinfo.i_new_cpuid = (_nvp)->v_cpuid;\
279 apix_rebindinfo.i_new_av = (_nvp)->v_autovect;\
280 apix_rebindinfo.i_go = 1;\
281 }
282
283 #define APIX_CLR_REBIND_INFO() \
284 apix_rebindinfo.i_go = 0
285
286 #define APIX_IS_FAKE_INTR(_vector)\
287 (apix_rebindinfo.i_go && (_vector) == APIX_RESV_VECTOR)
288
289 #define APIX_DO_FAKE_INTR(_cpu, _vector)\
290 if (APIX_IS_FAKE_INTR(_vector)) {\
291 struct autovec *tp = NULL;\
292 if ((_cpu) == apix_rebindinfo.i_old_cpuid)\
293 tp = apix_rebindinfo.i_old_av;\
294 else if ((_cpu) == apix_rebindinfo.i_new_cpuid)\
295 tp = apix_rebindinfo.i_new_av;\
296 ASSERT(tp != NULL);\
297 if (tp->av_vector != NULL &&\
298 (tp->av_flags & AV_PENTRY_PEND) == 0) {\
299 tp->av_flags |= AV_PENTRY_PEND;\
300 apix_insert_pending_av(apixs[(_cpu)], tp,\
301 tp->av_prilevel);\
302 apixs[(_cpu)]->x_intr_pending |=\
303 (1 << tp->av_prilevel);\
304 }\
305 }
306
307 extern int apix_add_avintr(void *intr_id, int ipl, avfunc xxintr, char *name,
308 int vector, caddr_t arg1, caddr_t arg2, uint64_t *ticksp, dev_info_t *dip);
309 extern void apix_rem_avintr(void *intr_id, int ipl, avfunc xxintr,
310 int virt_vect);
311
312 extern uint32_t apix_bind_cpu_locked(dev_info_t *dip);
313 extern apix_vector_t *apix_rebind(apix_vector_t *vecp, processorid_t tocpu,
314 int count);
315
316 extern uchar_t apix_alloc_ipi(int ipl);
|