Skip to content
Snippets Groups Projects
processor.h 53.4 KiB
Newer Older
  • Learn to ignore specific revisions
  • #define IS_E_PROCESSOR(spridr)	(!(spridr & 0x00010000))
    #endif
    #endif
    
    
    #define IS_SVR_REV(svr, maj, min) \
    	((SVR_MAJ(svr) == maj) && (SVR_MIN(svr) == min))
    
    
     * SVR_SOC_VER() Version Values
    
    #define SVR_8533	0x803400
    #define SVR_8533_E	0x803C00
    
    #define SVR_8535	0x803701
    #define SVR_8535_E	0x803F01
    
    #define SVR_8536	0x803700
    #define SVR_8536_E	0x803F00
    
    #define SVR_8540	0x803000
    #define SVR_8541	0x807200
    #define SVR_8541_E	0x807A00
    #define SVR_8543	0x803200
    #define SVR_8543_E	0x803A00
    #define SVR_8544	0x803401
    #define SVR_8544_E	0x803C01
    #define SVR_8545	0x803102
    #define SVR_8545_E	0x803902
    #define SVR_8547_E	0x803901
    #define SVR_8548	0x803100
    #define SVR_8548_E	0x803900
    #define SVR_8555	0x807100
    #define SVR_8555_E	0x807900
    #define SVR_8560	0x807000
    
    #define SVR_8567	0x807501
    #define SVR_8567_E	0x807D01
    
    #define SVR_8568	0x807500
    #define SVR_8568_E	0x807D00
    
    #define SVR_8569	0x808000
    #define SVR_8569_E	0x808800
    
    #define SVR_8572	0x80E000
    #define SVR_8572_E	0x80E800
    
    #define SVR_P1010	0x80F100
    #define SVR_P1010_E	0x80F900
    
    #define SVR_P1011	0x80E500
    #define SVR_P1011_E	0x80ED00
    
    #define SVR_P1012	0x80E501
    #define SVR_P1012_E	0x80ED01
    #define SVR_P1013	0x80E700
    #define SVR_P1013_E	0x80EF00
    
    #define SVR_P1014	0x80F101
    #define SVR_P1014_E	0x80F901
    
    #define SVR_P1020	0x80E400
    #define SVR_P1020_E	0x80EC00
    
    #define SVR_P1021	0x80E401
    #define SVR_P1021_E	0x80EC01
    #define SVR_P1022	0x80E600
    #define SVR_P1022_E	0x80EE00
    
    #define SVR_P2010	0x80E300
    #define SVR_P2010_E	0x80EB00
    #define SVR_P2020	0x80E200
    #define SVR_P2020_E	0x80EA00
    
    #define SVR_P3041	0x821103
    #define SVR_P3041_E	0x821903
    
    #define SVR_P4040	0x820100
    #define SVR_P4040_E	0x820900
    #define SVR_P4080	0x820000
    #define SVR_P4080_E	0x820800
    
    #define SVR_P5010	0x822100
    #define SVR_P5010_E	0x822900
    #define SVR_P5020	0x822000
    #define SVR_P5020_E	0x822800
    
    
    #define SVR_8610	0x80A000
    #define SVR_8641	0x809000
    #define SVR_8641D	0x809001
    
    
    #define SVR_Unknown	0xFFFFFF
    
    
    Wolfgang Denk's avatar
    Wolfgang Denk committed
    #define _GLOBAL(n)\
    	.globl n;\
    n:
    
    /* Macros for setting and retrieving special purpose registers */
    
    #define stringify(s)	tostring(s)
    #define tostring(s)	#s
    
    #define mfdcr(rn)	({unsigned int rval; \
    			asm volatile("mfdcr %0," stringify(rn) \
    				     : "=r" (rval)); rval;})
    #define mtdcr(rn, v)	asm volatile("mtdcr " stringify(rn) ",%0" : : "r" (v))
    
    #define mfmsr()		({unsigned int rval; \
    			asm volatile("mfmsr %0" : "=r" (rval)); rval;})
    #define mtmsr(v)	asm volatile("mtmsr %0" : : "r" (v))
    
    #define mfspr(rn)	({unsigned int rval; \
    			asm volatile("mfspr %0," stringify(rn) \
    				     : "=r" (rval)); rval;})
    #define mtspr(rn, v)	asm volatile("mtspr " stringify(rn) ",%0" : : "r" (v))
    
    #define tlbie(v)	asm volatile("tlbie %0 \n sync" : : "r" (v))
    
    /* Segment Registers */
    
    #define SR0	0
    #define SR1	1
    #define SR2	2
    #define SR3	3
    #define SR4	4
    #define SR5	5
    #define SR6	6
    #define SR7	7
    #define SR8	8
    #define SR9	9
    #define SR10	10
    #define SR11	11
    #define SR12	12
    #define SR13	13
    #define SR14	14
    #define SR15	15
    
    #ifndef __ASSEMBLY__
    
    
    struct cpu_type {
    	char name[15];
    	u32 soc_ver;
    
    Anatolij Gustschin's avatar
    Anatolij Gustschin committed
    struct cpu_type *identify_cpu(u32 ver);
    
    #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
    
    #define CPU_TYPE_ENTRY(n, v, nc) \
    	{ .name = #n, .soc_ver = SVR_##v, .num_cores = (nc), }
    
    #if defined(CONFIG_MPC83xx)
    
    #define CPU_TYPE_ENTRY(x) {#x, SPR_##x}
    #endif
    #endif
    
    
    Wolfgang Denk's avatar
    Wolfgang Denk committed
    #ifndef CONFIG_MACH_SPECIFIC
    extern int _machine;
    extern int have_of;
    #endif /* CONFIG_MACH_SPECIFIC */
    
    /* what kind of prep workstation we are */
    extern int _prep_type;
    /*
     * This is used to identify the board type from a given PReP board
     * vendor. Board revision is also made available.
     */
    extern unsigned char ucSystemType;
    extern unsigned char ucBoardRev;
    extern unsigned char ucBoardRevMaj, ucBoardRevMin;
    
    struct task_struct;
    void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp);
    void release_thread(struct task_struct *);
    
    /*
     * Create a new kernel thread.
     */
    extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
    
    /*
     * Bus types
     */
    #define EISA_bus 0
    #define EISA_bus__is_a_macro /* for versions in ksyms.c */
    #define MCA_bus 0
    #define MCA_bus__is_a_macro /* for versions in ksyms.c */
    
    /* Lazy FPU handling on uni-processor */
    extern struct task_struct *last_task_used_math;
    extern struct task_struct *last_task_used_altivec;
    
    /*
     * this is the minimum allowable io space due to the location
     * of the io areas on prep (first one at 0x80000000) but
     * as soon as I get around to remapping the io areas with the BATs
     * to match the mac we can raise this. -- Cort
     */
    #define TASK_SIZE	(0x80000000UL)
    
    /* This decides where the kernel will search for a free chunk of vm
     * space during mmap's.
     */
    #define TASK_UNMAPPED_BASE	(TASK_SIZE / 8 * 3)
    
    typedef struct {
    	unsigned long seg;
    } mm_segment_t;
    
    struct thread_struct {
    	unsigned long	ksp;		/* Kernel stack pointer */
    	unsigned long	wchan;		/* Event task is sleeping on */
    	struct pt_regs	*regs;		/* Pointer to saved register state */
    	mm_segment_t	fs;		/* for get_fs() validation */
    	void		*pgdir;		/* root of page-table tree */
    
    	signed long	last_syscall;
    
    Wolfgang Denk's avatar
    Wolfgang Denk committed
    	double		fpr[32];	/* Complete floating point set */
    	unsigned long	fpscr_pad;	/* fpr ... fpscr must be contiguous */
    	unsigned long	fpscr;		/* Floating point status */
    #ifdef CONFIG_ALTIVEC
    	vector128	vr[32];		/* Complete AltiVec set */
    	vector128	vscr;		/* AltiVec status */
    	unsigned long	vrsave;
    #endif /* CONFIG_ALTIVEC */
    };
    
    #define INIT_SP		(sizeof(init_stack) + (unsigned long) &init_stack)
    
    #define INIT_THREAD  { \
    	INIT_SP, /* ksp */ \
    	0, /* wchan */ \
    	(struct pt_regs *)INIT_SP - 1, /* regs */ \
    	KERNEL_DS, /*fs*/ \
    	swapper_pg_dir, /* pgdir */ \
    	0, /* last_syscall */ \
    	{0}, 0, 0 \
    }
    
    /*
     * Note: the vm_start and vm_end fields here should *not*
    
     * be in kernel space.	(Could vm_end == vm_start perhaps?)
    
    Wolfgang Denk's avatar
    Wolfgang Denk committed
     */
    #define INIT_MMAP { &init_mm, 0, 0x1000, NULL, \
    		    PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, \
    		    1, NULL, NULL }
    
    /*
     * Return saved PC of a blocked thread. For now, this is the "user" PC
     */
    static inline unsigned long thread_saved_pc(struct thread_struct *t)
    {
    	return (t->regs) ? t->regs->nip : 0;
    }
    
    #define copy_segments(tsk, mm)		do { } while (0)
    #define release_segments(mm)		do { } while (0)
    #define forget_segments()		do { } while (0)
    
    unsigned long get_wchan(struct task_struct *p);
    
    #define KSTK_EIP(tsk)  ((tsk)->thread.regs->nip)
    #define KSTK_ESP(tsk)  ((tsk)->thread.regs->gpr[1])
    
    /*
     * NOTE! The task struct and the stack go together
     */
    #define THREAD_SIZE (2*PAGE_SIZE)
    #define alloc_task_struct() \
    	((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
    #define free_task_struct(p)	free_pages((unsigned long)(p),1)
    
    #define get_task_struct(tsk)	  atomic_inc(&mem_map[MAP_NR(tsk)].count)
    
    Wolfgang Denk's avatar
    Wolfgang Denk committed
    
    /* in process.c - for early bootup debug -- Cort */
    int ll_printk(const char *, ...);
    void ll_puts(const char *);
    
    #define init_task	(init_task_union.task)
    #define init_stack	(init_task_union.stack)
    
    /* In misc.c */
    void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
    
    #endif /* ndef ASSEMBLY*/
    
    #ifdef CONFIG_MACH_SPECIFIC
    #if defined(CONFIG_8xx)
    #define _machine _MACH_8xx
    #define have_of 0
    #elif defined(CONFIG_OAK)
    #define _machine _MACH_oak
    #define have_of	0
    #elif defined(CONFIG_WALNUT)
    #define _machine _MACH_walnut
    #define have_of 0
    #elif defined(CONFIG_APUS)
    #define _machine _MACH_apus
    #define have_of 0
    #elif defined(CONFIG_GEMINI)
    #define _machine _MACH_gemini
    #define have_of 0
    #elif defined(CONFIG_8260)
    #define _machine _MACH_8260
    #define have_of 0
    #elif defined(CONFIG_SANDPOINT)
    #define _machine _MACH_sandpoint
    
    #elif defined(CONFIG_HIDDEN_DRAGON)
    #define _machine _MACH_hidden_dragon
    
    Wolfgang Denk's avatar
    Wolfgang Denk committed
    #define have_of 0
    #else
    #error "Machine not defined correctly"
    #endif
    #endif /* CONFIG_MACH_SPECIFIC */
    
    #endif /* __ASM_PPC_PROCESSOR_H */