Ignore:
Timestamp:
2006-10-13T20:42:54Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7dcf22a
Parents:
8ce8499
Message:

Prototypical implementation of new IRQ redirector in sparc64.
The new code can support shared IRQs in kernel (and multiple IRQs per device).
Userspace support is yet to be written.
The only architecture that uses this code is actually sparc64 only.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/trap/interrupt.c

    r8ce8499 r0d107f31  
    3636#include <arch/trap/interrupt.h>
    3737#include <interrupt.h>
    38 #include <arch/drivers/fhc.h>
    39 #include <arch/drivers/kbd.h>
     38#include <irq.h>
    4039#include <typedefs.h>
    4140#include <arch/types.h>
     
    4544#include <arch/barrier.h>
    4645#include <print.h>
    47 #include <genarch/kbd/z8530.h>
    4846#include <arch.h>
    4947#include <mm/tlb.h>
    5048#include <config.h>
     49
     50/*
     51 * To be removed once we get rid of the dependency in ipc_irq_bind_arch().
     52 */
     53#include <arch/drivers/kbd.h>
     54#include <genarch/kbd/z8530.h>
    5155
    5256/** Register Interrupt Level Handler.
     
    7276}
    7377
     78/** Process hardware interrupt.
     79 *
     80 * @param n Ignored.
     81 * @param istate Ignored.
     82 */
    7483void interrupt(int n, istate_t *istate)
    7584{
     
    8089        data0 = asi_u64_read(ASI_UDB_INTR_R, ASI_UDB_INTR_R_DATA_0);
    8190
    82         switch (data0) {
    83 #ifdef CONFIG_Z8530
    84         case Z8530_INTRCV_DATA0:
    85                 if (kbd_type != KBD_Z8530)
    86                         break;
     91        irq_t *irq = irq_dispatch(data0);
     92        if (irq) {
    8793                /*
    88                  * So far, we know we got this interrupt through the FHC.
    89                  * Since we don't have enough information about the FHC and
    90                  * because the interrupt looks like level sensitive,
    91                  * we cannot handle it by scheduling one of the level
    92                  * interrupt traps. Call the interrupt handler directly.
     94                 * The IRQ handler was found.
    9395                 */
    94 
    95                 if (z8530_belongs_to_kernel)
    96                         z8530_interrupt();
    97                 else
    98                         ipc_irq_send_notif(0);
    99                 fhc_clear_interrupt(central_fhc, data0);
    100                 break;
    101 
     96                irq->handler(irq, irq->arg);
     97        } else if (data0 > config.base) {
     98                /*
     99                 * This is a cross-call.
     100                 * data0 contains address of kernel function.
     101                 * We call the function only after we verify
     102                 * it is on of the supported ones.
     103                 */
     104#ifdef CONFIG_SMP
     105                if (data0 == (uintptr_t) tlb_shootdown_ipi_recv) {
     106                        tlb_shootdown_ipi_recv();
     107                }
    102108#endif
    103         default:
    104                 if (data0 > config.base) {
    105                         /*
    106                          * This is a cross-call.
    107                          * data0 contains address of kernel function.
    108                          * We call the function only after we verify
    109                          * it is on of the supported ones.
    110                          */
    111 #ifdef CONFIG_SMP
    112                         if (data0 == (uintptr_t) tlb_shootdown_ipi_recv) {
    113                                 tlb_shootdown_ipi_recv();
    114                                 break;
    115                         }
     109        } else {
     110                /*
     111                 * Spurious interrupt.
     112                 */
     113#ifdef CONFIG_DEBUG
     114                printf("cpu%d: spurious interrupt (intrcv=%#llx, data0=%#llx)\n", CPU->id, intrcv, data0);
    116115#endif
    117                 }
    118                        
    119                 printf("cpu%d: spurious interrupt (intrcv=%#llx, data0=%#llx)\n", CPU->id, intrcv, data0);
    120                 break;
    121116        }
    122117
Note: See TracChangeset for help on using the changeset viewer.