summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-06-03 15:46:59 +0200
committerRichard Braun <rbraun@sceen.net>2017-06-03 15:46:59 +0200
commitab6aa05afffdbc9c5a0969f37d0b989549de1a9a (patch)
treea9f8aa1522a0be9de6d4f766b3a9b5d8360c57a6
parent3325ff8fec93d7b2fa2f8359aff8de51b406d552 (diff)
x86/pic: new pic_setup_disabled function
This function is meant to initialize the legacy PIC in a disabled state, for use in APIC systems where legacy hardware is still present.
-rw-r--r--arch/x86/machine/pic.c19
-rw-r--r--arch/x86/machine/pic.h13
2 files changed, 28 insertions, 4 deletions
diff --git a/arch/x86/machine/pic.c b/arch/x86/machine/pic.c
index 52f9461a..ab30ac20 100644
--- a/arch/x86/machine/pic.c
+++ b/arch/x86/machine/pic.c
@@ -16,6 +16,7 @@
*/
#include <assert.h>
+#include <stdbool.h>
#include <stdint.h>
#include <kern/error.h>
@@ -198,8 +199,8 @@ pic_spurious_intr(void *arg)
return 0;
}
-void __init
-pic_setup(void)
+static void __init
+pic_setup_common(bool register_ctl)
{
int error;
@@ -227,7 +228,7 @@ pic_setup(void)
io_write_byte(PIC_MASTER_IMR, pic_master_mask);
io_write_byte(PIC_SLAVE_IMR, pic_slave_mask);
- if (lapic_unused()) {
+ if (register_ctl) {
pic_register();
}
@@ -241,3 +242,15 @@ pic_setup(void)
&pic_slave_spurious_intr);
error_check(error, __func__);
}
+
+void __init
+pic_setup(void)
+{
+ pic_setup_common(true);
+}
+
+void __init
+pic_setup_disabled(void)
+{
+ pic_setup_common(false);
+}
diff --git a/arch/x86/machine/pic.h b/arch/x86/machine/pic.h
index 9da75b74..e49d336e 100644
--- a/arch/x86/machine/pic.h
+++ b/arch/x86/machine/pic.h
@@ -21,8 +21,19 @@
#include <machine/trap.h>
/*
- * Set up the pic module.
+ * Initialize the pic module.
*/
void pic_setup(void);
+/*
+ * Initialize the pic module in an APIC system.
+ *
+ * This function is called by the acpi module if ACPI reports the presence
+ * of legacy interrupt controllers.
+ *
+ * Since it doesn't register the legacy PIC as an interrupt controller, the
+ * acpi module must have registered I/O APICs before calling this function.
+ */
+void pic_setup_disabled(void);
+
#endif /* _X86_PIC_H */