xref: /netbsd-src/sys/arch/x86/include/pic.h (revision c24c993fe4cf289234b8ce9b47d92eb1278cfbda)
1 /*	$NetBSD: pic.h,v 1.10 2020/04/25 15:26:18 bouyer Exp $	*/
2 
3 #ifndef _X86_PIC_H
4 #define _X86_PIC_H
5 
6 struct cpu_info;
7 
8 /*
9  * Structure common to all PIC softcs
10  */
11 struct pic {
12 	const char *pic_name;
13 	int pic_type;
14 	int pic_vecbase;
15 	int pic_apicid;
16 	__cpu_simple_lock_t pic_lock;
17 	void (*pic_hwmask)(struct pic *, int);
18 	void (*pic_hwunmask)(struct pic *, int);
19 	void (*pic_addroute)(struct pic *, struct cpu_info *, int, int, int);
20 	void (*pic_delroute)(struct pic *, struct cpu_info *, int, int, int);
21 	bool (*pic_trymask)(struct pic *, int);
22 	struct intrstub *pic_level_stubs;
23 	struct intrstub *pic_edge_stubs;
24 	struct ioapic_softc *pic_ioapic; /* if pic_type == PIC_IOAPIC */
25 	struct msipic *pic_msipic; /* if (pic_type == PIC_MSI) || (pic_type == PIC_MSIX) */
26 	/* interface for subr_interrupt.c */
27 	void (*pic_intr_get_devname)(const char *, char *, size_t);
28 	void (*pic_intr_get_assigned)(const char *, kcpuset_t *);
29 	uint64_t (*pic_intr_get_count)(const char *, u_int);
30 };
31 
32 /*
33  * PIC types.
34  */
35 #define PIC_I8259	0
36 #define PIC_IOAPIC	1
37 #define PIC_LAPIC	2
38 #define PIC_MSI		3
39 #define PIC_MSIX	4
40 #define PIC_SOFT	5
41 #define PIC_XEN		6
42 
43 extern struct pic i8259_pic;
44 extern struct pic local_pic;
45 extern struct pic softintr_pic;
46 extern struct pic xen_pic;
47 #endif
48