2 * arch/ubicom32/include/asm/ip5000-asm.h
3 * Instruction macros for the IP5000.
5 * (C) Copyright 2009, Ubicom, Inc.
7 * This file is part of the Ubicom32 Linux Kernel Port.
9 * The Ubicom32 Linux Kernel Port is free software: you can redistribute
10 * it and/or modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation, either version 2 of the
12 * License, or (at your option) any later version.
14 * The Ubicom32 Linux Kernel Port is distributed in the hope that it
15 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
17 * the GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with the Ubicom32 Linux Kernel Port. If not,
21 * see <http://www.gnu.org/licenses/>.
23 * Ubicom32 implementation derived from (with many thanks):
29 #ifndef _ASM_UBICOM32_IP5000_ASM_H
30 #define _ASM_UBICOM32_IP5000_ASM_H
32 #if !defined(__LINKER__)
34 #if defined(__ASSEMBLY__)
39 .if (((\quant) + 3) / 8) > 0
40 .rept (((\quant) + 3) / 8)
44 .if ((((\quant) + 3) % 8) / 4) > 0
51 * Same macro as above just in C inline asm
54 .macro cycles quant \n\
55 .if (\\quant) == 1 \n\
58 .if (((\\quant) + 3) / 8) > 0 \n\
59 .rept (((\\quant) + 3) / 8) \n\
63 .if ((((\\quant) + 3) % 8) / 4) > 0 \n\
72 #if defined(__ASSEMBLY__)
78 * Same macro as above just in C inline asm
81 .macro pipe_flush cyc \n\
82 cycles 11 - (\\cyc) \n\
88 #if defined(__ASSEMBLY__)
89 .macro setcsr_flush cyc
94 * Same macro as above just in C inline asm
97 .macro setcsr_flush cyc \n\
98 cycles 5 - (\\cyc) \n\
104 * Macros for prefetch (using miss-aligned memory write)
106 #if defined(__ASSEMBLY__)
108 .macro pre_fetch_macro thread_num, Ascratch, Aaddress length
109 bclr MT_TRAP_EN, MT_TRAP_EN, #(\thread_num)
110 bset \Ascratch, \Aaddress, #0 ; force a miss-aligned address
111 jmpt.t .+4 ; delay for both address setup and trap disable
112 move.4 (\Ascratch), #0
114 move.4 32(\Ascratch), #0
117 move.4 64(\Ascratch), #0
120 move.4 96(\Ascratch), #0
123 invalid_instruction ; maximum pre-fetch size is 4 cache lines
125 bset MT_TRAP_EN, MT_TRAP_EN, #(\thread_num)
130 * Same macro as above just in C inline asm
133 .macro pre_fetch_macro thread_num, Ascratch, Aaddress length \n\
134 bclr MT_TRAP_EN, MT_TRAP_EN, #(\thread_num) \n\
135 bset \\Ascratch, \\Aaddress, #0 ; force a miss-aligned address \n\
136 jmpt.t .+4 ; delay for both address setup and trap disable \n\
137 move.4 (\\Ascratch), #0 \n\
138 .if (\\length > 32) \n\
139 move.4 32(\\Ascratch), #0 \n\
141 .if (\\length > 64) \n\
142 move.4 64(\\Ascratch), #0 \n\
144 .if (\\length > 96) \n\
145 move.4 96(\\Ascratch), #0 \n\
147 .if (\\length > 128) \n\
148 invalid_instruction ; maximum pre-fetch size is 4 cache lines \n\
150 bset MT_TRAP_EN, MT_TRAP_EN, #(\\thread_num) \n\
155 #endif /* !defined(__LINKER__) */
156 #endif /* defined _ASM_UBICOM32_IP5000_ASM_H */