summaryrefslogtreecommitdiff
path: root/big-little/switcher/context/sh_vgic.c
diff options
context:
space:
mode:
Diffstat (limited to 'big-little/switcher/context/sh_vgic.c')
-rw-r--r--big-little/switcher/context/sh_vgic.c170
1 files changed, 85 insertions, 85 deletions
diff --git a/big-little/switcher/context/sh_vgic.c b/big-little/switcher/context/sh_vgic.c
index 7672fdd..c2ba190 100644
--- a/big-little/switcher/context/sh_vgic.c
+++ b/big-little/switcher/context/sh_vgic.c
@@ -18,7 +18,7 @@
* contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- */
+ */
#include "virt_helpers.h"
#include "gic_registers.h"
@@ -87,13 +87,13 @@ static unsigned int cpuinfo_map[MAX_CPUIFS];
*/
unsigned map_cpuif(unsigned cluster_id, unsigned cpu_id)
{
- unsigned cpuif_id = 0;
+ unsigned cpuif_id = 0;
- cpuif_id = bitindex(read32(GIC_ID_PHY_BASE + GICD_CPUS) & 0xff);
- cpuif_map[cluster_id][cpu_id] = cpuif_id;
- cpuinfo_map[cpuif_id] = (cluster_id << 4) | cpu_id;
+ cpuif_id = bitindex(read32(GIC_ID_PHY_BASE + GICD_CPUS) & 0xff);
+ cpuif_map[cluster_id][cpu_id] = cpuif_id;
+ cpuinfo_map[cpuif_id] = (cluster_id << 4) | cpu_id;
- return 0;
+ return 0;
}
/*
@@ -101,7 +101,7 @@ unsigned map_cpuif(unsigned cluster_id, unsigned cpu_id)
*/
unsigned get_cpuif(unsigned cluster_id, unsigned cpu_id)
{
- return cpuif_map[cluster_id][cpu_id];
+ return cpuif_map[cluster_id][cpu_id];
}
/*
@@ -109,7 +109,7 @@ unsigned get_cpuif(unsigned cluster_id, unsigned cpu_id)
*/
unsigned get_cpuinfo(unsigned cpuif)
{
- return cpuinfo_map[cpuif];
+ return cpuinfo_map[cpuif];
}
/*
@@ -117,24 +117,24 @@ unsigned get_cpuinfo(unsigned cpuif)
*/
unsigned get_cpu_mask(unsigned cpuif_mask)
{
- unsigned num_bytes = sizeof(unsigned int) / sizeof(unsigned char), ctr;
- unsigned cpuif = 0, clusterid = read_clusterid(), cpu_mask = 0;
- unsigned cpuid = 0;
-
- for (ctr = 0; ctr < num_bytes; ctr++) { /* Iterate through the cpu_mask byte wise */
- unsigned byte = 0;
- unsigned char lz = 0;
-
- byte = (cpuif_mask >> (ctr << 3)) & 0xff;
- while ((lz = __clz(byte)) != 0x20) {
- cpuif = 31 - lz;
- byte &= ~(1 << cpuif); /* Clear the bit just discovered */
- cpuid = get_cpuinfo(cpuif) & 0xf;
- cpu_mask |= (1 << cpuid) << (ctr << 3);
- }
- }
-
- return cpu_mask;
+ unsigned num_bytes = sizeof(unsigned int) / sizeof(unsigned char), ctr;
+ unsigned cpuif = 0, clusterid = read_clusterid(), cpu_mask = 0;
+ unsigned cpuid = 0;
+
+ for (ctr = 0; ctr < num_bytes; ctr++) { /* Iterate through the cpu_mask byte wise */
+ unsigned byte = 0;
+ unsigned char lz = 0;
+
+ byte = (cpuif_mask >> (ctr << 3)) & 0xff;
+ while ((lz = __clz(byte)) != 0x20) {
+ cpuif = 31 - lz;
+ byte &= ~(1 << cpuif); /* Clear the bit just discovered */
+ cpuid = get_cpuinfo(cpuif) & 0xf;
+ cpu_mask |= (1 << cpuid) << (ctr << 3);
+ }
+ }
+
+ return cpu_mask;
}
/*
@@ -142,24 +142,24 @@ unsigned get_cpu_mask(unsigned cpuif_mask)
*/
unsigned get_cpuif_mask(unsigned cpu_mask)
{
- unsigned num_bytes = sizeof(unsigned int) / sizeof(unsigned char), ctr;
- unsigned cpuif = 0, clusterid = read_clusterid(), cpuif_mask = 0;
- unsigned cpuid = 0;
-
- for (ctr = 0; ctr < num_bytes; ctr++) { /* Iterate through the cpu_mask byte wise */
- unsigned byte = 0;
- unsigned char lz = 0;
-
- byte = (cpu_mask >> (ctr << 3)) & 0xff;
- while ((lz = __clz(byte)) != 0x20) {
- cpuid = 31 - lz;
- byte &= ~(1 << cpuid); /* Clear the bit just discovered */
- cpuif = get_cpuif(clusterid, cpuid);
- cpuif_mask |= (1 << cpuif) << (ctr << 3);
- }
- }
-
- return cpuif_mask;
+ unsigned num_bytes = sizeof(unsigned int) / sizeof(unsigned char), ctr;
+ unsigned cpuif = 0, clusterid = read_clusterid(), cpuif_mask = 0;
+ unsigned cpuid = 0;
+
+ for (ctr = 0; ctr < num_bytes; ctr++) { /* Iterate through the cpu_mask byte wise */
+ unsigned byte = 0;
+ unsigned char lz = 0;
+
+ byte = (cpu_mask >> (ctr << 3)) & 0xff;
+ while ((lz = __clz(byte)) != 0x20) {
+ cpuid = 31 - lz;
+ byte &= ~(1 << cpuid); /* Clear the bit just discovered */
+ cpuif = get_cpuif(clusterid, cpuid);
+ cpuif_mask |= (1 << cpuif) << (ctr << 3);
+ }
+ }
+
+ return cpuif_mask;
}
/*
@@ -174,52 +174,52 @@ unsigned get_cpuif_mask(unsigned cpu_mask)
*/
unsigned remap_cpuif(unsigned *cpuif_mask)
{
- unsigned cluster_id = read_clusterid(), num_cpus = num_secondaries() + 1;
-
+ unsigned cluster_id = read_clusterid(), num_cpus =
+ num_secondaries() + 1;
- if(cluster_id == EAGLE)
- *cpuif_mask = *cpuif_mask >> num_cpus;
- else
- *cpuif_mask = *cpuif_mask << num_cpus;
+ if (cluster_id == EAGLE)
+ *cpuif_mask = *cpuif_mask >> num_cpus;
+ else
+ *cpuif_mask = *cpuif_mask << num_cpus;
- return 0;
+ return 0;
}
#else
unsigned remap_cpuif(unsigned *cpuif_mask)
{
- unsigned ib_cpuif_mask = 0, ob_cpuif = 0, ib_cpuif = 0, ob_cpuid =
- 0, ob_clusterid = 0, ib_cpuid = 0, ib_clusterid = 0;
- unsigned num_bytes = sizeof(unsigned int) / sizeof(unsigned char), ctr;
-
- for (ctr = 0; ctr < num_bytes; ctr++) {
- unsigned byte = 0;
- unsigned char lz = 0;
-
- byte = (*cpuif_mask >> (ctr << 3)) & 0xff;
-
- while ((lz = __clz(byte)) != 0x20) {
- ob_cpuif = 31 - lz;
- byte &= ~(1 << ob_cpuif); /* Clear the bit just discovered */
- ob_cpuid = get_cpuinfo(ob_cpuif) & 0xf;
- ob_clusterid = (get_cpuinfo(ob_cpuif) >> 4) & 0xf;
-
- /*
- * TODO: Can we assume that the inbound and outbound clusters will
- * always be logical complements of each other
- */
- ib_clusterid = !ob_clusterid;
-
- /*
- * TODO: Assuming that the cpuids have a 1:1 mapping i.e. cpuX on
- * one cluster will always map to cpuX on the other cluster.
- */
- ib_cpuid = ob_cpuid;
- ib_cpuif = get_cpuif(ib_clusterid, ib_cpuid);
- ib_cpuif_mask |= (1 << ib_cpuif) << (ctr << 3);
- }
- }
-
- *cpuif_mask = ib_cpuif_mask;
- return 0;
+ unsigned ib_cpuif_mask = 0, ob_cpuif = 0, ib_cpuif = 0, ob_cpuid =
+ 0, ob_clusterid = 0, ib_cpuid = 0, ib_clusterid = 0;
+ unsigned num_bytes = sizeof(unsigned int) / sizeof(unsigned char), ctr;
+
+ for (ctr = 0; ctr < num_bytes; ctr++) {
+ unsigned byte = 0;
+ unsigned char lz = 0;
+
+ byte = (*cpuif_mask >> (ctr << 3)) & 0xff;
+
+ while ((lz = __clz(byte)) != 0x20) {
+ ob_cpuif = 31 - lz;
+ byte &= ~(1 << ob_cpuif); /* Clear the bit just discovered */
+ ob_cpuid = get_cpuinfo(ob_cpuif) & 0xf;
+ ob_clusterid = (get_cpuinfo(ob_cpuif) >> 4) & 0xf;
+
+ /*
+ * TODO: Can we assume that the inbound and outbound clusters will
+ * always be logical complements of each other
+ */
+ ib_clusterid = !ob_clusterid;
+
+ /*
+ * TODO: Assuming that the cpuids have a 1:1 mapping i.e. cpuX on
+ * one cluster will always map to cpuX on the other cluster.
+ */
+ ib_cpuid = ob_cpuid;
+ ib_cpuif = get_cpuif(ib_clusterid, ib_cpuid);
+ ib_cpuif_mask |= (1 << ib_cpuif) << (ctr << 3);
+ }
+ }
+
+ *cpuif_mask = ib_cpuif_mask;
+ return 0;
}
#endif