Home | History | Annotate | Line # | Download | only in include
alpha_cpu.h revision 1.37
      1  1.37  thorpej /* $NetBSD: alpha_cpu.h,v 1.37 2000/03/05 18:46:14 thorpej Exp $ */
      2   1.1      cgd 
      3   1.1      cgd /*
      4   1.1      cgd  * Copyright (c) 1996 Carnegie-Mellon University.
      5   1.1      cgd  * All rights reserved.
      6   1.1      cgd  *
      7   1.1      cgd  * Author: Chris G. Demetriou
      8   1.1      cgd  *
      9   1.1      cgd  * Permission to use, copy, modify and distribute this software and
     10   1.1      cgd  * its documentation is hereby granted, provided that both the copyright
     11   1.1      cgd  * notice and this permission notice appear in all copies of the
     12   1.1      cgd  * software, derivative works or modified versions, and any portions
     13   1.1      cgd  * thereof, and that both notices appear in supporting documentation.
     14   1.1      cgd  *
     15   1.1      cgd  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16   1.1      cgd  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17   1.1      cgd  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18   1.1      cgd  *
     19   1.1      cgd  * Carnegie Mellon requests users of this software to return to
     20   1.1      cgd  *
     21   1.1      cgd  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22   1.1      cgd  *  School of Computer Science
     23   1.1      cgd  *  Carnegie Mellon University
     24   1.1      cgd  *  Pittsburgh PA 15213-3890
     25   1.1      cgd  *
     26   1.1      cgd  * any improvements or extensions that they make and grant Carnegie the
     27   1.1      cgd  * rights to redistribute these changes.
     28   1.1      cgd  */
     29   1.1      cgd 
     30   1.1      cgd #ifndef __ALPHA_ALPHA_CPU_H__
     31   1.1      cgd #define	__ALPHA_ALPHA_CPU_H__
     32   1.1      cgd 
     33   1.1      cgd /*
     34   1.1      cgd  * Alpha CPU + OSF/1 PALcode definitions for use by the kernel.
     35   1.1      cgd  *
     36   1.1      cgd  * Definitions for:
     37   1.1      cgd  *
     38   1.2      cgd  *	Process Control Block
     39   1.2      cgd  *	Interrupt/Exception/Syscall Stack Frame
     40   1.1      cgd  *	Processor Status Register
     41   1.2      cgd  *	Machine Check Error Summary Register
     42   1.2      cgd  *	Machine Check Logout Area
     43  1.19   mjacob  *	Per CPU state Management of Machine Check Handling
     44   1.1      cgd  *	Virtual Memory Management
     45   1.4      cgd  *	Kernel Entry Vectors
     46   1.4      cgd  *	MMCSR Fault Type Codes
     47   1.1      cgd  *	Translation Buffer Invalidation
     48   1.1      cgd  *
     49   1.1      cgd  * and miscellaneous PALcode operations.
     50   1.1      cgd  */
     51   1.1      cgd 
     52   1.1      cgd 
     53   1.1      cgd /*
     54   1.2      cgd  * Process Control Block definitions [OSF/1 PALcode Specific]
     55   1.2      cgd  */
     56   1.2      cgd 
     57   1.2      cgd struct alpha_pcb {
     58   1.2      cgd 	unsigned long	apcb_ksp;	/* kernel stack ptr */
     59   1.2      cgd 	unsigned long	apcb_usp;	/* user stack ptr */
     60   1.2      cgd 	unsigned long	apcb_ptbr;	/* page table base reg */
     61   1.2      cgd 	unsigned int	apcb_cpc;	/* charged process cycles */
     62   1.2      cgd 	unsigned int	apcb_asn;	/* address space number */
     63   1.2      cgd 	unsigned long	apcb_unique;	/* process unique value */
     64  1.29  thorpej #define	apcb_backup_ksp	apcb_unique	/* backup kernel stack ptr */
     65   1.2      cgd 	unsigned long	apcb_flags;	/* flags; see below */
     66   1.2      cgd 	unsigned long	apcb_decrsv0;	/* DEC reserved */
     67   1.2      cgd 	unsigned long	apcb_decrsv1;	/* DEC reserved */
     68   1.2      cgd };
     69   1.2      cgd 
     70   1.2      cgd #define	ALPHA_PCB_FLAGS_FEN	0x0000000000000001
     71   1.2      cgd #define	ALPHA_PCB_FLAGS_PME	0x4000000000000000
     72   1.2      cgd 
     73   1.2      cgd /*
     74   1.3      cgd  * Interrupt/Exception/Syscall "Hardware" (really PALcode)
     75   1.3      cgd  * Stack Frame definitions
     76   1.3      cgd  *
     77   1.3      cgd  * These are quadword offsets from the sp on kernel entry, i.e.
     78   1.3      cgd  * to get to the value in question you access (sp + (offset * 8)).
     79   1.3      cgd  *
     80   1.3      cgd  * On syscall entry, A0-A2 aren't written to memory but space
     81   1.3      cgd  * _is_ reserved for them.
     82   1.2      cgd  */
     83   1.2      cgd 
     84   1.3      cgd #define	ALPHA_HWFRAME_PS	0	/* processor status register */
     85   1.3      cgd #define	ALPHA_HWFRAME_PC	1	/* program counter */
     86   1.3      cgd #define	ALPHA_HWFRAME_GP	2	/* global pointer */
     87   1.3      cgd #define	ALPHA_HWFRAME_A0	3	/* a0 */
     88   1.3      cgd #define	ALPHA_HWFRAME_A1	4	/* a1 */
     89   1.3      cgd #define	ALPHA_HWFRAME_A2	5	/* a2 */
     90   1.3      cgd 
     91   1.3      cgd #define	ALPHA_HWFRAME_SIZE	6	/* 6 8-byte words */
     92   1.2      cgd 
     93   1.2      cgd /*
     94   1.1      cgd  * Processor Status Register [OSF/1 PALcode Specific]
     95   1.1      cgd  *
     96   1.1      cgd  * Includes user/kernel mode bit, interrupt priority levels, etc.
     97   1.1      cgd  */
     98   1.1      cgd 
     99   1.1      cgd #define	ALPHA_PSL_USERMODE	0x0008		/* set -> user mode */
    100   1.1      cgd #define	ALPHA_PSL_IPL_MASK	0x0007		/* interrupt level mask */
    101   1.1      cgd 
    102   1.1      cgd #define	ALPHA_PSL_IPL_0		0x0000		/* all interrupts enabled */
    103   1.1      cgd #define	ALPHA_PSL_IPL_SOFT	0x0001		/* software ints disabled */
    104   1.1      cgd #define	ALPHA_PSL_IPL_IO	0x0004		/* I/O dev ints disabled */
    105   1.1      cgd #define	ALPHA_PSL_IPL_CLOCK	0x0005		/* clock ints disabled */
    106   1.1      cgd #define	ALPHA_PSL_IPL_HIGH	0x0006		/* all but mchecks disabled */
    107   1.1      cgd 
    108   1.1      cgd #define	ALPHA_PSL_MUST_BE_ZERO	0xfffffffffffffff0
    109   1.1      cgd 
    110   1.1      cgd /* Convenience constants: what must be set/clear in user mode */
    111   1.1      cgd #define	ALPHA_PSL_USERSET	ALPHA_PSL_USERMODE
    112   1.1      cgd #define	ALPHA_PSL_USERCLR	(ALPHA_PSL_MUST_BE_ZERO | ALPHA_PSL_IPL_MASK)
    113  1.15   mjacob 
    114  1.15   mjacob /*
    115  1.15   mjacob  * Interrupt Type Code Definitions [OSF/1 PALcode Specific]
    116  1.15   mjacob  */
    117  1.15   mjacob 
    118  1.15   mjacob #define	ALPHA_INTR_XPROC	0	/* interprocessor interrupt */
    119  1.15   mjacob #define	ALPHA_INTR_CLOCK	1	/* clock interrupt */
    120  1.15   mjacob #define	ALPHA_INTR_ERROR	2	/* correctable error or mcheck */
    121  1.15   mjacob #define	ALPHA_INTR_DEVICE	3	/* device interrupt */
    122  1.15   mjacob #define	ALPHA_INTR_PERF		4	/* performance counter */
    123  1.15   mjacob #define	ALPHA_INTR_PASSIVE	5	/* passive release */
    124   1.1      cgd 
    125   1.2      cgd /*
    126   1.2      cgd  * Machine Check Error Summary Register definitions [OSF/1 PALcode Specific]
    127   1.4      cgd  *
    128   1.4      cgd  * The following bits are values as read.  On write, _PCE, _SCE, and
    129   1.4      cgd  * _MIP are "write 1 to clear."
    130   1.2      cgd  */
    131   1.1      cgd 
    132   1.2      cgd #define	ALPHA_MCES_IMP							\
    133   1.2      cgd     0xffffffff00000000	/* impl. dependent */
    134   1.2      cgd #define	ALPHA_MCES_RSVD							\
    135   1.2      cgd     0x00000000ffffffe0	/* reserved */
    136   1.2      cgd #define	ALPHA_MCES_DSC							\
    137   1.2      cgd     0x0000000000000010	/* disable system correctable error reporting */
    138   1.2      cgd #define	ALPHA_MCES_DPC							\
    139   1.2      cgd     0x0000000000000008	/* disable processor correctable error reporting */
    140   1.2      cgd #define	ALPHA_MCES_PCE							\
    141   1.2      cgd     0x0000000000000004	/* processor correctable error in progress */
    142   1.2      cgd #define	ALPHA_MCES_SCE							\
    143   1.2      cgd     0x0000000000000002	/* system correctable error in progress */
    144   1.2      cgd #define	ALPHA_MCES_MIP							\
    145   1.2      cgd     0x0000000000000001	/* machine check in progress */
    146   1.2      cgd 
    147   1.2      cgd /*
    148   1.2      cgd  * Machine Check Error Summary Register definitions [OSF/1 PALcode Specific]
    149  1.19   mjacob  *
    150  1.19   mjacob  * Note that these are *generic* OSF/1 PALcode specific defines. There are
    151  1.19   mjacob  * platform variations to these entities.
    152   1.2      cgd  */
    153   1.2      cgd 
    154   1.2      cgd struct alpha_logout_area {
    155   1.2      cgd 	unsigned int	la_frame_size;		/* frame size */
    156   1.2      cgd 	unsigned int	la_flags;		/* flags; see below */
    157   1.2      cgd 	unsigned int	la_cpu_offset;		/* offset to cpu area */
    158   1.2      cgd 	unsigned int	la_system_offset;	/* offset to system area */
    159   1.2      cgd };
    160   1.2      cgd 
    161   1.2      cgd #define	ALPHA_LOGOUT_FLAGS_RETRY	0x80000000	/* OK to continue */
    162   1.2      cgd #define	ALPHA_LOGOUT_FLAGS_SE		0x40000000	/* second error */
    163   1.2      cgd #define	ALPHA_LOGOUT_FLAGS_SBZ		0x3fffffff	/* should be zero */
    164   1.2      cgd 
    165   1.2      cgd #define	ALPHA_LOGOUT_NOT_BUILT						\
    166   1.2      cgd     (struct alpha_logout_area *)0xffffffffffffffff)
    167   1.2      cgd 
    168   1.2      cgd #define	ALPHA_LOGOUT_PAL_AREA(lap)					\
    169   1.2      cgd     (unsigned long *)((unsigned char *)(lap) + 16)
    170   1.2      cgd #define	ALPHA_LOGOUT_PAL_SIZE(lap)					\
    171   1.2      cgd     ((lap)->la_cpu_offset - 16)
    172   1.2      cgd #define	ALPHA_LOGOUT_CPU_AREA(lap)					\
    173   1.2      cgd     (unsigned long *)((unsigned char *)(lap) + (lap)->la_cpu_offset)
    174   1.2      cgd #define	ALPHA_LOGOUT_CPU_SIZE(lap)					\
    175   1.2      cgd     ((lap)->la_system_offset - (lap)->la_cpu_offset)
    176   1.2      cgd #define	ALPHA_LOGOUT_SYSTEM_AREA(lap)					\
    177   1.2      cgd     (unsigned long *)((unsigned char *)(lap) + (lap)->la_system_offset)
    178   1.2      cgd #define	ALPHA_LOGOUT_SYSTEM_SIZE(lap)					\
    179   1.2      cgd     ((lap)->la_frame_size - (lap)->la_system_offset)
    180  1.19   mjacob 
    181  1.19   mjacob /* types of machine checks */
    182  1.19   mjacob #define	ALPHA_SYS_ERROR		0x620	/* System correctable error	*/
    183  1.19   mjacob #define	ALPHA_PROC_ERROR	0x630	/* Processor correctable error	*/
    184  1.19   mjacob #define	ALPHA_SYS_MCHECK	0x660	/* System machine check		*/
    185  1.19   mjacob #define	ALPHA_PROC_MCHECK	0x670	/* Processor machine check	*/
    186  1.19   mjacob 
    187   1.1      cgd /*
    188   1.2      cgd  * Virtual Memory Management definitions [OSF/1 PALcode Specific]
    189   1.1      cgd  *
    190   1.1      cgd  * Includes user and kernel space addresses and information,
    191   1.1      cgd  * page table entry definitions, etc.
    192   1.1      cgd  *
    193   1.1      cgd  * NOTE THAT THESE DEFINITIONS MAY CHANGE IN FUTURE ALPHA CPUS!
    194   1.1      cgd  */
    195   1.1      cgd 
    196   1.1      cgd #define	ALPHA_PGSHIFT		13
    197   1.2      cgd #define	ALPHA_PGBYTES		(1 << ALPHA_PGSHIFT)
    198   1.1      cgd 
    199   1.1      cgd #define	ALPHA_USEG_BASE		0			/* virtual */
    200   1.1      cgd #define	ALPHA_USEG_END		0x000003ffffffffff
    201   1.1      cgd 
    202   1.1      cgd #define	ALPHA_K0SEG_BASE	0xfffffc0000000000	/* direct-mapped */
    203   1.6      cgd #define	ALPHA_K0SEG_END		0xfffffdffffffffff
    204   1.6      cgd #define	ALPHA_K1SEG_BASE	0xfffffe0000000000	/* virtual */
    205   1.1      cgd #define	ALPHA_K1SEG_END		0xffffffffffffffff
    206   1.1      cgd 
    207   1.7      cgd #define ALPHA_K0SEG_TO_PHYS(x)	((x) & ~ALPHA_K0SEG_BASE)
    208   1.1      cgd #define ALPHA_PHYS_TO_K0SEG(x)	((x) | ALPHA_K0SEG_BASE)
    209   1.1      cgd 
    210   1.1      cgd #define	ALPHA_PTE_VALID			0x0001
    211   1.1      cgd 
    212   1.1      cgd #define	ALPHA_PTE_FAULT_ON_READ		0x0002
    213   1.1      cgd #define	ALPHA_PTE_FAULT_ON_WRITE	0x0004
    214   1.1      cgd #define	ALPHA_PTE_FAULT_ON_EXECUTE	0x0008
    215   1.1      cgd 
    216   1.1      cgd #define	ALPHA_PTE_ASM			0x0010		/* addr. space match */
    217   1.1      cgd #define	ALPHA_PTE_GRANULARITY		0x0060		/* granularity hint */
    218   1.1      cgd 
    219   1.1      cgd #define	ALPHA_PTE_PROT			0xff00
    220   1.1      cgd #define	ALPHA_PTE_KR			0x0100
    221   1.1      cgd #define	ALPHA_PTE_UR			0x0200
    222   1.1      cgd #define	ALPHA_PTE_KW			0x1000
    223   1.1      cgd #define	ALPHA_PTE_UW			0x2000
    224   1.1      cgd 
    225  1.10  thorpej #define	ALPHA_PTE_WRITE			(ALPHA_PTE_KW | ALPHA_PTE_UW)
    226   1.1      cgd 
    227  1.20  thorpej #define	ALPHA_PTE_SOFTWARE		0x00000000ffff0000
    228  1.21  thorpej #define	ALPHA_PTE_PALCODE		(~ALPHA_PTE_SOFTWARE) /* shorthand */
    229   1.1      cgd 
    230   1.1      cgd #define	ALPHA_PTE_PFN			0xffffffff00000000
    231   1.1      cgd 
    232   1.1      cgd #define	ALPHA_PTE_TO_PFN(pte)		((pte) >> 32)
    233   1.1      cgd #define	ALPHA_PTE_FROM_PFN(pfn)		((pfn) << 32)
    234   1.1      cgd 
    235   1.1      cgd typedef unsigned long alpha_pt_entry_t;
    236   1.1      cgd 
    237   1.4      cgd /*
    238   1.4      cgd  * Kernel Entry Vectors.  [OSF/1 PALcode Specific]
    239   1.4      cgd  */
    240   1.4      cgd 
    241   1.4      cgd #define	ALPHA_KENTRY_INT	0
    242   1.4      cgd #define	ALPHA_KENTRY_ARITH	1
    243   1.4      cgd #define	ALPHA_KENTRY_MM		2
    244   1.4      cgd #define	ALPHA_KENTRY_IF		3
    245   1.4      cgd #define	ALPHA_KENTRY_UNA	4
    246   1.4      cgd #define	ALPHA_KENTRY_SYS	5
    247   1.4      cgd 
    248   1.4      cgd /*
    249   1.4      cgd  * MMCSR Fault Type Codes.  [OSF/1 PALcode Specific]
    250   1.4      cgd  */
    251   1.4      cgd 
    252   1.4      cgd #define	ALPHA_MMCSR_INVALTRANS	0
    253   1.4      cgd #define	ALPHA_MMCSR_ACCESS	1
    254   1.4      cgd #define	ALPHA_MMCSR_FOR		2
    255   1.4      cgd #define	ALPHA_MMCSR_FOE		3
    256   1.4      cgd #define	ALPHA_MMCSR_FOW		4
    257   1.4      cgd 
    258   1.4      cgd /*
    259   1.4      cgd  * Instruction Fault Type Codes.  [OSF/1 PALcode Specific]
    260   1.4      cgd  */
    261   1.4      cgd 
    262   1.4      cgd #define	ALPHA_IF_CODE_BPT	0
    263   1.4      cgd #define	ALPHA_IF_CODE_BUGCHK	1
    264   1.4      cgd #define	ALPHA_IF_CODE_GENTRAP	2
    265   1.4      cgd #define	ALPHA_IF_CODE_FEN	3
    266   1.4      cgd #define	ALPHA_IF_CODE_OPDEC	4
    267   1.1      cgd 
    268   1.1      cgd /*
    269   1.2      cgd  * Translation Buffer Invalidation definitions [OSF/1 PALcode Specific]
    270   1.1      cgd  */
    271   1.1      cgd 
    272   1.5      cgd #define	ALPHA_TBIA()	alpha_pal_tbi(-2, 0)		/* all TB entries */
    273   1.5      cgd #define	ALPHA_TBIAP()	alpha_pal_tbi(-1, 0)		/* all per-process */
    274   1.5      cgd #define	ALPHA_TBISI(va)	alpha_pal_tbi(1, (va))		/* ITB entry for va */
    275   1.5      cgd #define	ALPHA_TBISD(va)	alpha_pal_tbi(2, (va))		/* DTB entry for va */
    276   1.5      cgd #define	ALPHA_TBIS(va)	alpha_pal_tbi(3, (va))		/* all for va */
    277   1.1      cgd 
    278   1.1      cgd /*
    279  1.12  thorpej  * Bits used in the amask instruction [EV56 and later]
    280  1.12  thorpej  */
    281  1.12  thorpej 
    282  1.12  thorpej #define	ALPHA_AMASK_BWX		0x0001		/* byte/word extension */
    283  1.12  thorpej #define	ALPHA_AMASK_CIX		0x0002		/* count extension */
    284  1.12  thorpej #define	ALPHA_AMASK_MAX		0x0100		/* multimedia extension */
    285  1.12  thorpej 
    286  1.12  thorpej /*
    287  1.12  thorpej  * Chip family IDs returned by implver instruction
    288  1.12  thorpej  */
    289  1.12  thorpej 
    290  1.12  thorpej #define	ALPHA_IMPLVER_EV4	0		/* LCA/EV4/EV45 */
    291  1.12  thorpej #define	ALPHA_IMPLVER_EV5	1		/* EV5/EV56/PCA56 */
    292  1.12  thorpej #define	ALPHA_IMPLVER_EV6	2		/* EV6 */
    293  1.24  thorpej 
    294  1.24  thorpej /*
    295  1.24  thorpej  * Maximum processor ID we allow from `whami', and related constants.
    296  1.24  thorpej  *
    297  1.24  thorpej  * XXX This is not really processor or PALcode specific, but this is
    298  1.24  thorpej  * a convenient place to put these definitions.
    299  1.24  thorpej  *
    300  1.24  thorpej  * XXX This is clipped at 63 so that we can use `long's for proc bitmasks.
    301  1.24  thorpej  */
    302  1.24  thorpej 
    303  1.24  thorpej #define	ALPHA_WHAMI_MAXID	63
    304  1.24  thorpej #define	ALPHA_MAXPROCS		(ALPHA_WHAMI_MAXID + 1)
    305  1.16  thorpej 
    306  1.16  thorpej /*
    307  1.16  thorpej  * Misc. support routines.
    308  1.16  thorpej  */
    309  1.16  thorpej const char	*alpha_dsr_sysname __P((void));
    310  1.12  thorpej 
    311  1.12  thorpej /*
    312   1.1      cgd  * Stubs for Alpha instructions normally inaccessible from C.
    313   1.1      cgd  */
    314  1.14  thorpej unsigned long	alpha_amask __P((unsigned long));
    315  1.14  thorpej unsigned long	alpha_implver __P((void));
    316  1.32  thorpej 
    317  1.32  thorpej static __inline unsigned long alpha_rpcc __P((void))
    318  1.32  thorpej 	__attribute__((__unused__));
    319  1.32  thorpej 
    320  1.32  thorpej static __inline unsigned long
    321  1.32  thorpej alpha_rpcc()
    322  1.32  thorpej {
    323  1.32  thorpej 	unsigned long v0;
    324  1.32  thorpej 
    325  1.32  thorpej 	__asm __volatile("rpcc %0" : "=r" (v0));
    326  1.32  thorpej 	return (v0);
    327  1.32  thorpej }
    328  1.32  thorpej 
    329  1.33  thorpej #define	alpha_mb()	__asm __volatile("mb" : : : "memory")
    330  1.33  thorpej #define	alpha_wmb()	__asm __volatile("mb" : : : "memory")	/* XXX */
    331   1.1      cgd 
    332   1.1      cgd /*
    333   1.1      cgd  * Stubs for OSF/1 PALcode operations.
    334   1.1      cgd  */
    335  1.33  thorpej #include <machine/pal.h>
    336  1.33  thorpej 
    337  1.11  thorpej void		alpha_pal_cflush __P((unsigned long));
    338   1.2      cgd void		alpha_pal_halt __P((void)) __attribute__((__noreturn__));
    339   1.4      cgd unsigned long	_alpha_pal_swpipl __P((unsigned long));	/* for profiling */
    340   1.2      cgd void		alpha_pal_wrent __P((void *, unsigned long));
    341   1.2      cgd void		alpha_pal_wrvptptr __P((unsigned long));
    342  1.32  thorpej 
    343  1.36  thorpej static __inline unsigned long alpha_pal_rdmces __P((void))
    344  1.36  thorpej 	__attribute__((__unused__));
    345  1.32  thorpej static __inline unsigned long alpha_pal_rdps __P((void))
    346  1.32  thorpej 	__attribute__((__unused__));
    347  1.36  thorpej static __inline unsigned long alpha_pal_rdusp __P((void))
    348  1.36  thorpej 	__attribute__((__unused__));
    349  1.36  thorpej static __inline unsigned long alpha_pal_rdval __P((void))
    350  1.36  thorpej 	__attribute__((__unused__));
    351  1.36  thorpej static __inline unsigned long alpha_pal_swpctx __P((unsigned long))
    352  1.36  thorpej 	__attribute__((__unused__));
    353  1.32  thorpej static __inline unsigned long alpha_pal_swpipl __P((unsigned long))
    354  1.32  thorpej 	__attribute__((__unused__));
    355  1.32  thorpej static __inline void alpha_pal_tbi __P((unsigned long, vaddr_t))
    356  1.32  thorpej 	__attribute__((__unused__));
    357  1.32  thorpej static __inline unsigned long alpha_pal_whami __P((void))
    358  1.32  thorpej 	__attribute__((__unused__));
    359  1.36  thorpej static __inline void alpha_pal_wrfen __P((unsigned long))
    360  1.36  thorpej 	__attribute__((__unused__));
    361  1.36  thorpej static __inline void alpha_pal_wripir __P((unsigned long))
    362  1.36  thorpej 	__attribute__((__unused__));
    363  1.36  thorpej static __inline void alpha_pal_wrusp __P((unsigned long))
    364  1.36  thorpej 	__attribute__((__unused__));
    365  1.36  thorpej static __inline void alpha_pal_wrmces __P((unsigned long))
    366  1.36  thorpej 	__attribute__((__unused__));
    367  1.36  thorpej static __inline void alpha_pal_wrval __P((unsigned long))
    368  1.36  thorpej 	__attribute__((__unused__));
    369  1.32  thorpej 
    370  1.36  thorpej #define	alpha_pal_draina() __asm __volatile("call_pal %0 # PAL_draina"	\
    371  1.36  thorpej 				: : "i" (PAL_draina) : "memory")
    372  1.36  thorpej 
    373  1.36  thorpej #define	alpha_pal_imb()	__asm __volatile("call_pal %0 # PAL_imb"	\
    374  1.33  thorpej 				: : "i" (PAL_imb) : "memory")
    375  1.32  thorpej 
    376  1.32  thorpej static __inline unsigned long
    377  1.36  thorpej alpha_pal_rdmces()
    378  1.36  thorpej {
    379  1.36  thorpej 	register unsigned long v0 __asm("$0");
    380  1.36  thorpej 
    381  1.36  thorpej 	__asm __volatile("call_pal %1 # PAL_OSF1_rdmces"
    382  1.36  thorpej 		: "=r" (v0)
    383  1.36  thorpej 		: "i" (PAL_OSF1_rdmces)
    384  1.36  thorpej 		/* clobbers t0, t8..t11 */
    385  1.36  thorpej 		: "$1", "$22", "$23", "$24", "$25");
    386  1.36  thorpej 
    387  1.36  thorpej 	return (v0);
    388  1.36  thorpej }
    389  1.36  thorpej 
    390  1.36  thorpej static __inline unsigned long
    391  1.32  thorpej alpha_pal_rdps()
    392  1.32  thorpej {
    393  1.32  thorpej 	register unsigned long v0 __asm("$0");
    394  1.32  thorpej 
    395  1.36  thorpej 	__asm __volatile("call_pal %1 # PAL_OSF1_rdps"
    396  1.32  thorpej 		: "=r" (v0)
    397  1.33  thorpej 		: "i" (PAL_OSF1_rdps)
    398  1.32  thorpej 		/* clobbers t0, t8..t11 */
    399  1.32  thorpej 		: "$1", "$22", "$23", "$24", "$25");
    400  1.32  thorpej 
    401  1.32  thorpej 	return (v0);
    402  1.32  thorpej }
    403  1.32  thorpej 
    404  1.32  thorpej static __inline unsigned long
    405  1.36  thorpej alpha_pal_rdusp()
    406  1.36  thorpej {
    407  1.36  thorpej 	register unsigned long v0 __asm("$0");
    408  1.36  thorpej 
    409  1.36  thorpej 	__asm __volatile("call_pal %1 # PAL_OSF1_rdusp"
    410  1.36  thorpej 		: "=r" (v0)
    411  1.36  thorpej 		: "i" (PAL_OSF1_rdusp)
    412  1.36  thorpej 		/* clobbers t0, t8..t11 */
    413  1.36  thorpej 		: "$1", "$22", "$23", "$24", "$25");
    414  1.36  thorpej 
    415  1.36  thorpej 	return (v0);
    416  1.36  thorpej }
    417  1.36  thorpej 
    418  1.36  thorpej static __inline unsigned long
    419  1.36  thorpej alpha_pal_rdval()
    420  1.36  thorpej {
    421  1.36  thorpej 	register unsigned long v0 __asm("$0");
    422  1.36  thorpej 
    423  1.36  thorpej 	__asm __volatile("call_pal %1 # PAL_OSF1_rdval"
    424  1.36  thorpej 		: "=r" (v0)
    425  1.36  thorpej 		: "i" (PAL_OSF1_rdval)
    426  1.36  thorpej 		/* clobbers t0, t8..t11 */
    427  1.36  thorpej 		: "$1", "$22", "$23", "$24", "$25");
    428  1.36  thorpej 
    429  1.36  thorpej 	return (v0);
    430  1.36  thorpej }
    431  1.36  thorpej 
    432  1.36  thorpej static __inline unsigned long
    433  1.37  thorpej alpha_pal_swpctx(unsigned long ctx)
    434  1.36  thorpej {
    435  1.36  thorpej 	register unsigned long a0 __asm("$16") = ctx;
    436  1.36  thorpej 	register unsigned long v0 __asm("$0");
    437  1.36  thorpej 
    438  1.36  thorpej 	__asm __volatile("call_pal %2 # PAL_OSF1_swpctx"
    439  1.36  thorpej 		: "=r" (a0), "=r" (v0)
    440  1.36  thorpej 		: "i" (PAL_OSF1_swpctx), "0" (a0)
    441  1.36  thorpej 		/* clobbers t0, t8..t11, a0 (above) */
    442  1.36  thorpej 		: "$1", "$22", "$23", "$24", "$25");
    443  1.36  thorpej 
    444  1.36  thorpej 	return (v0);
    445  1.36  thorpej }
    446  1.36  thorpej 
    447  1.36  thorpej static __inline unsigned long
    448  1.37  thorpej alpha_pal_swpipl(unsigned long ipl)
    449  1.32  thorpej {
    450  1.32  thorpej 	register unsigned long a0 __asm("$16") = ipl;
    451  1.32  thorpej 	register unsigned long v0 __asm("$0");
    452  1.32  thorpej 
    453  1.36  thorpej 	__asm __volatile("call_pal %2 # PAL_OSF1_swpipl"
    454  1.33  thorpej 		: "=r" (a0), "=r" (v0)
    455  1.33  thorpej 		: "i" (PAL_OSF1_swpipl), "0" (a0)
    456  1.33  thorpej 		/* clobbers t0, t8..t11, a0 (above) */
    457  1.33  thorpej 		: "$1", "$22", "$23", "$24", "$25");
    458  1.32  thorpej 
    459  1.32  thorpej 	return (v0);
    460  1.32  thorpej }
    461  1.32  thorpej 
    462  1.32  thorpej static __inline void
    463  1.37  thorpej alpha_pal_tbi(unsigned long op, vaddr_t va)
    464  1.32  thorpej {
    465  1.32  thorpej 	register unsigned long a0 __asm("$16") = op;
    466  1.32  thorpej 	register unsigned long a1 __asm("$17") = va;
    467  1.32  thorpej 
    468  1.36  thorpej 	__asm __volatile("call_pal %2 # PAL_OSF1_tbi"
    469  1.33  thorpej 		: "=r" (a0), "=r" (a1)
    470  1.33  thorpej 		: "i" (PAL_OSF1_tbi), "0" (a0), "1" (a1)
    471  1.33  thorpej 		/* clobbers t0, t8..t11, a0 (above), a1 (above) */
    472  1.33  thorpej 		: "$1", "$22", "$23", "$24", "$25");
    473  1.32  thorpej }
    474  1.32  thorpej 
    475  1.32  thorpej static __inline unsigned long
    476  1.32  thorpej alpha_pal_whami()
    477  1.32  thorpej {
    478  1.32  thorpej 	register unsigned long v0 __asm("$0");
    479  1.32  thorpej 
    480  1.36  thorpej 	__asm __volatile("call_pal %1 # PAL_OSF1_whami"
    481  1.32  thorpej 		: "=r" (v0)
    482  1.33  thorpej 		: "i" (PAL_OSF1_whami)
    483  1.32  thorpej 		/* clobbers t0, t8..t11 */
    484  1.32  thorpej 		: "$1", "$22", "$23", "$24", "$25");
    485  1.32  thorpej 
    486  1.32  thorpej 	return (v0);
    487  1.36  thorpej }
    488  1.36  thorpej 
    489  1.36  thorpej static __inline void
    490  1.37  thorpej alpha_pal_wrfen(unsigned long onoff)
    491  1.36  thorpej {
    492  1.36  thorpej 	register unsigned long a0 __asm("$16") = onoff;
    493  1.36  thorpej 
    494  1.36  thorpej 	__asm __volatile("call_pal %1 # PAL_OSF1_wrfen"
    495  1.36  thorpej 		: "=r" (a0)
    496  1.36  thorpej 		: "i" (PAL_OSF1_wrfen), "0" (a0)
    497  1.36  thorpej 		/* clobbers t0, t8..t11, a0 (above) */
    498  1.36  thorpej 		: "$1", "$22", "$23", "$24", "$25");
    499  1.36  thorpej }
    500  1.36  thorpej 
    501  1.36  thorpej static __inline void
    502  1.37  thorpej alpha_pal_wripir(unsigned long cpu_id)
    503  1.36  thorpej {
    504  1.36  thorpej 	register unsigned long a0 __asm("$16") = cpu_id;
    505  1.36  thorpej 
    506  1.36  thorpej 	__asm __volatile("call_pal %1 # PAL_ipir"
    507  1.36  thorpej 		: "=r" (a0)
    508  1.36  thorpej 		: "i" (PAL_ipir), "0" (a0)
    509  1.36  thorpej 		/* clobbers t0, t8..t11, a0 (above) */
    510  1.36  thorpej 		: "$1", "$22", "$23", "$24", "$25");
    511  1.36  thorpej }
    512  1.36  thorpej 
    513  1.36  thorpej static __inline void
    514  1.37  thorpej alpha_pal_wrusp(unsigned long usp)
    515  1.36  thorpej {
    516  1.36  thorpej 	register unsigned long a0 __asm("$16") = usp;
    517  1.36  thorpej 
    518  1.36  thorpej 	__asm __volatile("call_pal %1 # PAL_OSF1_wrusp"
    519  1.36  thorpej 		: "=r" (a0)
    520  1.36  thorpej 		: "i" (PAL_OSF1_wrusp), "0" (a0)
    521  1.36  thorpej 		/* clobbers t0, t8..t11, a0 (above) */
    522  1.36  thorpej 		: "$1", "$22", "$23", "$24", "$25");
    523  1.36  thorpej }
    524  1.36  thorpej 
    525  1.36  thorpej static __inline void
    526  1.37  thorpej alpha_pal_wrmces(unsigned long mces)
    527  1.36  thorpej {
    528  1.36  thorpej 	register unsigned long a0 __asm("$16") = mces;
    529  1.36  thorpej 
    530  1.36  thorpej 	__asm __volatile("call_pal %1 # PAL_OSF1_wrmces"
    531  1.36  thorpej 		: "=r" (a0)
    532  1.36  thorpej 		: "i" (PAL_OSF1_wrmces), "0" (a0)
    533  1.36  thorpej 		/* clobbers t0, t8..t11 */
    534  1.36  thorpej 		: "$1", "$22", "$23", "$24", "$25");
    535  1.36  thorpej }
    536  1.36  thorpej 
    537  1.36  thorpej static __inline void
    538  1.37  thorpej alpha_pal_wrval(unsigned long val)
    539  1.36  thorpej {
    540  1.36  thorpej 	register unsigned long a0 __asm("$16") = val;
    541  1.36  thorpej 
    542  1.36  thorpej 	__asm __volatile("call_pal %1 # PAL_OSF1_wrval"
    543  1.36  thorpej 		: "=r" (a0)
    544  1.36  thorpej 		: "i" (PAL_OSF1_wrval), "0" (a0)
    545  1.36  thorpej 		/* clobbers t0, t8..t11, a0 (above) */
    546  1.36  thorpej 		: "$1", "$22", "$23", "$24", "$25");
    547  1.32  thorpej }
    548   1.1      cgd 
    549   1.9      cgd #endif /* __ALPHA_ALPHA_CPU_H__ */
    550