source: rtems/bsps/powerpc/psim/irq/irq_init.c @ 54d87f2

5
Last change on this file since 54d87f2 was 8f8ccee, checked in by Sebastian Huber <sebastian.huber@…>, on 04/23/18 at 07:50:39

bsps: Move interrupt controller support to bsps

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[ba9c4a7]1/*
[270ce1ff]2 *  This file contains the implementation of rtems initialization
[ba9c4a7]3 *  related to interrupt handling
4 */
5
6/*
7 *  Copyright (C) 1999 valette@crf.canon.fr
[270ce1ff]8 *
[ba9c4a7]9 *  Enhanced by Jay Kulpinski <jskulpin@eng01.gdds.com>
10 *  to make it valid for MVME2300 Motorola boards.
[270ce1ff]11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
[c499856]14 *  http://www.rtems.org/license/LICENSE.
[270ce1ff]15 */
16
17#include <libcpu/io.h>
18#include <libcpu/spr.h>
19#include <bsp/irq.h>
20#include <bsp.h>
[b094233]21#include <psim.h>
[2d2de4eb]22#include <bsp/vectors.h>
[270ce1ff]23#include <rtems/bspIo.h>
[b094233]24#include <bsp/openpic.h>
[ba9c4a7]25#include <bsp/irq-generic.h>
[270ce1ff]26
[9e602b0]27static rtems_irq_connect_data      rtemsIrq[BSP_IRQ_NUMBER];
28static rtems_irq_global_settings   initial_config;
29static rtems_irq_connect_data      defaultIrq = {
[4243433]30  /* vectorIdex, hdl  , handle  , on  , off , isOn */
31      0,          NULL, NULL    , NULL, NULL, NULL
[270ce1ff]32};
33static rtems_irq_prio irqPrioTable[BSP_IRQ_NUMBER]={
34  /*
35   * Processor exceptions handled as interrupts
36   */
37  0
38};
39
40  /*
41   * This code assumes the exceptions management setup has already
42   * been done. We just need to replace the exceptions that will
43   * be handled like interrupt. On mcp750/mpc750 and many PPC processors
44   * this means the decrementer exception and the external exception.
45   */
46void BSP_rtems_irq_mng_init(unsigned cpuId)
47{
48  int i;
[ac7af4a]49
[270ce1ff]50  /*
51   * First initialize the Interrupt management hardware
52   */
[b094233]53  OpenPIC = (void*)PSIM.OpenPIC;
54  openpic_init(1,0,0,16,0,0);
[270ce1ff]55
56  /*
57   * Initialize Rtems management interrupt table
58   */
[9e602b0]59  /*
60   * re-init the rtemsIrq table
61   */
62  for (i = 0; i < BSP_IRQ_NUMBER; i++) {
63    rtemsIrq[i]      = defaultIrq;
64    rtemsIrq[i].name = i;
65  }
66  /*
67   * Init initial Interrupt management config
68   */
69  initial_config.irqNb        = BSP_IRQ_NUMBER;
70  initial_config.defaultEntry = defaultIrq;
71  initial_config.irqHdlTbl    = rtemsIrq;
72  initial_config.irqBase      = BSP_LOWEST_OFFSET;
73  initial_config.irqPrioTbl   = irqPrioTable;
74
[b094233]75  for (i = BSP_PCI_IRQ_LOWEST_OFFSET; i< BSP_PCI_IRQ_NUMBER; i++ ) {
76        irqPrioTable[i] = 8;
77  }
78
[9e602b0]79  if (!BSP_rtems_irq_mngt_set(&initial_config)) {
[270ce1ff]80    /*
[9e602b0]81     * put something here that will show the failure...
[270ce1ff]82     */
[1c193a2]83    rtems_panic(
[9e602b0]84      "Unable to initialize RTEMS interrupt Management!!! System locked\n"
85    );
86  }
[ac7af4a]87
88  #ifdef TRACE_IRQ_INIT
[270ce1ff]89    printk("RTEMS IRQ management is now operationnal\n");
[9e602b0]90  #endif
[270ce1ff]91}
[97f82fc]92
[ba9c4a7]93static int psim_exception_handler(
94  BSP_Exception_frame *frame,
95  unsigned exception_number
96)
[97f82fc]97{
[1c193a2]98  rtems_panic("Unexpected interrupt occured");
[97f82fc]99  return 0;
100}
101
102/*
103 * functions to enable/disable a source at the ipic
104 */
[c6810c8]105void bsp_interrupt_vector_enable( rtems_vector_number irqnum)
[97f82fc]106{
107  /* FIXME: do something */
[cf2ec29d]108  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(irqnum));
[97f82fc]109}
110
[c6810c8]111void bsp_interrupt_vector_disable( rtems_vector_number irqnum)
[97f82fc]112{
113  /* FIXME: do something */
[cf2ec29d]114  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(irqnum));
[97f82fc]115}
116
117rtems_status_code bsp_interrupt_facility_initialize(void)
118{
119  /* Install exception handler */
120  if (ppc_exc_set_handler( ASM_EXT_VECTOR, psim_exception_handler)) {
121    return RTEMS_IO_ERROR;
122  }
123 
124  return RTEMS_SUCCESSFUL;
125}
Note: See TracBrowser for help on using the repository browser.