xref: /illumos-gate/usr/src/cmd/mdb/i86pc/modules/common/intr_common.h (revision eb9a1df2aeb866bf1de4494433b6d7e5fa07b3ae)
1 /*
2  * CDDL HEADER START
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) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
23  * Copyright 2018 Joyent, Inc.
24  */
25 
26 #ifndef _MDB_INTR_COMMON_H
27 #define	_MDB_INTR_COMMON_H
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #include <stddef.h>
34 #include <sys/mdb_modapi.h>
35 #include <mdb/mdb_ks.h>
36 #include <sys/modctl.h>
37 #include <sys/avintr.h>
38 #include <sys/psm_common.h>
39 #include <sys/pic.h>
40 #include <sys/apic.h>
41 #include <sys/apix.h>
42 
43 /*
44  * Function prototypes
45  */
46 void interrupt_help(void);
47 void interrupt_print_isr(uintptr_t, uintptr_t, uintptr_t);
48 void apic_interrupt_dump(apic_irq_t *, struct av_head *, int i,
49 	ushort_t *, char);
50 void apix_interrupt_dump(apix_vector_t *, apic_irq_t *,
51     struct autovec *, ushort_t *, char);
52 void apix_interrupt_ipi_dump(apix_vector_t *, struct autovec *,
53     ushort_t *);
54 int ioapic(uintptr_t, uint_t, int, const mdb_arg_t *);
55 int apic(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv);
56 
57 void soft_interrupt_help(void);
58 int soft_interrupt_dump(uintptr_t, uint_t, int, const mdb_arg_t *);
59 
60 /*
61  * ::interrupts usage related defines and variables
62  * -d and -i options are supported and saved in option_flags
63  */
64 #define	INTR_DISPLAY_DRVR_INST	0x1	/* -d option */
65 #define	INTR_DISPLAY_INTRSTAT	0x2	/* -i option */
66 
67 extern int	option_flags;
68 
69 #define	BUSTYPE_PCI	0x0d
70 #define	BUSTYPE_NONE	0x00
71 
72 /*
73  * gld_intr_addr is used to save address of gld_intr() ISR
74  */
75 extern uintptr_t	gld_intr_addr;
76 
77 /* cached the PIR ipi vector to differentiate it from poke_cpu */
78 extern int	apic_pir_vect;
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif	/* _MDB_INTR_COMMON_H */
85