123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430 |
- #ifndef _ASM_PROCESSOR_H
- #define _ASM_PROCESSOR_H
- #include <linux/atomic.h>
- #include <linux/cpumask.h>
- #include <linux/threads.h>
- #include <asm/cachectl.h>
- #include <asm/cpu.h>
- #include <asm/cpu-info.h>
- #include <asm/dsemul.h>
- #include <asm/mipsregs.h>
- #include <asm/prefetch.h>
- #define current_text_addr() ({ __label__ _l; _l: &&_l;})
- extern unsigned int vced_count, vcei_count;
- #define HAVE_ARCH_PICK_MMAP_LAYOUT 1
- #ifdef CONFIG_32BIT
- #ifdef CONFIG_KVM_GUEST
- #define TASK_SIZE 0x3fff8000UL
- #else
- #define TASK_SIZE 0x80000000UL
- #endif
- #define STACK_TOP_MAX TASK_SIZE
- #define TASK_IS_32BIT_ADDR 1
- #endif
- #ifdef CONFIG_64BIT
- #define TASK_SIZE32 0x7fff8000UL
- #ifdef CONFIG_MIPS_VA_BITS_48
- #define TASK_SIZE64 (0x1UL << ((cpu_data[0].vmbits>48)?48:cpu_data[0].vmbits))
- #else
- #define TASK_SIZE64 0x10000000000UL
- #endif
- #define TASK_SIZE (test_thread_flag(TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE64)
- #define STACK_TOP_MAX TASK_SIZE64
- #define TASK_SIZE_OF(tsk) \
- (test_tsk_thread_flag(tsk, TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE64)
- #define TASK_IS_32BIT_ADDR test_thread_flag(TIF_32BIT_ADDR)
- #endif
- #define STACK_TOP ((TASK_SIZE & PAGE_MASK) - PAGE_SIZE)
- #define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3)
- #define NUM_FPU_REGS 32
- #ifdef CONFIG_CPU_HAS_MSA
- # define FPU_REG_WIDTH 128
- #else
- # define FPU_REG_WIDTH 64
- #endif
- union fpureg {
- __u32 val32[FPU_REG_WIDTH / 32];
- __u64 val64[FPU_REG_WIDTH / 64];
- };
- #ifdef CONFIG_CPU_LITTLE_ENDIAN
- # define FPR_IDX(width, idx) (idx)
- #else
- # define FPR_IDX(width, idx) ((idx) ^ ((64 / (width)) - 1))
- #endif
- #define BUILD_FPR_ACCESS(width) \
- static inline u##width get_fpr##width(union fpureg *fpr, unsigned idx) \
- { \
- return fpr->val##width[FPR_IDX(width, idx)]; \
- } \
- \
- static inline void set_fpr##width(union fpureg *fpr, unsigned idx, \
- u##width val) \
- { \
- fpr->val##width[FPR_IDX(width, idx)] = val; \
- }
- BUILD_FPR_ACCESS(32)
- BUILD_FPR_ACCESS(64)
- struct mips_fpu_struct {
- union fpureg fpr[NUM_FPU_REGS];
- unsigned int fcr31;
- unsigned int msacsr;
- };
- #define NUM_DSP_REGS 6
- typedef __u32 dspreg_t;
- struct mips_dsp_state {
- dspreg_t dspr[NUM_DSP_REGS];
- unsigned int dspcontrol;
- };
- #define INIT_CPUMASK { \
- {0,} \
- }
- struct mips3264_watch_reg_state {
-
- unsigned long watchlo[NUM_WATCH_REGS];
-
- u16 watchhi[NUM_WATCH_REGS];
- };
- union mips_watch_reg_state {
- struct mips3264_watch_reg_state mips3264;
- };
- #if defined(CONFIG_CPU_CAVIUM_OCTEON)
- struct octeon_cop2_state {
-
- unsigned long cop2_crc_iv;
-
- unsigned long cop2_crc_length;
-
- unsigned long cop2_crc_poly;
-
- unsigned long cop2_llm_dat[2];
-
- unsigned long cop2_3des_iv;
-
- unsigned long cop2_3des_key[3];
-
- unsigned long cop2_3des_result;
-
- unsigned long cop2_aes_inp0;
-
- unsigned long cop2_aes_iv[2];
-
- unsigned long cop2_aes_key[4];
-
- unsigned long cop2_aes_keylen;
-
- unsigned long cop2_aes_result[2];
-
- unsigned long cop2_hsh_datw[15];
-
- unsigned long cop2_hsh_ivw[8];
-
- unsigned long cop2_gfm_mult[2];
-
- unsigned long cop2_gfm_poly;
-
- unsigned long cop2_gfm_result[2];
-
- unsigned long cop2_sha3[2];
- };
- #define COP2_INIT \
- .cp2 = {0,},
- struct octeon_cvmseg_state {
- unsigned long cvmseg[CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE]
- [cpu_dcache_line_size() / sizeof(unsigned long)];
- };
- #elif defined(CONFIG_CPU_XLP)
- struct nlm_cop2_state {
- u64 rx[4];
- u64 tx[4];
- u32 tx_msg_status;
- u32 rx_msg_status;
- };
- #define COP2_INIT \
- .cp2 = {{0}, {0}, 0, 0},
- #else
- #define COP2_INIT
- #endif
- typedef struct {
- unsigned long seg;
- } mm_segment_t;
- #ifdef CONFIG_CPU_HAS_MSA
- # define ARCH_MIN_TASKALIGN 16
- # define FPU_ALIGN __aligned(16)
- #else
- # define ARCH_MIN_TASKALIGN 8
- # define FPU_ALIGN
- #endif
- struct mips_abi;
- struct thread_struct {
-
- unsigned long reg16;
- unsigned long reg17, reg18, reg19, reg20, reg21, reg22, reg23;
- unsigned long reg29, reg30, reg31;
-
- unsigned long cp0_status;
-
- struct mips_fpu_struct fpu FPU_ALIGN;
-
- atomic_t bd_emu_frame;
-
- unsigned long bd_emu_branch_pc;
-
- unsigned long bd_emu_cont_pc;
- #ifdef CONFIG_MIPS_MT_FPAFF
-
- unsigned long emulated_fp;
-
- cpumask_t user_cpus_allowed;
- #endif
-
- struct mips_dsp_state dsp;
-
- union mips_watch_reg_state watch;
-
- unsigned long cp0_badvaddr;
- unsigned long cp0_baduaddr;
- unsigned long error_code;
- unsigned long trap_nr;
- #ifdef CONFIG_CPU_CAVIUM_OCTEON
- struct octeon_cop2_state cp2 __attribute__ ((__aligned__(128)));
- struct octeon_cvmseg_state cvmseg __attribute__ ((__aligned__(128)));
- #endif
- #ifdef CONFIG_CPU_XLP
- struct nlm_cop2_state cp2;
- #endif
- struct mips_abi *abi;
- };
- #ifdef CONFIG_MIPS_MT_FPAFF
- #define FPAFF_INIT \
- .emulated_fp = 0, \
- .user_cpus_allowed = INIT_CPUMASK,
- #else
- #define FPAFF_INIT
- #endif
- #define INIT_THREAD { \
-
- \
- .reg16 = 0, \
- .reg17 = 0, \
- .reg18 = 0, \
- .reg19 = 0, \
- .reg20 = 0, \
- .reg21 = 0, \
- .reg22 = 0, \
- .reg23 = 0, \
- .reg29 = 0, \
- .reg30 = 0, \
- .reg31 = 0, \
-
- \
- .cp0_status = 0, \
-
- \
- .fpu = { \
- .fpr = {{{0,},},}, \
- .fcr31 = 0, \
- .msacsr = 0, \
- }, \
-
- \
- FPAFF_INIT \
- \
- .bd_emu_frame = ATOMIC_INIT(BD_EMUFRAME_NONE), \
- .bd_emu_branch_pc = 0, \
- .bd_emu_cont_pc = 0, \
-
- \
- .dsp = { \
- .dspr = {0, }, \
- .dspcontrol = 0, \
- }, \
-
- \
- .watch = {{{0,},},}, \
-
- \
- .cp0_badvaddr = 0, \
- .cp0_baduaddr = 0, \
- .error_code = 0, \
- .trap_nr = 0, \
-
- \
- COP2_INIT \
- }
- struct task_struct;
- #define release_thread(thread) do { } while(0)
- extern unsigned long thread_saved_pc(struct task_struct *tsk);
- extern void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp);
- static inline void flush_thread(void)
- {
- }
- unsigned long get_wchan(struct task_struct *p);
- #define __KSTK_TOS(tsk) ((unsigned long)task_stack_page(tsk) + \
- THREAD_SIZE - 32 - sizeof(struct pt_regs))
- #define task_pt_regs(tsk) ((struct pt_regs *)__KSTK_TOS(tsk))
- #define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc)
- #define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29])
- #define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status)
- #define cpu_relax() barrier()
- #define cpu_relax_lowlatency() cpu_relax()
- #define return_address() ({__asm__ __volatile__("":::"$31");__builtin_return_address(0);})
- #ifdef CONFIG_CPU_HAS_PREFETCH
- #define ARCH_HAS_PREFETCH
- #define prefetch(x) __builtin_prefetch((x), 0, 1)
- #define ARCH_HAS_PREFETCHW
- #define prefetchw(x) __builtin_prefetch((x), 1, 1)
- #endif
- extern int mips_get_process_fp_mode(struct task_struct *task);
- extern int mips_set_process_fp_mode(struct task_struct *task,
- unsigned int value);
- #define GET_FP_MODE(task) mips_get_process_fp_mode(task)
- #define SET_FP_MODE(task,value) mips_set_process_fp_mode(task, value)
- #endif
|