[rtems commit] bsps/i386: Interrupt server support

Sebastian Huber sebh at rtems.org
Wed Sep 30 13:50:56 UTC 2015


Module:    rtems
Branch:    master
Commit:    f91fbbf4b8e6fbe70b792ee52521076f28e1da14
Changeset: http://git.rtems.org/rtems/commit/?id=f91fbbf4b8e6fbe70b792ee52521076f28e1da14

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Sep 30 15:30:09 2015 +0200

bsps/i386: Interrupt server support

---

 c/src/lib/libbsp/i386/pc386/startup/ldsegs.S |  8 ++++----
 c/src/lib/libbsp/i386/shared/irq/irq.c       |  3 +++
 c/src/lib/libbsp/i386/shared/irq/irq.h       | 14 +++++++++++++-
 c/src/lib/libbsp/i386/shared/irq/irq_asm.S   |  2 ++
 4 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S b/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S
index f527ff9..82ff982 100644
--- a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S
+++ b/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S
@@ -147,16 +147,16 @@ next_step:
 	outb	al, $0xA1
 	call	SYM(pc386_delay)
 
+	/*
+	 * The IMR values must correspond to the initial value of i8259s_cache.
+	 */
 	movb	$0xFF, al		/* mask off all interrupts for now  */
 	outb	al, $0xA1
 	call	SYM(pc386_delay)
 	movb	$0xFB, al		/* mask all irq's but irq2 which    */
 	outb	al, $0x21		/* is cascaded                      */
 	call	SYM(pc386_delay)
-
-	movw	$0xFFFB, SYM(i8259s_cache) /* set up same values in cache */
-
-  #endif
+#endif
 	jmp	SYM (_establish_stack)	# return to the bsp entry code
 
 /*-------------------------------------------------------------------------+
diff --git a/c/src/lib/libbsp/i386/shared/irq/irq.c b/c/src/lib/libbsp/i386/shared/irq/irq.c
index 415d0d0..95ab6ac 100644
--- a/c/src/lib/libbsp/i386/shared/irq/irq.c
+++ b/c/src/lib/libbsp/i386/shared/irq/irq.c
@@ -55,6 +55,7 @@ int      i;
  * This cache is initialized in ldseg.s
  */
 rtems_i8259_masks i8259s_cache = 0xFFFB;
+rtems_i8259_masks i8259s_super_imr = 0xFFFB;
 
 /*-------------------------------------------------------------------------+
 |         Function:  BSP_irq_disable_at_i8259s
@@ -77,6 +78,7 @@ int BSP_irq_disable_at_i8259s    (const rtems_irq_number irqLine)
 
   mask = 1 << irqLine;
   i8259s_cache |= mask;
+  i8259s_super_imr |= mask;
 
   if (irqLine < 8)
   {
@@ -112,6 +114,7 @@ int BSP_irq_enable_at_i8259s    (const rtems_irq_number irqLine)
 
   mask = ~(1 << irqLine);
   i8259s_cache &= mask;
+  i8259s_super_imr &= mask;
 
   if (irqLine < 8)
   {
diff --git a/c/src/lib/libbsp/i386/shared/irq/irq.h b/c/src/lib/libbsp/i386/shared/irq/irq.h
index 90cf71c..095af42 100644
--- a/c/src/lib/libbsp/i386/shared/irq/irq.h
+++ b/c/src/lib/libbsp/i386/shared/irq/irq.h
@@ -80,7 +80,19 @@ extern "C" {
  */
 typedef unsigned short rtems_i8259_masks;
 
-extern  rtems_i8259_masks i8259s_cache;
+/**
+ * @brief Contains the current IMR of both i8259s.
+ */
+extern rtems_i8259_masks i8259s_cache;
+
+/**
+ * @brief Contains the super IMR of both i8259s to overrule i8259s_cache during
+ * interrupt exit.
+ *
+ * This enables a bsp_interrupt_vector_disable() in interrupt handlers.  This
+ * is required for the interrupt server support used by the new network stack.
+ */
+extern rtems_i8259_masks i8259s_super_imr;
 
 /*-------------------------------------------------------------------------+
 | Function Prototypes.
diff --git a/c/src/lib/libbsp/i386/shared/irq/irq_asm.S b/c/src/lib/libbsp/i386/shared/irq/irq_asm.S
index 5ea84e5..d0ed9b6 100644
--- a/c/src/lib/libbsp/i386/shared/irq/irq_asm.S
+++ b/c/src/lib/libbsp/i386/shared/irq/irq_asm.S
@@ -214,7 +214,9 @@ nested:
 	cmp       ecx, 16               /* is this a PIC IRQ? */
 	jge       .dont_restore_i8259
 
+	movw      SYM (i8259s_super_imr), dx
 	movl      MSK_OFF(esp), eax
+	orw       dx, ax
 	movw      ax, SYM (i8259s_cache)
 	outb	  $PIC_MASTER_IMR_IO_PORT
 	movb	  ah, al




More information about the vc mailing list