Changeset 63d27156 in rtems


Ignore:
Timestamp:
01/06/22 20:27:52 (6 months ago)
Author:
Gedare Bloom <gedare@…>
Branches:
master
Children:
6c36cb7a
Parents:
ea7b1b7
git-author:
Gedare Bloom <gedare@…> (01/06/22 20:27:52)
git-committer:
Gedare Bloom <gedare@…> (01/12/22 16:00:19)
Message:

arm/gicv3: refactor DIST initialization to helper

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bsps/shared/dev/irq/arm-gicv3.c

    rea7b1b7 r63d27156  
    356356}
    357357
     358static void gicv3_init_dist(void)
     359{
     360  volatile gic_dist *dist = ARM_GIC_DIST;
     361  uint32_t id_count = get_id_count(dist);
     362  uint32_t id;
     363
     364  dist->icddcr = GIC_DIST_ICDDCR_ARE_NS | GIC_DIST_ICDDCR_ARE_S
     365               | GIC_DIST_ICDDCR_ENABLE_GRP1S | GIC_DIST_ICDDCR_ENABLE_GRP1NS
     366               | GIC_DIST_ICDDCR_ENABLE_GRP0;
     367
     368  for (id = 0; id < id_count; id += 32) {
     369    /* Disable all interrupts */
     370    dist->icdicer[id / 32] = 0xffffffff;
     371
     372    /* Set G1NS */
     373    dist->icdigr[id / 32] = 0xffffffff;
     374    dist->icdigmr[id / 32] = 0;
     375  }
     376
     377  for (id = 0; id < id_count; ++id) {
     378    gic_id_set_priority(dist, id, PRIORITY_DEFAULT);
     379  }
     380
     381  for (id = 32; id < id_count; ++id) {
     382    gic_id_set_targets(dist, id, 0x01);
     383  }
     384}
     385
    358386static void gicv3_init_cpu_interface(void)
    359387{
     
    391419void bsp_interrupt_facility_initialize(void)
    392420{
    393   volatile gic_dist *dist = ARM_GIC_DIST;
    394   uint32_t id_count = get_id_count(dist);
    395   uint32_t id;
    396 
    397421  arm_interrupt_facility_set_exception_handler();
    398 
    399   dist->icddcr = GIC_DIST_ICDDCR_ARE_NS | GIC_DIST_ICDDCR_ARE_S
    400                | GIC_DIST_ICDDCR_ENABLE_GRP1S | GIC_DIST_ICDDCR_ENABLE_GRP1NS
    401                | GIC_DIST_ICDDCR_ENABLE_GRP0;
    402 
    403   for (id = 0; id < id_count; id += 32) {
    404     /* Disable all interrupts */
    405     dist->icdicer[id / 32] = 0xffffffff;
    406 
    407     /* Set interrupt group to 1 in the current security mode */
    408 #if defined(ARM_MULTILIB_ARCH_V4) || defined(AARCH64_IS_NONSECURE)
    409     dist->icdigr[id / 32] = 0xffffffff;
    410     dist->icdigmr[id / 32] = 0;
    411 #else
    412     dist->icdigr[id / 32] = 0;
    413     dist->icdigmr[id / 32] = 0xffffffff;
    414 #endif
    415   }
    416 
    417   for (id = 0; id < id_count; ++id) {
    418     gic_id_set_priority(dist, id, PRIORITY_DEFAULT);
    419   }
    420 
    421   for (id = 32; id < id_count; ++id) {
    422     gic_id_set_targets(dist, id, 0x01);
    423   }
    424 
     422  gicv3_init_dist();
    425423  gicv3_init_cpu_interface();
    426424}
Note: See TracChangeset for help on using the changeset viewer.