Home | History | Annotate | Line # | Download | only in include
alpha.h revision 1.41
      1 /* $NetBSD: alpha.h,v 1.41 2020/09/27 23:16:10 thorpej Exp $ */
      2 
      3 /*
      4  * Copyright (c) 1988 University of Utah.
      5  * Copyright (c) 1982, 1990, 1993
      6  *	The Regents of the University of California.  All rights reserved.
      7  *
      8  * This code is derived from software contributed to Berkeley by
      9  * the Systems Programming Group of the University of Utah Computer
     10  * Science Department.
     11  *
     12  * Redistribution and use in source and binary forms, with or without
     13  * modification, are permitted provided that the following conditions
     14  * are met:
     15  * 1. Redistributions of source code must retain the above copyright
     16  *    notice, this list of conditions and the following disclaimer.
     17  * 2. Redistributions in binary form must reproduce the above copyright
     18  *    notice, this list of conditions and the following disclaimer in the
     19  *    documentation and/or other materials provided with the distribution.
     20  * 3. Neither the name of the University nor the names of its contributors
     21  *    may be used to endorse or promote products derived from this software
     22  *    without specific prior written permission.
     23  *
     24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34  * SUCH DAMAGE.
     35  *
     36  * from: Utah $Hdr: cpu.h 1.16 91/03/25$
     37  *
     38  *	@(#)cpu.h	8.4 (Berkeley) 1/5/94
     39  */
     40 
     41 #ifndef _ALPHA_H_
     42 #define _ALPHA_H_
     43 
     44 typedef union alpha_s_float {
     45 	uint32_t i;
     46 	uint32_t frac: 23,
     47 		  exp:   8,
     48 		  sign:  1;
     49 } s_float;
     50 
     51 typedef union alpha_t_float {
     52 	uint64_t i;
     53 	uint64_t frac: 52,
     54 		  exp:  11,
     55 		  sign:  1;
     56 } t_float;
     57 
     58 #ifdef _KERNEL
     59 
     60 #include <sys/bus.h>
     61 
     62 #include <sys/pcu.h>
     63 
     64 struct pcb;
     65 struct lwp;
     66 struct reg;
     67 struct rpb;
     68 struct trapframe;
     69 
     70 extern bool alpha_is_qemu;
     71 extern u_long cpu_implver;		/* from IMPLVER instruction */
     72 extern u_long cpu_amask;		/* from AMASK instruction */
     73 extern int bootdev_debug;
     74 extern int alpha_fp_sync_complete;
     75 extern int alpha_unaligned_print, alpha_unaligned_fix, alpha_unaligned_sigbus;
     76 
     77 void	XentArith(uint64_t, uint64_t, uint64_t);	/* MAGIC */
     78 void	XentIF(uint64_t, uint64_t, uint64_t);		/* MAGIC */
     79 void	XentInt(uint64_t, uint64_t, uint64_t);		/* MAGIC */
     80 void	XentMM(uint64_t, uint64_t, uint64_t);		/* MAGIC */
     81 void	XentRestart(void);				/* MAGIC */
     82 void	XentSys(uint64_t, uint64_t, uint64_t);		/* MAGIC */
     83 void	XentUna(uint64_t, uint64_t, uint64_t);		/* MAGIC */
     84 void	alpha_init(u_long, u_long, u_long, u_long, u_long);
     85 void	ast(struct trapframe *);
     86 int	badaddr(void *, size_t);
     87 int	badaddr_read(void *, size_t, void *);
     88 uint64_t console_restart(struct trapframe *);
     89 void	do_sir(void);
     90 void	exception_return(void);				/* MAGIC */
     91 void	alpha_kthread_backstop(void);			/* MAGIC */
     92 void	frametoreg(const struct trapframe *, struct reg *);
     93 void	init_bootstrap_console(void);
     94 void	init_prom_interface(unsigned long, struct rpb *);
     95 void	interrupt(unsigned long, unsigned long, unsigned long,
     96 	    struct trapframe *);
     97 void	machine_check(unsigned long, struct trapframe *, unsigned long,
     98 	    unsigned long);
     99 uint64_t hwrpb_checksum(void);
    100 void	hwrpb_restart_setup(void);
    101 void	regdump(struct trapframe *);
    102 void	regtoframe(const struct reg *, struct trapframe *);
    103 void	savectx(struct pcb *);
    104 void	trap(unsigned long, unsigned long, unsigned long, unsigned long,
    105 	    struct trapframe *);
    106 void	trap_init(void);
    107 void	enable_nsio_ide(bus_space_tag_t);
    108 char *	dot_conv(unsigned long);
    109 
    110 extern const pcu_ops_t fpu_ops;
    111 
    112 void    fpu_state_load(struct lwp *, u_int);
    113 void    fpu_state_save(struct lwp *);
    114 void    fpu_state_release(struct lwp *);
    115 
    116 static __inline bool
    117 fpu_valid_p(struct lwp *l)
    118 {
    119 	return pcu_valid_p(&fpu_ops, l);
    120 }
    121 
    122 static __inline void
    123 fpu_load(void)
    124 {
    125 	pcu_load(&fpu_ops);
    126 }
    127 
    128 static __inline void
    129 fpu_save(lwp_t *l)
    130 {
    131 	pcu_save(&fpu_ops, l);
    132 }
    133 
    134 static __inline void
    135 fpu_discard(lwp_t *l, bool valid_p)
    136 {
    137 	pcu_discard(&fpu_ops, l, valid_p);
    138 }
    139 
    140 void	alpha_patch(bool);
    141 
    142 /* Multiprocessor glue; cpu.c */
    143 
    144 struct cpu_info;
    145 int	cpu_iccb_send(long, const char *);
    146 void	cpu_iccb_receive(void);
    147 void	cpu_hatch(struct cpu_info *);
    148 void	cpu_halt(void) __attribute__((__noreturn__));
    149 void	cpu_spinup_trampoline(void);				/* MAGIC */
    150 void	cpu_pause(unsigned long);
    151 void	cpu_resume(unsigned long);
    152 #if defined(DDB)
    153 void	cpu_debug_dump(void);
    154 #endif
    155 
    156 /* IEEE and VAX FP completion */
    157 
    158 void alpha_sts(int, s_float *);					/* MAGIC */
    159 void alpha_stt(int, t_float *);					/* MAGIC */
    160 void alpha_lds(int, s_float *);					/* MAGIC */
    161 void alpha_ldt(int, t_float *);					/* MAGIC */
    162 
    163 uint64_t alpha_read_fpcr(void);					/* MAGIC */
    164 void alpha_write_fpcr(uint64_t);				/* MAGIC */
    165 
    166 uint64_t alpha_read_fp_c(struct lwp *);
    167 void alpha_write_fp_c(struct lwp *, uint64_t);
    168 
    169 int alpha_fp_complete(u_long, u_long, struct lwp *, uint64_t *);
    170 
    171 /* Security sensitive rate limiting printf */
    172 
    173 void rlprintf(struct timeval *t, const char *fmt, ...);
    174 
    175 #endif /* _KERNEL */
    176 #endif /* _ALPHA_H_ */
    177