Home | History | Annotate | Line # | Download | only in include
cpu.h revision 1.66
      1  1.66    rmind /*	$NetBSD: cpu.h,v 1.66 2011/02/08 20:20:10 rmind Exp $	*/
      2   1.1      leo 
      3   1.1      leo /*
      4  1.66    rmind  * Copyright (c) 1988 University of Utah.
      5   1.1      leo  * Copyright (c) 1982, 1990 The Regents of the University of California.
      6   1.1      leo  * All rights reserved.
      7  1.42      agc  *
      8  1.42      agc  * This code is derived from software contributed to Berkeley by
      9  1.42      agc  * the Systems Programming Group of the University of Utah Computer
     10  1.42      agc  * Science Department.
     11  1.42      agc  *
     12  1.42      agc  * Redistribution and use in source and binary forms, with or without
     13  1.42      agc  * modification, are permitted provided that the following conditions
     14  1.42      agc  * are met:
     15  1.42      agc  * 1. Redistributions of source code must retain the above copyright
     16  1.42      agc  *    notice, this list of conditions and the following disclaimer.
     17  1.42      agc  * 2. Redistributions in binary form must reproduce the above copyright
     18  1.42      agc  *    notice, this list of conditions and the following disclaimer in the
     19  1.42      agc  *    documentation and/or other materials provided with the distribution.
     20  1.42      agc  * 3. Neither the name of the University nor the names of its contributors
     21  1.42      agc  *    may be used to endorse or promote products derived from this software
     22  1.42      agc  *    without specific prior written permission.
     23  1.42      agc  *
     24  1.42      agc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     25  1.42      agc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26  1.42      agc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27  1.42      agc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     28  1.42      agc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     29  1.42      agc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     30  1.42      agc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31  1.42      agc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32  1.42      agc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33  1.42      agc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34  1.42      agc  * SUCH DAMAGE.
     35  1.42      agc  *
     36  1.42      agc  * from: Utah $Hdr: cpu.h 1.16 91/03/25$
     37  1.42      agc  *
     38  1.42      agc  *	@(#)cpu.h	7.7 (Berkeley) 6/27/91
     39  1.42      agc  */
     40   1.1      leo 
     41   1.1      leo #ifndef _MACHINE_CPU_H_
     42   1.1      leo #define _MACHINE_CPU_H_
     43   1.1      leo 
     44  1.45     yamt #if defined(_KERNEL)
     45  1.45     yamt 
     46   1.1      leo /*
     47   1.1      leo  * Exported definitions unique to atari/68k cpu support.
     48   1.1      leo  */
     49   1.1      leo 
     50  1.37      mrg #if defined(_KERNEL_OPT)
     51  1.33  thorpej #include "opt_lockdebug.h"
     52  1.33  thorpej #endif
     53  1.33  thorpej 
     54   1.1      leo /*
     55  1.14  thorpej  * Get common m68k CPU definitions.
     56  1.14  thorpej  */
     57  1.14  thorpej #include <m68k/cpu.h>
     58  1.14  thorpej #define	M68K_MMU_MOTOROLA
     59  1.14  thorpej 
     60  1.40  thorpej void	cpu_proc_fork(struct proc *, struct proc *);
     61  1.40  thorpej 
     62   1.1      leo /*
     63   1.1      leo  * Arguments to hardclock and gatherstats encapsulate the previous
     64   1.1      leo  * machine state in an opaque clockframe.  On the hp300, we use
     65   1.1      leo  * what the hardware pushes on an interrupt (frame format 0).
     66   1.1      leo  */
     67   1.1      leo struct clockframe {
     68  1.17      leo 	u_int	cf_regs[4];	/* d0,d1,a0,a1 (see locore.s)	*/
     69  1.17      leo 	u_short	cf_sr;		/* sr at time of interrupt	*/
     70  1.17      leo 	u_long	cf_pc;		/* pc at time of interrupt	*/
     71  1.17      leo 	u_short	cf_vo;		/* vector offset (4-word frame)	*/
     72  1.38   thomas } __attribute__((packed));
     73   1.1      leo 
     74  1.17      leo #define	CLKF_USERMODE(framep)	(((framep)->cf_sr & PSL_S) == 0)
     75  1.17      leo #define	CLKF_PC(framep)		((framep)->cf_pc)
     76   1.1      leo #if 0
     77   1.1      leo /* We would like to do it this way... */
     78  1.17      leo #define	CLKF_INTR(framep)	(((framep)->cf_sr & PSL_M) == 0)
     79   1.1      leo #else
     80   1.1      leo /* but until we start using PSL_M, we have to do this instead */
     81   1.1      leo #define	CLKF_INTR(framep)	(0)	/* XXX */
     82   1.1      leo #endif
     83   1.1      leo 
     84   1.1      leo 
     85   1.1      leo /*
     86   1.1      leo  * Preempt the current process if in interrupt from user mode,
     87   1.1      leo  * or after the current trap/syscall if in system mode.
     88   1.1      leo  */
     89  1.53       he #define	cpu_need_resched(ci,flags)	{ci->ci_want_resched = 1; setsoftast();}
     90   1.1      leo 
     91   1.1      leo /*
     92   1.1      leo  * Give a profiling tick to the current process from the softclock
     93   1.1      leo  * interrupt.  On hp300, request an ast to send us through trap(),
     94   1.1      leo  * marking the proc as needing a profiling tick.
     95   1.1      leo  */
     96  1.49       ad #define	profile_tick(l, framep)	((l)->l_pflag |= LP_OWEUPC, setsoftast())
     97  1.49       ad #define	cpu_need_proftick(l)	((l)->l_pflag |= LP_OWEUPC, setsoftast())
     98   1.1      leo 
     99   1.1      leo /*
    100   1.1      leo  * Notify the current process (p) that it has a signal pending,
    101   1.1      leo  * process as soon as possible.
    102   1.1      leo  */
    103  1.49       ad #define	cpu_signotify(l)	setsoftast()
    104   1.1      leo 
    105   1.1      leo #define setsoftast()	(astpending = 1)
    106   1.1      leo 
    107   1.1      leo extern int	astpending;	/* need trap before returning to user mode */
    108  1.33  thorpej 
    109   1.1      leo /*
    110   1.1      leo  * The rest of this should probably be moved to ../atari/ataricpu.h,
    111   1.1      leo  * although some of it could probably be put into generic 68k headers.
    112   1.1      leo  */
    113   1.1      leo #define	BASEPRI(sr)	((sr & PSL_IPL) == 0)
    114  1.45     yamt #endif /* _KERNEL */
    115   1.1      leo 
    116   1.1      leo /*
    117   1.1      leo  * Values for machineid.
    118   1.1      leo  */
    119  1.10      leo #define	ATARI_68000	1		/* 68000 CPU			*/
    120  1.10      leo #define	ATARI_68010	(1<<1)		/* 68010 CPU			*/
    121  1.10      leo #define ATARI_68020	(1L<<2)		/* 68020 CPU			*/
    122  1.10      leo #define ATARI_68030	(1L<<3)		/* 68030 CPU			*/
    123  1.10      leo #define ATARI_68040	(1L<<4)		/* 68040 CPU			*/
    124  1.22      leo #define ATARI_68060	(1L<<6)		/* 68060 CPU			*/
    125  1.36      leo #define	ATARI_TT	(1L<<11)	/* This is a TT030		*/
    126  1.36      leo #define	ATARI_FALCON	(1L<<12)	/*           Falcon		*/
    127  1.36      leo #define	ATARI_HADES	(1L<<13)	/*           Hades		*/
    128  1.36      leo #define	ATARI_MILAN	(1L<<14)	/*           Milan		*/
    129   1.7      leo 
    130   1.7      leo #define	ATARI_CLKBROKEN	(1L<<16)
    131   1.1      leo 
    132  1.10      leo #define	ATARI_ANYCPU	(ATARI_68000|ATARI_68010|ATARI_68020|ATARI_68030 \
    133  1.22      leo 			|ATARI_68040|ATARI_68060)
    134   1.1      leo 
    135  1.36      leo #define	ATARI_ANYMACH	(ATARI_TT|ATARI_FALCON|ATARI_HADES|ATARI_MILAN)
    136  1.12      leo 
    137  1.45     yamt #if defined(_KERNEL)
    138  1.18      leo extern int machineid;
    139  1.45     yamt #endif /* _KERNEL */
    140   1.1      leo 
    141   1.1      leo /*
    142   1.1      leo  * CTL_MACHDEP definitions.
    143   1.1      leo  */
    144   1.1      leo #define CPU_CONSDEV	1	/* dev_t: console terminal device */
    145   1.1      leo #define CPU_MAXID	2	/* number of valid machdep ids */
    146   1.1      leo 
    147  1.11      leo #ifdef _KERNEL
    148  1.11      leo /*
    149  1.11      leo  * Prototypes from atari_init.c
    150  1.11      leo  */
    151  1.62  tsutsui int	cpu_dump(int (*)(dev_t, daddr_t, void *, size_t), daddr_t *);
    152  1.62  tsutsui int	cpu_dumpsize(void);
    153  1.11      leo 
    154  1.11      leo /*
    155  1.11      leo  * Prototypes from autoconf.c
    156  1.11      leo  */
    157  1.62  tsutsui void	config_console(void);
    158  1.11      leo 
    159  1.11      leo /*
    160  1.11      leo  * Prototypes from fpu.c
    161  1.11      leo  */
    162  1.62  tsutsui const char *fpu_describe(int);
    163  1.62  tsutsui int	fpu_probe(void);
    164  1.11      leo 
    165  1.11      leo /*
    166  1.11      leo  * Prototypes from locore.s
    167  1.11      leo  */
    168  1.11      leo struct fpframe;
    169  1.11      leo 
    170  1.62  tsutsui void	clearseg(paddr_t);
    171  1.62  tsutsui void	doboot(void);
    172  1.62  tsutsui void	loadustp(int);
    173  1.62  tsutsui void	m68881_save(struct fpframe *);
    174  1.62  tsutsui void	m68881_restore(struct fpframe *);
    175  1.62  tsutsui void	physcopyseg(paddr_t, paddr_t);
    176  1.62  tsutsui u_int	probeva(u_int, u_int);
    177  1.62  tsutsui int	suline(void *, void *);
    178  1.11      leo 
    179  1.11      leo /*
    180  1.11      leo  * Prototypes from machdep.c:
    181  1.11      leo  */
    182  1.62  tsutsui int	badbaddr(void *, int);
    183  1.62  tsutsui void	consinit(void);
    184  1.11      leo typedef void (*si_farg)(void *, void *);	/* XXX */
    185  1.62  tsutsui void	init_sicallback(void);			/* XXX */
    186  1.62  tsutsui void	add_sicallback(si_farg, void *, void *);
    187  1.62  tsutsui void	rem_sicallback(si_farg);
    188  1.62  tsutsui void	dumpsys(void);
    189  1.62  tsutsui vaddr_t reserve_dumppages(vaddr_t);
    190  1.11      leo 
    191  1.11      leo 
    192  1.11      leo /*
    193  1.11      leo  * Prototypes from nvram.c:
    194  1.11      leo  */
    195  1.11      leo struct uio;
    196  1.62  tsutsui int	nvram_uio(struct uio *);
    197  1.11      leo 
    198  1.11      leo /*
    199  1.24      leo  * Prototypes from pci_machdep.c
    200  1.24      leo  */
    201  1.62  tsutsui void init_pci_bus(void);
    202  1.11      leo 
    203  1.11      leo #endif /* _KERNEL */
    204   1.1      leo #endif /* !_MACHINE_CPU_H_ */
    205