aboutsummaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2019-11-10 16:27:42 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-11-10 16:28:50 +0100
commit1d34167488e56e36ad702627b17be7ac18a9db9c (patch)
tree9f107a4647490b81793e6548d0e0da444f742584 /linux
parent09c207eb2e7dd63d51c1f5e2abccf2562e6fd87e (diff)
downloadgnumach-1d34167488e56e36ad702627b17be7ac18a9db9c.tar.gz
gnumach-1d34167488e56e36ad702627b17be7ac18a9db9c.tar.bz2
gnumach-1d34167488e56e36ad702627b17be7ac18a9db9c.zip
simplify interrupt handling
We have removed spl levels, now remove the machinery to manage different PIC masks according to levels. Only keep machinery to disable interrupts whatever the level. * i386/i386/pic.c (pic_mask): Remove array. (picinit): Do not form PIC mask. Set initial PIC mask to 0. (form_pic_mask): Remove function. * i386/i386/pic.h (form_pic_mask, pic_mask): Remove declarations. * i386/i386/spl.S (SETMASK): Remove macro. (XEN_SETMASK): Add macro, containing the Xen version of SETMASK. (spl0, splx_cli, spl) [MACH_XEN]: Call XEN_SETMASK instead of SETMASK. * i386/i386/pit.c (clkstart): Do not call form_pic_mask. * i386/i386at/autoconf.c (take_dev_irq, take_ctlr_irq): Likewise. * i386/i386at/kd_mouse.c (kd_mouse_open, kd_mouse_close): Likewise. * linux/dev/arch/i386/kernel/irq.c (mask_irq, unmask_irq): Directly update curr_pic_mask without using pic_mask array. (init_IRQ, restore_IRQ): do not call form_pic_mask. * linux/dev/include/asm-i386/system.h: Include <i386/ipl.h>. (__save_flags, __restore_flags): Use curr_ipl and splx instead of hardware flags. * linux/dev/init/main.c (linux_init): Do not call cli. * linux/dev/kernel/sched.c (linux_timer_intr): Do not use pic_mask. * linux/src/drivers/block/ide.c (try_to_identify): Disable irq probing. * linux/src/drivers/scsi/NCR53c406a.c (NCR53c406a_detect): Disable irq probing.
Diffstat (limited to 'linux')
-rw-r--r--linux/dev/arch/i386/kernel/irq.c26
-rw-r--r--linux/dev/include/asm-i386/system.h8
-rw-r--r--linux/dev/init/main.c1
-rw-r--r--linux/dev/kernel/sched.c2
-rw-r--r--linux/src/drivers/block/ide.c2
-rw-r--r--linux/src/drivers/scsi/NCR53c406a.c2
6 files changed, 18 insertions, 23 deletions
diff --git a/linux/dev/arch/i386/kernel/irq.c b/linux/dev/arch/i386/kernel/irq.c
index a02e9582..596dae6b 100644
--- a/linux/dev/arch/i386/kernel/irq.c
+++ b/linux/dev/arch/i386/kernel/irq.c
@@ -128,18 +128,15 @@ linux_intr (int irq)
static inline void
mask_irq (unsigned int irq_nr)
{
- int i;
-
- for (i = 0; i < intpri[irq_nr]; i++)
- pic_mask[i] |= 1 << irq_nr;
+ int new_pic_mask = curr_pic_mask | 1 << irq_nr;
- if (curr_pic_mask != pic_mask[curr_ipl])
+ if (curr_pic_mask != new_pic_mask)
{
- curr_pic_mask = pic_mask[curr_ipl];
+ curr_pic_mask = new_pic_mask;
if (irq_nr < 8)
- outb (curr_pic_mask & 0xff, PIC_MASTER_OCW);
+ outb (curr_pic_mask & 0xff, PIC_MASTER_OCW);
else
- outb (curr_pic_mask >> 8, PIC_SLAVE_OCW);
+ outb (curr_pic_mask >> 8, PIC_SLAVE_OCW);
}
}
@@ -149,18 +146,18 @@ mask_irq (unsigned int irq_nr)
static inline void
unmask_irq (unsigned int irq_nr)
{
- int mask, i;
+ int mask;
+ int new_pic_mask;
mask = 1 << irq_nr;
if (irq_nr >= 8)
mask |= 1 << 2;
- for (i = 0; i < intpri[irq_nr]; i++)
- pic_mask[i] &= ~mask;
+ new_pic_mask = curr_pic_mask & ~mask;
- if (curr_pic_mask != pic_mask[curr_ipl])
+ if (curr_pic_mask != new_pic_mask)
{
- curr_pic_mask = pic_mask[curr_ipl];
+ curr_pic_mask = new_pic_mask;
if (irq_nr < 8)
outb (curr_pic_mask & 0xff, PIC_MASTER_OCW);
else
@@ -737,8 +734,6 @@ init_IRQ (void)
}
}
- form_pic_mask ();
-
/*
* Enable interrupts.
*/
@@ -777,6 +772,5 @@ restore_IRQ (void)
*/
ivect[0] = old_clock_handler;
intpri[0] = old_clock_pri;
- form_pic_mask ();
}
diff --git a/linux/dev/include/asm-i386/system.h b/linux/dev/include/asm-i386/system.h
index f26a33e7..41eb65a4 100644
--- a/linux/dev/include/asm-i386/system.h
+++ b/linux/dev/include/asm-i386/system.h
@@ -1,6 +1,8 @@
#ifndef __ASM_SYSTEM_H
#define __ASM_SYSTEM_H
+#include <i386/ipl.h> /* curr_ipl, splx */
+
#include <asm/segment.h>
/*
@@ -223,10 +225,8 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
#define mb() __asm__ __volatile__ ("" : : :"memory")
#define __sti() __asm__ __volatile__ ("sti": : :"memory")
#define __cli() __asm__ __volatile__ ("cli": : :"memory")
-#define __save_flags(x) \
-__asm__ __volatile__("pushf ; pop %0" : "=r" (x): /* no input */ :"memory")
-#define __restore_flags(x) \
-__asm__ __volatile__("push %0 ; popf": /* no output */ :"g" (x):"memory")
+#define __save_flags(x) (x = ((curr_ipl > 0) ? 0 : (1 << 9)))
+#define __restore_flags(x) splx((x & (1 << 9)) ? 0 : 7)
#ifdef __SMP__
diff --git a/linux/dev/init/main.c b/linux/dev/init/main.c
index 3740c12c..6d853957 100644
--- a/linux/dev/init/main.c
+++ b/linux/dev/init/main.c
@@ -151,7 +151,6 @@ linux_init (void)
linux_net_emulation_init ();
#endif
- cli ();
device_setup ();
#ifdef CONFIG_PCMCIA
diff --git a/linux/dev/kernel/sched.c b/linux/dev/kernel/sched.c
index 87906a45..2a9eeb3f 100644
--- a/linux/dev/kernel/sched.c
+++ b/linux/dev/kernel/sched.c
@@ -622,6 +622,6 @@ linux_timer_intr (void)
mark_bh (TQUEUE_BH);
#if 0
if (linux_timer_print)
- printf ("linux_timer_intr: pic_mask[0] %x\n", pic_mask[0]);
+ printf ("linux_timer_intr: hello\n");
#endif
}
diff --git a/linux/src/drivers/block/ide.c b/linux/src/drivers/block/ide.c
index 43b12f1f..170e4e13 100644
--- a/linux/src/drivers/block/ide.c
+++ b/linux/src/drivers/block/ide.c
@@ -2703,6 +2703,8 @@ static int try_to_identify (ide_drive_t *drive, byte cmd)
int irq_off;
if (!HWIF(drive)->irq) { /* already got an IRQ? */
+ printk("%s: Not probing legacy IRQs)\n", drive->name);
+ return 2;
probe_irq_off(probe_irq_on()); /* clear dangling irqs */
irqs_on = probe_irq_on(); /* start monitoring irqs */
OUT_BYTE(drive->ctl,IDE_CONTROL_REG); /* enable device irq */
diff --git a/linux/src/drivers/scsi/NCR53c406a.c b/linux/src/drivers/scsi/NCR53c406a.c
index 9f2de9a0..7745f5ad 100644
--- a/linux/src/drivers/scsi/NCR53c406a.c
+++ b/linux/src/drivers/scsi/NCR53c406a.c
@@ -525,7 +525,7 @@ NCR53c406a_detect(Scsi_Host_Template * tpnt){
#ifndef IRQ_LEV
if (irq_level < 0) { /* LILO override if >= 0*/
- irq_level=irq_probe();
+ irq_level = -1; // XXX No probing irq_probe();
if (irq_level < 0) { /* Trouble */
printk("NCR53c406a: IRQ problem, irq_level=%d, giving up\n", irq_level);
return 0;