Allow CSS to redefine function `plat_arm_calc_core_pos`
authorDavid Wang <david.wang@arm.com>
Thu, 22 Oct 2015 05:30:50 +0000 (13:30 +0800)
committerDavid Wang <david.wang@arm.com>
Tue, 27 Oct 2015 02:11:55 +0000 (10:11 +0800)
Currently all ARM CSS platforms which include css_helpers.S use the same
strong definition of `plat_arm_calc_core_pos`. This patch allows these CSS
platforms to define their own strong definition of this function.

* Replace the strong definition of `plat_arm_calc_core_pos` in
  css_helpers.S with a utility function `css_calc_core_pos_swap_cluster`
  does the same thing (swaps cluster IDs). ARM CSS platforms may choose
  to use this function or not.

* Add a Juno strong definition of `plat_arm_calc_core_pos`, which uses
  `css_calc_core_pos_swap_cluster`.

Change-Id: Ib5385ed10e44adf6cd1398a93c25973eb3506d9d

plat/arm/board/juno/aarch64/juno_helpers.S
plat/arm/css/common/aarch64/css_helpers.S

index ce41baeec673b7dac6e7f3381f0d7e2feb06dbdf..263a980564876fbb8627c28648e179fc6712e810 100644 (file)
@@ -37,7 +37,7 @@
 
 
        .globl  plat_reset_handler
-
+       .globl  plat_arm_calc_core_pos
 
        /* --------------------------------------------------------------------
         * void plat_reset_handler(void);
@@ -117,3 +117,12 @@ ret:
        isb
        ret
 endfunc plat_reset_handler
+
+       /* -----------------------------------------------------
+        *  unsigned int plat_arm_calc_core_pos(uint64_t mpidr)
+        *  Helper function to calculate the core position.
+        * -----------------------------------------------------
+        */
+func plat_arm_calc_core_pos
+       b       css_calc_core_pos_swap_cluster
+endfunc plat_arm_calc_core_pos
index 1137a492355c70eee6a800e4da5fea5b86b0be97..d1702708ff564a833fd4be43c81f44e6a98a8002 100644 (file)
@@ -34,7 +34,7 @@
 
        .weak   plat_secondary_cold_boot_setup
        .weak   plat_get_my_entrypoint
-       .globl  plat_arm_calc_core_pos
+       .globl  css_calc_core_pos_swap_cluster
        .weak   plat_is_my_cpu_primary
 
        /* -----------------------------------------------------
@@ -73,20 +73,20 @@ func plat_get_my_entrypoint
 endfunc plat_get_my_entrypoint
 
        /* -----------------------------------------------------------
-        * unsigned int plat_arm_calc_core_pos(uint64_t mpidr)
-        * Function to calculate the core position by
+        * unsigned int css_calc_core_pos_swap_cluster(uint64_t mpidr)
+        * Utility function to calculate the core position by
         * swapping the cluster order. This is necessary in order to
         * match the format of the boot information passed by the SCP
         * and read in plat_is_my_cpu_primary below.
         * -----------------------------------------------------------
         */
-func plat_arm_calc_core_pos
+func css_calc_core_pos_swap_cluster
        and     x1, x0, #MPIDR_CPU_MASK
        and     x0, x0, #MPIDR_CLUSTER_MASK
        eor     x0, x0, #(1 << MPIDR_AFFINITY_BITS)  // swap cluster order
        add     x0, x1, x0, LSR #6
        ret
-endfunc plat_arm_calc_core_pos
+endfunc css_calc_core_pos_swap_cluster
 
        /* -----------------------------------------------------
         * unsigned int plat_is_my_cpu_primary (void);