Ignore:
Timestamp:
Oct 12, 2016, 7:40:41 AM (4 years ago)
Author:
Pavel Pisa <pisa@…>
Branches:
master
Children:
20625a5
Parents:
f45ddeea
git-author:
Pavel Pisa <pisa@…> (10/12/16 07:40:41)
git-committer:
Pavel Pisa <pisa@…> (10/17/16 07:41:58)
Message:

bsps/i386: replace global interrupt disable by SMP build supporting locking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/shared/irq/irq.c

    rf45ddeea r6b54dcb  
    2323
    2424#include "elcr.h"
     25
     26RTEMS_INTERRUPT_LOCK_DEFINE( static, rtems_i8259_access_lock, "rtems_i8259_access_lock" );
    2527
    2628/*
     
    131133{
    132134  unsigned short        mask;
    133   rtems_interrupt_level level;
    134 
    135   rtems_interrupt_disable(level);
     135  rtems_interrupt_lock_context lock_context;
     136
     137  rtems_interrupt_lock_acquire(&rtems_i8259_access_lock, &lock_context);
    136138
    137139  mask = 1 << irqLine;
     
    147149  }
    148150
    149   rtems_interrupt_enable(level);
     151  rtems_interrupt_lock_release(&rtems_i8259_access_lock, &lock_context);
    150152
    151153  return 0;
     
    162164{
    163165  unsigned short        mask;
    164   rtems_interrupt_level level;
     166  rtems_interrupt_lock_context lock_context;
    165167  uint8_t               isr;
    166168  uint8_t               irr;
    167169
    168   rtems_interrupt_disable(level);
     170  rtems_interrupt_lock_acquire(&rtems_i8259_access_lock, &lock_context);
    169171
    170172  mask = 1 << irqLine;
     
    187189    printk("i386: isr=%x irr=%x\n", isr, irr);
    188190
    189   rtems_interrupt_enable(level);
     191  rtems_interrupt_lock_release(&rtems_i8259_access_lock, &lock_context);
    190192
    191193  return 0;
     
    240242static void compute_i8259_masks_from_prio (void)
    241243{
    242   rtems_interrupt_level level;
     244  rtems_interrupt_lock_context lock_context;
    243245  unsigned int i;
    244246  unsigned int j;
    245247
    246   rtems_interrupt_disable(level);
     248  rtems_interrupt_lock_acquire(&rtems_i8259_access_lock, &lock_context);
    247249
    248250  /*
     
    261263  }
    262264
    263   rtems_interrupt_enable(level);
     265  rtems_interrupt_lock_release(&rtems_i8259_access_lock, &lock_context);
    264266}
    265267
     
    315317void BSP_dispatch_isr(int vector)
    316318{
     319  rtems_interrupt_lock_context lock_context;
    317320  rtems_i8259_masks in_progress_save = 0;
    318321
     
    322325     */
    323326    if (vector <= BSP_IRQ_MAX_ON_i8259A) {
     327
     328      rtems_interrupt_lock_acquire_isr(&rtems_i8259_access_lock, &lock_context);
     329
    324330      /*
    325331       * See if this is a spurious interrupt.
     
    336342          if ((isr & (1 << 7)) == 0) {
    337343            ++spurious_count;
     344            rtems_interrupt_lock_release_isr(&rtems_i8259_access_lock, &lock_context);
    338345            return;
    339346          }
     
    356363       */
    357364      BSP_irq_ack_at_i8259a(vector);
     365
     366      rtems_interrupt_lock_release_isr(&rtems_i8259_access_lock, &lock_context);
    358367    }
    359368
     
    379388
    380389    if (vector <= BSP_IRQ_MAX_ON_i8259A) {
     390
     391      rtems_interrupt_lock_acquire_isr(&rtems_i8259_access_lock, &lock_context);
     392
    381393      /*
    382394       * Put the mask back but keep this vector masked if the trigger type is
     
    389401        BSP_i8259a_irq_update_slave_imr();
    390402      }
     403
     404      rtems_interrupt_lock_release_isr(&rtems_i8259_access_lock, &lock_context);
    391405    }
    392406  }
Note: See TracChangeset for help on using the changeset viewer.