Changeset cbc9232 in rtems


Ignore:
Timestamp:
01/10/22 14:52:40 (6 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
00081b3
Parents:
963a26c
git-author:
Sebastian Huber <sebastian.huber@…> (01/10/22 14:52:40)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/11/22 15:18:11)
Message:

bsp/qoriq: Implement Interrupt Manager directives

Update #3269.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bsps/powerpc/qoriq/irq/irq.c

    r963a26c rcbc9232  
    281281}
    282282
     283static bool is_ipi(rtems_vector_number vector)
     284{
     285        return (vector - QORIQ_IRQ_IPI_BASE) < 4;
     286}
     287
    283288rtems_status_code qoriq_pic_set_priority(
    284289        rtems_vector_number vector,
     
    321326)
    322327{
    323         volatile qoriq_pic_src_cfg *src_cfg = get_src_cfg(vector);
    324 
     328        volatile qoriq_pic_src_cfg *src_cfg;
     329
     330        if (is_ipi(vector)) {
     331                return RTEMS_UNSATISFIED;
     332        }
     333
     334        src_cfg = get_src_cfg(vector);
    325335        src_cfg->dr = _Processor_mask_To_uint32_t(affinity, 0);
    326336        return RTEMS_SUCCESSFUL;
     
    332342)
    333343{
    334         volatile qoriq_pic_src_cfg *src_cfg = get_src_cfg(vector);
    335 
     344        volatile qoriq_pic_src_cfg *src_cfg;
     345
     346        if (is_ipi(vector)) {
     347                return RTEMS_UNSATISFIED;
     348        }
     349
     350        src_cfg = get_src_cfg(vector);
    336351        _Processor_mask_From_uint32_t(affinity, src_cfg->dr, 0);
    337352        return RTEMS_SUCCESSFUL;
     
    340355static void pic_vector_enable(rtems_vector_number vector, uint32_t msk)
    341356{
    342         volatile qoriq_pic_src_cfg *src_cfg = get_src_cfg(vector);
     357        volatile qoriq_pic_src_cfg *src_cfg;
    343358        rtems_interrupt_lock_context lock_context;
    344359
    345360        bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
    346361
     362        src_cfg = get_src_cfg(vector);
    347363        rtems_interrupt_lock_acquire(&lock, &lock_context);
    348364        src_cfg->vpr = (src_cfg->vpr & ~VPR_MSK) | msk;
     
    351367
    352368rtems_status_code bsp_interrupt_get_attributes(
    353   rtems_vector_number         vector,
    354   rtems_interrupt_attributes *attributes
    355 )
    356 {
    357   return RTEMS_SUCCESSFUL;
     369        rtems_vector_number vector,
     370        rtems_interrupt_attributes *attributes
     371)
     372{
     373        bool vector_is_ipi = is_ipi(vector);
     374        attributes->is_maskable = true;
     375        attributes->can_enable = true;
     376        attributes->maybe_enable = true;
     377        attributes->can_disable = true;
     378        attributes->maybe_disable = true;
     379        attributes->cleared_by_acknowledge = true;
     380        attributes->can_get_affinity = !vector_is_ipi;
     381        attributes->can_set_affinity = !vector_is_ipi;
     382        attributes->can_raise = vector_is_ipi;
     383        attributes->can_raise_on = vector_is_ipi;
     384        return RTEMS_SUCCESSFUL;
    358385}
    359386
    360387rtems_status_code bsp_interrupt_is_pending(
    361   rtems_vector_number vector,
    362   bool               *pending
    363 )
    364 {
    365   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
    366   bsp_interrupt_assert(pending != NULL);
    367   *pending = false;
    368   return RTEMS_UNSATISFIED;
     388        rtems_vector_number vector,
     389        bool *pending
     390)
     391{
     392        volatile qoriq_pic_src_cfg *src_cfg;
     393
     394        bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
     395        bsp_interrupt_assert(pending != NULL);
     396
     397        src_cfg = get_src_cfg(vector);
     398        *pending = (src_cfg->vpr & VPR_A) != 0;
     399        return RTEMS_SUCCESSFUL;
     400}
     401
     402static void raise_on(rtems_vector_number vector, uint32_t cpu_index)
     403{
     404        rtems_vector_number ipi_index = vector - QORIQ_IRQ_IPI_BASE;
     405        qoriq.pic.ipidr[ipi_index].reg = 1U << cpu_index;
    369406}
    370407
    371408rtems_status_code bsp_interrupt_raise(rtems_vector_number vector)
     409{
     410        bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
     411
     412        if (is_ipi(vector)) {
     413                raise_on(vector, rtems_scheduler_get_processor());
     414                return RTEMS_SUCCESSFUL;
     415        }
     416
     417        return RTEMS_UNSATISFIED;
     418}
     419
     420#if defined(RTEMS_SMP)
     421rtems_status_code bsp_interrupt_raise_on(
     422        rtems_vector_number vector,
     423        uint32_t cpu_index
     424)
     425{
     426        bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
     427
     428        if (is_ipi(vector)) {
     429                raise_on(vector, cpu_index);
     430                return RTEMS_SUCCESSFUL;
     431        }
     432
     433        return RTEMS_UNSATISFIED;
     434}
     435#endif
     436
     437rtems_status_code bsp_interrupt_clear(rtems_vector_number vector)
    372438{
    373439  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
     
    375441}
    376442
    377 #if defined(RTEMS_SMP)
    378 rtems_status_code bsp_interrupt_raise_on(
    379   rtems_vector_number vector,
    380   uint32_t            cpu_index
    381 )
    382 {
    383   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
    384   return RTEMS_UNSATISFIED;
    385 }
    386 #endif
    387 
    388 rtems_status_code bsp_interrupt_clear(rtems_vector_number vector)
    389 {
    390   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
    391   return RTEMS_UNSATISFIED;
    392 }
    393 
    394443rtems_status_code bsp_interrupt_vector_is_enabled(
    395   rtems_vector_number vector,
    396   bool               *enabled
    397 )
    398 {
    399   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
    400   bsp_interrupt_assert(enabled != NULL);
    401   *enabled = false;
    402   return RTEMS_UNSATISFIED;
     444        rtems_vector_number vector,
     445        bool *enabled
     446)
     447{
     448        volatile qoriq_pic_src_cfg *src_cfg;
     449
     450        bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
     451        bsp_interrupt_assert(enabled != NULL);
     452
     453        src_cfg = get_src_cfg(vector);
     454        *enabled = (src_cfg->vpr & VPR_MSK) == 0;
     455        return RTEMS_SUCCESSFUL;
    403456}
    404457
Note: See TracChangeset for help on using the changeset viewer.