Ignore:
Timestamp:
May 5, 2017, 1:42:45 PM (4 years ago)
Author:
Daniel Hellstrom <daniel@…>
Branches:
5, master
Children:
ce76b9d2
Parents:
aa19873
git-author:
Daniel Hellstrom <daniel@…> (05/05/17 13:42:45)
git-committer:
Daniel Hellstrom <daniel@…> (05/14/17 10:31:59)
Message:

leon, genirq: SMP support for PCI peripherals

The common interrupt layer for GRLIB PCI perihperals is prepared for SMP
support by this patch. The existing locking (interrupt disabling) is
replaced by a new requirement on the user to implement locking before
calling the genirq API. This approach avoids taking more locks than
necessary.

The split up of the locks also introduces that the user must allocate
memory to describe ISR handlers, to avoid calling malloc()/free() while
possessing a spin-lock and interrupts are globally disabled.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/shared/include/genirq.h

    raa19873 r8670c464  
    3636
    3737/* Free the dynamically allocated memory that the genirq interface has
    38  * allocated.
     38 * allocated. Also the handlers will be freed.
    3939 *
    4040 * Returns zero on success, otherwise failure.
     
    4848extern int genirq_check(genirq_t d, int irq);
    4949
    50 /* Register shared interrupt handler.
     50/* Allocate one ISR handler and initialize it. Input to genirq_register().
     51 *
     52 * \param isr    The interrupt service routine called upon IRQ
     53 * \param arg    The argument given to isr() when called.
     54 *
     55 * Returns a pointer on success, on failure NULL is returned.
     56 */
     57extern void *genirq_alloc_handler(genirq_handler isr, void *arg);
     58
     59/* Free handler memory */
     60#define genirq_free_handler(handler) free(handler)
     61
     62/* Register shared interrupt handler previously initialized with
     63 * genirq_alloc_handler().
     64 *
     65 * NOTE: internal list structures are accessed and needs to be protected by
     66 *       spin-locks/IRQ disable by the user to guarantee a correct behaviour.
    5167 *
    5268 * \param irq    The interrupt number to register ISR on
    53  * \param isr    The interrupt service routine called upon IRQ
    54  * \param arg    The argument given to isr() when called.
     69 * \param handler Install the pre- allocated and initialized handler.
    5570 *
    5671 * Return Values
     
    5974 * 1   = Handler registered Successfully, _not_ first handler on this IRQ
    6075 */
    61 extern int genirq_register(genirq_t d, int irq, genirq_handler isr, void *arg);
     76extern int genirq_register(genirq_t d, int irq, void *handler);
    6277
    63 /* Unregister an previous registered interrupt handler
     78/* Unregister an previous registered interrupt handler. It is the user's
     79 * responsibility to free the handler returned by genirq_unregister().
     80 *
     81 * NOTE: internal list structures are accessed and needs to be protected by
     82 *       spin-locks/IRQ disable by the user to guarantee a correct behaviour.
    6483 *
    6584 * Return Values
    66  *  -1 = ISR not registered before
    67  *  0  = ISR unregistered
    68  *  1  = Unable to unregister enabled ISR
     85 * NULL    = ISR not registered before or unable to unregister enabled ISR
     86 * Pointer = ISR sucessfully unregistered. Returned is the handler pointer
     87 *           previously allocated with genirq_alloc_handler().
    6988 */
    70 extern int genirq_unregister(genirq_t d, int irq, genirq_handler isr, void *arg);
     89extern void *genirq_unregister(genirq_t d, int irq,
     90                                genirq_handler isr, void *arg);
    7191
    7292/* Enables IRQ only for this isr[arg] combination. Records if this
     
    7494 * on the interrupt controller.
    7595 *
    76  * IRQs must be disabled before entering this function.
     96 * NOTE: internal list structures are accessed and needs to be protected by
     97 *       spin-locks/IRQ disable by the user to guarantee a correct behaviour.
    7798 *
    7899 * Return values
     
    87108 * must interrupts be disabled on the interrupt controller.
    88109 *
    89  * IRQs must be disabled before entering this function.
     110 * NOTE: internal list structures are accessed and needs to be protected by
     111 *       spin-locks/IRQ disable by the user to guarantee a correct behaviour.
    90112 *
    91113 * Return values
     
    98120/* Must be called by user when an IRQ has fired, the argument 'irq'
    99121 * is the IRQ number of the IRQ which was fired.
     122 *
     123 * NOTE: internal list structures are accessed and needs to be protected by
     124 *       spin-locks/IRQ disable by the user to guarantee a correct behaviour.
    100125 */
    101126extern void genirq_doirq(genirq_t d, int irq);
Note: See TracChangeset for help on using the changeset viewer.