From 29809d2f1e8c02ea2b0ede0ef698eeadae085716 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Thu, 13 Aug 2009 13:24:49 +0000 Subject: Make the i386 APIC code closer to the amd64 version. Many whitespace fixes, some additional code. ok toby@, oga@ --- sys/arch/i386/include/cpufunc.h | 5 ++++- sys/arch/i386/include/i82093var.h | 4 ++-- sys/arch/i386/include/intr.h | 4 +++- sys/arch/i386/include/pic.h | 43 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 sys/arch/i386/include/pic.h (limited to 'sys/arch/i386/include') diff --git a/sys/arch/i386/include/cpufunc.h b/sys/arch/i386/include/cpufunc.h index 7813ce64ad6..cd66ef4dde4 100644 --- a/sys/arch/i386/include/cpufunc.h +++ b/sys/arch/i386/include/cpufunc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc.h,v 1.14 2007/11/28 17:05:09 tedu Exp $ */ +/* $OpenBSD: cpufunc.h,v 1.15 2009/08/13 13:24:48 kettenis Exp $ */ /* $NetBSD: cpufunc.h,v 1.8 1994/10/27 04:15:59 cgd Exp $ */ /* @@ -269,6 +269,9 @@ breakpoint(void) __asm __volatile("int $3"); } +#define read_psl() read_eflags() +#define write_psl(x) write_eflags(x) + void amd64_errata(struct cpu_info *); #endif /* _KERNEL */ diff --git a/sys/arch/i386/include/i82093var.h b/sys/arch/i386/include/i82093var.h index 4bd7659fb95..42b2d72a39b 100644 --- a/sys/arch/i386/include/i82093var.h +++ b/sys/arch/i386/include/i82093var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i82093var.h,v 1.7 2008/10/05 16:57:36 kettenis Exp $ */ +/* $OpenBSD: i82093var.h,v 1.8 2009/08/13 13:24:48 kettenis Exp $ */ /* $NetBSD: i82093var.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */ /*- @@ -49,7 +49,7 @@ struct ioapic_pin }; struct ioapic_softc { - struct device sc_dev; /* generic device glue */ + struct pic sc_pic; struct ioapic_softc *sc_next; int sc_apicid; int sc_apic_vers; diff --git a/sys/arch/i386/include/intr.h b/sys/arch/i386/include/intr.h index fd5f02fa4af..bfba600f8de 100644 --- a/sys/arch/i386/include/intr.h +++ b/sys/arch/i386/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.38 2009/04/19 17:50:18 oga Exp $ */ +/* $OpenBSD: intr.h,v 1.39 2009/08/13 13:24:48 kettenis Exp $ */ /* $NetBSD: intr.h,v 1.5 1996/05/13 06:11:28 mycroft Exp $ */ /* @@ -129,6 +129,8 @@ void splassert_check(int, const char *); #define setsoftnet() softintr(SIR_NET) #define setsofttty() softintr(SIR_TTY) +#include + struct cpu_info; #ifdef MULTIPROCESSOR diff --git a/sys/arch/i386/include/pic.h b/sys/arch/i386/include/pic.h new file mode 100644 index 00000000000..ce95cc48e45 --- /dev/null +++ b/sys/arch/i386/include/pic.h @@ -0,0 +1,43 @@ +/* $OpenBSD: pic.h,v 1.1 2009/08/13 13:24:48 kettenis Exp $ */ +/* $NetBSD: pic.h,v 1.1 2003/02/26 21:26:11 fvdl Exp $ */ + +#ifndef _X86_PIC_H +#define _X86_PIC_H + +#include +#include +#include + +struct cpu_info; + +/* + * Structure common to all PIC softcs + */ +struct pic { + struct device pic_dev; + int pic_type; +#ifdef MULTIPROCESSOR + struct mutex pic_mutex; +#endif + void (*pic_hwmask)(struct pic *, int); + void (*pic_hwunmask)(struct pic *, int); + void (*pic_addroute)(struct pic *, struct cpu_info *, int, int, int); + void (*pic_delroute)(struct pic *, struct cpu_info *, int, int, int); + struct intrstub *pic_level_stubs; + struct intrstub *pic_edge_stubs; +}; + +#define pic_name pic_dev.dv_xname + +/* + * PIC types. + */ +#define PIC_I8259 0 +#define PIC_IOAPIC 1 +#define PIC_LAPIC 2 +#define PIC_SOFT 3 + +extern struct pic i8259_pic; +extern struct pic local_pic; +extern struct pic softintr_pic; +#endif -- cgit v1.2.3