Changeset df62e51 in rtems


Ignore:
Timestamp:
Sep 8, 2017, 8:11:20 AM (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
2fc32460
Parents:
134fe56
git-author:
Sebastian Huber <sebastian.huber@…> (09/08/17 08:11:20)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/12/17 08:00:36)
Message:

bsp/qoriq: Virtual interrupt controller support

Update #3085.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/qoriq/irq/irq.c

    r134fe56 rdf62e51  
    88
    99/*
    10  * Copyright (c) 2010-2015 embedded brains GmbH.  All rights reserved.
     10 * Copyright (c) 2010, 2017 embedded brains GmbH.  All rights reserved.
    1111 *
    1212 *  embedded brains GmbH
     
    2727#include <libcpu/powerpc-utility.h>
    2828
     29#include <asm/epapr_hcalls.h>
     30
    2931#include <bsp.h>
    3032#include <bsp/irq.h>
     
    3335#include <bsp/utility.h>
    3436#include <bsp/qoriq.h>
     37
     38RTEMS_INTERRUPT_LOCK_DEFINE(static, lock, "QorIQ IRQ")
     39
     40#define SPURIOUS 0xffff
     41
     42#ifdef QORIQ_IS_HYPERVISOR_GUEST
     43
     44void bsp_interrupt_set_affinity(
     45        rtems_vector_number vector,
     46        const Processor_mask *affinity
     47)
     48{
     49        uint32_t config;
     50        unsigned int priority;
     51        uint32_t destination;
     52        uint32_t new_destination;
     53        rtems_interrupt_lock_context lock_context;
     54
     55        new_destination = _Processor_mask_Find_last_set(affinity) - 1;
     56
     57        rtems_interrupt_lock_acquire(&lock, &lock_context);
     58        ev_int_get_config(vector, &config, &priority, &destination);
     59        ev_int_set_config(vector, config, priority, new_destination);
     60        rtems_interrupt_lock_release(&lock, &lock_context);
     61}
     62
     63void bsp_interrupt_get_affinity(
     64        rtems_vector_number vector,
     65        Processor_mask *affinity
     66)
     67{
     68        uint32_t config;
     69        unsigned int priority;
     70        uint32_t destination;
     71
     72        ev_int_get_config(vector, &config, &priority, &destination);
     73        _Processor_mask_From_uint32_t(affinity, destination, 0);
     74}
     75
     76void bsp_interrupt_vector_enable(rtems_vector_number vector)
     77{
     78        bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
     79        ev_int_set_mask(vector, 0);
     80}
     81
     82void bsp_interrupt_vector_disable(rtems_vector_number vector)
     83{
     84        bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
     85        ev_int_set_mask(vector, 1);
     86}
     87
     88void bsp_interrupt_dispatch(void)
     89{
     90        unsigned int vector;
     91
     92        ev_int_iack(0, &vector);
     93
     94        if (vector != SPURIOUS) {
     95                uint32_t msr;
     96
     97                msr = ppc_external_exceptions_enable();
     98                bsp_interrupt_handler_dispatch(vector);
     99                ppc_external_exceptions_disable(msr);
     100
     101                ev_int_eoi(vector);
     102        } else {
     103                bsp_interrupt_handler_default(vector);
     104        }
     105}
     106
     107rtems_status_code bsp_interrupt_facility_initialize(void)
     108{
     109        return RTEMS_SUCCESSFUL;
     110}
     111
     112#else /* !QORIQ_IS_HYPERVISOR_GUEST */
    35113
    36114#define VPR_MSK BSP_BBIT32(0)
     
    47125#define GCR_RST BSP_BBIT32(0)
    48126#define GCR_M BSP_BBIT32(2)
    49 
    50 #define SPURIOUS 0xffff
    51 
    52 RTEMS_INTERRUPT_LOCK_DEFINE(static, lock, "QorIQ IRQ")
    53127
    54128#define SRC_CFG_IDX(i) ((i) - QORIQ_IRQ_EXT_BASE)
     
    292366        return RTEMS_SUCCESSFUL;
    293367}
     368
     369#endif /* QORIQ_IS_HYPERVISOR_GUEST */
Note: See TracChangeset for help on using the changeset viewer.