]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - arch/blackfin/mach-bf561/include/mach/mem_map.h
Blackfin arch: smp patch cleanup from LKML review
[mirror_ubuntu-zesty-kernel.git] / arch / blackfin / mach-bf561 / include / mach / mem_map.h
index c26d8486cc4b833d85ed36204f5642c2c2608dce..419dffdc96ebd4ad6c6bbf80b0228786f692c054 100644 (file)
 /* Memory Map for ADSP-BF561 processors */
 
 #ifdef CONFIG_BF561
-#define L1_CODE_START     0xFFA00000
-#define L1_DATA_A_START     0xFF800000
-#define L1_DATA_B_START     0xFF900000
+#define COREA_L1_CODE_START       0xFFA00000
+#define COREA_L1_DATA_A_START     0xFF800000
+#define COREA_L1_DATA_B_START     0xFF900000
+#define COREB_L1_CODE_START       0xFF600000
+#define COREB_L1_DATA_A_START     0xFF400000
+#define COREB_L1_DATA_B_START     0xFF500000
+
+#define L1_CODE_START       COREA_L1_CODE_START
+#define L1_DATA_A_START     COREA_L1_DATA_A_START
+#define L1_DATA_B_START     COREA_L1_DATA_B_START
 
 #define L1_CODE_LENGTH      0x4000
 
 
 /* Scratch Pad Memory */
 
-#define L1_SCRATCH_START       0xFFB00000
+#define COREA_L1_SCRATCH_START 0xFFB00000
+#define COREB_L1_SCRATCH_START 0xFF700000
+
+#define L1_SCRATCH_START       COREA_L1_SCRATCH_START
 #define L1_SCRATCH_LENGTH      0x1000
 
+#ifdef __ASSEMBLY__
+
+/*
+ * The following macros both return the address of the PDA for the
+ * current core.
+ *
+ * In its first safe (and hairy) form, the macro neither clobbers any
+ * register aside of the output Preg, nor uses the stack, since it
+ * could be called with an invalid stack pointer, or the current stack
+ * space being uncovered by any CPLB (e.g. early exception handling).
+ *
+ * The constraints on the second form are a bit relaxed, and the code
+ * is allowed to use the specified Dreg for determining the PDA
+ * address to be returned into Preg.
+ */
+#ifdef CONFIG_SMP
+#define GET_PDA_SAFE(preg)             \
+       preg.l = lo(DSPID);             \
+       preg.h = hi(DSPID);             \
+       preg = [preg];                  \
+       preg = preg << 2;               \
+       preg = preg << 2;               \
+       preg = preg << 2;               \
+       preg = preg << 2;               \
+       preg = preg << 2;               \
+       preg = preg << 2;               \
+       preg = preg << 2;               \
+       preg = preg << 2;               \
+       preg = preg << 2;               \
+       preg = preg << 2;               \
+       preg = preg << 2;               \
+       preg = preg << 2;               \
+       if cc jump 2f;                  \
+       cc = preg == 0x0;               \
+       preg.l = _cpu_pda;              \
+       preg.h = _cpu_pda;              \
+       if !cc jump 3f;                 \
+1:                                     \
+       /* preg = 0x0; */               \
+       cc = !cc; /* restore cc to 0 */ \
+       jump 4f;                        \
+2:                                     \
+       cc = preg == 0x0;               \
+       preg.l = _cpu_pda;              \
+       preg.h = _cpu_pda;              \
+       if cc jump 4f;                  \
+       /* preg = 0x1000000; */         \
+       cc = !cc; /* restore cc to 1 */ \
+3:                                     \
+       preg = [preg];                  \
+4:
+
+#define GET_PDA(preg, dreg)            \
+       preg.l = lo(DSPID);             \
+       preg.h = hi(DSPID);             \
+       dreg = [preg];                  \
+       preg.l = _cpu_pda;              \
+       preg.h = _cpu_pda;              \
+       cc = bittst(dreg, 0);           \
+       if !cc jump 1f;                 \
+       preg = [preg];                  \
+1:                                     \
+
+#define GET_CPUID(preg, dreg)          \
+       preg.l = lo(DSPID);             \
+       preg.h = hi(DSPID);             \
+       dreg = [preg];                  \
+       dreg = ROT dreg BY -1;          \
+       dreg = CC;
+
+#else
+#define GET_PDA_SAFE(preg)             \
+       preg.l = _cpu_pda;              \
+       preg.h = _cpu_pda;
+
+#define GET_PDA(preg, dreg)    GET_PDA_SAFE(preg)
+#endif /* CONFIG_SMP */
+
+#endif /* __ASSEMBLY__ */
+
 #endif                         /* _MEM_MAP_533_H_ */